/* Garage Logbook - macOS-inspired interface */
:root {
  --bg: #f4f4f6;
  --card: #ffffff;
  --card-2: #f7f7f9;
  --sidebar: rgba(234, 234, 238, .82);
  --toolbar: rgba(244, 244, 246, .8);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --line: rgba(0, 0, 0, .09);
  --line-strong: rgba(0, 0, 0, .16);
  --hover: rgba(0, 0, 0, .045);
  --selected: rgba(0, 0, 0, .085);
  --accent: #007aff;
  --accent-press: #0062cc;
  --accent-soft: rgba(0, 122, 255, .12);
  --red: #d70015;
  --red-soft: rgba(255, 59, 48, .12);
  --orange: #b25000;
  --orange-soft: rgba(255, 149, 0, .16);
  --green: #1a7f37;
  --green-soft: rgba(52, 199, 89, .16);
  --control: #ffffff;
  --control-border: rgba(0, 0, 0, .14);
  --shadow-control: 0 .5px 1px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .08);
  --shadow-card: 0 0 0 .5px rgba(0, 0, 0, .08), 0 1px 3px rgba(0, 0, 0, .05);
  --shadow-sheet: 0 0 0 .5px rgba(0, 0, 0, .2), 0 24px 70px rgba(0, 0, 0, .32);
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --fs: 13px;
  --control-h: 28px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e;
    --card: #2a2a2d;
    --card-2: #323236;
    --sidebar: rgba(38, 38, 41, .86);
    --toolbar: rgba(28, 28, 30, .8);
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #6e6e73;
    --line: rgba(255, 255, 255, .1);
    --line-strong: rgba(255, 255, 255, .2);
    --hover: rgba(255, 255, 255, .06);
    --selected: rgba(255, 255, 255, .11);
    --accent: #0a84ff;
    --accent-press: #409cff;
    --accent-soft: rgba(10, 132, 255, .22);
    --red: #ff6961;
    --red-soft: rgba(255, 69, 58, .2);
    --orange: #ffb340;
    --orange-soft: rgba(255, 159, 10, .2);
    --green: #4cd964;
    --green-soft: rgba(48, 209, 88, .18);
    --control: #3a3a3e;
    --control-border: rgba(255, 255, 255, .12);
    --shadow-control: 0 .5px 1px rgba(0, 0, 0, .4), inset 0 .5px 0 rgba(255, 255, 255, .12);
    --shadow-card: 0 0 0 .5px rgba(255, 255, 255, .09);
    --shadow-sheet: 0 0 0 .5px rgba(255, 255, 255, .16), 0 24px 70px rgba(0, 0, 0, .6);
    --grid: #38383b;
    --axis: #55555a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs)/1.4 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- Window layout ---------- */
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar {
  width: 236px; flex: none; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: .5px solid var(--line-strong);
  -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  padding: 10px 10px 10px; overflow-y: auto; user-select: none; -webkit-user-select: none;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.toolbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--toolbar); border-bottom: .5px solid var(--line-strong);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  position: relative; z-index: 5;
}
.toolbar .title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.toolbar .subtitle { color: var(--text-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolbar .title-block { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.content { flex: 1; overflow-y: auto; padding: 22px 24px 60px; -webkit-overflow-scrolling: touch; }
.page { max-width: 1120px; margin: 0 auto; }
.loading { color: var(--text-2); padding: 40px; text-align: center; }
.scrim { display: none; }

/* ---------- Sidebar ---------- */
.brand { display: flex; align-items: center; gap: 9px; padding: 6px 8px 14px; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.brand b { font-size: 14px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--text-2); font-size: 11px; font-weight: 400; }
.side-label { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 14px 8px 4px; letter-spacing: .01em; }
.side-item {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: 6px;
  color: var(--text); cursor: default; border: 0; background: none; width: 100%; text-align: left;
}
.side-item:hover { background: var(--hover); text-decoration: none; }
.side-item.active { background: var(--selected); }
.side-item svg.icon { color: var(--accent); }
.side-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .count { color: var(--text-3); font-size: 12px; }
.side-item.car { height: 40px; }
.side-thumb { width: 36px; height: 26px; border-radius: 5px; object-fit: cover; background: var(--selected); flex: none; display: grid; place-items: center; color: var(--text-3); overflow: hidden; }
.side-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.side-item.car .label small { display: block; color: var(--text-2); font-size: 11px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.side-item.car .label { line-height: 1.25; }
.side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.side-item.subtle { color: var(--text-2); }
.side-item.subtle svg.icon { color: var(--text-2); }

/* ---------- Controls ---------- */
.btn {
  height: var(--control-h); padding: 0 11px; border-radius: 6px; border: 0; background: var(--control);
  box-shadow: var(--shadow-control); display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  cursor: default; white-space: nowrap; font-weight: 500; flex: none; text-decoration: none !important; color: var(--text);
}
.btn:hover { filter: brightness(.97); }
.btn:active { filter: brightness(.92); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 .5px 1px rgba(0, 0, 0, .2), inset 0 .5px 0 rgba(255, 255, 255, .2); }
.btn.primary:active { background: var(--accent-press); }
.btn.danger { color: var(--red); }
.btn.plain { background: none; box-shadow: none; color: var(--text-2); padding: 0 7px; }
.btn.plain:hover { background: var(--hover); filter: none; color: var(--text); }
.btn.link { background: none; box-shadow: none; color: var(--accent); padding: 0 4px; height: auto; }
.btn.large { height: 34px; padding: 0 16px; font-size: 14px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.icon-only { padding: 0; width: var(--control-h); }
.btn:focus-visible, .input:focus-visible, .seg button:focus-visible, .side-item:focus-visible, .row-click:focus-visible, .car-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px;
}
.seg { display: inline-flex; background: var(--selected); border-radius: 7px; padding: 2px; gap: 1px; flex: none; }
.seg button { border: 0; background: none; height: calc(var(--control-h) - 4px); padding: 0 12px; border-radius: 5px; cursor: default; font-weight: 500; color: var(--text); white-space: nowrap; }
.seg button.on { background: var(--control); box-shadow: 0 .5px 2px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .06); }
.input, select.input, textarea.input {
  width: 100%; height: var(--control-h); padding: 0 8px; border-radius: 6px; border: .5px solid var(--control-border);
  background: var(--control); box-shadow: inset 0 .5px 1px rgba(0, 0, 0, .06); outline: none; min-width: 0;
}
textarea.input { height: auto; min-height: 64px; padding: 6px 8px; resize: vertical; line-height: 1.4; }
select.input { -webkit-appearance: none; appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='14' viewBox='0 0 10 14'%3E%3Cpath d='M2 5.5 5 2.5l3 3M2 8.5l3 3 3-3' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.input::placeholder { color: var(--text-3); }
.search { position: relative; width: 200px; flex: 0 1 200px; min-width: 90px; }
.search svg { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 14px; height: 14px; }
.search .input { padding-left: 27px; }

/* ---------- Generic blocks ---------- */
.section { margin-top: 28px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; min-height: 28px; }
.section-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.section-head .hint { color: var(--text-2); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card.pad { padding: 16px; }
.grid { display: grid; gap: 14px; }
.grid > * { min-width: 0; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; align-items: start; }
.stat { padding: 14px 16px; }
.stat .k { color: var(--text-2); font-size: 12px; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.stat .s { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--selected); color: var(--text-2); white-space: nowrap; }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.orange { background: var(--orange-soft); color: var(--orange); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill svg.icon { width: 11px; height: 11px; stroke-width: 2.2; }
.plate {
  display: inline-flex; align-items: stretch; height: 22px; border-radius: 4px; overflow: hidden; background: #f7c600; color: #111;
  font: 700 13px/22px "SF Mono", ui-monospace, Menlo, Consolas, monospace; letter-spacing: .04em; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .35); white-space: nowrap; vertical-align: middle;
}
.plate i { background: #003399; color: #fff; font: 700 7px/1 var(--font); width: 13px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; font-style: normal; letter-spacing: 0; }
.plate span { padding: 0 7px; }
.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty .big { width: 54px; height: 54px; border-radius: 14px; background: var(--selected); display: grid; place-items: center; margin: 0 auto 12px; color: var(--text-2); }
.empty .big svg.icon { width: 26px; height: 26px; stroke-width: 1.5; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 420px; margin: 0 auto 14px; }

/* ---------- Car cards (overview) ---------- */
.grid.cars { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.car-card { overflow: hidden; display: flex; flex-direction: column; cursor: default; color: inherit; text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.car-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-card), 0 8px 24px rgba(0, 0, 0, .1); }
.car-card .photo { aspect-ratio: 16 / 9; background: var(--card-2); display: grid; place-items: center; color: var(--text-3); position: relative; }
.car-card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; }
.car-card .photo svg.icon { width: 46px; height: 46px; stroke-width: 1.1; }
.car-card .body { padding: 12px 14px 14px; }
.car-card .name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.car-card .name span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-card .sub { color: var(--text-2); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.car-card .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; padding-top: 10px; border-top: .5px solid var(--line); }
.car-card .facts .k { color: var(--text-2); font-size: 11px; }
.car-card .facts .v { font-weight: 600; white-space: nowrap; }

/* ---------- Lists & tables ---------- */
.list { overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; min-height: 40px; border-top: .5px solid var(--line); }
.row:first-child { border-top: 0; }
.row-click { cursor: default; color: inherit; text-decoration: none !important; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.row-click:hover { background: var(--hover); }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .d { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .right { text-align: right; white-space: nowrap; flex: none; }
.row .chev { color: var(--text-3); width: 13px; height: 13px; }
.date-badge { width: 46px; white-space: nowrap; flex: none; text-align: center; line-height: 1.1; }
.date-badge b { display: block; font-size: 17px; font-weight: 700; }
.date-badge small { color: var(--text-2); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kv .row { min-height: 36px; padding: 7px 14px; }
.kv .k { color: var(--text-2); width: 42%; flex: none; }
.kv .v { flex: 1; min-width: 0; text-align: right; overflow-wrap: anywhere; user-select: text; }
.year-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 4px 8px; }
.year-head:first-child { margin-top: 0; }
.year-head h3 { font-size: 15px; font-weight: 700; }
.year-head span { color: var(--text-2); }
.who { display: inline-flex; align-items: center; gap: 4px; }
/* second line of a maintenance row: who did it · what was done, one font, one baseline */
.row .d.sub { display: flex; align-items: center; gap: 5px; min-width: 0; }
.row .d.sub > * { font: inherit; color: inherit; line-height: 16px; flex: none; }
.row .d.sub > b { font-weight: 600; }
.row .d.sub > .what { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .d.sub > .who { max-width: 55%; overflow: hidden; white-space: nowrap; }
.row .d.sub > .who svg.icon { flex: none; }
.row .d.sub > .sep { color: var(--text-3); }
.who svg.icon { width: 12px; height: 12px; }
.clip { color: var(--text-3); display: inline-flex; align-items: center; gap: 2px; font-size: 11px; }
.clip svg.icon { width: 12px; height: 12px; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-2); padding: 7px 12px; border-bottom: .5px solid var(--line-strong); white-space: nowrap; position: sticky; top: 0; background: var(--card); }
.table td { padding: 8px 12px; border-top: .5px solid var(--line); vertical-align: top; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr.click:hover { background: var(--hover); }
.table .r { text-align: right; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: .5px solid var(--line-strong); }
.table-wrap { overflow-x: auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters select.input { width: auto; }

/* ---------- Car page ---------- */
.hero { display: flex; gap: 20px; align-items: stretch; }
.hero .cover { width: 340px; flex: none; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow-card); display: grid; place-items: center; color: var(--text-3); position: relative; border: 0; padding: 0; cursor: default; }
.hero .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero .cover svg.icon { width: 56px; height: 56px; stroke-width: 1; }
.hero .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hero h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.hero .sub { color: var(--text-2); font-size: 15px; margin-top: 3px; }
.hero .tags { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.hero .facts { margin-top: auto; padding-top: 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.fact { background: var(--card); border-radius: 8px; box-shadow: var(--shadow-card); padding: 9px 12px; min-width: 0; }
.fact .k { color: var(--text-2); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact .v { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabs { display: flex; align-items: center; gap: 10px; margin: 22px 0 16px; flex-wrap: wrap; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.photo-tile { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--card); box-shadow: var(--shadow-card); border: 0; padding: 0; cursor: default; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 9px 7px; color: #fff; font-size: 12px; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photo-tile .badge { position: absolute; top: 7px; left: 7px; background: rgba(0, 0, 0, .55); color: #fff; font-size: 10px; font-weight: 600; border-radius: 9px; padding: 2px 7px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }

/* ---------- Reminders ---------- */
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--text-3); }
.dot.red { background: #ff3b30; } .dot.orange { background: #ff9500; } .dot.green { background: #34c759; }

/* ---------- Charts ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--text-2); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--hover); }
.chart .val { fill: var(--text); font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--text-2); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--card); color: var(--text); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow-sheet); font-size: 12px; min-width: 140px; }
.tooltip b { display: block; margin-bottom: 4px; }
.tooltip .tr { display: flex; align-items: center; gap: 6px; }
.tooltip .tr i { width: 8px; height: 8px; border-radius: 2px; }
.tooltip .tr span:last-child { margin-left: auto; padding-left: 14px; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Sheets (modal dialogs) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .28); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; animation: fade .16s ease-out; }
.sheet { background: var(--bg); border-radius: 12px; box-shadow: var(--shadow-sheet); width: 100%; max-width: 580px; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column; animation: drop .22s cubic-bezier(.2, .9, .3, 1.1); overflow: hidden; }
.sheet.wide { max-width: 720px; }
.sheet.narrow { max-width: 420px; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; flex: none; }
.sheet-head h2 { font-size: 15px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 4px 18px 16px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: .5px solid var(--line-strong); flex: none; background: var(--card-2); }
.sheet-error { color: var(--red); font-size: 12px; flex: 1; min-width: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px) scale(.985); } }
.alert { text-align: center; padding: 22px 22px 16px; }
.alert img { width: 56px; height: 56px; margin-bottom: 10px; }
.alert h2 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.alert p { color: var(--text-2); font-size: 12px; }
.alert-actions { display: flex; flex-direction: column; gap: 7px; padding: 0 22px 20px; }
.alert-actions .btn { width: 100%; height: 30px; }

/* ---------- Forms ---------- */
.group-label { font-size: 12px; font-weight: 600; color: var(--text-2); margin: 16px 4px 6px; }
.group-label:first-child { margin-top: 4px; }
.form-group { background: var(--card); border-radius: 8px; box-shadow: var(--shadow-card); }
.field { display: flex; align-items: center; gap: 12px; padding: 6px 12px; min-height: 40px; border-top: .5px solid var(--line); }
.field:first-child { border-top: 0; }
.field > label { width: 34%; flex: none; color: var(--text); }
.field > .ctl { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; }
.field.stack { flex-direction: column; align-items: stretch; gap: 5px; padding: 9px 12px; }
.field.stack > label { width: auto; }
.field .unit { color: var(--text-2); flex: none; }
.field .help { color: var(--text-2); font-size: 11px; white-space: nowrap; }
.field .ctl.right { justify-content: flex-end; }
.item-row { display: flex; gap: 6px; align-items: center; padding: 5px 12px; border-top: .5px solid var(--line); }
.item-row:first-child { border-top: 0; }
.item-row .amt { width: 96px; flex: none; text-align: right; }
.item-row .lab { width: 38%; flex: none; }
.group-foot { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-top: .5px solid var(--line); color: var(--text-2); font-size: 12px; min-height: 36px; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--text-2); cursor: default; display: block; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.drop b { color: var(--accent); font-weight: 600; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chip { position: relative; width: 84px; }
.file-chip .thumb { width: 84px; height: 84px; border-radius: 7px; overflow: hidden; background: var(--card); box-shadow: var(--shadow-card); display: grid; place-items: center; color: var(--text-2); border: 0; padding: 0; cursor: default; }
.file-chip .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-chip .thumb svg.icon { width: 28px; height: 28px; stroke-width: 1.3; }
.file-chip .nm { font-size: 10px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.file-chip .rm { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--text-2); color: var(--bg); display: grid; place-items: center; cursor: default; padding: 0; }
.file-chip .rm svg.icon { width: 11px; height: 11px; stroke-width: 3; }
.files.large .file-chip, .files.large .file-chip .thumb { width: 120px; }
.files.large .file-chip .thumb { height: 120px; }

/* ---------- Record detail ---------- */
.detail-top { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.detail-top h3 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.detail-top .cost { font-size: 20px; font-weight: 700; white-space: nowrap; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 9px; padding: 8px 14px; border-top: .5px solid var(--line); align-items: baseline; }
.checklist li:first-child { border-top: 0; }
.checklist li svg.icon { color: var(--green); width: 13px; height: 13px; stroke-width: 2.6; position: relative; top: 2px; }
.checklist li span { flex: 1; user-select: text; }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .88); display: flex; flex-direction: column; animation: fade .15s; }
.lightbox .bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; flex: none; }
.lightbox .bar .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lightbox .bar .btn { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; }
.lightbox .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 14px; gap: 8px; }
.lightbox .stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox .stage iframe { width: min(900px, 100%); height: 100%; border: 0; background: #fff; border-radius: 4px; }
.lightbox .stage { position: relative; }
.lightbox .stage img { min-width: 0; }
.lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; background: rgba(30, 30, 30, .6); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: default; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lightbox .nav.prev { left: 18px; } .lightbox .nav.next { right: 18px; }
.lightbox .nav[disabled] { opacity: .25; }
.lightbox .nav svg.icon { width: 20px; height: 20px; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(40, 40, 42, .92); color: #fff; padding: 8px 14px; border-radius: 18px; font-weight: 500; box-shadow: 0 6px 24px rgba(0, 0, 0, .3); animation: drop .2s; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.toast.error { background: rgba(200, 30, 30, .95); }

/* ---------- Shops ---------- */
.grid.shops { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.shop-card { padding: 14px; display: flex; gap: 12px; color: inherit; text-decoration: none !important; cursor: default; }
.shop-card:hover { box-shadow: var(--shadow-card), 0 6px 20px rgba(0, 0, 0, .08); }
.avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: none; }
.avatar.big { width: 64px; height: 64px; border-radius: 16px; font-size: 24px; }
.shop-card .t { font-weight: 700; font-size: 14px; }
.shop-card .d { color: var(--text-2); font-size: 12px; }
.shop-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.shop-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 300px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.login-card h1 { font-size: 20px; }
.login-card p { color: var(--text-2); margin-bottom: 6px; }
.login-card .input { height: 34px; text-align: center; }
.login-card .btn { width: 100%; }
.login-error { color: var(--red); font-size: 12px; }

/* ---------- Print: maintenance record ---------- */
#print-root { display: none; }
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }
  .app, #sheet-root, #toast-root, .tooltip { display: none !important; }
  #print-root { display: block; }
  .pr-head { display: flex; gap: 16px; align-items: flex-start; border-bottom: 1.5pt solid #000; padding-bottom: 10pt; margin-bottom: 12pt; }
  .pr-head img { width: 150pt; height: 95pt; object-fit: cover; border-radius: 4pt; }
  .pr-head h1 { font-size: 20pt; margin-bottom: 2pt; }
  .pr-head .sub { color: #444; font-size: 11pt; }
  .pr-head .meta { margin-top: 8pt; display: grid; grid-template-columns: auto auto; gap: 1pt 18pt; justify-content: start; font-size: 9.5pt; }
  .pr-head .meta b { font-weight: 600; color: #444; }
  #print-root h2 { font-size: 12pt; margin: 14pt 0 6pt; }
  .pr-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
  .pr-table th { text-align: left; border-bottom: 1pt solid #000; padding: 3pt 5pt; font-size: 8.5pt; text-transform: uppercase; letter-spacing: .04em; }
  .pr-table td { border-bottom: .5pt solid #bbb; padding: 5pt; vertical-align: top; }
  .pr-table tr { break-inside: avoid; }
  .pr-table .r { text-align: right; white-space: nowrap; }
  .pr-table .nw { white-space: nowrap; }
  .pr-table ul { margin: 2pt 0 0; padding-left: 12pt; color: #333; }
  .pr-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24pt; font-size: 9.5pt; }
  .pr-specs div { display: flex; justify-content: space-between; gap: 10pt; border-bottom: .5pt solid #ccc; padding: 2.5pt 0; }
  .pr-specs div span:first-child { color: #555; }
  .pr-foot { margin-top: 14pt; color: #666; font-size: 8.5pt; }
}

/* ---------- Narrow screens / phones ---------- */
.only-narrow { display: none !important; }
@media (max-width: 860px) {
  :root { --fs: 15px; --control-h: 36px; }
  .only-narrow { display: inline-flex !important; }
  .hide-narrow { display: none !important; }
  .sidebar { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-102%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); padding-top: max(10px, env(safe-area-inset-top)); }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .3); }
  .side-item { height: 38px; } .side-item.car { height: 46px; }
  .toolbar { padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .content { padding: 16px 14px 80px; }
  .hero { flex-direction: column; gap: 14px; }
  .hero .cover { width: 100%; }
  .hero .facts { grid-template-columns: 1fr 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .grid.stats { grid-template-columns: 1fr 1fr; }
  .stat .v { font-size: 20px; }
  .input, select.input { font-size: 16px; }
  .sheet-backdrop { padding: 0; align-items: flex-end; }
  .sheet, .sheet.wide { max-width: none; max-height: 94dvh; border-radius: 14px 14px 0 0; animation-name: rise; padding-bottom: env(safe-area-inset-bottom); }
  .sheet.narrow { max-width: 340px; border-radius: 14px; margin: auto; animation-name: drop; padding-bottom: 0; }
  .sheet-backdrop:has(.sheet.narrow) { align-items: center; padding: 16px; }
  .field > label { width: 38%; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .row .hide-phone { display: none; }
  .tabs .seg { width: 100%; overflow-x: auto; scrollbar-width: none; } .tabs .seg button { flex: 1 0 auto; padding: 0 7px; }
  .item-row .amt { width: 84px; }
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* backstory tab */
.story-card { padding: 0; overflow: hidden; }
textarea.input.story { display: block; width: 100%; min-height: 260px; border: 0; border-radius: 0; background: transparent; box-shadow: none; padding: 16px 18px; font-size: 15px; line-height: 1.55; resize: none; }
textarea.input.story:focus-visible { outline: none; box-shadow: none; }
.story-foot { display: flex; align-items: center; gap: 12px; margin: 10px 4px 0; }

/* APK countdown tile */
button.fact.apk { border: 0; font: inherit; text-align: left; cursor: pointer; grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fact.apk .k { color: inherit; opacity: .85; font-size: 12px; font-weight: 600; }
.fact.apk .v { font-size: 18px; }
.fact.apk.red { background: var(--red-soft); color: var(--red); }
.fact.apk.orange { background: var(--orange-soft); color: var(--orange); }
.fact.apk.green { background: var(--green-soft); color: var(--green); }
.fact.apk.none { color: var(--text-2); }
