/* One working column: header, progress, filters, then the list grouped by who builds each vehicle.
   A row opens into its own edit form. Colours and faces follow packages/theme/tokens.css. */
:root {
  --bg: #f5f6f3;
  --surface: #ffffff;
  --sunk: #eceee9;
  --fg: #181a17;
  --muted: #6c7168;
  --line: #d9dcd4;
  --brand: #0c8047;
  --brand-soft: #d3f3df;
  --on-brand: #ffffff;
  --volt: #ceff52;
  --volt-ink: #213103;
  --warn: #a15c07;
  --warn-soft: #fdf0d5;
  --danger: #b4231a;
  --font-display: "Familjen Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --logo-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e0c; --surface: #181a17; --sunk: #222520; --fg: #eceee9; --muted: #8f948a; --line: #3e423c;
    --brand: #3bb874; --brand-soft: #0c5131; --on-brand: #032516; --volt: #bdf522; --volt-ink: #213103;
    --warn: #f0b44c; --warn-soft: #3a2a0c; --danger: #f07a70; --logo-filter: invert(1); color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: max(24px, env(safe-area-inset-top, 0px)) 64px;
}
img { max-width: 100%; }
.wrap { max-width: 1000px; margin: 0 auto; display: grid; gap: 20px; }
.app { display: grid; gap: 18px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; line-height: 1.15; }
h2 { font-size: 1.15rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

/* Header */
.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.brandline { display: flex; align-items: center; gap: 12px; }
/* Black ink on transparent, as the website uses it; inverted to white on dark, like `--emvc-logo-filter`. */
.mark { width: 40px; height: 40px; flex: none; filter: var(--logo-filter); }
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 0.85rem; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live[data-mode="live"]::before { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.live[data-mode="error"]::before { background: var(--danger); }
.intro { margin: 0; max-width: 70ch; color: var(--muted); }

/* Sign in */
.login { max-width: 420px; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.login p { margin: 0; }
.error { color: var(--danger); font-size: 0.9rem; }

/* Progress and feed */
.progress { display: grid; gap: 8px; }
.bar { height: 10px; border-radius: 99px; background: var(--sunk); overflow: hidden; display: flex; }
.bar span { display: block; height: 100%; width: 0; transition: width .3s ease; }
.bar .b-ok { background: var(--brand); }
.bar .b-q { background: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend b { color: var(--fg); font-weight: 600; }
.feed { font-size: 0.85rem; color: var(--muted); }
.feed summary { cursor: pointer; }
.feed ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow: auto; }
.feed li b { color: var(--fg); font-weight: 600; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 160px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
/* Three filters side by side; on a phone they share one row and the labels shrink. */
.filter-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 720px) { .filter-bar { grid-template-columns: repeat(3, minmax(0, 220px)); } }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 500; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* List */
.section { display: grid; gap: 10px; }
.section-head { display: grid; gap: 4px; padding-top: 6px; }
.section-head p { margin: 0; color: var(--muted); font-size: 0.9rem; max-width: 72ch; }
.group-label { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin: 10px 0 2px; text-transform: uppercase; letter-spacing: .06em; }
.list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.item + .item { border-top: 1px solid var(--line); }
.row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; }
.row:hover, .item.open > .row { background: var(--sunk); }
.status { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.status[data-s="question"] { border-color: var(--warn); background: var(--warn); }
.status[data-s="verified"] { border-color: var(--brand); background: var(--brand); }
.thumb { width: 64px; height: 44px; border-radius: 6px; background: var(--sunk); object-fit: cover; display: grid; place-items: center; font: 600 0.7rem var(--font-display); color: var(--muted); overflow: hidden; }
.who { min-width: 0; display: grid; gap: 2px; }
.who .name { font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.who .sub { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.tag { font-size: 0.7rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--sunk); color: var(--muted); letter-spacing: .02em; }
.tag.new { background: var(--fg); color: var(--bg); }
.tag.best { background: var(--volt); color: var(--volt-ink); }
.tag.prio { border: 1px solid var(--danger); color: var(--danger); background: none; }
.tag.ask { background: var(--warn-soft); color: var(--warn); }
.price { text-align: right; display: grid; }
.price .now { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.price .was { font-size: 0.8rem; color: var(--muted); text-decoration: line-through; white-space: nowrap; }
.price .up { font-size: 0.75rem; color: var(--warn); }
.marks { display: flex; gap: 2px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--line); }
.icon-btn.star[aria-pressed="true"] { color: var(--volt-ink); background: var(--volt); }
.icon-btn.flag[aria-pressed="true"] { color: var(--danger); }
.icon-btn svg { width: 18px; height: 18px; }

@media (max-width: 600px) {
  .row { grid-template-columns: auto auto minmax(0, 1fr); }
  .price { grid-column: 3; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .marks { grid-column: 3; margin-left: -8px; }
}

/* Editor */
.editor { padding: 6px 14px 18px 14px; display: grid; gap: 16px; background: var(--sunk); }
.editor-top { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 600px) { .editor-top { grid-template-columns: 1fr; } }
.photo { display: grid; gap: 8px; }
.photo img, .photo .none { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.photo .none { display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; text-align: center; padding: 12px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.85rem; }
.notes-box { display: grid; gap: 10px; }
.ask-box, .info-box { border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; }
.ask-box { background: var(--warn-soft); }
.ask-box b { color: var(--warn); }
.info-box { background: var(--surface); border: 1px solid var(--line); }
.info-box b { color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
/* align-content: start keeps each label on its input when a neighbour's hint makes the row taller. */
.field { display: grid; gap: 4px; min-width: 0; align-content: start; }
.field label, .field .lbl { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
/* 16px stops phones zooming into a field when it's tapped. */
@media (max-width: 600px) { .field input, .field select, .field textarea, .search { font-size: 16px; } }
.field textarea { min-height: 72px; resize: vertical; }
.field .hint { font-size: 0.78rem; color: var(--muted); }
.wide { grid-column: 1 / -1; }
.new-brand { margin-top: 4px; }
.field.missing input, .field.missing select, .field.missing textarea { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.field.missing > label { color: var(--warn); }
.gaps { margin: 0; font-size: 0.85rem; color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.audit { font-size: 0.8rem; color: var(--muted); }
.notice { font-size: 0.85rem; color: var(--warn); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.add { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 16px; display: grid; gap: 12px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 99px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
