/* Шкала категорий мойки.
   A measuring instrument, not a dashboard: road-sign type (DIN, built into iPhone), hairlines instead of cards,
   colour only where it carries the category. Top: the gauge (horseshoe or line). Middle: the chosen cars by area
   with the borders between them. Bottom: search in the thumb zone. */

:root {
  --bg: #efede7;
  --bg-2: #e4e1d8;
  --ink: #141412;
  --ink-2: #4f4d46;
  --ink-3: #8a877d;
  --hair: #cfcbbf;
  --rule: #141412;
  --signal: #d8431c;

  --k1: #7d8f9b; --k2: #23877a; --k3: #2c51a3; --k4: #d0841a; --k5: #c33a2c;

  --f-ui: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-sign: "DIN Condensed", "Roboto Condensed", "Arial Narrow", "PT Sans Narrow", sans-serif;
  --f-num: "DIN Alternate", "Roboto Condensed", "Arial Narrow", var(--f-ui);
  --row: 52px;
  --rule-w: 62px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110; --bg-2: #1c1c1a; --ink: #ecebe6; --ink-2: #b2b0a8; --ink-3: #74726b; --hair: #2f2e2a; --rule: #ecebe6;
    --signal: #ff7348;
    --k1: #93a5b1; --k2: #3fb3a2; --k3: #7c9bf0; --k4: #f0a440; --k5: #f0604e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111110; --bg-2: #1c1c1a; --ink: #ecebe6; --ink-2: #b2b0a8; --ink-3: #74726b; --hair: #2f2e2a; --rule: #ecebe6;
  --signal: #ff7348;
  --k1: #93a5b1; --k2: #3fb3a2; --k3: #7c9bf0; --k4: #f0a440; --k5: #f0604e;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.35 var(--f-ui); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.app { height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-width: 760px; margin: 0 auto; }

/* ---------- instrument ---------- */
.instr {
  padding: calc(var(--safe-t) + 8px) max(16px, var(--safe-r)) 0 max(16px, var(--safe-l));
  background: var(--bg); position: relative; z-index: 2; border-bottom: 2px solid var(--rule);
}
.instr-bar { display: flex; align-items: flex-start; gap: 10px; }
.brand { flex: 1; min-width: 0; }
.brand b { display: block; font: 700 24px/1 var(--f-sign); text-transform: uppercase; letter-spacing: .02em; padding-top: 3px; }
.brand span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.ghost {
  border: 0; background: transparent; height: 36px; padding: 0 2px; display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; font-size: 14px; font-weight: 600; border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
}
.ghost svg { width: 11px; height: 11px; }
.ghost.icon { width: 38px; justify-content: center; border: 1.5px solid var(--ink); border-radius: 3px; }
.ghost.icon svg { width: 22px; height: 22px; }
.ghost:active { opacity: .6; }

.gauge-wrap { position: relative; margin: 2px auto 0; width: 100%; max-width: min(340px, 88vw); touch-action: none; }
.gauge { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.gauge .track { fill: none; stroke: var(--bg-2); }
.gauge .sector { fill: none; }
.gauge .tick { stroke: var(--ink-3); }
.gauge .tick.major { stroke: var(--ink); }
.gauge .tick-label { font: 700 12px var(--f-sign); fill: var(--ink-2); }
.gauge .needle { stroke: var(--signal); stroke-linecap: round; }
.gauge .needle-dot { fill: var(--signal); }
.gauge .stem { stroke-width: 1.5; }
.gauge .knob { cursor: grab; }
.gauge .knob circle.hit { fill: transparent; }
.gauge .knob circle.face { stroke: var(--bg); stroke-width: 2; }
.gauge .knob text { font: 700 14px var(--f-sign); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.gauge .knob.drag circle.face { stroke: var(--ink); stroke-width: 2.5; }

.readout { position: absolute; left: 50%; top: 65%; transform: translate(-50%, -50%); width: 40%; text-align: center; pointer-events: none; }
.ro-area { font: 700 46px/.9 var(--f-sign); letter-spacing: -.01em; white-space: nowrap; }
.ro-area small { font: 700 16px var(--f-sign); color: var(--ink-3); margin-left: 2px; }
.ro-cat { margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ro-cat b { font: 700 17px/1 var(--f-sign); color: var(--c); margin-right: 1px; }
.ro-car { margin-top: 1px; font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.app[data-mode="line"] .gauge-wrap { max-width: none; margin-top: 4px; }
.app[data-mode="line"] .readout {
  position: static; transform: none; width: auto; text-align: left; display: grid; grid-template-columns: auto minmax(0, 1fr);
  column-gap: 12px; align-items: end; margin: 0 0 6px;
}
.app[data-mode="line"] .ro-area { grid-row: span 2; font-size: 40px; }
.app[data-mode="line"] .ro-cat, .app[data-mode="line"] .ro-car { margin: 0; }

/* category legend: five columns of type on hairlines */
.cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 4px calc(-1 * max(16px, var(--safe-l))) 0; border-top: 1px solid var(--hair); }
.cat {
  border: 0; border-left: 1px solid var(--hair); background: transparent; padding: 6px 4px 7px 7px; text-align: left; cursor: pointer;
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 5px; align-items: end;
}
.cat:first-child { border-left: 0; padding-left: max(14px, var(--safe-l)); }
.cat b { font: 700 28px/.8 var(--f-sign); color: var(--c); padding-top: 4px; }
.cat span { font: 12.5px/1.1 var(--f-num); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; text-align: right; }
.cat span + span { grid-column: 1 / -1; text-align: left; color: var(--ink); font-size: 13.5px; margin-top: 4px; }
.cat:active { background: var(--bg-2); }

/* ---------- list ---------- */
.tape { position: relative; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; outline: none; }
.tape-spacer { position: relative; width: 100%; }
.tape-empty { position: absolute; inset: 40px 16px auto; text-align: center; color: var(--ink-3); }
.row {
  position: absolute; left: 0; right: 0; height: var(--row);
  display: grid; grid-template-columns: var(--rule-w) minmax(0, 1fr) auto; align-items: center;
  padding-right: max(16px, var(--safe-r));
}
/* the ruler: area on the left, a vertical line with a tick per car and a longer one at each whole m² */
.row .t {
  align-self: stretch; position: relative; padding: 0 12px 0 max(10px, var(--safe-l)); text-align: right;
  font: 15px/var(--row) var(--f-num); font-variant-numeric: tabular-nums; color: var(--ink-2);
  border-right: 1px solid var(--ink-3);
}
.row .t::after { content: ""; position: absolute; right: 0; top: 50%; width: 5px; height: 1px; background: var(--ink-3); }
.row .t.int::after { width: 12px; height: 2px; background: var(--ink); top: 0; }
.row .t.int::before {
  content: attr(data-int); position: absolute; right: 15px; top: -6px; font: 700 11px/12px var(--f-sign); color: var(--ink);
  background: var(--bg); padding: 0 2px;
}
.car { cursor: pointer; background: var(--bg); }
.car:active { background: var(--bg-2); }
.car .nm { min-width: 0; padding: 0 8px 0 12px; border-bottom: 1px solid var(--hair); align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.car .nm b { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.car .nm b i { font-style: normal; font-weight: 400; color: var(--ink-2); }
.car .nm small { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car .cn { align-self: stretch; border-bottom: 1px solid var(--hair); display: flex; flex-direction: column; align-items: flex-end; justify-content: center; min-width: 30px; }
.car .cn b { font: 700 26px/.9 var(--f-sign); color: var(--c); }
.car .cn small { font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.car .cn small.bad { color: var(--signal); }
/* a marked car: its number on the ruler is highlighted like a marker pen on a tape */
.car.marked .t { background: var(--signal); color: #fff; font-weight: 700; border-right-color: var(--signal); }
.car.marked .t::after { background: #fff; }
.gauge .markdot { fill: var(--bg); stroke: var(--signal); stroke-width: 2; }
.act.mark { border-color: var(--signal); }
.act.mark b { color: var(--signal); }
.act.mark.on { background: var(--signal); }
.act.mark.on b, .act.mark.on small { color: #fff; }
.car.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--signal) 22%, var(--bg)); } }

.bnd { z-index: 1; background: var(--bg); border-top: 2px solid var(--c); }
.bnd .t { color: var(--c); font-weight: 700; border-right-color: var(--c); }
.bnd .t::after { display: none; }
.bnd .lbl { padding: 0 6px 0 12px; min-width: 0; cursor: pointer; display: flex; align-items: center; gap: 9px; }
.bnd .lbl b { font: 700 34px/1 var(--f-sign); color: var(--c); padding-top: 4px; }
.bnd .lbl span { font-size: 12.5px; line-height: 1.25; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bnd .lbl span strong { display: block; color: var(--ink); font-size: 14px; }
.bnd .step { display: flex; align-items: center; gap: 6px; }
.stepbtn {
  width: 44px; height: 38px; border-radius: 3px; border: 1.5px solid var(--c, var(--ink)); background: transparent;
  color: var(--c, var(--ink)); font: 700 22px/1 var(--f-sign); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  padding: 0;
}
.stepbtn svg { width: 20px; height: 20px; display: block; margin: 0 auto; }
.stepbtn:active { background: color-mix(in srgb, currentColor 16%, transparent); }
.stepbtn:disabled { opacity: .3; }

/* ---------- dock ---------- */
.dock {
  display: flex; gap: 8px; align-items: center; background: var(--bg); border-top: 2px solid var(--rule);
  padding: 8px max(12px, var(--safe-r)) calc(8px + var(--safe-b)) max(12px, var(--safe-l)); z-index: 2;
}
.search { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; background: var(--bg-2); border-radius: 3px; }
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink); }
.search svg { width: 18px; height: 18px; color: var(--ink-2); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 16px var(--f-ui); height: 100%; -webkit-appearance: none; appearance: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: var(--ink-3); }
.clear { border: 0; background: transparent; color: var(--ink-2); width: 32px; height: 32px; font-size: 22px; line-height: 1; cursor: pointer; flex: none; }
.dock-btn { width: 44px; height: 44px; border-radius: 3px; border: 1.5px solid var(--ink); background: transparent; display: grid; place-items: center; position: relative; cursor: pointer; flex: none; }
.dock-btn svg { width: 20px; height: 20px; }
.dock-btn:active { background: var(--bg-2); }
.dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.badge { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 20px; padding: 2px 5px 0; background: var(--signal); color: #fff; font: 700 14px/18px var(--f-sign); text-align: center; border-radius: 2px; }

/* ---------- sheet ---------- */
.shade { position: fixed; inset: 0; background: rgba(10, 10, 9, .45); z-index: 20; animation: fade .18s ease-out; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; margin: 0 auto; max-width: 760px;
  background: var(--bg); border-radius: 10px 10px 0 0; max-height: min(86dvh, 860px); display: flex; flex-direction: column;
  padding-bottom: var(--safe-b); border-top: 2px solid var(--rule); animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--hair); margin: 7px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 4px max(12px, var(--safe-r)) 6px max(16px, var(--safe-l)); flex: none; }
.sheet-head h2 { flex: 1; margin: 0; font: 700 26px/1.05 var(--f-sign); padding-top: 4px; min-width: 0; }
.sheet-head .ghost.icon { border: 0; }
.sheet-body { overflow-y: auto; padding: 0 max(16px, var(--safe-r)) 18px max(16px, var(--safe-l)); overscroll-behavior: contain; }
@keyframes rise { from { transform: translateY(24px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet, .shade, /* a marked car: its number on the ruler is highlighted like a marker pen on a tape */
.car.marked .t { background: var(--signal); color: #fff; font-weight: 700; border-right-color: var(--signal); }
.car.marked .t::after { background: #fff; }
.gauge .markdot { fill: var(--bg); stroke: var(--signal); stroke-width: 2; }
.act.mark { border-color: var(--signal); }
.act.mark b { color: var(--signal); }
.act.mark.on { background: var(--signal); }
.act.mark.on b, .act.mark.on small { color: #fff; }
.car.flash { animation: none; } }

.sub { color: var(--ink-2); font-size: 13.5px; margin: 0 0 12px; }
.verdict { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 10px 0; border-top: 2px solid var(--c); border-bottom: 1px solid var(--hair); margin-bottom: 12px; }
.verdict .n { font: 700 52px/.8 var(--f-sign); color: var(--c); padding-top: 6px; }
.verdict .d { font-size: 13px; color: var(--ink-2); min-width: 0; }
.verdict .d b { display: block; font-size: 15px; color: var(--ink); }
.verdict .p { font: 700 28px/1 var(--f-sign); padding-top: 4px; }
.note { font-size: 13.5px; margin: 0 0 12px; padding: 0; }
.note::before { content: "!"; display: inline-block; width: 18px; height: 18px; margin-right: 7px; background: var(--signal); color: #fff; font: 700 14px/19px var(--f-sign); text-align: center; border-radius: 2px; }
.note.calm::before { content: "✓"; background: var(--ink-3); font: 700 11px/18px var(--f-ui); }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); margin: 0 0 14px; font-size: 14.5px; }
.facts dt, .facts dd { padding: 7px 0; border-bottom: 1px solid var(--hair); }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; text-align: right; }
.facts dd .num { font-size: 16px; }
.facts dd small { display: block; color: var(--ink-3); font-size: 12px; }
.acts { display: grid; gap: 8px; margin-top: 4px; }
.act { border: 1.5px solid var(--ink); background: transparent; border-radius: 3px; min-height: 48px; padding: 9px 12px; text-align: left; cursor: pointer; display: grid; gap: 1px; }
.act b { font-size: 15px; }
.act small { color: var(--ink-2); font-size: 12.5px; }
.act.primary { background: var(--ink); color: var(--bg); }
.act.primary small { color: color-mix(in srgb, var(--bg) 72%, transparent); }
.act:active { transform: translateY(1px); }

.seg { display: flex; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 10px 4px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button small { display: block; font-weight: 400; font-size: 11.5px; opacity: .75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { border: 1.5px solid var(--hair); background: transparent; border-radius: 3px; padding: 8px 11px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lbl-h { font: 700 15px/1 var(--f-sign); color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin: 6px 0 8px; padding-top: 3px; }
.sw { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--hair); cursor: pointer; }
.sw:last-of-type { border-bottom: 1px solid var(--hair); }
.sw span { flex: 1; }
.sw small { display: block; color: var(--ink-3); font-size: 12.5px; }
.sw input { width: 22px; height: 22px; accent-color: var(--ink); }

.prices { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.prices th, .prices td { padding: 9px 3px; border-bottom: 1px solid var(--hair); text-align: right; }
.prices th:first-child, .prices td:first-child { text-align: left; padding-left: 0; }
.prices thead th { font: 700 20px/1 var(--f-sign); color: var(--c); padding-top: 6px; }
.prices thead th small { display: block; font: 600 11px var(--f-ui); color: var(--ink-3); }
.prices thead th:first-child { color: var(--ink-3); font: 600 12px var(--f-ui); vertical-align: bottom; }
.prices td.num { font-size: 15px; }
.prices tbody tr { cursor: pointer; }
.prices tbody tr.grp { cursor: default; }
.prices tbody tr.grp th { text-align: left; font: 700 16px/1 var(--f-sign); text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); padding: 16px 0 6px; border-bottom: 2px solid var(--rule); }
.prices tbody tr[aria-selected="true"] td { font-weight: 700; }
.prices tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--signal); padding-left: 8px; }

.bedit { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.bedit input { flex: 1; min-width: 0; height: 56px; border-radius: 3px; border: 1.5px solid var(--ink); background: var(--bg); color: var(--ink); text-align: center; font: 700 34px var(--f-sign); padding-top: 6px; }
.bedit .stepbtn { width: 56px; height: 56px; --c: var(--ink); }
.bedit .stepbtn svg { width: 26px; height: 26px; }
.nb { display: grid; margin-bottom: 12px; }
.nb button {
  display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left;
  border: 0; border-bottom: 1px solid var(--hair); background: transparent; padding: 8px 0; cursor: pointer; min-height: 46px;
}
.nb button .num { font-size: 15px; }
.nb button span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.nb button em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.nb button > em:last-child { font: 700 18px var(--f-sign); color: var(--ink-2); }
.nb .line { border-bottom: 2px solid var(--signal); margin: -1px 0 0; height: 0; }
.trans { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-bottom: 14px; border-top: 1px solid var(--hair); }
.trans div { padding: 8px 0; border-bottom: 1px solid var(--hair); }
.trans b { display: block; font: 700 28px/1 var(--f-sign); padding-top: 3px; }
.trans span { font-size: 12.5px; color: var(--ink-2); }
.list-h { display: flex; justify-content: space-between; align-items: baseline; }

.toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%); z-index: 30; background: var(--ink); color: var(--bg); border-radius: 3px; padding: 10px 14px; font-size: 14px; max-width: calc(100% - 32px); }

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

@media (min-width: 900px) {
  .app { max-width: 1100px; grid-template-columns: 420px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .instr { grid-row: 1 / span 2; border-bottom: 0; border-right: 2px solid var(--rule); overflow-y: auto; }
  .tape { grid-column: 2; }
  .dock { grid-column: 2; }
  .gauge-wrap { max-width: 380px; }
  .cats { margin: 10px 0 0; grid-template-columns: 1fr; border-top: 2px solid var(--rule); }
  .cat, .cat:first-child { border-left: 0; border-bottom: 1px solid var(--hair); padding: 10px 0; grid-template-columns: 44px 1fr 1fr; }
  .cat b { grid-row: auto; }
}
