/* Perekup CRM: a garage book on the phone.
   Direction (unslop): calm, precise, like a well-kept dealer's ledger. The world is the car lot: each car drawn in its own
   colour and body, Russian number plates, price tags. Chrome stays quiet: one tinted neutral ramp, three text roles, one
   accent (CDMS blue), hairlines instead of shadows, a 4 px spacing grid, weights 400–600, tabular figures, no emoji. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --surface-3: #e4e7ec;
  --text: #16191f;
  --text-2: #4a515c;
  --muted: #737a86;
  --line: rgb(22 25 31 / 8%);
  --line-strong: rgb(22 25 31 / 14%);
  --accent: #2457ff;
  --accent-ink: #ffffff;
  --accent-soft: #e9eeff;
  --pos: #2e7d4f;
  --neg: #c0392b;
  --warn: #9a5b06;
  --warn-soft: #fbf1df;
  --art-bg: #eceef2;
  --art-ground: #e1e4e9;
  --art-glass: #c6d0db;
  --art-rim: #a9b0ba;
  --bar-own: var(--accent);
  --bar-total: #b9c6f5;
  --r-card: 16px;
  --r-ctl: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --tabbar-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1f232a; --surface-3: #282d35; --text: #eceef1; --text-2: #b5bac3; --muted: #8a909b;
    --line: rgb(236 238 241 / 8%); --line-strong: rgb(236 238 241 / 14%); --accent: #7d9bff; --accent-ink: #0f1115; --accent-soft: #1c2540;
    --pos: #6cc08d; --neg: #ec7a6d; --warn: #e0a54a; --warn-soft: #2c2213;
    --art-bg: #1d2128; --art-ground: #252a32; --art-glass: #3a4452; --art-rim: #6b7380; --bar-total: #2c3a66; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1f232a; --surface-3: #282d35; --text: #eceef1; --text-2: #b5bac3; --muted: #8a909b;
  --line: rgb(236 238 241 / 8%); --line-strong: rgb(236 238 241 / 14%); --accent: #7d9bff; --accent-ink: #0f1115; --accent-soft: #1c2540;
  --pos: #6cc08d; --neg: #ec7a6d; --warn: #e0a54a; --warn-soft: #2c2213;
  --art-bg: #1d2128; --art-ground: #252a32; --art-glass: #3a4452; --art-rim: #6b7380; --bar-total: #2c3a66; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 720px; margin: 0 auto; padding: 0 16px calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
h2 .icon { color: var(--muted); }
h3 { font-size: 13px; font-weight: 500; margin: 12px 0 4px; color: var(--muted); }
small { color: var(--muted); font-size: 13px; }
b { font-weight: 600; }
.num, .row-amount, .sum-tile b, .tile b, .hero-num, .money-grid b, .kv b, .mini span, .bl-top b { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 0 4px; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.warn { color: var(--warn); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -4px; }
.icon.lg { width: 28px; height: 28px; }
.scroll-x { display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; }
.scroll-x::-webkit-scrollbar { display: none; }
.stack { display: grid; gap: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; margin: 0 -16px 8px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.topbar h1 { flex: 1; }
.badge { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 0; border-radius: var(--r-ctl); background: transparent; color: var(--text); cursor: pointer; transition: background-color .12s var(--ease); }
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn.sm { width: 32px; height: 32px; color: var(--muted); }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.icon-btn:active { background: var(--surface-2); }
.icon-btn[disabled] { opacity: .3; }
.icon-btn.flip .icon { transform: scaleX(-1); }

/* Buttons and chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; transition: background-color .12s var(--ease), transform .12s var(--ease); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger.ghost { background: transparent; color: var(--neg); border-color: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.icon-only { padding: 0; width: 44px; flex: none; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; }
.link-btn { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 500; padding: 0; cursor: pointer; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chips.scroll-x { flex-wrap: nowrap; margin: 8px -16px; padding: 0 16px; }
.card .chips.scroll-x { margin: 4px -16px 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 36px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer; }
.chip-btn .icon { width: 16px; height: 16px; color: var(--muted); }
.chip-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip-btn.on .icon { color: inherit; }
.chip-btn small { color: inherit; opacity: .6; font-variant-numeric: tabular-nums; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip .icon { width: 14px; height: 14px; }
.status-for_sale { color: var(--accent); background: var(--accent-soft); }
.status-reserved { color: var(--warn); background: var(--warn-soft); }
.status-sold { color: var(--pos); }

/* Custom dropdowns (picker.mjs) */
.picker { position: relative; min-width: 0; }
.pk-btn { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 4px 12px 4px 4px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer; transition: border-color .12s var(--ease), background-color .12s var(--ease); }
.picker.open .pk-btn { border-color: var(--accent); background: var(--surface); }
.pk-current { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.pk-current .pk-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-chev { color: var(--muted); transition: transform .2s var(--ease); }
.picker.open .pk-chev { transform: rotate(180deg); }
.pk-tile { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.pk-tile .icon { width: 18px; height: 18px; }
.pk-tile .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pk-menu { position: fixed; z-index: 60; display: grid; gap: 2px; padding: 4px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 32px rgb(0 0 0 / 14%); animation: pk-in .16s var(--ease); }
.picker.up .pk-menu { animation-name: pk-in-up; }
@keyframes pk-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes pk-in-up { from { opacity: 0; transform: translateY(4px); } }
.pk-opt, .search-row, .menu-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 4px 12px 4px 4px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.pk-opt[hidden] { display: none; }
.pk-opt:hover, .pk-opt:focus-visible, .search-row:hover, .search-row:focus-visible { background: var(--surface-2); outline: none; }
.pk-opt[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.pk-opt[aria-selected="true"] .pk-tile { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.pk-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pk-text .pk-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-check { visibility: hidden; color: var(--accent); }
.pk-opt[aria-selected="true"] .pk-check { visibility: visible; }
.pk-search { width: 100%; height: 40px; margin-bottom: 4px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--text); font: inherit; }
.suggest .pk-opt { min-height: 40px; padding-left: 12px; }
.suggest input { width: 100%; }
.picker.compact .pk-btn { min-height: 32px; padding: 0 8px 0 4px; gap: 4px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--surface); }
.picker.compact .pk-tile { width: 24px; height: 24px; border: 0; background: transparent; }
.picker.compact .pk-tile .icon, .picker.compact .pk-chev { width: 16px; height: 16px; }
.status-line .picker.compact .pk-btn { background: var(--surface); }

/* Home */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum-tile, .tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.sum-tile b, .tile b { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-tile span, .tile span { font-size: 12px; color: var(--muted); }
.hint { display: flex; align-items: flex-start; gap: 8px; width: 100%; margin: 12px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; font: inherit; font-size: 14px; color: var(--text); }
.hint > span { flex: 1; }
.hint .icon { margin-top: 1px; color: var(--muted); }
.hint.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.hint.warn .icon { color: inherit; }
button.hint { cursor: pointer; align-items: center; }
.price-hint { display: block; }
.hint-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-hint .chips { margin-bottom: 0; }
.price-hint .chip-btn b { font-weight: 600; font-variant-numeric: tabular-nums; }
.due { margin-top: 12px; padding: 12px 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.due-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.due-head .icon { color: var(--muted); }
.due ul { list-style: none; margin: 8px 0 0; padding: 0; }
.due li a { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); }
.searchbar { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; padding: 0 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.searchbar input { flex: 1; min-width: 0; height: 44px; border: 0; background: transparent; color: var(--text); font: inherit; outline: none; }
.searchbar.in-sheet { margin: 0; background: var(--surface-2); }
.sortrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0 0; }
.car-list { display: grid; gap: 8px; margin-top: 8px; }
.car-card { display: grid; grid-template-columns: 84px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); transition: background-color .12s var(--ease); }
.car-card:active { background: var(--surface-2); }
.car-card.stale { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.thumb { position: relative; width: 84px; height: 60px; border-radius: 8px; overflow: hidden; background: var(--art-bg); }
.thumb.wide { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.thumb img, .thumb .car-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb img:not([src]) { display: none; }
.car-main { min-width: 0; }
.car-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.car-sub span:not(.chip) { display: inline-flex; align-items: center; gap: 2px; }
.car-sub .icon { width: 14px; height: 14px; }
.car-result { display: flex; flex-direction: column; align-items: flex-end; text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; }
.car-result b { white-space: nowrap; }
.car-result.row-flex { flex-direction: row; align-items: baseline; gap: 8px; text-align: left; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 12px; }
.empty p { margin: 0; max-width: 300px; }
.empty-art { width: 160px; height: 96px; color: var(--muted); }

/* Board */
.board { gap: 12px; margin: 12px -16px 0; padding: 0 16px 8px; align-items: flex-start; }
.column { flex: none; width: 76%; max-width: 300px; scroll-snap-align: start; }
.column-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.column-body { display: grid; gap: 8px; }
.board-card { padding: 8px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; }
.board-card.stale { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.board-link { display: grid; gap: 4px; }

/* Car page */
.gallery { gap: 8px; margin: 0 -16px; padding: 0 16px; }
.photo { position: relative; flex: none; width: 80%; max-width: 420px; aspect-ratio: 16 / 10; border: 0; padding: 0; border-radius: var(--r-card); overflow: hidden; background: var(--art-bg); scroll-snap-align: center; cursor: pointer; }
.photo img, .photo .car-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo.add-photo { width: 120px; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--accent); font-weight: 500; font-size: 14px; border: 1px dashed var(--line-strong); background: var(--surface); }
.cover-tag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / 55%); color: #fff; font-size: 12px; }
.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 12px 0 0; font-size: 14px; }
.status-line > span { display: inline-flex; align-items: center; gap: 4px; }
.card { margin: 12px 0 0; padding: 16px; border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head .count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.result-main { display: flex; flex-direction: column; gap: 2px; }
.hero-num { font-size: 32px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; }
.split-bar { display: flex; gap: 2px; height: 8px; margin: 16px 0 8px; border-radius: 4px; overflow: hidden; }
.split-bar i { background: var(--bar-own); }
.split-bar i.inv { background: var(--bar-total); }
.split-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--bar-own); }
.sw.inv { background: var(--bar-total); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.kv span { color: var(--text-2); }
.kv.strong b { font-size: 17px; color: var(--accent); }
.money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.money-grid div { display: flex; flex-direction: column; }
.action-row { display: flex; gap: 8px; margin: 12px 0 0; }
.action-row .btn:not(.icon-only) { flex: 1; }
.paste-box { display: flex; gap: 8px; align-items: center; }
.paste-box input, .task-form input { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text); font: inherit; }
.links, .rows, .mini, .barlist, .tasks, .timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.link-row:first-child { border-top: 0; }
.link-badge { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--c); color: #fff; font-weight: 600; }
.link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.link-main b { font-weight: 500; display: flex; align-items: center; gap: 4px; }
.link-main b, .link-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.url-preview { word-break: break-all; font-size: 13px; color: var(--muted); margin: 0; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 0; min-height: 56px; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.row.static { cursor: default; }
.rows li:first-child .row { border-top: 0; }
.row-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--surface-2); color: var(--text-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 500; }
.row-main small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amount { display: flex; flex-direction: column; align-items: flex-end; font-weight: 500; white-space: nowrap; }
.split-line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin: 8px 0; color: var(--muted); }
.split-line b { color: var(--text); }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 0; }
.details dt { font-size: 13px; color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.plate-row { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.notes { white-space: pre-wrap; margin: 12px 0 0; }
.btn.danger.ghost.wide { margin-top: 24px; }

/* Number plate: the Russian layout, white with a black rim, region box on the right */
.plate { display: inline-flex; align-items: stretch; height: 28px; border: 1.5px solid #1a1d23; border-radius: 4px; background: #fff; color: #1a1d23; font: 500 15px/1 "DIN Alternate", "Roboto Condensed", system-ui, sans-serif; letter-spacing: .02em; overflow: hidden; }
.plate-main { display: flex; align-items: center; gap: 2px; padding: 0 6px; }
.plate-main b { font-size: 17px; font-weight: 600; }
.plate-reg { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 4px; border-left: 1.5px solid #1a1d23; font-size: 12px; }
.plate-reg small { font-size: 7px; color: #1a1d23; letter-spacing: .04em; }
.plate.plain { align-items: center; padding: 0 8px; }

/* To-do */
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress.big { height: 10px; border-radius: 5px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s var(--ease); }
.task { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.tick { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: transparent; cursor: pointer; transition: background-color .12s var(--ease), border-color .12s var(--ease); }
.tick .icon { width: 16px; height: 16px; stroke-width: 2; }
.task.done .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.task-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.task-text small { display: inline-flex; align-items: center; gap: 4px; }
.task-text small .icon { width: 14px; height: 14px; }
.task-form { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 12px; }
.task-form input[name=text] { grid-column: 1 / -1; }
.task-form input[type=date] { grid-column: 1 / 3; font-size: 15px; }
.task-form .btn { width: 44px; padding: 0; }
.card > .link-btn { margin-top: 12px; }

/* Timeline */
.timeline li { display: flex; gap: 12px; position: relative; padding: 0 0 12px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 17.5px; top: 36px; bottom: 0; width: 1px; background: var(--line-strong); }
.tl-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--surface-2); color: var(--text-2); }
.timeline .row-main { padding-top: 8px; }

/* Analytics */
.segmented { display: flex; gap: 2px; padding: 2px; border-radius: 12px; background: var(--surface-2); }
.segmented button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; padding: 0 4px; white-space: nowrap; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .12s var(--ease), color .12s var(--ease); }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
.segmented.tiny { padding: 2px; }
.segmented.tiny button { min-height: 32px; width: 40px; flex: none; }
.period-nav { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.tiles.inner { margin: 0; }
.tiles.inner .tile { background: var(--surface-2); border-color: transparent; }
.tiles.inner .tile:nth-child(2) { grid-column: span 2; order: -1; }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-size: 9px; fill: var(--muted); }
.chart .axis { stroke: var(--line-strong); }
.bar-total { fill: var(--bar-total); }
.bar-own { fill: var(--bar-own); }
.bar-neg { fill: var(--neg); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.legend i.bar-own { background: var(--bar-own); }
.legend i.bar-total { background: var(--bar-total); }
.barlist li { margin: 8px 0; }
.bl-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bl-top > span { display: inline-flex; align-items: center; gap: 8px; }
.bl-top .icon { color: var(--muted); }
.bl-bar { height: 6px; margin-top: 4px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bl-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.mini li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.mini li:first-child { border-top: 0; }
.mini a { font-weight: 500; min-width: 0; flex: 1 1 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini span { color: var(--muted); text-align: right; flex: 0 1 auto; }
.goal .split-line { margin-top: 12px; }

/* Investors */
.person { display: flex; align-items: center; gap: 12px; margin: 0; }
.avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-weight: 500; font-size: 15px; flex: none; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.right { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.owed .row { min-height: 0; }
.owed .card-head b { font-size: 17px; }

/* More, search, deal */
.menu { display: grid; gap: 2px; margin: -4px; }
.menu-row:hover { background: var(--surface-2); }
.menu-row > .icon { color: var(--muted); }
.search-sheet { gap: 8px; }
.search-results { display: grid; gap: 2px; min-height: 50vh; align-content: start; }
.group-title { margin: 12px 4px 4px; font-size: 13px; color: var(--muted); }
.search-row > .icon { color: var(--muted); }
.ad-text { width: 100%; min-height: 220px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text); font: inherit; font-size: 15px; line-height: 1.5; resize: vertical; }
.deal-result { display: grid; gap: 0; }
.deal-result .hint { margin: 12px 0; }

/* Welcome */
.welcome { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 24px; max-width: 400px; margin: 0 auto; padding: 24px 0; }
.welcome-art { position: relative; border-radius: 20px; overflow: hidden; aspect-ratio: 16 / 10; background: var(--art-bg); }
.welcome-art .car-art { width: 100%; height: 100%; display: block; }
.tag-art { position: absolute; right: 8%; top: 10%; width: 30%; transform: rotate(-8deg); }
.welcome-text h1 { font-size: 32px; }
.welcome-text p { color: var(--text-2); margin: 8px 0 0; font-size: 16px; }
.small-seg { max-width: 240px; margin: 0 auto; }

/* Tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; align-items: center; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabbar[hidden] { display: none; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.tabbar a .icon { width: 24px; height: 24px; }
.tabbar a.active { color: var(--text); }
.tabbar a.active .icon { color: var(--accent); }
.tab-add { display: grid; place-items: center; width: 48px; height: 48px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); cursor: pointer; transition: transform .12s var(--ease); }
.tab-add:active { transform: scale(.96); }
.tab-add .icon { width: 24px; height: 24px; stroke-width: 2; }

/* Sheets */
dialog.sheet { width: 100%; max-width: 640px; max-height: 92vh; margin: auto auto 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text); overflow-y: auto; animation: up .2s var(--ease); }
dialog.sheet.tall { min-height: 80vh; }
dialog.sheet::backdrop { background: rgb(10 12 16 / 45%); }
dialog.sheet.full { background: #000; max-height: 100vh; height: 100vh; border-radius: 0; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-grip { width: 36px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: var(--line-strong); }
.sheet-form { display: grid; gap: 12px; }
.sheet-form h2 { font-size: 20px; }
.sheet-form h2 .icon { width: 22px; height: 22px; }
.sheet-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; }
.sheet-actions .btn.danger.ghost { flex: 0 0 auto; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field input, .field textarea, .suggest input { width: 100%; min-height: 48px; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px; }
.field input:focus, .field textarea:focus, .paste-box input:focus, .task-form input:focus, .suggest input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; padding: 4px 0; }
details[open] { display: grid; gap: 12px; }
.check { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1.5px solid var(--line-strong); border-radius: 6px; color: transparent; }
.check .box .icon { width: 16px; height: 16px; stroke-width: 2; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { margin: 0; padding: 8px 12px; border-radius: 8px; background: color-mix(in srgb, var(--neg) 10%, transparent); color: var(--neg); font-size: 14px; }
.live-profit { margin: 0; font-size: 16px; font-variant-numeric: tabular-nums; }
.viewer { display: flex; flex-direction: column; height: 100%; gap: 12px; }
.viewer img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.viewer .btn { background: #1f232a; color: #fff; border-color: #343a44; }

/* Notices */
.notices { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); z-index: 70; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.notice { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 480px; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 14px; transition: opacity .2s var(--ease), transform .2s var(--ease); }
.notice button { border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.notice.out { opacity: 0; transform: translateY(8px); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 640px) {
  .summary { gap: 12px; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tiles.inner .tile:nth-child(2) { grid-column: auto; order: 0; }
  .photo { width: 48%; }
  .column { width: 280px; }
}
.menu > * { min-width: 0; }
.menu-row .pk-text small { white-space: normal; }
.action-row .btn { white-space: nowrap; padding: 0 12px; }
/* Keep focused or scrolled-to controls clear of the sticky top bar and the tab bar. */
:where(button, a, input, textarea, label, .picker) { scroll-margin: 72px 0 calc(var(--tabbar-h) + 24px); }
