/* Carnamcha — design tokens and components from the Claude Design handoff (docs/BRAND.md).
   Mobile-first at 390 px, 640 px max-width centred on desktop. Light and dark share one token set. */

:root {
  --brand: #2a7f86;         /* lockup teal · 4.9:1 on --bg */
  --brand-ink: #fbf4e8;     /* text on brand */
  --accent: #d9662b;        /* icon orange · badges, chips, bars, 18px+ text only */
  --ink: #1c2426;
  --muted: #5d6969;
  --line: #e3ded4;
  --bg: #f7f3ec;            /* cream from the icon's road */
  --card: #ffffff;
  --danger: #b3362c;
  --ok: #2f7d4f;
  --chart-fuel: #2a7f86;
  --chart-service: #d9662b;
  --tint: #eef4f4;
  --acc-tint: #fbeee6;
  --danger-tint: #f9e9e7;
  --ok-tint: #e9f3ec;
  --radius: 12px;
  --tabbar-h: 62px;
  --font-latin: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-serif: Newsreader, Georgia, serif;
  --font-urdu: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #3d9aa2; --brand-ink: #0e1b1c; --accent: #ea8a52; --ink: #f1ede4; --muted: #a7afae; --line: #2d383a;
    --bg: #121a1b; --card: #1b2426; --danger: #e8736a; --ok: #62c48b; --chart-fuel: #52b7be; --chart-service: #f09b66;
    --tint: #17282a; --acc-tint: #2c2019; --danger-tint: #2e1c1a; --ok-tint: #17281e;
  }
}
:root[data-theme="dark"] {
  --brand: #3d9aa2; --brand-ink: #0e1b1c; --accent: #ea8a52; --ink: #f1ede4; --muted: #a7afae; --line: #2d383a;
  --bg: #121a1b; --card: #1b2426; --danger: #e8736a; --ok: #62c48b; --chart-fuel: #52b7be; --chart-service: #f09b66;
  --tint: #17282a; --acc-tint: #2c2019; --danger-tint: #2e1c1a; --ok-tint: #17281e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.45 var(--font-latin); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.subpage { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--brand); }
a:hover { color: var(--accent); }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h2 { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
h3 { font-size: 17px; font-weight: 600; margin: 0 0 .4rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
[dir="rtl"], .urdu { font-family: var(--font-urdu); line-height: 1.9; }
[dir="auto"] { unicode-bidi: plaintext; }

/* ---------- Top bar (56 px) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--brand); color: var(--brand-ink);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { max-width: 640px; margin: 0 auto; height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; min-width: 0; }
.brand svg { width: 24px; height: 24px; flex: none; }
.brand-en { font-family: var(--font-serif); font-weight: 600; font-size: 21px; line-height: 1; letter-spacing: .3px; }
.brand-ur { font-family: var(--font-urdu); font-size: 14px; line-height: 1; margin-top: -4px; }
.vehicle-switch select {
  font: 500 14px/1 var(--font-latin); height: 36px; padding: 0 28px 0 12px; border-radius: 999px;
  border: 1px solid currentColor; background: transparent; color: inherit; max-width: 46vw;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' fill='none' stroke='%23fbf4e8' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
:root[data-theme="dark"] .vehicle-switch select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' fill='none' stroke='%230e1b1c' stroke-width='1.6'/%3E%3C/svg%3E"); }
.vehicle-switch select option { color: var(--ink); background: var(--card); }
/* sub-page header: back chevron, title, subtitle */
.subhead { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.subhead .back { color: inherit; text-decoration: none; font-size: 22px; line-height: 1; padding: 6px 4px 6px 0; }
.subhead-titles { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.subhead-title { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subhead-sub { font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subhead-action { margin-left: auto; color: inherit; font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---------- Page ---------- */
.page { max-width: 640px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.page > h2:first-child { margin-top: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.page-head .sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.card-title { font-weight: 600; margin-bottom: 4px; }
.card-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; }
.card-list > * { padding: 12px 0; border-bottom: 1px solid var(--line); }
.card-list > *:last-child { border-bottom: 0; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.row-link { text-decoration: none; color: inherit; }
.rowtitle { font-size: 16px; font-weight: 600; }
.rowtitle.brand { color: var(--brand); }
.rowmeta { font-size: 13px; color: var(--muted); }
.amount { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { color: var(--muted); }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-value.mismatch { color: var(--danger); }
.stat-note { font-size: 13px; color: var(--muted); }
.stat-note.mismatch { color: var(--danger); }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.list-item a.cover { color: inherit; text-decoration: none; font-size: 16px; font-weight: 600; }
.list-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.list-sub { color: var(--muted); font-size: 13px; }
.list-amount { text-align: right; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.list-amount strong { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.thumb { width: 48px; height: 60px; border-radius: 6px; flex: none; object-fit: cover; background: repeating-linear-gradient(135deg, var(--line) 0 2px, var(--bg) 2px 10px); }

/* ---------- Badges (quality / state) and chips (facts) ---------- */
.badge { display: inline-block; font-size: 12px; font-weight: 500; line-height: 1; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: transparent; vertical-align: middle; white-space: nowrap; }
.badge-displayed, .badge-status-confirmed, .badge-ok { border-color: var(--ok); color: var(--ok); }
.badge-measured { border-color: var(--brand); color: var(--brand); }
.badge-estimated, .badge-partial, .badge-status-pending, .badge-status-processing { border-color: var(--accent); color: var(--accent); }
.badge-status-needs_review, .badge-status-failed { border-color: var(--danger); color: var(--danger); }
.badge-status-draft { color: var(--muted); }
.badge-q { width: 22px; height: 22px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; border-color: var(--accent); color: var(--accent); }
.chip { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); text-decoration: none; white-space: nowrap; }
.chip-item { color: var(--brand); background: var(--tint); border-color: var(--brand); font-weight: 500; }
.chip-unmatched { color: var(--accent); background: var(--acc-tint); border: 1px dashed var(--accent); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- Banners ---------- */
.flash, .banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-radius: var(--radius); padding: 12px 14px; font-size: 14px; line-height: 1.4; border: 1px solid; }
.flash-notice, .banner-info { background: var(--tint); border-color: var(--brand); color: var(--ink); }
.flash-alert, .banner-danger { background: var(--danger-tint); border-color: var(--danger); color: var(--ink); }
.banner-ok { background: var(--ok-tint); border-color: var(--ok); }
.banner-accent, .due { background: var(--acc-tint); border-color: var(--accent); }
.due.flash-alert { background: var(--danger-tint); border-color: var(--danger); }
.banner .glyph { font-weight: 700; flex: none; }
.banner-ok .glyph { color: var(--ok); }
.banner-accent .glyph { color: var(--accent); }
.banner-info .glyph { color: var(--brand); }
.banner .go { font-weight: 600; text-decoration: none; }
.banner-accent .go { color: var(--accent); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--brand); border-top-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.extraction-pending { justify-content: flex-start; }
.errors { background: var(--danger-tint); border: 1px solid var(--danger); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }
.empty { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 16px/1 var(--font-latin); height: 44px; padding: 0 18px; border-radius: var(--radius); border: 0; background: var(--brand); color: var(--brand-ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-secondary { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-text { background: transparent; color: var(--brand); border: 0; padding: 0 8px; text-decoration: underline; }
.btn-small { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { display: flex; width: 100%; }
.btn-tall { height: 48px; }
.btn[disabled] { opacity: .45; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { display: contents; }
.actions .grow { flex: 1; }
.action-bar { position: sticky; bottom: 0; margin: 8px -16px -16px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--card); display: flex; gap: 10px; }
.action-bar .btn { height: 48px; }
.action-bar .grow { flex: 1; }
.action-bar form { display: contents; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.form > *, .form-row > *, .form-row-3 > *, .field > * { min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field > .label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; font-weight: 400; color: var(--muted); }
.field .hint.ok { color: var(--ok); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; min-width: 0; height: 44px; font: 16px/1.2 var(--font-latin); padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
input[dir="rtl"], textarea[dir="rtl"] { font-family: var(--font-urdu); text-align: right; }
textarea { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.4; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1 3l4 4 4-4' fill='none' stroke='%235d6969' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
input[readonly], .field .derived { background: var(--bg); }
input[type=file] { font-size: 14px; width: 100%; }
input::placeholder, textarea::placeholder { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 400; min-height: 44px; }
.check input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); border-radius: 6px; flex: none; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.segmented label { text-align: center; padding: 11px 0; font-size: 15px; cursor: pointer; border-left: 1px solid var(--line); min-width: 0; }
.segmented label:first-child { border-left: 0; }
.segmented input { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:has(input:checked) { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.radio-list { display: flex; flex-direction: column; }
.radio-list label { display: flex; align-items: center; gap: 10px; font-size: 15px; min-height: 40px; cursor: pointer; }
.radio-list input[type=radio] { width: 20px; height: 20px; margin: 0; accent-color: var(--brand); flex: none; }
.photo-slots { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.photo-slot { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.photo-slot .slot { min-height: 96px; border: 1.5px dashed var(--brand); border-radius: var(--radius); background: var(--tint); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--brand); font-size: 13px; font-weight: 600; padding: 10px; text-align: center; }
.photo-slot .slot.filled { border: 1px solid var(--line); background: var(--card); padding: 6px; }
.photo-slot .slot img { width: 100%; height: auto; border-radius: 8px; }
.photo-slot input[type=file] { font-size: 12px; color: var(--muted); }
.photo-slot .slot { cursor: pointer; }
.photo-slot .hint, .photo-slot .label { font-size: 12px; color: var(--muted); }
.photo-slot .label { font-size: 13px; font-weight: 600; color: var(--ink); }
details.more summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; min-height: 40px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "▶"; font-size: 11px; }
details.more[open] summary::after { content: "▼"; }
.inline-form { background: var(--card); border: 1.5px solid var(--brand); border-radius: var(--radius); padding: 14px; }

/* ---------- Tab bar ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 0 10px; }
.tabbar-inner.four { grid-template-columns: repeat(4, 1fr); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; text-decoration: none; }
.tab svg { width: 24px; height: 24px; }
.tab.active { color: var(--brand); font-weight: 600; }
.tab-add { color: var(--brand); font-weight: 600; }
.tab-add .plus { width: 40px; height: 40px; margin-top: -14px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: 26px; line-height: 40px; text-align: center; box-shadow: 0 2px 0 var(--line); }

/* ---------- Auth ---------- */
.auth { display: flex; flex-direction: column; justify-content: flex-start; gap: 22px; padding: 24px 24px 32px; max-width: 420px; margin: 0 auto; }
.auth-lockup { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--brand); text-align: center; }
.auth-lockup svg { width: 88px; height: 88px; }
.auth-lockup .en { font-family: var(--font-serif); font-weight: 600; font-size: 34px; line-height: 1; margin-top: 6px; }
.auth-lockup .ur { font-family: var(--font-urdu); font-size: 26px; line-height: 2; }
.auth-lockup .tag { font-size: 14px; color: var(--muted); }

/* ---------- Charts ---------- */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; height: 150px; align-items: end; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 1px; position: relative; }
.bar-value { position: absolute; top: 0; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-fill { width: 100%; background: var(--chart-fuel); border-radius: 0 0 3px 3px; min-height: 0; }
.bar-fill.bar-maintenance { background: var(--chart-service); border-radius: 3px 3px 0 0; }
.bar-labels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; font-size: 12px; color: var(--muted); text-align: center; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 10px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--chart-fuel); }
.swatch-maintenance { background: var(--chart-service); }
.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 10px; overflow: hidden; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .series { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .marker { fill: var(--brand); stroke: var(--card); stroke-width: 2; }
.chart .marker-hit { fill: transparent; }
.chart .marker-hit:hover + .marker { r: 7; }
.chart .value-label { fill: var(--ink); font-size: 11px; font-weight: 600; }
.chart-caption { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.chart-caption i { width: 14px; height: 2px; background: var(--brand); display: inline-block; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); font-size: 13px; width: max-content; }
.toggle-row a { padding: 6px 12px; text-decoration: none; color: var(--ink); border-left: 1px solid var(--line); text-align: center; }
.toggle-row a:first-child { border-left: 0; }
.toggle-row a.on { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-height: 40px; text-decoration: none; }
.switch i { width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; flex: none; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.switch.on i { background: var(--brand); }
.switch.on i::after { left: auto; right: 2px; background: var(--brand-ink); box-shadow: none; }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 13px; font-weight: 600; color: var(--muted); padding: 10px 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td + td, table.data th + th { padding-left: 10px; }
.table-wrap { overflow-x: auto; }

/* ---------- Documents & review ---------- */
.doc-image { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: repeating-linear-gradient(135deg, var(--line) 0 2px, var(--card) 2px 12px); position: relative; }
.doc-image img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; background: var(--card); }
.doc-image .open { position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 600; color: var(--brand); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; text-decoration: none; }
.doc-image-empty { padding: 28px; color: var(--muted); text-align: center; font-size: 14px; }
.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.line { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.line-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.line-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.line-raw { font-size: 16px; color: var(--muted); }
.line-raw[dir="rtl"], .line-raw.urdu { text-align: right; }
.line-norm { font-size: 16px; font-weight: 600; }
.line-sub { font-size: 13px; color: var(--muted); }
.line-amount { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.line-amount .amount.passthrough { color: var(--muted); text-decoration: line-through; }
.line-amount a { font-size: 13px; font-weight: 600; }
.line-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.line.passthrough { border-style: dashed; }
.line-actions .btn { height: auto; min-height: 40px; padding: 8px 12px; font-size: 14px; text-align: left; white-space: normal; line-height: 1.3; background: var(--tint); color: var(--brand); border: 1px solid var(--brand); border-radius: 10px; width: 100%; justify-content: flex-start; }
.totals { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.totals .row { font-size: 15px; align-items: center; }
.totals .row strong { font-variant-numeric: tabular-nums; }
.year-buttons { display: flex; gap: 6px; }
.year-buttons .btn { height: 34px; padding: 0 10px; font-size: 14px; border-radius: 10px; background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.year-buttons form { display: contents; }

@media (min-width: 640px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .stat-value { font-size: 20px; white-space: nowrap; }
  .two-col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
}

/* Install card */
.install .actions .btn { flex: 1; }
.install [hidden] { display: none !important; }
.install .banner .glyph { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

/* Review checklist */
.pinned-receipt { position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 5; background: var(--bg); padding: 6px 0; margin: -6px 0; }
.pinned-receipt summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.pinned-receipt summary::-webkit-details-marker { display: none; }
.pinned-thumb { width: 56px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.pinned-receipt[open] summary { border-radius: var(--radius) var(--radius) 0 0; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 4px; }
.progress-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .3s ease; }
.tick-form { display: contents; }
.tick { margin-left: auto; }
.line.confirmed { opacity: .75; }
.line.confirmed .line-norm { font-weight: 500; }
