/* One shared interface for the web and Android WebView.
   Desktop: 1440 - 2*32 gutters - 352 intake - 24 gap = 1000px document.
   The workbook inside the frame retains its own original styles. */
:root {
  color-scheme: light;
  --canvas: #f5f4ef;
  --surface: #fffefa;
  --surface-soft: #eeece5;
  --ink: #302e29;
  --muted: #6a675f;
  --line: #e4e1d8;
  --control: #ccc7bb;
  --accent: #a64f34;
  --accent-hover: #8c402a;
  --accent-soft: #f4e9e2;
  --positive: #3f654c;
  --warning: #825b24;
  --warning-soft: #f8f0e3;
  --danger: #9a3d35;
  --danger-soft: #faece8;
  --green: var(--accent);
  --green-soft: var(--accent-soft);
  --radius: 14px;
  --small-radius: 8px;
  --space: 20px;
  --motion: 180ms;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --display-font: var(--font);
  font: 15px/1.6 var(--font);
  background: var(--canvas);
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; padding-bottom: calc(92px + env(safe-area-inset-bottom,0px)); background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button, a, summary { transition: background-color var(--motion), border-color var(--motion), color var(--motion); }
button:disabled { cursor: default; background: var(--surface-soft); color: #625e56; border-color: var(--line); opacity: 1; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; font-weight: 550; line-height: 1.4; letter-spacing: -.02em; }
h2 { font-size: 16px; line-height: 1.5; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; pointer-events: none; }
button > * { pointer-events: none; }
button:active:not(:disabled) { transform: translateY(1px); }
.app-header { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: calc(8px + env(safe-area-inset-top,0px)) var(--space) 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; margin-right: auto; font-size: 18px; font-weight: 600; white-space: nowrap; }
.brand-mark { color: var(--accent); width: 25px; height: 25px; }
.brand-word { font-family: var(--display-font); font-weight: 600; letter-spacing: .01em; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: var(--small-radius); background: transparent; color: var(--muted); }
.icon-button:hover { background: var(--surface-soft); color: var(--ink); }
.header-status { min-height: 44px; padding: 8px 6px; border: 0; border-radius: var(--small-radius); background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.header-status[data-phase=synced] { color: var(--positive); }
.header-status[data-phase=error], .header-status[data-phase=conflict] { color: var(--warning); }
main { width: 100%; max-width: 1472px; margin: 0 auto; padding: 16px var(--space) 24px; }
.vehicle-workspace { min-width: 0; }
.batch-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 22px; }
.batch-summary h1 { font-family: var(--display-font); }
.batch-summary p { margin-top: 6px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.saved-mark { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.saved-mark svg { width: 16px; height: 16px; }
.save-error { color: var(--danger) !important; }
.batch-summary:has(.save-error) .saved-mark { display: none; }
.filter-group { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.filter-group button { min-height: 44px; padding: 8px 2px 11px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.filter-group button[aria-pressed=true] { color: var(--ink); border-bottom-color: var(--ink); }
.filter-group span { margin-left: 7px; font-variant-numeric: tabular-nums; }
.choice-group { display: flex; gap: 4px; padding: 4px; margin: 8px 0 22px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.choice-group button { flex: 1; min-height: 40px; border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; background: transparent; color: var(--muted); font-size: 13px; }
.choice-group button[aria-pressed=true] { background: var(--surface); border-color: var(--line); color: var(--ink); font-weight: 600; }
.primary, .secondary, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: var(--small-radius); font-size: 14px; font-weight: 550; line-height: 1.5; text-decoration: none; }
.primary { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.primary:hover:enabled { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary { background: var(--surface); border: 1px solid var(--control); color: var(--ink); }
.secondary:hover:enabled { background: var(--surface-soft); }
.text-button { background: transparent; border: 0; color: var(--muted); }
.text-button:hover:enabled { color: var(--ink); background: var(--surface-soft); }
.full-width { width: 100%; }
.action-dock { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; padding: 12px var(--space) calc(12px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--line); background: var(--canvas); }
.action-dock button { min-height: 48px; }
.action-dock svg { width: 18px; height: 18px; }
.app-sheet { width: min(600px,100%); max-width: 600px; max-height: calc(100dvh - env(safe-area-inset-top,0px) - 12px); padding: 0; margin: auto auto 0; border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--ink); overflow: hidden; box-shadow: 0 16px 64px #29241e24; } /* taste-skill-ignore: dialog is a floating overlay */
.app-sheet::backdrop { background: #302c254d; }
.app-sheet[open] { display: flex; flex-direction: column; animation: sheet-enter var(--motion) ease-out; }
.sheet-handle { width: 30px; height: 3px; margin: 10px auto 0; border-radius: 4px; background: var(--control); flex-shrink: 0; }
.sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; padding: 8px var(--space) 12px; flex-shrink: 0; }
.sheet-top h2 { font-size: 20px; font-weight: 550; letter-spacing: -.02em; outline: none; }
.sheet-body { padding: 4px var(--space) 24px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.sheet-footer { padding: 16px var(--space) calc(18px + env(safe-area-inset-bottom,0px)); border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.sheet-intro { color: var(--muted); font-size: 13px; margin-bottom: 22px; line-height: 1.7; }
.sheet-body > label, .field label, .defaults label { display: block; margin: 20px 0 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.sheet-body > label:first-child { margin-top: 0; }
input[type=text], textarea { width: 100%; max-width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--control); border-radius: var(--small-radius); outline: none; background: var(--surface); color: var(--ink); font-size: 16px; }
textarea { min-height: 180px; resize: vertical; line-height: 1.8; }
input:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: #6d685f; opacity: 1; }
input:disabled, textarea:disabled { color: var(--muted); background: var(--surface-soft); opacity: 1; }
input[type=file] { width: 100%; padding: 10px 0; font-size: 13px; color: var(--muted); }
input[type=file]::file-selector-button { min-height: 44px; margin-right: 8px; padding: 8px 12px; border: 1px solid var(--control); border-radius: var(--small-radius); font: inherit; color: var(--ink); background: var(--surface); }
.field { margin-bottom: 18px; }
.field label { margin: 0 0 8px; }
.plate-field input { font-size: 20px; font-weight: 550; letter-spacing: .01em; }
.id-field input { font-variant-numeric: tabular-nums; }
.field-invalid input { border-color: #ac8b63; background: #fffaf2; }
.editor-status { margin-bottom: 24px; }
.autosave-hint { margin-top: 6px; color: var(--muted); font-size: 12px; }
.issues { color: var(--warning); font-size: 13px; line-height: 1.8; margin: 12px 0; }
.issues p { margin: 5px 0; }
.issues .issue-ok { color: var(--positive); }
.remove { width: 100%; min-height: 44px; margin-top: 16px; padding: 10px; border: 0; border-radius: var(--small-radius); background: transparent; color: var(--danger); font-size: 14px; }
.remove:hover { background: var(--danger-soft); }
.delete-confirm { padding: 16px; margin-top: 12px; border-radius: var(--small-radius); background: var(--danger-soft); font-size: 14px; }
.delete-confirm p { margin-bottom: 12px; }
.danger { background: var(--danger); border-color: var(--danger); }
.button-pair { display: flex; gap: 10px; margin-top: 12px; }
.button-pair > * { flex: 1; min-width: 0; }
.intake-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 0; }
.upload-button { position: relative; cursor: pointer; font-size: 13px; font-weight: 500; border-color: var(--line); }
.upload-button:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.upload-button svg { width: 17px; height: 17px; }
.notice, .conflict { padding: 14px 16px; margin: 12px 0; border: 1px solid var(--line); border-radius: var(--small-radius); background: var(--surface); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.warning, .conflict { border-color: #e5d5bb; background: var(--warning-soft); color: var(--warning); }
.conflict p { margin-bottom: 10px; }
.conflict button { margin: 4px 4px 0 0; padding: 8px 12px; font-size: 13px; }
.ocr-status { margin: 12px 0; color: var(--muted); font-size: 13px; }
.ocr-status:empty { display: none; }
.thumbnails { display: grid; gap: 12px; }
.thumb { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 8px 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--small-radius); background: var(--surface); }
.thumb > a { grid-row: 1/3; }
.thumb img { width: 56px; height: 72px; object-fit: cover; border-radius: 4px; }
.shot-status { color: var(--muted); font-size: 12px; }
.thumb button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 13px; }
.thumb > button { grid-column: 2; }
.thumb details { grid-column: 1/-1; }
.thumb textarea { margin: 10px 0; font-size: 14px; }
.disclosure { border-top: 1px solid var(--line); padding: 18px 0 0; margin-top: 22px; }
.disclosure > summary { min-height: 32px; color: var(--muted); font-size: 13px; cursor: pointer; }
.disclosure[open] > summary { margin-bottom: 14px; }
details pre { color: var(--muted); font-size: 13px; line-height: 1.8; }
#history { max-height: 260px; overflow: auto; }
#history details { padding: 12px 0; border-bottom: 1px solid var(--line); }
#history summary { font-size: 12px; cursor: pointer; }
.export-brief { padding: 16px; border-radius: var(--small-radius); margin-bottom: 24px; background: var(--surface-soft); }
.export-brief strong { font-size: 16px; font-weight: 550; }
.export-brief p { margin-top: 6px; color: var(--muted); font-size: 13px; }
.export-brief b { font-weight: 550; font-variant-numeric: tabular-nums; }
.confirm { display: flex !important; align-items: flex-start; gap: 10px; margin-bottom: 0 !important; padding: 16px 0; color: var(--ink) !important; font-size: 14px !important; }
.confirm input { width: 20px; height: 20px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.export-hint { margin: 6px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.help { color: var(--muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 60px; padding: 16px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 14px; text-decoration: none; }
.menu-row svg { width: 17px; height: 17px; color: var(--muted); }
.menu-row:hover { background: var(--surface-soft); }
.settings-note { padding-top: 24px; }
.update-status { outline: none; font-size: 15px; line-height: 1.8; }
#updateNotes { margin: 18px 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
#updatePanel .sheet-footer:has(button[hidden]) { display: none; }
.vehicle { margin: 0; }
.vehicle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 88px; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.vehicle-row:hover { background: var(--surface-soft); }
.vehicle-row > div:first-child { min-width: 0; }
.row-plate { display: block; font-size: 18px; font-weight: 550; line-height: 1.4; font-variant-numeric: tabular-nums; }
.row-person { margin-top: 5px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.vehicle-row-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.vehicle-row-right > svg { width: 16px; height: 16px; color: var(--muted); }
.vehicle-status { display: inline-flex; gap: 4px; padding: 3px 7px; border-radius: 4px; background: var(--surface-soft); color: var(--muted); font-size: 12px; line-height: 1.5; white-space: nowrap; }
.vehicle-status.needs-check { background: var(--warning-soft); color: var(--warning); }
.list-hint { margin: 18px 0; color: var(--muted); font-size: 12px; }
.empty-state { padding: 28px 0; }
.empty-drawing { display: none; }
.empty-state h2 { font-size: 16px; }
.empty-state p { margin-top: 8px; color: var(--muted); font-size: 14px; }
.filter-empty .text-button { margin-top: 12px; }
.batch-sheet-section { min-width: 0; margin: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.batch-sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; }
.batch-sheet-heading h2 { font-size: 15px; font-weight: 550; }
.batch-sheet-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.batch-sheet-heading button { flex-shrink: 0; padding: 8px; font-size: 12px; }
.batch-sheet-host { height: var(--batch-sheet-height,400px); width: 100%; max-width: 100%; min-width: 0; border-top: 1px solid var(--line); overflow: hidden; }
.batch-sheet-frame { width: 100%; height: 100%; display: block; border: 0; background: var(--surface); }
.sheet-source { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sheet-source summary, .vehicle-details > summary { min-height: 28px; cursor: pointer; }
.sheet-source pre { margin-bottom: 4px; }
.vehicle-details { margin-top: 20px; }
.vehicle-details > summary { padding: 10px 0; color: var(--muted); font-size: 13px; }
#exportSheet .sheet-footer { display: grid; gap: 10px; }
.sync-summary { margin-bottom: 12px; font-size: 16px; font-weight: 550; overflow-wrap: anywhere; }
.sync-privacy { margin: 12px 0 22px; font-size: 13px; line-height: 1.8; color: var(--muted); }
.sync-actions { display: grid; gap: 10px; }
.sync-code { min-height: 98px !important; font: 14px/1.7 ui-monospace,monospace !important; overflow-wrap: anywhere; resize: none; word-break: break-all; }
.sync-divider { border-top: 1px solid var(--line); margin: 24px 0 18px; padding-top: 18px; }
.sync-divider > label, #syncPairDetails label { display: block; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
#syncPreview { margin-top: 12px; width: 100%; }
#syncJoinPreview p, #syncConflict p, #syncDeleteConfirm p { margin: 8px 0 12px; }
#syncConflict .button-pair { display: grid; grid-template-columns: 1fr; }
#syncPairDetails { margin: 18px 0; }
.sync-code-note { margin: 10px 0; color: var(--warning); font-size: 12px; line-height: 1.8; }
#syncDisconnect, #syncDeleteRequest { color: var(--danger); }
#syncFeedback { margin-bottom: 14px; }
#desktopIntake, .desktop-shortcut { display: none; }
#toast { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom,0px)); width: max-content; max-width: calc(100vw - 40px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 13px; line-height: 1.6; pointer-events: none; }
body:has(dialog[open]) { overflow: hidden; }
body:has(dialog[open]) #toast { visibility: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@keyframes sheet-enter { from { transform: translateY(12px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }
@media (min-width:640px) {
  :root { --space: 24px; }
  .app-sheet { margin: auto; border-radius: 14px; max-height: 90dvh; }
  .sheet-handle { display: none; }
  .sheet-top { min-height: 80px; padding-top: 16px; }
  .sheet-footer { padding-bottom: 20px; }
  .action-dock { max-width: 720px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; }
}
@media (min-width:1024px) {
  body.desktop-layout { padding: 0 0 28px; }
  .desktop-layout .app-header { max-width: 1472px; min-height: 72px; margin: 0 auto; padding: 12px 32px; }
  .desktop-layout main { display: grid; grid-template-columns: minmax(0,1fr) 352px; gap: 24px; align-items: stretch; padding: 16px 32px; }
  .desktop-layout .vehicle-workspace { padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
  .desktop-layout .batch-summary { margin-bottom: 18px; }
  .desktop-layout .filter-group { margin-bottom: 12px; }
  .desktop-layout .batch-sheet-section { border: 0; border-radius: 0; }
  .desktop-layout .batch-sheet-heading { padding: 12px 0 16px; }
  .desktop-layout .batch-sheet-host { border: 1px solid var(--line); border-radius: 8px; }
  .desktop-layout .sheet-source { border: 0; padding: 16px 0 0; }
  .desktop-layout #desktopIntake { display: flex; flex-direction: column; min-height: 510px; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
  .desktop-intake-heading { padding: 24px 24px 12px; }
  .desktop-intake-heading h2 { font-size: 17px; font-weight: 550; }
  .desktop-layout #desktopIntake .sheet-body { display: flex; flex-direction: column; flex: 1; padding: 0 24px 16px; }
  .desktop-layout #desktopIntake .sheet-body > label { margin-top: 0; }
  .desktop-layout #desktopIntake textarea#raw { flex: 1; min-height: 220px; resize: none; background: var(--surface); }
  .desktop-layout #desktopIntake .sheet-footer { padding: 16px 24px 20px; }
  .desktop-layout .desktop-shortcut { display: block; text-align: center; color: var(--muted); font-size: 11px; margin-top: 10px; }
  .desktop-layout .action-dock { position: static; display: flex; max-width: none; margin: 0 8px 0 0; padding: 0; border: 0; background: transparent; }
  .desktop-layout .action-dock button { min-height: 38px; padding: 8px 12px; font-size: 13px; }
  .desktop-layout .action-dock .primary { background: transparent; color: var(--ink); border-color: var(--control); }
  .desktop-layout .action-dock .primary:hover { background: var(--surface-soft); }
  .desktop-layout .action-dock .secondary { background: transparent; border-color: transparent; color: var(--muted); }
  .desktop-layout .action-dock svg { width: 16px; height: 16px; }
  .desktop-layout #desktopIntake.drag-over { outline: 2px solid var(--accent); outline-offset: 3px; }
  .desktop-layout .vehicle-editor .vehicle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .desktop-layout .vehicle-editor .plate-field, .desktop-layout .vehicle-editor .id-field { grid-column: 1/-1; }
  .desktop-layout #toast { bottom: 24px; }
}
@media (min-width:1024px) and (max-width:1190px) {
  .desktop-layout main { grid-template-columns: minmax(0,1fr) 320px; gap: 20px; padding: 12px 24px; }
  .desktop-layout .vehicle-workspace { padding: 20px; }
  .desktop-layout #desktopIntake .sheet-body, .desktop-intake-heading, .desktop-layout #desktopIntake .sheet-footer { padding-left: 20px; padding-right: 20px; }
}
@media (max-width:600px) {
  h1 { font-size: 24px; }
  main { padding-top: 16px; }
  .batch-summary { margin-bottom: 18px; }
  .batch-summary p { font-size: 12px; }
  .saved-mark { display: none; }
  .filter-group { margin-bottom: 16px; }
  .batch-sheet-heading { padding: 12px; }
  .batch-sheet-heading p { max-width: 225px; font-size: 11px; }
  .batch-sheet-heading .text-button { min-height: 44px; padding: 6px; font-size: 12px; }
  .brand { gap: 8px; font-size: 17px; }
  .brand-mark { width: 22px; height: 22px; }
  .app-header { gap: 8px; }
  .sheet-source summary, .vehicle-details > summary { min-height: 44px; display: flex; align-items: center; }
  .vehicle-row-right { gap: 5px; }
}
@media (max-width:360px) {
  :root { --space: 16px; }
  .brand { font-size: 16px; }
  .header-status { font-size: 11px; }
  .action-dock button { padding: 10px; font-size: 13px; }
}
@media (prefers-reduced-motion:reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
