/* CarStrike Compliance - design system
   Tokens -> base -> layout -> components -> pages -> responsive. Light theme, enterprise neutral. */
:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #cbd5e1;
  --brand: #0f172a; --brand-2: #1e293b; --accent: #2563eb; --accent-2: #1d4ed8; --amber: #f59e0b;
  --ok: #16a34a; --ok-bg: #ecfdf5; --ok-line: #a7f3d0; --warn: #d97706; --warn-bg: #fffbeb; --warn-line: #fde68a;
  --bad: #dc2626; --bad-bg: #fef2f2; --bad-line: #fecaca; --info-bg: #eff6ff; --info-line: #bfdbfe;
  --radius: 12px; --radius-s: 8px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.08);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.14); --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; }
a { color: var(--accent); }
code, .mono { font-family: var(--mono); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h2 { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 1.6rem 0 .7rem; }
h2:first-child { margin-top: 0; }
h2 small { text-transform: none; letter-spacing: 0; font-weight: 500; }
h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .hidden { display: none !important; }
.page-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -.01em; }

/* ---------- top bar / nav ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--brand); color: #fff; display: flex; align-items: center; gap: 1rem; padding: 0 1rem; height: 56px; box-shadow: 0 1px 0 rgba(255,255,255,.06), var(--shadow); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1rem; white-space: nowrap; text-decoration: none; color: #fff; }
.brand small { font-weight: 400; opacity: .7; margin-left: .25rem; }
.logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--amber); color: #111; font-weight: 800; font-size: .8rem; letter-spacing: .02em; font-family: Georgia, serif; }
.nav-toggle { display: none; }
.nav-burger { display: none; margin-left: auto; width: var(--tap); height: var(--tap); align-items: center; justify-content: center; cursor: pointer; border-radius: 8px; }
.nav-burger span { width: 22px; height: 2px; background: #fff; position: relative; display: block; }
.nav-burger span::before, .nav-burger span::after { content: ""; position: absolute; left: 0; width: 22px; height: 2px; background: #fff; }
.nav-burger span::before { top: -7px; } .nav-burger span::after { top: 7px; }
.topbar nav { display: flex; gap: .15rem; margin-left: .5rem; }
.topbar nav a { color: #cbd5e1; text-decoration: none; padding: .45rem .8rem; border-radius: 8px; font-weight: 500; font-size: .92rem; }
.topbar nav a.active { background: rgba(255,255,255,.14); color: #fff; } .topbar nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.nav-user { color: #cbd5e1; font-size: .85rem; text-decoration: none; } .nav-user:hover { color: #fff; }
.pill { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .7rem; border-radius: 999px; background: rgba(255,255,255,.1); font-size: .8rem; white-space: nowrap; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 3px rgba(255,255,255,.08); }
.pill-ok .dot, .dot.pill-ok { background: #22c55e; } .pill-busy .dot { background: var(--amber); } .pill-bad .dot { background: #ef4444; }
.pill .stock { padding-left: .5rem; border-left: 1px solid rgba(255,255,255,.25); opacity: .85; }

/* ---------- layout ---------- */
.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1rem 5rem; }
.layout { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(380px, 1.05fr); gap: 1.25rem; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 1.25rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .9rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .9rem; }
.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: .6rem; }

/* ---------- forms ---------- */
label { display: block; font-size: .82rem; color: var(--ink-2); font-weight: 600; margin-bottom: .75rem; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; font-size: 1rem; min-height: var(--tap);
  border: 1px solid var(--line-2); border-radius: var(--radius-s); background: #fff; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
input.invalid { border-color: var(--bad); background: var(--bad-bg); }
input.from-pdf { border-color: #86efac; background: #f0fdf4; } input.from-default { border-color: #fcd34d; background: var(--warn-bg); }
#vin { text-transform: uppercase; letter-spacing: .12em; font-size: 1.1rem; }
.inline select { width: auto; } .inline input:not([type=checkbox]) { width: auto; }
.check-row { display: flex !important; align-items: center; gap: .55rem; font-weight: 500; min-height: var(--tap); cursor: pointer; }
.check-row input { width: 20px !important; height: 20px; margin: 0 !important; accent-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); margin-top: .4rem; }
.tag { display: inline-block; font-size: .68rem; padding: .08rem .45rem; border-radius: 999px; margin-left: .35rem; vertical-align: middle; font-weight: 700; letter-spacing: .02em; }
.tag.pdf { background: #dcfce7; color: #166534; } .tag.default { background: #fef3c7; color: #92400e; } .tag.manual { background: #e2e8f0; color: #334155; } .tag.missing { background: #fee2e2; color: #991b1b; }

/* ---------- buttons ---------- */
button, .button { font: inherit; font-weight: 600; font-size: .92rem; padding: .55rem 1rem; min-height: var(--tap); border-radius: var(--radius-s); border: 1px solid var(--line-2); background: #fff; cursor: pointer; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: background .15s, border-color .15s, transform .05s; }
button:hover, .button:hover { background: #f8fafc; border-color: #94a3b8; }
button:active { transform: translateY(1px); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
button.primary:disabled { background: #93c5fd; border-color: #93c5fd; cursor: not-allowed; }
button.danger { border-color: var(--bad-line); color: #991b1b; background: #fff5f5; } button.danger:hover { background: #fee2e2; }
button.big { font-size: 1.05rem; padding: .75rem 1.5rem; }
button.small, .button.small { min-height: 34px; padding: .3rem .7rem; font-size: .85rem; }
button.link { background: none; border: none; color: var(--accent); text-decoration: underline; padding: 0; min-height: 0; font-weight: 500; }
.print-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin: .5rem 0; }
.print-row > label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; margin: 0; }

/* ---------- feedback ---------- */
.status-box { margin-top: .9rem; padding: .8rem 1rem; border-radius: var(--radius-s); background: var(--info-bg); border: 1px solid var(--info-line); }
.status-box.ok { background: var(--ok-bg); border-color: var(--ok-line); } .status-box.bad { background: var(--bad-bg); border-color: var(--bad-line); } .status-box.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.problems, .warnings { padding: .7rem .9rem; border-radius: var(--radius-s); font-size: .9rem; margin-bottom: .8rem; }
.problems { background: var(--bad-bg); border: 1px solid var(--bad-line); color: #7f1d1d; }
.warnings { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #78350f; }
.problems ul, .warnings ul { margin: .2rem 0 0; padding-left: 1.2rem; }
.printer-detail { margin-top: .8rem; font-size: .85rem; color: var(--muted); } .printer-detail ul { margin: .3rem 0; padding-left: 1.2rem; } .printer-detail .bad { color: var(--bad); font-weight: 600; }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: .75rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; max-width: 92vw; font-weight: 500; }
.toast.bad { background: #991b1b; } .toast.ok { background: #166534; }
.st { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.st-completed, .st-certified { background: #dcfce7; color: #166534; } .st-pending, .st-processing, .st-submitted, .st-held, .st-queued, .st-dispatched { background: #dbeafe; color: #1e40af; }
.st-canceled, .st-aborted, .st-failed, .st-info_requested { background: #fee2e2; color: #991b1b; } .st-timeout, .st-unknown, .st-review { background: #fef3c7; color: #92400e; }
.st-open { background: #e0e7ff; color: #3730a3; } .st-approved { background: #ccfbf1; color: #115e59; } .st-closed { background: #e2e8f0; color: #334155; }

/* ---------- document drop / upload ---------- */
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 1.1rem 1.2rem; text-align: center; background: #f8fafc; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--info-bg); border-color: var(--accent); }
.dropzone p { margin: .2rem 0; }
.extract-summary { margin-top: .6rem; padding: .7rem .9rem; border-radius: var(--radius-s); background: var(--ok-bg); border: 1px solid var(--ok-line); font-size: .9rem; }
.extract-summary.warn { background: var(--warn-bg); border-color: var(--warn-line); }
details { margin-top: .5rem; font-size: .85rem; } details pre { max-height: 240px; overflow: auto; background: #f8fafc; padding: .6rem; border-radius: 6px; white-space: pre-wrap; }
label.button input[type=file] { display: none; }

/* ---------- preview ---------- */
.preview-tabs { display: flex; gap: .4rem; align-items: center; margin-bottom: .8rem; flex-wrap: wrap; }
.tab { border-radius: 999px; padding: .35rem .9rem; min-height: 36px; } .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.preview-tabs .check-row { margin-left: auto; min-height: 36px; }
.label-frame { position: relative; display: inline-block; background: repeating-linear-gradient(45deg, #f1f5f9 0 6px, #e2e8f0 6px 12px); border: 1px dashed #94a3b8; border-radius: 4px; }
.label-frame img { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.label-frame.landscape { width: 100%; max-width: 760px; } .label-frame.portrait { width: 320px; max-width: 100%; }
.label-frame.true-size.landscape { width: 100.9mm; max-width: none; } .label-frame.true-size.portrait { width: 54.3mm; }
.dim { position: absolute; font-size: .72rem; color: var(--muted); background: rgba(255,255,255,.85); padding: 0 .3rem; border-radius: 3px; }
.dim-w { left: 50%; transform: translateX(-50%); bottom: -1.3rem; } .dim-h { right: -0.6rem; top: 50%; transform: translateY(-50%) rotate(90deg); transform-origin: right center; }
.feed-arrow { position: absolute; top: -1.3rem; left: 0; font-size: .72rem; color: var(--muted); }
.preview-view { padding-bottom: 1.4rem; }
details.typo { margin: .4rem 0 .8rem; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .5rem .9rem; background: #f8fafc; }
details.typo summary { cursor: pointer; font-weight: 600; font-size: .9rem; min-height: 32px; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.typo-scale { display: flex; align-items: center; gap: 1rem; margin: .6rem 0; flex-wrap: wrap; } .typo-scale label { flex: 1; margin: 0; min-width: 200px; }
.typo-scale .gap-in { flex: 0 0 auto; font-size: .85rem; } .typo-scale .gap-in input { display: block; width: 6em; }
.typo-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.typo-table th { text-align: left; font-weight: 700; color: var(--muted); font-size: .72rem; text-transform: uppercase; padding: .2rem .3rem; }
.typo-table td { padding: .3rem .3rem; border-top: 1px solid var(--line); vertical-align: middle; }
.typo-table select, .typo-table input { margin-top: 0 !important; padding: .35rem .45rem !important; font-size: .9rem !important; min-height: 36px; }
.typo-table input.size-in { width: 6em; display: inline-block !important; }

/* ---------- tables ---------- */
table.log { width: 100%; border-collapse: collapse; font-size: .88rem; margin-top: .6rem; }
table.log th, table.log td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.log th { font-size: .72rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
table.log tr:hover td { background: #f8fafc; }
table.log td.inline { gap: .35rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 50; padding: 1rem; }
.modal-box { background: #fff; border-radius: 14px; padding: 1.3rem 1.5rem; width: min(520px, 100%); box-shadow: var(--shadow-lg); max-height: 92vh; overflow: auto; }
.modal-box.wide { width: min(900px, 100%); }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.viewer-body { text-align: center; background: var(--bg); padding: 1rem; border-radius: 8px; } .viewer-body img { max-height: 70vh; max-width: 100%; background: #fff; }
.confirm-grid { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .95rem; margin: 0; }
.confirm-grid dt { color: var(--muted); } .confirm-grid dd { margin: 0; font-weight: 600; word-break: break-word; }

/* ---------- jobs / checklist ---------- */
.checklist { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.slot { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem .9rem; background: #fafafa; }
.slot.done { border-color: #86efac; background: #f0fdf4; }
.slot-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.slot-title { font-weight: 600; font-size: .93rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.thumbs figure { margin: 0; width: 150px; } .thumbs img { width: 150px; height: 112px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumbs figcaption { font-size: .7rem; margin-top: .15rem; display: flex; justify-content: space-between; gap: .3rem; }
.activity { list-style: none; padding: 0; margin: .4rem 0; max-height: 320px; overflow: auto; } .activity li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.kpi { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .8rem; }
.kpi .v { font-size: 1.25rem; font-weight: 700; } .kpi .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fee { font-weight: 700; font-size: 1.15rem; }

/* ---------- login / marketing ---------- */
.login-wrap { min-height: calc(100vh - 56px); display: grid; grid-template-columns: 1.1fr 1fr; }
.marketing { background: linear-gradient(160deg, #0f172a 0%, #1e293b 60%, #0b1220 100%); color: #e2e8f0; padding: 3rem 3.5rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.marketing::after { content: ""; position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(245,158,11,.35), transparent 65%); }
.marketing .logo { width: 48px; height: 48px; font-size: 1.2rem; border-radius: 12px; }
.marketing h1 { font-size: 2rem; margin: 1.2rem 0 .6rem; color: #fff; letter-spacing: -.02em; }
.marketing p.lead { font-size: 1.05rem; color: #cbd5e1; max-width: 46ch; }
.features { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .8rem; }
.features li { display: flex; gap: .8rem; align-items: flex-start; } .features .ico { width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,.08); display: grid; place-items: center; flex: none; color: var(--amber); font-weight: 800; }
.features strong { color: #fff; display: block; } .features span { color: #94a3b8; font-size: .9rem; }
.marketing .foot { margin-top: 2rem; font-size: .8rem; color: #64748b; }
.login-side { display: grid; place-items: center; padding: 2rem 1rem; }
.login-box { width: min(420px, 100%); }
.login-box h2 { font-size: 1.3rem; text-transform: none; letter-spacing: 0; color: var(--ink); margin-bottom: 1rem; }

/* ---------- mobile sticky action bar ---------- */
.actionbar { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) { .layout { grid-template-columns: 1fr; } .grid3, .grid4 { grid-template-columns: 1fr 1fr; } .login-wrap { grid-template-columns: 1fr; } .marketing { padding: 2rem 1.5rem; } }
@media (max-width: 720px) {
  .container { padding: .9rem .8rem 5.5rem; }
  .panel { padding: 1rem; border-radius: 10px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; gap: .6rem; }
  .topbar { flex-wrap: wrap; height: auto; min-height: 56px; padding: .4rem .8rem; }
  .nav-burger { display: flex; }
  .topbar nav { display: none; width: 100%; flex-direction: column; margin: .4rem 0 .2rem; }
  .nav-toggle:checked ~ nav { display: flex; }
  .topbar nav a { padding: .7rem .8rem; font-size: 1rem; }
  .topbar-right { margin-left: 0; width: 100%; justify-content: space-between; order: 5; padding: .2rem 0 .4rem; }
  .label-frame.portrait { width: 100%; max-width: 260px; }
  .preview-tabs .check-row { margin-left: 0; width: 100%; }
  table.log, table.log thead, table.log tbody, table.log tr, table.log td, table.log th { display: block; }
  table.log thead { display: none; }
  table.log tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; padding: .4rem .6rem; background: #fff; }
  table.log td { border: none; padding: .25rem 0; display: flex; gap: .6rem; align-items: center; }
  table.log td::before { content: attr(data-label); flex: 0 0 34%; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
  table.log td:not([data-label])::before { content: none; }
  table.log td.inline { flex-wrap: wrap; }
  .thumbs figure { width: calc(50% - .25rem); } .thumbs img { width: 100%; height: 130px; }
  .actionbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: .6rem .8rem calc(.6rem + env(safe-area-inset-bottom)); gap: .6rem; }
  .actionbar button, .actionbar .button { flex: 1; }
  .modal-box { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
