/* Production shell and shared controls, from Claude Design handoff. */
:root {
  --cd-color-ink-text-2:var(--cd-color-ink-text2);
  --cd-color-ink-text-3:var(--cd-color-ink-text3);
  --cd-size-tabbar:var(--cd-size-tab-bar);
  --cd-black:var(--cd-color-ink-chrome);
  --cd-ink:var(--cd-color-ink-text);
  --cd-muted:var(--cd-color-ink-text3);
  --cd-line:var(--cd-color-line-divider);
  --cd-canvas:var(--cd-color-surface-page);
  --cd-surface:var(--cd-color-surface-card);
  --cd-red:var(--cd-color-brand-red);
  --cd-red-dark:var(--cd-color-brand-red-pressed);
  --cd-blue:var(--cd-color-action-link);
  --cd-blue-soft:var(--cd-color-action-link-tint);
  --cd-green:var(--cd-color-status-success-icon);
  --cd-green-soft:var(--cd-color-status-success-bg);
  --cd-amber:var(--cd-color-status-warning-fg);
  --cd-amber-soft:var(--cd-color-status-warning-bg);
  --bg:var(--cd-canvas); --surface:var(--cd-surface); --surface-2:var(--cd-color-surface-sunken);
  --ink:var(--cd-ink); --muted:var(--cd-muted); --subtle:var(--cd-color-ink-icon-muted);
  --line:var(--cd-line); --red:var(--cd-red); --red-hover:var(--cd-red-dark);
  --red-soft:var(--cd-color-brand-red-tint); --blue:var(--cd-blue); --blue-soft:var(--cd-blue-soft);
  --green:var(--cd-green); --green-soft:var(--cd-green-soft);
  --amber:var(--cd-amber); --amber-soft:var(--cd-amber-soft);
  --mobile-gutter:var(--cd-space-screen-x);
  --mobile-nav-height:82px; --nav:56px; --radius:var(--cd-radius-card); --shadow:none;
  --app-width:480px; --cd-safe-bottom:max(20px,env(safe-area-inset-bottom));
}
html { background:#e9ebef; scroll-behavior:auto; scroll-padding-top:calc(56px + env(safe-area-inset-top)); }
body { min-width:0; background:#e9ebef; font:400 16px/21px var(--cd-font-ui); color:var(--ink); }
button,input,select,textarea { font-family:inherit; }
.shell { width:min(100%,var(--app-width)); min-height:100dvh; margin-inline:auto; background:var(--bg); box-shadow:none; overflow:clip; }
main { width:100%; max-width:none; margin:0; padding:16px 16px calc(102px + env(safe-area-inset-bottom)); }
.view { min-width:0; animation:none; }
h1,h2,h3 { letter-spacing:-.02em; overflow-wrap:break-word; }
h1 { font-size:26px; line-height:32px; font-weight:700; }
h2 { font-size:22px; line-height:28px; font-weight:700; }
h3 { font-size:20px; line-height:26px; font-weight:700; }
p { overflow-wrap:break-word; }
.ui-icon,.header-icon svg,.tabbar svg { fill:none; stroke:currentColor; stroke-width:1.75; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; }
.ui-icon { width:24px; height:24px; }

.topbar {
  position:sticky; top:0; z-index:var(--z-sticky); width:100%;
  display:grid; grid-template-columns:96px minmax(0,1fr) 96px; align-items:center;
  height:calc(56px + env(safe-area-inset-top)); padding:env(safe-area-inset-top) 6px 0;
  background:var(--cd-black); color:#fff; border:0; backdrop-filter:none;
}
.topbar .brand { position:static; left:auto; transform:none; justify-self:center; gap:8px; min-height:44px; margin:0; padding:6px; text-decoration:none; }
.brand-logo { display:block; width:auto; height:30px; flex:0 0 auto; }
.brand-mark { width:4px; height:30px; background:var(--cd-red); border-radius:1px; }
.brand-wordmark { font-family:Arial,sans-serif; font-size:15px; line-height:14px; font-weight:900; letter-spacing:-.01em; }
.topbar .header-icon { width:44px; height:44px; border:0; border-radius:22px; padding:0; display:grid; place-items:center; background:transparent; color:#fff; }
.topbar .header-icon svg { width:24px; height:24px; }
.topbar-actions { justify-self:end; display:flex; gap:0; margin:0; }
.notification-badge { top:5px; right:4px; min-width:18px; height:18px; font-size:11px; font-weight:700; border:2px solid var(--cd-black); background:var(--cd-red); }
.connection { display:none; }
.topbar .header-icon:hover,.topbar .header-icon:active { background:#2a2d33; }
.logged-out .topbar { display:flex; justify-content:center; }
.logged-out .topbar .header-icon,.logged-out .topbar .topbar-actions { display:none; }
.logged-out .tabbar { display:none; }
.logged-out main { min-height:calc(100dvh - 56px - env(safe-area-inset-top)); padding:24px 16px; display:flex; align-items:center; }
.auth-brand { display:none; }
.auth-view { width:100%; max-width:none; }
.auth-card { padding:20px 16px; gap:16px; border-radius:16px; background:#fff; }

.tabbar {
  position:fixed; inset:auto 0 0; top:auto; z-index:var(--z-nav); margin-inline:auto;
  transform:none;
  width:min(100%,var(--app-width)); height:calc(62px + var(--cd-safe-bottom));
  display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:0;
  padding:0 0 var(--cd-safe-bottom); background:var(--cd-black); border:0; box-shadow:none;
}
.tabbar a { width:auto; min-width:0; min-height:62px; height:62px; margin:0; padding:0 2px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; color:#c9ccd2; font-size:11px; line-height:13px; font-weight:500; border-radius:0; background:transparent; }
.tabbar a.active,.tabbar a[aria-current=page] { color:var(--cd-color-brand-red-on-dark); font-weight:600; background:transparent; }
.tabbar a.active::before,.tabbar a.active::after { display:none; }
.tabbar a:hover,.tabbar a:active { background:#202328; }
.tabbar svg { width:24px; height:24px; }
.tabbar .add-orb { width:32px; height:32px; display:grid; place-items:center; border:0; box-shadow:none; background:transparent; }
.tabbar .add-orb svg { width:32px; height:32px; }
.nested-view .tabbar { visibility:visible; pointer-events:auto; }
.nested-view main { padding-bottom:calc(102px + env(safe-area-inset-bottom)); }

.page-head h1,.home-header h1,.wizard-top h1,.add-intro h1 { font-size:26px; line-height:32px; letter-spacing:-.02em; }
.page-head p,.add-intro p,.wizard-top p { color:var(--muted); font-size:15px; line-height:20px; }
.card,.wizard-card,.weather-card { padding:16px; border-radius:16px; background:#fff; }
.button { min-height:52px; padding:12px 16px; border-radius:12px; font-size:16px; line-height:21px; font-weight:600; box-shadow:none; }
.button.primary { background:var(--red); color:#fff; border:0; }
.button.primary:hover,.button.primary:active { background:var(--red-hover); }
.button.secondary { background:#fff; border:1px solid var(--cd-color-line-control); color:var(--ink); }
.button.secondary:hover,.button.secondary:active { background:var(--surface-2); }
.button.danger { background:var(--cd-color-status-error-bg); border:0; color:var(--cd-color-status-error-fg); }
.button.ghost,.text-link,.link-button,.small-action { color:var(--blue); }
.text-link,.link-button,.small-action,.icon-button { min-width:44px; min-height:44px; }
.form-grid,.wizard-form,.stack-form,.mileage-form,.password-fields,.policy-form,.feedback-form { gap:16px; }
label { min-width:0; }
.form-grid label,.stack-form label,.wizard-form label,.mileage-form label,.password-form label,.password-fields label,.feedback-form label { display:grid; gap:6px; color:var(--cd-color-ink-text2); font-size:14px; line-height:20px; font-weight:500; }
input:where(:not([type=checkbox]):not([type=radio]):not([type=file])),select,textarea,.picker-trigger { width:100%; min-width:0; min-height:52px; border:1px solid var(--cd-color-line-field); border-radius:10px; background:#fff; padding:12px 14px; font-size:16px; line-height:21px; font-weight:400; }
textarea { min-height:100px; resize:vertical; }
input::placeholder,textarea::placeholder { color:var(--cd-color-ink-placeholder); opacity:1; }
input:read-only:not([type=checkbox]):not([type=radio]),textarea:read-only { background:var(--cd-color-surface-field-read-only); }
select { padding-right:44px!important; background-position:right 16px center!important; background-size:20px 20px!important; }
.picker-trigger { display:flex; align-items:center; justify-content:space-between; gap:12px; text-align:left; }
.picker-trigger strong { font-size:16px; font-weight:400; }
.picker-trigger svg { width:20px; height:20px; }
.checkline { display:flex!important; align-items:flex-start; gap:12px!important; min-height:44px; padding:4px 0; margin:0; }
.checkline input,input[type=checkbox] { width:24px!important; height:24px!important; min-height:24px!important; flex:0 0 24px; margin:0!important; accent-color:var(--red); }
input[type=radio] { width:22px; height:22px; min-height:22px; margin:0; accent-color:var(--red); }
.form-actions { gap:12px; margin-top:24px; }
.stack-form > .button[type=submit],.password-fields > .button[type=submit],.feedback-form > .button[type=submit] { margin-top:8px; }
.form-error { margin:8px 0 0; font-size:14px; line-height:20px; font-weight:500; color:var(--cd-color-status-error-fg); }
.form-error:empty { min-height:0; margin:0; }
.field-help { font-size:13px; line-height:17px; font-weight:400; color:var(--muted); margin-top:0; }
.warning-box,.ai-status,.manual-note { padding:12px 16px; border-radius:12px; font-size:14px; line-height:20px; }
.warning-box { background:var(--amber-soft); color:var(--amber); }
.status-chip { min-height:22px; padding:2px 7px; border-radius:6px; font-size:12px; line-height:16px; font-weight:600; }
.detail-view { gap:20px; }
.detail-view > .detail-head { margin-top:-16px; }
.review-form .status-chip + .form-grid { margin-top:16px; }
.detail-head { min-height:52px; margin:0 -16px; padding:4px 16px 4px 4px; align-items:center; background:#fff; border-bottom:1px solid var(--line); }
.detail-head h1 { font-size:18px; line-height:24px; font-weight:600; margin:0; }
.detail-head p { margin:2px 0 0; font-size:13px; line-height:17px; }
.back-button { color:var(--ink); }
.back-button svg { width:24px; height:24px; }
.view-back { min-height:44px; margin-bottom:12px; }
.detail-total,.detail-list,.detail-fact,.line-items,.vehicle-info,.mileage-card { background:#fff; border-radius:12px; }
.detail-list { padding:0 16px; }
.detail-row { padding-block:12px; gap:12px; }
.detail-total { padding:16px; border:0; }
.detail-total strong { font-size:26px; line-height:32px; }
.line-items { padding:0 16px; }
.garage-car { padding:16px; border:1px solid var(--line); border-radius:16px; background:#fff; }
.garage-car .home-car__visual { width:100%; height:auto; min-height:0; max-height:none; aspect-ratio:362/196; margin:12px 0 0; border-radius:12px; }
.garage-car .home-car__visual .image-opener { display:block; min-width:0; width:100%; height:100%; }
.garage-car .home-car__visual img { display:block; width:100%; height:100%; max-width:100%; object-fit:contain; }
.assistant-view .sources button { color:var(--blue); min-height:44px; }

dialog { width:min(448px,calc(100% - 32px)); max-height:calc(100dvh - 32px); border:0; padding:0; background:transparent; overflow:auto; }
dialog::backdrop { background:var(--cd-color-surface-scrim); }
.dialog-card { padding:20px 16px; border-radius:16px; box-shadow:none; }
.dialog-head { align-items:center; gap:12px; }
.dialog-head h2 { font-size:20px; line-height:26px; margin:0; }
.dialog-head .icon-button { flex:0 0 44px; padding:0; color:var(--muted); background:transparent; border:0; }
.dialog-actions { margin-top:24px; gap:12px; }
.picker-dialog { width:min(480px,100%); max-height:calc(100dvh - 72px); margin:auto auto 0; }
.picker-card { padding:16px; border-radius:20px 20px 0 0; }
.picker-search { margin-block:16px 12px; }
.picker-results { max-height:55dvh; }
.picker-results button { min-height:56px; padding:12px 16px; gap:16px; }
.picker-results button > .ui-icon { flex:0 0 24px; width:24px; height:24px; margin-left:12px; }

.add-sheet { inset:auto 0 0; margin:0 auto; width:min(480px,100%); max-width:none; max-height:calc(100dvh - 56px); border-radius:20px 20px 0 0; }
.add-sheet[open] { animation:cd-sheet-in 200ms ease-out; }
.add-sheet__card { padding:8px 16px calc(24px + env(safe-area-inset-bottom)); background:#fff; border-radius:20px 20px 0 0; display:flex; flex-direction:column; gap:12px; }
.add-sheet__handle { width:36px; height:4px; margin:0 auto; border-radius:2px; background:#dcdfE4; }
.add-sheet__head { display:flex; justify-content:space-between; align-items:center; min-height:44px; gap:12px; }
.add-sheet__head h2 { margin:0; font-size:20px; line-height:26px; }
.add-sheet__photos { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.add-sheet__photo { min-height:104px; border:1px solid var(--cd-color-line-control); border-radius:12px; padding:14px; display:flex; flex-direction:column; justify-content:space-between; align-items:flex-start; gap:12px; background:#fff; color:var(--ink); font-size:15px; line-height:20px; font-weight:600; text-align:left; }
.add-sheet__photo:first-child { background:var(--red); color:#fff; border:0; }
.add-sheet__photo svg { width:28px; height:28px; }
.add-sheet__rows { overflow:hidden; border:1px solid var(--line); border-radius:12px; }
.add-sheet__row { width:100%; min-height:64px; display:flex; align-items:center; gap:12px; padding:10px 16px 10px 12px; border:0; border-bottom:1px solid var(--line); background:#fff; text-align:left; }
.add-sheet__row:last-child { border-bottom:0; }
.add-sheet__row > span { flex:1; min-width:0; }
.add-sheet__row strong { display:block; font-size:16px; line-height:21px; font-weight:500; }
.add-sheet__row small { display:block; margin-top:2px; font-size:13px; line-height:17px; color:var(--muted); }
.add-sheet__row > svg:last-child { width:20px; height:20px; color:var(--subtle); }
.add-sheet__note { margin:0; font-size:12px; line-height:16px; color:var(--muted); }
.toast-stack { position:fixed; inset:auto 12px calc(94px + env(safe-area-inset-bottom)); width:calc(100% - 24px); max-width:456px; margin-inline:auto; display:flex; flex-direction:column; gap:8px; }
.toast { padding:14px 16px; border-radius:12px; background:var(--ink); font-size:14px; line-height:20px; box-shadow:0 2px 8px rgba(0,0,0,.2); }
:where(a,button,input,select,textarea,summary):focus-visible { outline:2px solid var(--cd-color-action-focus); outline-offset:2px; }
.form-grid input:focus,.form-grid select:focus,.stack-form input:focus,.stack-form select:focus,.wizard-form input:focus,.wizard-form select:focus,.auth-card input:focus,.picker-search input:focus { border-color:var(--blue); box-shadow:0 0 0 2px var(--blue-soft); }
:where(button,input,select,textarea):disabled { cursor:not-allowed; opacity:.6; }
@keyframes cd-sheet-in { from { opacity:.5; transform:translateY(24px); } to { opacity:1; transform:none; } }
@media (max-width:370px) { .topbar { grid-template-columns:88px minmax(0,1fr) 88px; } .topbar .brand { gap:6px; padding:4px; } .brand-wordmark { font-size:14px; } .form-actions { flex-direction:column; } .garage-car .form-actions { display:grid; grid-template-columns:1fr; } }
@media (min-width:980px) { .tabbar { top:auto; bottom:0; flex-direction:row; } main { padding-left:16px; } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { animation-duration:0s!important; transition-duration:0s!important; scroll-behavior:auto!important; } }
@media (forced-colors:active) { .add-sheet__photo,.button { border:1px solid ButtonText; } .tabbar a.active { outline:2px solid Highlight; } }
