/* Flight Deck mockup: shared styles (v2).
   Static mockup with sample data. Not the final design.

   Layout: a navy sidebar lists the places in work order (Overview, then Intake, Articles, Texts, Export),
   each with what is waiting there; Settings and the user sit at the bottom. A light top bar holds the
   global search (Cmd+K / Ctrl+K).

   Colour rules:
   - Amber means "a person has to act": Data missing, Differs from approval, Outdated, and attention items.
   - Red: stopped files and failed jobs. Blue: In review / waiting for approval. Green: Approved and
     Exported (Exported adds a check icon). Grey: Imported and neutral facts.
   - Navy is the only primary button colour, Approve included.
   Type: Barlow everywhere; Barlow Semi Condensed only for page titles and big numbers.
   Sizes: 12, 14, 16, 20, 28, 36 px. */

@import url("https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,500;0,600;1,400&family=Barlow+Semi+Condensed:wght@500;600&display=swap");

:root {
  /* Base palette */
  --bg: #e8ecee;          /* aluminium: app background */
  --surface: #ffffff;
  --surface-2: #f4f6f7;   /* table headers, wells */
  --ink: #1b2b38;         /* navy: text, primary buttons, sidebar */
  --ink-2: #3d4e5b;
  --muted: #5a6772;       /* 4.9:1 on --bg, 5.8:1 on white */
  --line: #d5dce0;
  --line-strong: #b9c3c9;
  --photo-bg: #f3f4f2;    /* behind product pictures */

  /* Status colours: four hues plus grey */
  --signal: #f2b233;      --signal-ink: #6f4a00;  --signal-bg: #fff4d9;  --signal-line: #f0dca7;  /* amber: act now */
  --held: #c23a2b;        --held-bg: #fbe9e6;     --held-line: #efc2bb;                          /* red: stopped, failed */
  --review: #2d6cb0;      --review-bg: #e6f0fa;   --review-line: #bfd5ee;                        /* blue: in review */
  --approved: #237349;    --approved-bg: #e3f3e9; --approved-line: #b9dcc6;                      /* green: approved, exported */
  --neutral: #5a6772;     --neutral-bg: #eef1f3;                                                 /* grey: imported */

  /* Type */
  --font: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-cond: "Barlow Semi Condensed", "DIN Alternate", "Arial Narrow", "Helvetica Neue", sans-serif;
  --fs-12: 12px; --fs-14: 14px; --fs-16: 16px; --fs-20: 20px; --fs-28: 28px; --fs-36: 36px;

  /* Shape and space */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --page-max: 1280px;
  --gap: 16px;
  --sidebar-w: 232px;
  --focus: 0 0 0 3px rgba(45, 108, 176, 0.35);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

a { color: var(--review); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; text-wrap: balance; }
h1 { font-family: var(--font-cond); font-size: var(--fs-28); letter-spacing: 0.005em; overflow-wrap: anywhere; }
h2 { font-size: var(--fs-16); }
h3 { font-size: var(--fs-14); }
h4 { font-size: var(--fs-14); }
p { margin: 0; }
small, .small { font-size: var(--fs-12); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.big-num { font-family: var(--font-cond); font-weight: 600; font-size: var(--fs-36); line-height: 1; }
.mono-id { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.file-name { overflow-wrap: anywhere; }
[id] { scroll-margin-top: 72px; } /* anchors land below the sticky top bar */

/* Icons (Lucide, one stroke width) */
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-14 { width: 14px; height: 14px; }
.icon-20 { width: 20px; height: 20px; }
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--muted); font: 500 var(--fs-12)/18px var(--font); text-align: center;
}

/* ---------------------------------------------------------------- App frame: sidebar + main column */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 12px; background: var(--ink); color: #c9d3da; overflow-y: auto;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: var(--fs-16); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; flex: none; }
.sidebar-toggle { display: none; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-sep { height: 1px; background: rgba(255,255,255,0.10); margin: 8px 8px; }
.side-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-md);
  color: #c9d3da; font-size: var(--fs-14); font-weight: 500;
}
.side-link .icon { color: #93a4b1; }
.side-link:hover { background: rgba(255,255,255,0.07); color: #fff; text-decoration: none; }
.side-link[aria-current="page"] { background: rgba(255,255,255,0.12); color: #fff; }
.side-link[aria-current="page"] .icon { color: #fff; }
.side-count {
  margin-left: auto; min-width: 24px; padding: 0 7px; border-radius: 999px; text-align: center;
  background: rgba(255,255,255,0.10); color: #dfe6eb; font-size: var(--fs-12); font-weight: 600; line-height: 20px;
}
.side-count.is-attention { background: var(--signal); color: var(--ink); }
.side-count.is-alert { background: var(--held); color: #fff; }

.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.10); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 10px 2px; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: #3a5163; color: #fff; font-weight: 600; font-size: var(--fs-12);
}
.user-meta { display: flex; flex-direction: column; line-height: 1.2; color: #fff; font-size: var(--fs-14); }
.user-meta span { color: #b4c2cc; font-size: var(--fs-12); }

.main-col { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 56px; padding: 0 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.global-search {
  display: flex; align-items: center; gap: 10px; width: min(520px, 100%); height: 36px; padding: 0 8px 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2);
  color: var(--muted); font: var(--fs-14) var(--font); cursor: text; text-align: left;
}
.global-search:hover { border-color: var(--muted); }
.global-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mockup note: grey, so amber keeps meaning "act now" */
.mock-note { padding: 5px 24px; background: #dde3e6; color: #4a5761; font-size: var(--fs-12); border-bottom: 1px solid var(--line); }
.mock-note a { color: #2a4a66; text-decoration: underline; margin-left: 6px; }

/* ---------------------------------------------------------------- Page */

.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 24px 24px 72px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.page-title .count { color: var(--muted); font-size: var(--fs-20); font-weight: 500; }
.page-head .lede { color: var(--muted); margin-top: 4px; max-width: 70ch; } /* only on the States gallery */
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: var(--fs-12); color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* Toolbar under the page head: search and compact filters */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 280px; max-width: 420px; }
.filter-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  color: var(--ink); font: 500 var(--fs-14) var(--font); cursor: pointer; white-space: nowrap;
}
.filter-btn:hover { background: var(--surface-2); }
.filter-btn .filter-label { color: var(--muted); font-weight: 400; }
.filter-btn .icon { color: var(--muted); }
.filter-btn.is-set { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.menu-pop { width: 240px; padding: 6px; }
.menu-pop [data-filter-value], .menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 7px 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--ink); font: var(--fs-14) var(--font); text-align: left; cursor: pointer;
}
.menu-pop [data-filter-value]:hover, .menu-item:hover { background: var(--neutral-bg); }
.menu-pop [data-filter-value][aria-checked="true"]::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translateY(-2px); }

.grid-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.grid-side { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; } /* big number with its label */
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ---------------------------------------------------------------- Surfaces */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel-head p { color: var(--muted); font-size: var(--fs-12); }
.panel-body { padding: 16px; }
.panel-sep { border-top: 1px solid var(--line); }
.panel-foot { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.well { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 var(--fs-14)/1 var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #2a3f50; }
.btn-danger { color: var(--held); border-color: var(--held-line); }
.btn-danger:hover { background: var(--held-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--neutral-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-12); }
.btn-icon { width: 32px; padding: 0; }
.btn[disabled], .btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
label.btn:focus-within { box-shadow: var(--focus); }
/* A chosen option in a pair such as "Keep approved / Accept new": same mark as a chosen card or filter */
.btn[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--neutral-bg); }
.link-btn { border: 0; background: none; padding: 0; color: var(--review); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Status chips and flags */

.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 7px; border-radius: 999px;
  font-size: var(--fs-12); font-weight: 500; line-height: 18px; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral);
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.status-imported { background: var(--neutral-bg); color: var(--neutral); }
.status-missing, .status-differs, .status-outdated, .status-waiting { background: var(--signal-bg); color: var(--signal-ink); }
.status-missing::before, .status-differs::before, .status-outdated::before, .status-waiting::before { background: var(--signal); }
.status-review { background: var(--review-bg); color: var(--review); }
.status-failed, .status-held { background: var(--held-bg); color: var(--held); }
.status-approved, .status-exported { background: var(--approved-bg); color: var(--approved); }
/* Exported: same green, marked with a check instead of a dot */
.status-exported::before {
  width: 9px; height: 5px; border-radius: 0; background: none;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* Flags next to attribute names. Only optional fields are labelled; mandatory is the default. */
.flag {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 6px; border-radius: 4px;
  font-size: var(--fs-12); font-weight: 500; line-height: 18px; vertical-align: 1px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}
.flag .icon { width: 12px; height: 12px; }
.flag-optional { color: var(--muted); background: var(--neutral-bg); border-color: transparent; }
.flag-gpsr { color: var(--ink-2); border-color: var(--line-strong); }
.flag-protected { color: var(--ink); border-color: var(--ink); }

/* Source chip: every value shows where it came from; click to see the passage */
.src {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink-2); font: var(--fs-12)/18px var(--font); cursor: pointer; white-space: nowrap;
}
.src:hover { border-color: var(--line-strong); background: #eaeef0; }
.src-kind { font-weight: 600; color: var(--muted); }
.src-ai { font-weight: 600; color: var(--ink); padding-left: 5px; border-left: 1px solid var(--line-strong); }
.src-none { border-style: dashed; color: var(--muted); cursor: default; background: transparent; }

.pop-wrap { position: relative; display: inline-block; }
.pop {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 360px; max-width: calc(100vw - 48px);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: 0 10px 28px rgba(27, 43, 56, 0.16); padding: 12px 14px; font-size: var(--fs-12); white-space: normal;
  display: none;
}
.pop.is-open { display: block; }
.pop-right .pop { left: auto; right: 0; }
.pop h4 { margin-bottom: 6px; }
.pop .quote { background: var(--surface-2); border-left: 3px solid var(--line-strong); padding: 8px 10px; margin: 8px 0; color: var(--ink); font-size: var(--fs-14); }
.pop mark, .quote mark { background: #ffe8a8; color: inherit; padding: 0 2px; border-radius: 2px; }

/* Tooltip for helper text that daily users don't need to read every time */
.tip { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--muted); cursor: help; vertical-align: -4px; }
.tip .icon { width: 15px; height: 15px; }
.tip::after {
  content: attr(data-tip); position: absolute; z-index: 40; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 280px; padding: 8px 10px; border-radius: var(--r-md);
  background: var(--ink); color: #fff; font: 400 var(--fs-12)/1.45 var(--font); text-align: left; white-space: normal;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; }
.tip-right::after { left: auto; right: -6px; transform: none; }

/* ---------------------------------------------------------------- Forms */

.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .label { font-size: var(--fs-12); font-weight: 500; color: var(--ink-2); }
.hint { font-size: var(--fs-12); color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: var(--fs-14) var(--font);
}
.textarea { height: auto; min-height: 90px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%235a6772' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--review); box-shadow: var(--focus); }
.input.is-changed, .select.is-changed, .textarea.is-changed { border-color: var(--review); background: #f7faff; }
.input-sm, .select-sm { height: 30px; font-size: var(--fs-12); }
.search { position: relative; }
.search .input { padding-left: 34px; }
.search .icon, .search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.radio-card {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-md); cursor: pointer; background: var(--surface);
}
.radio-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio-card input { margin-top: 3px; accent-color: var(--ink); }

/* ---------------------------------------------------------------- Tables */

.table-wrap { position: relative; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th {
  text-align: left; padding: 9px 12px;
  background: var(--surface-2); color: var(--muted);
  font-family: var(--font); font-weight: 600; font-size: var(--fs-12);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfb; }
.table tbody tr.is-selected td { background: #f3f7fc; }
.table .is-right { text-align: right; }
.table-compact td { padding: 7px 12px; }
/* Wide tables keep their columns and scroll sideways inside .table-wrap on small screens */
.table-wide { min-width: 720px; }
.table-mid { min-width: 560px; }
.th-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.th-sort .icon { width: 13px; height: 13px; opacity: 0.55; }
.th-sort:hover { color: var(--ink); }
.th-sort:hover .icon, .th-sort.is-sorted .icon { opacity: 1; }
.th-sort.is-sorted { color: var(--ink); }
.row-link { color: var(--ink); font-weight: 500; }
.row-link:hover { color: var(--review); }
.row-title { font-weight: 500; color: var(--ink); } /* a row's name when it is not a link */
.row-click, tr[data-href] { cursor: pointer; }
.cell-sub { display: block; color: var(--muted); font-size: var(--fs-12); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--muted); }

/* Bar that appears only when rows are selected */
.selection-bar {
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--ink); color: #fff; font-size: var(--fs-14);
}
.selection-bar .btn { height: 30px; font-size: var(--fs-12); background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.25); color: #fff; }
.selection-bar .btn:hover { background: rgba(255,255,255,0.16); }
.selection-bar .grow { flex: 1; }

/* Loading placeholders */
.skeleton { display: block; height: 10px; border-radius: 4px; background: linear-gradient(90deg, #eef1f3 25%, #f7f9fa 50%, #eef1f3 75%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
.skeleton-thumb { width: 44px; height: 44px; border-radius: var(--r-md); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty and error states */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 16px; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--neutral-bg); color: var(--muted); margin-bottom: 4px; }
.empty-mark .icon { width: 22px; height: 22px; }
.empty-mark.is-good { background: var(--approved-bg); color: var(--approved); }
.empty-mark.is-bad { background: var(--held-bg); color: var(--held); }
.empty h3 { font-size: var(--fs-16); }
.empty p { color: var(--muted); max-width: 46ch; }

/* ---------------------------------------------------------------- Tabs */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 16px; overflow-x: auto; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 11px 10px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font: 500 var(--fs-14) var(--font); white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 3px; background: var(--ink); border-radius: 3px 3px 0 0; }
.tab-count {
  min-width: 20px; padding: 0 6px; border-radius: 999px; text-align: center;
  background: var(--neutral-bg); color: var(--ink-2); font-size: var(--fs-12); font-weight: 600; line-height: 18px;
}
.tab-count.is-attention { background: var(--signal); color: var(--ink); }
.tab-count.is-alert { background: var(--held); color: #fff; }
[data-panel][hidden] { display: none !important; }

/* ---------------------------------------------------------------- Alerts, progress, toast */

/* One coloured alert block per screen at most: red for stopped or failed, amber when a person must act */
.alert { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid; font-size: var(--fs-14); }
.alert > .icon, .alert > svg { flex: none; width: 20px; height: 20px; margin-top: 1px; }
.alert > div:not(.alert-actions) { flex: 1 1 240px; min-width: 0; }
.alert-held { background: var(--held-bg); border-color: var(--held-line); color: #6d1f16; }
.alert-signal { background: var(--signal-bg); border-color: var(--signal-line); color: var(--signal-ink); }
.alert strong { display: block; }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.progress { height: 8px; border-radius: 999px; background: var(--neutral-bg); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--review); border-radius: 999px; transition: width 0.4s ease; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  padding: 10px 16px; border-radius: var(--r-md); background: var(--ink); color: #fff; font-size: var(--fs-14);
  box-shadow: 0 10px 28px rgba(27, 43, 56, 0.25); transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* Save bar that follows the page once something changes */
.save-bar {
  position: sticky; bottom: 0; z-index: 25;
  display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap;
  margin: 16px -24px -72px; padding: 12px 24px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line-strong); box-shadow: 0 -6px 18px rgba(27, 43, 56, 0.08);
}
.save-bar .grow { flex: 1; min-width: 180px; }

/* ---------------------------------------------------------------- Key-value lists, diff */

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: var(--fs-14); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.diff { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.diff > div { padding: 10px 12px; }
.diff-old { background: var(--surface-2); }
.diff-new { background: var(--signal-bg); border-left: 1px solid var(--line); }
.diff-label { font-size: var(--fs-12); color: var(--muted); margin-bottom: 2px; }
.diff del { color: var(--held); text-decoration-thickness: 1px; }
.diff ins { color: var(--signal-ink); text-decoration: none; font-weight: 600; }

/* ---------------------------------------------------------------- Product pictures (drawn stand-ins for supplier photos) */

.pthumb {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; overflow: hidden;
  border-radius: var(--r-md); background: var(--photo-bg); border: 1px solid var(--line);
}
.pthumb svg { width: 100%; height: 100%; }
.pthumb-sm { width: 40px; height: 40px; } /* smallest product picture; rows use 40-48 px */
.pthumb-lg { width: 72px; height: 72px; border-radius: var(--r-lg); }
.product-photo {
  display: grid; place-items: center; width: 100%; max-width: 100%; aspect-ratio: 4 / 3;
  border-radius: var(--r-lg); background: var(--photo-bg); border: 1px solid var(--line); overflow: hidden;
}
.product-photo svg { width: 100%; height: 100%; }
.article-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.article-head { display: flex; align-items: center; gap: 16px; min-width: 0; }

/* ---------------------------------------------------------------- Dropzone, image tiles, counters */

.dropzone {
  display: grid; place-items: center; text-align: center; gap: 8px;
  padding: 32px 16px; border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2);
  color: var(--muted);
}
.dropzone strong { color: var(--ink); font-size: var(--fs-16); }
.dropzone .icon { width: 24px; height: 24px; color: var(--muted); }

.thumb {
  position: relative; aspect-ratio: 1; max-width: 100%; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); font-size: var(--fs-12); overflow: hidden;
}
.thumb svg { width: 100%; height: 100%; }
.thumb .badge { position: absolute; left: 6px; top: 6px; }

.counter { font-size: var(--fs-12); color: var(--muted); text-align: right; }
.counter.is-over { color: var(--held); font-weight: 600; }

/* ---------------------------------------------------------------- Settings sub-navigation */

.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 72px; }
.subnav a, .subnav button { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-md); color: var(--ink-2); border: 0; background: none; font: var(--fs-14) var(--font); text-align: left; cursor: pointer; }
.subnav a:hover, .subnav button:hover { background: rgba(255,255,255,0.6); text-decoration: none; }
.subnav a[aria-current="page"], .subnav [aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--ink); }

/* ---------------------------------------------------------------- Overview */

/* One bar split by status; widths are the real shares */
.statusbar { display: flex; gap: 2px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--neutral-bg); }
.statusbar > a, .statusbar > span { display: block; min-width: 4px; height: 100%; }
.statusbar > a:hover { filter: brightness(0.92); }
.seg-imported { background: #aab5bd; }
.seg-missing, .seg-differs { background: var(--signal); }
.seg-failed { background: var(--held); }
.seg-review { background: var(--review); }
.seg-approved { background: #7cc39a; }
.seg-exported { background: var(--approved); }
.legend { list-style: none; margin: 0; padding: 0; }
.legend li a { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 44px; gap: 10px; align-items: center; padding: 7px 0; color: var(--ink); border-bottom: 1px solid var(--line); }
.legend li:last-child a { border-bottom: 0; }
.legend li a:hover { text-decoration: none; background: var(--surface-2); }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend .pct { color: var(--muted); text-align: right; font-size: var(--fs-12); }
.legend .n { font-weight: 600; text-align: right; }

/* Attention list: the one place amber is used at full strength */
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.attention li:last-child { border-bottom: 0; }
.attention .mark { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; }
.attention .mark .icon { width: 16px; height: 16px; }
.mark-held { background: var(--held-bg); color: var(--held); }
.mark-signal { background: var(--signal-bg); color: var(--signal-ink); }
.mark-review { background: var(--review-bg); color: var(--review); }
.attention .what { font-weight: 600; }
.attention .detail { color: var(--muted); font-size: var(--fs-12); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: start; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.activity li:last-child { border-bottom: 0; }
.activity .result { text-align: right; white-space: nowrap; }
.activity .who, .activity .when { color: var(--muted); font-size: var(--fs-12); }
.activity .status { justify-self: end; }

/* ---------------------------------------------------------------- Command palette (Cmd+K) */

.cmdk-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(27, 43, 56, 0.35); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.cmdk { width: min(640px, 100%); max-height: 70vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(27, 43, 56, 0.3); overflow: hidden; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.cmdk-input input { flex: 1; height: 52px; border: 0; outline: none; font: var(--fs-16) var(--font); color: var(--ink); background: none; min-width: 0; }
.cmdk-input input:focus-visible { box-shadow: none; }
.cmdk-input .icon { color: var(--muted); width: 18px; height: 18px; }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-group { padding: 8px 10px 4px; color: var(--muted); font-size: var(--fs-12); font-weight: 600; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-md); background: none; color: var(--ink); font: var(--fs-14) var(--font); text-align: left; cursor: pointer; }
.cmdk-item[aria-selected="true"] { background: var(--neutral-bg); }
.cmdk-item .cmdk-text { flex: 1; min-width: 0; }
.cmdk-item .cmdk-sub { display: block; color: var(--muted); font-size: var(--fs-12); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .cmdk-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); background: var(--surface-2); color: var(--muted); flex: none; }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-12); background: var(--surface-2); }

/* ---------------------------------------------------------------- Responsive and motion */

@media (max-width: 1180px) {
  .grid-main, .grid-2, .grid-3, .grid-side { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; flex-direction: row; overflow-x: auto; }
}
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: auto; padding: 8px 16px; gap: 0; overflow: visible; }
  .sidebar-top { padding: 4px 0; }
  .sidebar-toggle {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: var(--r-md);
    border: 1px solid rgba(255,255,255,0.25); background: none; color: #fff; font: 500 var(--fs-14) var(--font); cursor: pointer;
  }
  .sidebar .side-nav, .sidebar .sidebar-bottom { display: none; }
  .sidebar.is-open .side-nav, .sidebar.is-open .sidebar-bottom { display: flex; }
  .sidebar.is-open .side-nav { padding-top: 8px; }
  .topbar { position: static; padding: 0 16px; }
  .mock-note { padding: 5px 16px; }
  .page { padding: 16px 16px 72px; }
  .save-bar { margin: 16px -16px -72px; padding-left: 16px; padding-right: 16px; }
  .diff { grid-template-columns: 1fr; }
  .diff-new { border-left: 0; border-top: 1px solid var(--line); }
  .global-search kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
