
:root {
  --ground: #f2f4f7; --surface: #ffffff; --raised: #e9ecf0; --active: #e4e7eb;
  --border: #e3e6ea; --rule: #eef0f3; --control: #cfd4da;
  --text: #0a0a0a; --muted: #5d6166; --primary: #141414; --on-primary: #ffffff;
  --negative: #c4242a; --pill-neg-bg: #ffedea; --pill-neg-ink: #831c1e;
  --pill-warn-bg: #fffbeb; --pill-warn-ink: #92400e; --pill-warn-line: #fde68a;
  --radius: 8px; --radius-c: 6px; --gap: 12px; --pad: 32px; --side: 248px;
  --font: "Geist", Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ground); color: var(--text); font: 14px/1.5 var(--font); }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
a { color: inherit; }

.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 12px; border-right: 1px solid var(--border); }
.acct { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.mark { flex: none; width: 34px; height: 34px; border-radius: 8px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: .02em; }
.acct strong { display: block; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct > div > span { display: block; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; text-decoration: none; color: var(--muted); }
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a[aria-current="page"] { background: var(--active); color: var(--text); }
.nav svg, .side-foot svg { width: 16px; height: 16px; flex: none; }
.group { margin: 26px 10px 8px; font-size: 12px; color: var(--muted); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side-foot a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: 13px; }
.side-foot a:hover { color: var(--text); background: var(--raised); }
.made { margin: 14px 10px 0; font-size: 11px; color: var(--muted); }
.made b { color: var(--text); }

.canvas { padding: 32px var(--pad) 48px; min-width: 0; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { margin: 0; font-size: 24px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
.sub { margin: 4px 0 0; color: var(--muted); }
.title-actions { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: var(--radius-c); border: 1px solid var(--control); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; text-decoration: none; transition: background-color .15s ease, transform .1s ease; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--raised); }
.btn svg { width: 16px; height: 16px; }
.btn.sm { height: 30px; padding: 0 10px; }


.drop { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; background: var(--surface); border: 1px dashed var(--control); border-radius: var(--radius); padding: 28px; }
.drop.over { border-color: var(--text); background: var(--raised); }
.drop h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.drop p { margin: 0 0 14px; color: var(--muted); max-width: 52ch; }
.drop .row { display: flex; gap: 8px; flex-wrap: wrap; }
.cols-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.cols-list li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--rule); }
.cols-list li span:last-child { color: var(--muted); font-size: 12px; text-align: right; }
.cols-head { font-size: 13px; color: var(--muted); margin: 0 0 6px; }

.status { margin: 0 0 var(--gap); padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--pill-warn-line); background: var(--pill-warn-bg); color: var(--pill-warn-ink); font-size: 13px; }
.status.err { border-color: #f6c9c3; background: var(--pill-neg-bg); color: var(--pill-neg-ink); }
.busy { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 0 0 var(--gap); }
.busy i { width: 160px; height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; position: relative; }
.busy i b { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--text); transition: width .2s ease; }


.counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.count { text-align: left; height: 61px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.count span { display: block; font-size: 13px; color: var(--muted); }
.count strong { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.count:hover { border-color: var(--control); }
.count[aria-pressed="true"] { border: 1.5px solid var(--text); padding: 9.5px 11.5px; background: var(--raised); }
.count.bad strong { color: var(--negative); }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; font-size: 12px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
tbody tr { transition: background-color .12s ease; }
tbody tr:hover { background: #fafbfc; }
.thumb { width: 84px; height: 48px; border-radius: 4px; background: var(--raised); object-fit: contain; display: block; }
.who strong { display: block; font-weight: 500; }
.who span, .car span, .inv span { display: block; color: var(--muted); font-size: 12px; }
.car b { font-weight: 500; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acts { display: flex; gap: 4px; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; }
.pill.neg { background: var(--pill-neg-bg); color: var(--pill-neg-ink); }
.pill.warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); }
.issues { margin: 4px 0 0; padding: 0; list-style: none; color: var(--pill-neg-ink); font-size: 12px; }
.issues.w { color: var(--pill-warn-ink); }
.empty-row td { color: var(--muted); text-align: center; padding: 18px; }
.tot td { font-weight: 600; background: #fafbfc; }


.form { display: grid; grid-template-columns: 240px 1fr; gap: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 980px; }
.form h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.form .help { color: var(--muted); font-size: 13px; margin: 0; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: 500; font-size: 14px; }
.field input, .field select { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.field input:focus, .field select:focus { border-color: var(--text); outline: none; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: 18px; height: 18px; accent-color: #141414; }
.form-foot { grid-column: 2; display: flex; gap: 8px; align-items: center; }
.saved { color: var(--muted); font-size: 13px; }


.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(10, 10, 12, .44); display: flex; justify-content: flex-end; }
.sheet .panel { width: min(1180px, 100%); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sheet header strong { display: block; font-weight: 600; }
.sheet header span { color: var(--muted); font-size: 12px; }
.sheet iframe { flex: 1; width: 100%; border: 0; background: var(--ground); }

.topbar { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0; z-index: 30; height: 100%; width: 100%; background: var(--ground); border: 0; padding-top: 64px; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 31; height: 48px; align-items: center; gap: 10px; padding: 0 16px; background: var(--ground); border-bottom: 1px solid var(--border); }
  .topbar strong { flex: 1; font-weight: 600; }
  .topbar button { width: 44px; height: 44px; border: 0; background: transparent; display: grid; place-items: center; margin-left: -10px; cursor: pointer; }
  .canvas { padding: 20px 16px 40px; }
  .counts { grid-template-columns: repeat(4, minmax(120px, 1fr)); overflow-x: auto; }
  .drop { grid-template-columns: 1fr; padding: 20px; }
  .form { grid-template-columns: 1fr; }
  .form-foot { grid-column: 1; }
}
@media (max-width: 640px) {
  .title-actions { width: 100%; }
  .title-actions .btn { flex: 1; }
  .counts { display: flex; gap: 8px; margin-inline: -16px; padding-inline: 16px; }
  .count { flex: none; height: 44px; display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 0 14px; }
  .count[aria-pressed="true"] { padding: 0 13.5px; }
  .count span { font-size: 13px; color: inherit; }
  .count strong { font-size: 14px; }
  .list thead { display: none; }
  .list table, .list tbody { display: block; }
  .list tbody tr { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px; border-bottom: 1px solid var(--rule); }
  .list .who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .list td.x .ghost { display: none; }
  .list td { padding: 0; border: 0; }
  .list td.t { grid-row: 1 / span 2; }
  .list td.w { grid-column: 2; }
  .list td.a { grid-column: 3; grid-row: 1; text-align: right; }
  .list td.c { grid-column: 2; }
  .list td.i { display: none; }
  .list td.x { grid-column: 3; grid-row: 2; }
  .thumb { width: 72px; height: 42px; }
  .fields { grid-template-columns: 1fr; }
  .cols-list { grid-template-columns: 1fr; }
  .empty-row { display: block !important; }
  .tot { display: flex !important; justify-content: space-between; }
  .tot td:empty { display: none; }
}
@media (prefers-reduced-motion: reduce) { .btn, tbody tr, .busy i b { transition: none; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.list table { table-layout: auto; }
.list td.i, .list td.a { white-space: nowrap; }
.list td.c { min-width: 190px; }
.list td.c .v { font-style: normal; color: var(--muted); }

.list td.a .no { display: none; }
@media (max-width: 1100px) {
  .list th.i, .list td.i { display: none; }
  .list td.a .no { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
  .list td.c { min-width: 0; }
}


.designs { margin: 0 0 20px; }
.designs-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.designs-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.designs-head .sub { margin: 0; font-size: 13px; }
.dgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.dcard { text-align: left; padding: 8px 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .15s ease; }
.dcard:hover { border-color: var(--control); }
.dcard[aria-checked="true"] { border: 1.5px solid var(--text); padding: 7.5px 7.5px 11.5px; }
.dcard b { display: block; margin: 10px 4px 0; font-weight: 600; }
.dcard > span:last-child { display: block; margin: 0 4px; color: var(--muted); font-size: 12px; }
.dthumb { display: block; aspect-ratio: 16 / 10; border-radius: 4px; overflow: hidden; }
.dthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dthumb.d-paddock { background: #060607; } .dthumb.d-noir { background: #000; } .dthumb.d-cockpit { background: #03060c; } .dthumb.d-atelier { background: #e4e2de; }
@media (max-width: 900px) { .dgrid { grid-template-columns: repeat(4, minmax(150px, 1fr)); overflow-x: auto; } }
@media (max-width: 640px) { .dgrid { display: flex; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; } .dcard { flex: none; width: 170px; } }

.thumb.crop { display: block; overflow: hidden; background: #000; }
.thumb.crop img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.9); transform-origin: 50% 52%; display: block; }
