:root {
  --navy: #0b2038;
  --navy-2: #143a5b;
  --navy-3: #205478;
  --gold: #c99535;
  --gold-light: #f1dfb8;
  --cream: #f4efe5;
  --paper: #fbfaf7;
  --rust: #a84827;
  --ink: #15202a;
  --muted: #68717a;
  --line: #dcd8cf;
  --red: #a9362c;
  --red-soft: #f7e4e1;
  --amber: #9c6812;
  --amber-soft: #fff1cf;
  --blue-soft: #e2edf5;
  --green: #326246;
  --green-soft: #e5efe8;
  --shadow: 0 18px 45px rgba(11, 32, 56, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(201, 149, 53, .16), transparent 32%),
    var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.brand-lockup { color: white; text-decoration: none; display: block; border-bottom: 1px solid rgba(255,255,255,.13); padding: 0 4px 22px; }
.brand-lockup img { width: 178px; height: 70px; padding: 7px 9px; object-fit: contain; object-position: center; display: block; background: white; border-radius: 4px; }
.brand-lockup span { margin-top: 10px; display: block; color: var(--gold-light); text-transform: uppercase; font: 700 12px/1 Barlow Condensed, sans-serif; letter-spacing: .18em; }

#primary-nav { display: grid; gap: 6px; margin-top: 24px; }
.nav-item {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.70);
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { color: white; background: rgba(201,149,53,.17); box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { color: var(--gold-light); text-align: center; font-size: 15px; }
.nav-count { min-width: 28px; text-align: center; background: rgba(255,255,255,.10); color: rgba(255,255,255,.78); font-size: 10px; padding: 3px 6px; border-radius: 999px; }

.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.13); padding: 18px 4px 0; }
.version-chip { color: white; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.version-chip span { width: 7px; height: 7px; display: inline-block; margin-right: 7px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 0 4px rgba(201,149,53,.15); }
.sidebar-footer p { margin: 10px 0 0; color: rgba(255,255,255,.48); font-size: 11px; line-height: 1.55; }

.main-shell { min-width: 0; }
.topbar { min-height: 94px; padding: 18px 34px; background: rgba(251,250,247,.93); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 20px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font: 700 32px/.95 Barlow Condensed, sans-serif; margin: 4px 0 0; letter-spacing: -.01em; color: var(--navy); }
.eyebrow { margin: 0; text-transform: uppercase; color: var(--rust); font: 700 10px/1 Barlow Condensed, sans-serif; letter-spacing: .17em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.source-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.source-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.mobile-menu { display: none; border: 0; background: none; font-size: 24px; color: var(--navy); }

.button { border: 0; border-radius: 5px; padding: 10px 15px; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.button-primary { background: var(--gold); color: var(--navy); }
.button-primary:hover { background: #d7a747; }
.button-secondary { background: var(--navy); color: white; }
.button-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }

.boundary-banner { margin: 22px 34px 0; min-height: 42px; padding: 10px 15px; border: 1px solid #e8bc75; border-left: 4px solid var(--gold); background: #fff7e6; display: flex; align-items: center; gap: 12px; color: #695329; font-size: 11px; line-height: 1.45; }
.boundary-banner strong { color: var(--rust); font: 700 12px/1 Barlow Condensed, sans-serif; letter-spacing: .07em; white-space: nowrap; }

.screen { padding: 24px 34px 60px; }
.screen-stack { display: grid; gap: 22px; }
.loading-state { min-height: 55vh; display: grid; place-content: center; text-align: center; color: var(--muted); }
.loader { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero { min-height: 410px; border-radius: 10px; overflow: hidden; display: grid; grid-template-columns: minmax(340px, .85fr) 1.15fr; background: var(--navy); box-shadow: var(--shadow); }
.hero-copy { padding: 42px; color: white; align-self: center; }
.hero-copy .overline { margin: 0 0 13px; color: var(--gold-light); font: 700 12px/1 Barlow Condensed, sans-serif; letter-spacing: .17em; text-transform: uppercase; }
.hero-copy h2 { margin: 0; font: 800 56px/.88 Barlow Condensed, sans-serif; letter-spacing: -.025em; text-transform: uppercase; }
.hero-copy p { color: rgba(255,255,255,.69); max-width: 510px; font-size: 14px; line-height: 1.65; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.hero-image { min-height: 410px; position: relative; background: url("./public/assets/hero-flatbread.jpg") center/cover no-repeat; }
.hero-image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--navy) 0%, transparent 30%), linear-gradient(0deg, rgba(11,32,56,.35), transparent 55%); }
.photo-caption { position: absolute; z-index: 2; right: 18px; bottom: 16px; max-width: 240px; padding: 8px 10px; color: rgba(255,255,255,.85); background: rgba(11,32,56,.70); backdrop-filter: blur(10px); font-size: 10px; line-height: 1.35; border-left: 3px solid var(--gold); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { background: white; border: 1px solid var(--line); padding: 20px; border-radius: 7px; box-shadow: 0 5px 18px rgba(11,32,56,.04); position: relative; overflow: hidden; }
.metric-card::before { content: ""; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: var(--gold); }
.metric-card.alert::before { background: var(--rust); }
.metric-label { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--muted); text-transform: uppercase; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.metric-card strong { display: block; margin-top: 12px; color: var(--navy); font: 700 34px/1 Barlow Condensed, sans-serif; }
.metric-card p { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 7px 0 0; }

.section-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 20px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 7px; box-shadow: 0 5px 18px rgba(11,32,56,.035); overflow: hidden; }
.panel-header { padding: 18px 20px 14px; display: flex; align-items: end; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.panel-header h3, .section-heading h2 { margin: 0; color: var(--navy); font: 700 23px/1 Barlow Condensed, sans-serif; text-transform: uppercase; letter-spacing: .01em; }
.panel-header p, .section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.panel-body { padding: 18px 20px; }

.finding-list { display: grid; }
.finding-row { display: grid; grid-template-columns: 58px minmax(0,1fr) auto; gap: 13px; align-items: start; padding: 14px 0; border-bottom: 1px solid #eeeae2; }
.finding-row:last-child { border-bottom: 0; }
.severity { display: inline-flex; justify-content: center; border-radius: 999px; padding: 5px 8px; text-transform: uppercase; font-size: 8px; font-weight: 800; letter-spacing: .05em; }
.severity.high { background: var(--red-soft); color: var(--red); }
.severity.medium { background: var(--amber-soft); color: var(--amber); }
.finding-row strong { font-size: 12px; color: var(--ink); display: block; }
.finding-row p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.mini-link { background: transparent; border: 0; cursor: pointer; color: var(--navy-3); font-size: 10px; font-weight: 700; }

.photo-story { min-height: 100%; display: grid; grid-template-rows: 225px 1fr; }
.photo-story img { width: 100%; height: 100%; object-fit: cover; }
.photo-story-copy { padding: 22px; background: var(--navy); color: white; }
.photo-story-copy span { color: var(--gold-light); text-transform: uppercase; font: 700 10px/1 Barlow Condensed, sans-serif; letter-spacing: .14em; }
.photo-story-copy h3 { margin: 9px 0 6px; font: 700 29px/.95 Barlow Condensed, sans-serif; text-transform: uppercase; }
.photo-story-copy p { margin: 0; color: rgba(255,255,255,.65); font-size: 11px; line-height: 1.55; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.input, .select { border: 1px solid var(--line); background: white; color: var(--ink); height: 38px; border-radius: 5px; padding: 0 12px; font-size: 11px; outline: none; }
.input { min-width: 250px; }
.input:focus, .select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,149,53,.12); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: white; color: var(--muted); border-radius: 999px; padding: 7px 11px; font-size: 10px; font-weight: 600; cursor: pointer; }
.chip.active { background: var(--navy); color: white; border-color: var(--navy); }
.chip.warn.active { background: var(--rust); border-color: var(--rust); }

.data-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.record-card { background: white; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; display: flex; flex-direction: column; min-height: 215px; transition: .18s ease; }
.record-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #c9c1b2; }
.record-accent { height: 5px; background: var(--gold); }
.record-accent.alert { background: var(--rust); }
.record-body { padding: 17px; display: flex; flex: 1; flex-direction: column; }
.record-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.record-type { color: var(--rust); text-transform: uppercase; letter-spacing: .09em; font-size: 8px; font-weight: 800; }
.record-card h3 { margin: 11px 0 5px; color: var(--navy); font: 700 22px/.95 Barlow Condensed, sans-serif; text-transform: uppercase; }
.record-card .description { color: var(--muted); font-size: 10px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.record-meta { display: flex; flex-wrap: wrap; gap: 6px 13px; margin-top: auto; padding-top: 16px; color: var(--muted); font-size: 9px; }
.record-footer { border-top: 1px solid #eeeae2; padding: 10px 17px; display: flex; justify-content: space-between; align-items: center; }

.status { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 8px; font-size: 8px; text-transform: uppercase; font-weight: 800; letter-spacing: .04em; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; }
.status.source { background: var(--blue-soft); color: var(--navy-3); }
.status.source::before { background: var(--navy-3); }
.status.draft { background: #eceff1; color: #5f6870; }
.status.draft::before { background: #84909a; }
.status.review { background: var(--red-soft); color: var(--red); }
.status.review::before { background: var(--red); }
.status.open { background: var(--amber-soft); color: var(--amber); }
.status.open::before { background: var(--amber); }

.empty-state { grid-column: 1 / -1; padding: 52px 20px; text-align: center; background: white; border: 1px dashed var(--line); color: var(--muted); border-radius: 7px; }
.pagination-note { color: var(--muted); font-size: 10px; text-align: center; }

.station-board { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.station-column { background: white; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.station-column h3 { margin: 0; padding: 14px 16px; background: var(--navy); color: white; font: 700 20px/1 Barlow Condensed, sans-serif; text-transform: uppercase; display: flex; justify-content: space-between; }
.station-column h3 span { color: var(--gold-light); font-size: 11px; }
.production-item { padding: 12px 14px; border-bottom: 1px solid #eeeae2; display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; }
.production-item:last-child { border-bottom: 0; }
.production-item input { accent-color: var(--gold); width: 15px; height: 15px; }
.production-item.checked strong { text-decoration: line-through; color: #8c9298; }
.production-item strong { display: block; font-size: 11px; }
.production-item small { display: block; color: var(--muted); margin-top: 3px; font-size: 9px; }
.par-badge { color: var(--amber); background: var(--amber-soft); padding: 4px 7px; border-radius: 999px; font-size: 8px; font-weight: 800; text-transform: uppercase; }

.table-shell { background: white; border: 1px solid var(--line); border-radius: 7px; overflow: auto; }
.data-table { border-collapse: collapse; width: 100%; min-width: 840px; }
.data-table th { position: sticky; top: 0; z-index: 1; padding: 11px 12px; text-align: left; background: var(--navy); color: white; text-transform: uppercase; letter-spacing: .06em; font-size: 8px; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid #eeeae2; color: #303941; font-size: 10px; vertical-align: top; }
.data-table tr:hover td { background: #fbf6eb; }
.number { font-variant-numeric: tabular-nums; text-align: right; }

.opening-tabs { display: grid; grid-template-columns: repeat(3, 1fr); max-width: 480px; background: #ebe7de; padding: 4px; border-radius: 6px; }
.opening-tab { border: 0; background: transparent; color: var(--muted); padding: 8px 10px; border-radius: 4px; font-size: 10px; font-weight: 700; cursor: pointer; }
.opening-tab.active { background: white; color: var(--navy); box-shadow: 0 2px 6px rgba(11,32,56,.08); }

.standards-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 15px; }
.standard-card { background: white; border: 1px solid var(--line); border-radius: 7px; padding: 20px; }
.standard-card .icon-tile { width: 38px; height: 38px; border-radius: 6px; background: var(--gold-light); color: var(--navy); display: grid; place-content: center; font-size: 18px; }
.standard-card h3 { margin: 15px 0 7px; color: var(--navy); font: 700 22px/1 Barlow Condensed, sans-serif; text-transform: uppercase; }
.standard-card p { color: var(--muted); font-size: 10px; line-height: 1.55; }
.standard-card ul { padding-left: 16px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.source-card { background: white; border: 1px solid var(--line); border-radius: 7px; padding: 19px; display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 14px; }
.source-index { width: 42px; height: 42px; display: grid; place-content: center; border-radius: 50%; color: var(--navy); background: var(--gold-light); font: 700 16px/1 Barlow Condensed, sans-serif; }
.source-card h3 { margin: 1px 0 6px; font-size: 12px; color: var(--navy); }
.source-card p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.source-card .limitation { margin-top: 8px; padding-top: 8px; border-top: 1px solid #eeeae2; color: var(--rust); }
.source-card a { align-self: center; color: var(--navy-3); text-decoration: none; font-size: 18px; }

.detail-drawer { position: fixed; z-index: 100; right: 0; top: 0; bottom: 0; width: min(600px, 94vw); background: var(--paper); box-shadow: -20px 0 60px rgba(11,32,56,.25); transform: translateX(104%); transition: transform .24s ease; overflow-y: auto; }
.detail-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(11,32,56,.52); backdrop-filter: blur(2px); }
.drawer-hero { min-height: 245px; position: relative; display: flex; align-items: flex-end; padding: 26px; color: white; background: linear-gradient(30deg, var(--navy), var(--navy-3)); }
.drawer-hero.has-image { background-position: center; background-size: cover; }
.drawer-hero.has-image::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(11,32,56,.92), rgba(11,32,56,.15)); }
.drawer-hero-copy { position: relative; z-index: 1; }
.drawer-hero h2 { margin: 8px 0 0; font: 800 43px/.9 Barlow Condensed, sans-serif; text-transform: uppercase; }
.drawer-close { position: absolute; right: 16px; top: 16px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(11,32,56,.4); color: white; cursor: pointer; }
.drawer-content { padding: 24px 26px 36px; display: grid; gap: 22px; }
.detail-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-fact { padding: 12px; background: white; border: 1px solid var(--line); border-radius: 5px; }
.detail-fact span { display: block; color: var(--muted); text-transform: uppercase; font-size: 7px; font-weight: 800; letter-spacing: .06em; }
.detail-fact strong { display: block; color: var(--navy); font-size: 12px; margin-top: 5px; }
.detail-section h3 { margin: 0 0 10px; color: var(--navy); font: 700 19px/1 Barlow Condensed, sans-serif; text-transform: uppercase; }
.review-callout { background: var(--red-soft); color: var(--red); border-left: 4px solid var(--rust); padding: 13px 15px; font-size: 10px; line-height: 1.55; }
.ingredient-list, .method-list { display: grid; background: white; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ingredient-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #eeeae2; font-size: 10px; }
.ingredient-row:last-child, .method-row:last-child { border-bottom: 0; }
.ingredient-row .seq { color: var(--gold); font-weight: 800; }
.ingredient-row .qty { color: var(--muted); font-variant-numeric: tabular-nums; }
.method-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px; border-bottom: 1px solid #eeeae2; }
.method-row span { width: 24px; height: 24px; display: grid; place-content: center; border-radius: 50%; background: var(--navy); color: white; font-size: 8px; font-weight: 800; }
.method-row p { margin: 3px 0 0; font-size: 10px; line-height: 1.5; }

.toast { position: fixed; z-index: 150; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--navy); color: white; padding: 11px 16px; border-radius: 5px; box-shadow: var(--shadow); font-size: 10px; transition: .2s ease; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1120px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .data-card-grid { grid-template-columns: repeat(2, 1fr); }
  .standards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: block; cursor: pointer; }
  .topbar { padding: 16px 20px; min-height: 82px; }
  .topbar-actions .source-pill { display: none; }
  .button-secondary { display: none; }
  .boundary-banner { margin: 16px 20px 0; align-items: flex-start; flex-direction: column; gap: 5px; }
  .screen { padding: 20px 20px 50px; }
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 30px; }
  .hero-copy h2 { font-size: 46px; }
  .hero-image { min-height: 270px; }
  .section-grid, .source-grid { grid-template-columns: 1fr; }
  .station-board { grid-template-columns: 1fr; }
}

@media (max-width: 590px) {
  .metrics-grid, .data-card-grid, .standards-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .input { min-width: 0; width: 100%; }
  .topbar h1 { font-size: 27px; }
  .hero-copy h2 { font-size: 40px; }
  .detail-facts { grid-template-columns: 1fr 1fr; }
}
