/* Urban Hub — оформление в стиле Bybit (тёмная и светлая темы, переключатель в шапке).
   Цвета и шрифт взяты из их дизайн-системы: фон #000, карточки #101014,
   фирменный оранжевый #FF9C2E, рост #06C167, падение #F63649, шрифт Inter. */
:root {
  --ground: #000000;        /* страница */
  --surface: #101014;       /* карточки */
  --surface-2: #1e1f24;     /* поля, плашки */
  --line: #222227;          /* разделители */
  --line-strong: #404347;   /* рамки полей */
  --text: #ffffff;
  --muted: #9aa0a6;
  --faint: #6a6e73;
  --accent: #ff9c2e;        /* фирменный оранжевый Bybit */
  --accent-ink: #000000;    /* текст на оранжевой кнопке */
  --accent-soft: rgba(255, 156, 46, 0.16);
  --up: #06c167;
  --down: #f63649;
  --warn: #ff9c2e;
  --info: #3e8bff;
  --topbar: rgba(0, 0, 0, 0.92);
  --hover: rgba(255, 255, 255, 0.04);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.5);
  --heat: 255, 156, 46;
  --tint-warn: rgba(255, 156, 46, 0.1);
  --tint-err: rgba(246, 54, 73, 0.12);
  --tint-info: rgba(62, 139, 255, 0.1);
  --tint-ok: rgba(6, 193, 103, 0.1);
  --radius: 8px;
  --radius-btn: 12px;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

/* светлая тема: включается кнопкой в шапке (светлые токены Bybit) */
:root[data-theme='light'] {
  --ground: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f3f5f7;
  --line: #e9ecf0;
  --line-strong: #dde1e5;
  --text: #000000;
  --muted: #7f838a;
  --faint: #a1a5ab;
  --accent: #f29229;
  --accent-ink: #000000;
  --accent-soft: rgba(255, 156, 46, 0.14);
  --up: #06c167;
  --down: #f63649;
  --warn: #f29229;
  --info: #1f6feb;
  --topbar: rgba(255, 255, 255, 0.94);
  --hover: rgba(0, 0, 0, 0.04);
  --shadow: 0 14px 34px rgba(18, 18, 20, 0.14);
  --shadow-sm: 0 8px 22px rgba(18, 18, 20, 0.1);
  --heat: 242, 146, 41;
  --tint-warn: rgba(255, 156, 46, 0.14);
  --tint-err: rgba(246, 54, 73, 0.1);
  --tint-info: rgba(31, 111, 235, 0.09);
  --tint-ok: rgba(6, 193, 103, 0.1);
  color-scheme: light;
}
/* чуть больше контраста: карточки отделены от фона, шапка таблиц заметнее */
:root[data-theme='light'] .box { box-shadow: 0 1px 2px rgba(18, 18, 20, 0.06); }
:root[data-theme='light'] th { background: var(--surface-2); color: #45484d; }
:root[data-theme='light'] .topbar { border-bottom-color: var(--line); }
:root[data-theme='light'] .pill { border-color: var(--line-strong); }
:root[data-theme='light'] { --line-strong: #b9c0c9; }
:root[data-theme='light'] .input, :root[data-theme='light'] select.input { background: #fff; border-color: #b9c0c9; box-shadow: inset 0 1px 2px rgba(18, 18, 20, 0.05); }
:root[data-theme='light'] .input::placeholder { color: #8b9199; }
:root[data-theme='light'] .input:focus { border-color: var(--accent); }
:root[data-theme='light'] .btn { border-color: #c9ced6; }
:root[data-theme='light'] .seg { border-color: #b9c0c9; }
:root[data-theme='light'] .table-wrap { border-color: #d7dce2; }
:root[data-theme='light'] th, :root[data-theme='light'] td { border-bottom-color: #e3e7ec; }
:root[data-theme='light'] .rate__big, :root[data-theme='light'] .tick__value { color: #000; }
:root[data-theme='light'] .rate__big.is-fee, :root[data-theme='light'] .tick__value.is-fee { color: var(--accent); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--ground); color: var(--text); }
body { margin: 0; font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Телефоны и планшеты. iPhone (и Telegram внутри него) сам увеличивает страницу, когда нажимаешь
   на поле со шрифтом мельче 16px, и обратно не отдаляет. Даём полям ровно 16px — прыжков больше нет,
   а увеличить пальцами фото или мелкую цифру по-прежнему можно. Двойной тап тоже больше не зумит. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { touch-action: manipulation; }
@media (pointer: coarse) {
  input:not([type='checkbox']):not([type='radio']):not([type='file']):not([type='range']), select, textarea { font-size: 16px; }
}
a { color: var(--info); }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- каркас ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding-inline: 16px; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--topbar); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__row { display: flex; align-items: center; gap: 20px; min-height: 56px; }
.brand { font-family: var(--font-brand); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 600; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer;
  color: var(--muted); white-space: nowrap; font-weight: 500;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab[aria-selected='true'] { color: var(--accent-ink); background: var(--accent); font-weight: 600; }
.topbar__side { display: flex; align-items: center; gap: 8px; }

/* ---------- лента курсов ---------- */
.ticker { border-bottom: 1px solid var(--line); background: var(--surface); }
.ticker__row { display: flex; align-items: stretch; gap: 0; overflow-x: auto; scrollbar-width: thin; }
.tick { padding: 8px 18px 8px 0; margin-right: 18px; border-right: 1px solid var(--line); white-space: nowrap; }
.tick:last-of-type { border-right: 0; }
.tick__label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; display: flex; gap: 6px; align-items: center; }
.tick__value { font-family: var(--font-num); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tick__sub { font-family: var(--font-num); font-size: 11px; color: var(--faint); }
.tick__value.is-fee { color: var(--accent); }
.ticker__meta { margin-left: auto; display: flex; align-items: center; gap: 10px; padding-left: 12px; white-space: nowrap; color: var(--faint); font-size: 12px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; }
.dot.is-err { background: var(--down); }
.dot.is-manual { background: var(--warn); }

/* ---------- общее ---------- */
main { padding-block: 20px 48px; }
.panel { display: none; }
.panel.is-active { display: block; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
/* карточки курсов: все пять в одной строке, на узких экранах — по 3, 2 и 1 */
.cols-rates { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1240px) { .cols-rates { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .cols-rates { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols-rates { grid-template-columns: 1fr; } }
.cols-rates .box { padding: 14px; }
.cols-rates .rate__big { font-size: clamp(22px, 2vw, 30px); }
.cols-rates .kv { font-size: 12px; }
.cols-rates .rate__name { font-size: 13px; }
.cols-rates .rate__src, .cols-rates .rate__unit { font-size: 11px; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.box--flat { background: transparent; }
h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
h2 { font-size: 18px; }
h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; }
.head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.pill--warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.pill--err { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.pill--ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.pill--accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.notice { border-left: 3px solid var(--warn); background: var(--tint-warn); padding: 8px 12px; border-radius: 0 6px 6px 0; font-size: 13px; }
.notice--err { border-color: var(--down); background: var(--tint-err); }
.notice--info { border-color: var(--info); background: var(--tint-info); }
.notice--warn { border-color: var(--warn); background: var(--tint-warn); }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); }
.input, select.input {
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); 
  padding: 8px 10px; min-height: 38px; width: 100%; min-width: 0;
}
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.input.is-green { border-color: color-mix(in srgb, var(--up) 55%, transparent); background: var(--tint-ok); }
.input.is-auto { background: var(--surface-2); color: var(--muted); }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 12px; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg input:checked + span { background: var(--accent-soft); color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg input:disabled + span { opacity: 0.35; cursor: not-allowed; }
.seg label + label span { border-left: 1px solid var(--line-strong); }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: 13px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.btn {
  border: 1px solid var(--line-strong); background: var(--surface-2); padding: 7px 14px; border-radius: var(--radius-btn);
  cursor: pointer; font-weight: 600; white-space: nowrap; min-height: 34px;
}
.btn:hover { border-color: var(--muted); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: #ffad52; border-color: #ffad52; filter: none; }
.btn--ghost { background: transparent; }
.btn--sm { padding: 3px 10px; min-height: 28px; font-size: 12px; border-radius: 8px; }
.btn--danger { color: var(--down); }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- курсы ---------- */
.rate { display: flex; flex-direction: column; gap: 10px; }
.rate__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rate__name { font-weight: 600; }
.rate__src { font-size: 12px; color: var(--faint); }
.rate__big { font-family: var(--font-num); font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rate__unit { font-size: 12px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.kv .is-accent { color: var(--accent); font-weight: 600; }
.rate__ctl { border-top: 1px dashed var(--line); padding-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mini { width: 74px; min-height: 30px; padding: 4px 8px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
td.n, th.n { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--row-hover); }
:root { --row-hover: rgba(255, 255, 255, 0.08); }
:root[data-theme='light'] { --row-hover: rgba(18, 18, 20, 0.06); }
tr.is-hit td { background: var(--accent-soft); }
td input.cell { background: transparent; border: 1px solid transparent; border-radius: 4px; padding: 3px 6px; width: 100%; min-width: 60px; }
td input.cell:hover { border-color: var(--line-strong); }
td input.cell:focus { border-color: var(--accent); outline: none; background: var(--ground); }
td input.cell.n { text-align: right; font-family: var(--font-num); }
td.check-flag { color: var(--warn); }
.scroll-y { max-height: 62vh; overflow: auto; }

/* ---------- результат ---------- */
.result { display: flex; flex-direction: column; gap: 14px; }
.total { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent); }
.total__label { color: var(--muted); font-size: 13px; }
.total__value { font-family: var(--font-num); font-size: 30px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.total__sub { font-family: var(--font-num); color: var(--muted); font-size: 13px; }
.lines { display: grid; grid-template-columns: 1fr auto; font-size: 14px; }
.lines > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.lines .v { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.lines .r { grid-column: 1 / -1; padding-top: 0; font-size: 12px; color: var(--faint); border-bottom: 1px solid var(--line); margin-top: -1px; }
.lines .is-sum { font-weight: 600; }

details.box > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; gap: 8px; align-items: center; }
details.box > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.box[open] > summary::before { transform: rotate(90deg); }
details.box[open] > summary { margin-bottom: 14px; }

.frame { width: 100%; height: calc(100vh - 190px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

.toast { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--surface-2); border: 1px solid var(--line-strong); padding: 10px 14px; border-radius: 8px; z-index: 50; box-shadow: var(--shadow-sm); max-width: calc(100vw - 32px); }
.toast.is-err { border-color: var(--down); }

.demo-banner { background: var(--accent); color: var(--accent-ink); font-size: 12px; text-align: center; padding: 4px 16px; font-weight: 500; }

@media (max-width: 720px) {
  .topbar__row { flex-wrap: wrap; gap: 4px 10px; padding-block: 6px; min-height: 0; }
  .brand { font-size: 14px; }
  .topbar__side { margin-left: auto; gap: 6px; }
  .tabs { order: 3; flex-basis: 100%; margin-inline: -4px; }
  .tab { padding: 7px 10px; }
  .tick { padding: 5px 12px 5px 0; margin-right: 12px; }
  .tick__value { font-size: 16px; }
  .rate__big { font-size: 28px; }
  .ticker__meta { display: none; }
  /* шапка уезжает вверх, когда листаете вниз, и возвращается при прокрутке вверх (класс ставит app.js) */
  /* появление — быстрее и мягко тормозит, уход — чуть дольше и плавно разгоняется; лёгкое затухание сглаживает движение */
  .topbar { transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.4s ease; will-change: transform; }
  .topbar.is-away { transform: translateY(calc(-100% - env(safe-area-inset-top, 0px))); opacity: 0; transition: transform 0.5s cubic-bezier(0.45, 0, 0.25, 1), opacity 0.45s ease-in; }
}

input[type='file'] { color: var(--muted); max-width: 100%; }
input[type='file']::file-selector-button { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 12px; margin-right: 10px; cursor: pointer; }

/* ---------- утильсбор ---------- */
.util-top { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); margin-bottom: 16px; align-items: stretch; }
.util-total { flex-direction: column; justify-content: center; align-items: flex-start; }
.util-total .total__value { font-size: 34px; }
.util-filters { margin-bottom: 12px; }
.util-table { border-collapse: separate; border-spacing: 0; }
.util-table th, .util-table td { padding: 10px 14px; }
.util-table thead th { text-align: right; font-size: 12px; }
.util-table thead th:first-child { text-align: left; }
.util-table th .sub, .util-table td .sub { display: block; font-size: 11px; color: var(--faint); font-weight: 400; }
.util-table td.pw { font-weight: 500; }
.util-table td.v { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 14px; background-image: linear-gradient(rgba(var(--heat), var(--heat-a, 0)), rgba(var(--heat), var(--heat-a, 0))); }
.util-table td.v small { color: var(--faint); font-size: 11px; margin-left: 4px; }
.util-table td.v { white-space: nowrap; }
.util-table tr.is-row td { background-color: var(--tint-info); }
.util-table td.is-col, .util-table th.is-col { box-shadow: inset 1px 0 0 color-mix(in srgb, var(--info) 45%, transparent), inset -1px 0 0 color-mix(in srgb, var(--info) 45%, transparent); }
.util-table th.is-col { color: var(--info); }
.util-table td.is-pref { color: var(--up); }
.util-table td.is-pref small { color: var(--up); opacity: 0.75; }
.util-table td.is-hit { outline: 2px solid var(--accent); outline-offset: -2px; color: var(--accent); font-weight: 600; border-radius: 4px; }
.util-table tr.is-flag td.pw { color: var(--warn); }
.util-table input.cell { min-width: 110px; }
.pref { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.pref__big { font-family: var(--font-num); font-size: 20px; font-weight: 600; color: var(--up); }
.pref .form-grid { flex: 1; }

/* ---------- база авто ---------- */
.cars-table tbody tr { cursor: pointer; }
.cars-table.is-edit tbody tr { cursor: default; }
.cars-table td.muted { color: var(--faint); }
@media (max-width: 720px) { .util-top { grid-template-columns: 1fr; } }
.util-table.is-narrow { width: auto; min-width: min(100%, 520px); }
.util-wrap:has(.is-narrow) { width: fit-content; max-width: 100%; }

/* ---------- справочник ТХ ---------- */
.td-filters { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; }
.td-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.6fr) repeat(3, minmax(0, 0.8fr)); align-items: start; }
.td-grid + .td-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.2fr) auto; }
.td-range { display: flex; gap: 8px; align-items: center; }
.td-range .input { min-width: 0; }
.td-range .seg { flex-shrink: 0; }
.td-summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; min-height: 26px; }
.td-summary .big { font-family: var(--font-num); font-size: 18px; font-weight: 600; color: var(--accent); margin-right: 6px; }
.td-wrap { max-height: 68vh; overflow: auto; }
.td-table { table-layout: fixed; }
.td-table th { cursor: pointer; user-select: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-table td { overflow: hidden; text-overflow: ellipsis; }
.td-table th[aria-sort] { color: var(--accent); }
.td-table th .arr { font-size: 10px; margin-left: 3px; }
.td-table td.hp { color: var(--muted); }
.td-table td .sub { color: var(--faint); font-size: 11px; margin-left: 4px; }
.td-table td.empty { color: var(--faint); }
.td-table tbody tr { cursor: default; }
.td-table mark { background: var(--accent-soft); color: var(--accent); border-radius: 2px; }
.td-pager { margin-top: 10px; }
.eco { display: inline-block; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 99px; font-size: 11px; border: 1px solid var(--line-strong); color: var(--muted); }
@media (max-width: 1000px) { .td-grid, .td-grid + .td-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); } }
a.btn { text-decoration: none; color: var(--text); display: inline-flex; align-items: center; }

/* ---------- выпадающий список с поиском ---------- */
.field > label { font-size: 12px; color: var(--muted); }
.cb { position: relative; }
.cb .input { padding-right: 34px; }
.cb-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.cb-clear:hover { background: var(--surface-2); color: var(--text); }
.cb-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 320px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.cb-item { display: flex; justify-content: space-between; gap: 12px; padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.cb-item .n { color: var(--faint); font-family: var(--font-num); font-size: 12px; white-space: nowrap; }
.cb-item mark { background: none; color: var(--accent); font-weight: 600; }
.cb-item.is-active, .cb-item:hover { background: var(--accent-soft); }
.cb-more { padding: 6px 10px; color: var(--faint); font-size: 12px; }

/* диагностика источников */
.ok { color: var(--up); }
.bad { color: var(--down); }
.diag-pre { max-height: 220px; overflow: auto; font-size: 12px; background: var(--ground); padding: 8px; font-family: var(--font-num); border-radius: 6px; white-space: pre-wrap; word-break: break-all; }
.diag-detail { white-space: normal; word-break: break-word; min-width: 220px; }

/* карточки курсов: блок наценки всегда внизу, на одном уровне */
.rate__ctl { margin-top: auto; }
.rate__err { display: flex; flex-direction: column; gap: 4px; }
.rate__err details summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.rate__errtext { font-size: 12px; color: var(--muted); word-break: break-word; margin: 4px 0 6px; }
.td-status { margin: 14px 0 0; font-size: 12px; }
.input::placeholder { color: var(--faint); opacity: 0.8; }
.td-summary--bottom { margin: 12px 0 0; min-height: 0; gap: 6px; }
.td-summary--bottom .big { font-size: 13px; color: var(--muted); margin-right: 2px; }
.td-summary--bottom .pill { font-size: 11px; }
.td-summary--bottom + .td-status { margin-top: 6px; }

/* ---------- справочник ТХ на телефоне: карточки вместо таблицы ---------- */
.td-cards { display: none; }
.tdc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tdc__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.tdc__name { min-width: 0; font-size: 13px; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
.tdc__name b { color: var(--text); font-weight: 600; margin-right: 2px; }
.tdc__head .eco { flex-shrink: 0; }
.tdc__tiles { display: grid; grid-template-columns: 0.8fr 1.1fr 1.1fr; gap: 6px; }
.tdc__tile { display: flex; flex-direction: column; min-width: 0; padding: 6px 9px 7px; border-radius: 8px; background: var(--surface-2); }
.tdc__tile--empty .tdc__lbl { color: var(--faint); }
.tdc__nil { color: var(--faint); font-weight: 500; }
.tdc__lbl { font-size: 10.5px; line-height: 1.3; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tdc__val { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--text); white-space: nowrap; }
.tdc__val small { font-size: 12px; font-weight: 500; color: var(--muted); }
.tdc__sub { font-family: var(--font-num); font-size: 12px; line-height: 1.3; color: var(--muted); white-space: nowrap; }
/* мощность — главная цифра, оранжевая; 30-минутная — отдельной плиткой со своей подписью, приглушённая */
.tdc__tile--pow .tdc__val { color: var(--accent); }
.tdc__tile--p30 { background: none; border: 1px dashed var(--line-strong); }
.tdc__tile--p30 .tdc__val { font-size: 17px; font-weight: 600; }
.tdc__foot { font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.tdc__foot span { color: var(--text); font-family: var(--font-num); }
.tdc__foot i { font-style: normal; margin: 0 6px; color: var(--faint); }
.tdc mark { background: var(--accent-soft); color: var(--accent); border-radius: 2px; }
:root[data-theme='light'] .tdc { box-shadow: 0 1px 2px rgba(18, 18, 20, 0.05); }
.td-msort { display: none; }
@media (max-width: 720px) {
  .td-msort { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; scroll-margin-top: 170px; }
  .td-msort label { flex-shrink: 0; }
  .td-msort select { flex: 1; min-width: 0; }
  .td-msort .btn { flex-shrink: 0; min-height: 38px; min-width: 44px; font-size: 18px; justify-content: center; }

  /* фильтры: марка и модель во всю ширину, «год от / до» — парой, остальное друг под другом */
  .td-grid, .td-grid + .td-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .td-grid > * { grid-column: 1 / -1; }
  .td-grid > .td-y { grid-column: auto; }
  .td-actions > span { display: none; }

  /* на телефоне вместо таблицы — компактные карточки (#tdCards, их рисует app.js) */
  .td-wrap { display: none; }
  .td-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }

  .td-pager { flex-wrap: wrap; gap: 8px; }
  .td-pager .btn { min-height: 38px; }
  .td-pager .spacer { display: none; }
  .td-pager label, .td-pager #tdExport { flex-basis: 100%; }
  .td-pager #tdExport { text-align: center; justify-content: center; }
}

/* загрузка */
.skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
.skel--big { height: 34px; width: 55%; margin: 6px 0 10px; }
.skel-card { min-height: 220px; }
.spin { display: inline-block; width: 10px; height: 10px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .skel, .spin { animation: none; } }
/* светлая тема: таблицы утиля и справочника — на белом, как карточки */
:root[data-theme='light'] .table-wrap { background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 32, 0.06); }
:root[data-theme='light'] .td-summary--bottom, :root[data-theme='light'] .td-pager { color: var(--muted); }

/* выбор столбцов справочника */
.cols { position: relative; }
.cols > summary { list-style: none; cursor: pointer; }
.cols > summary::-webkit-details-marker { display: none; }
.cols__panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 220px; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: var(--shadow); padding: 10px; }
.cols__panel .check { white-space: nowrap; }

/* авто по ссылке */
/* КП для клиента */
.offer { margin-top: 4px; }
.offer > summary { list-style: none; display: inline-flex; }
.offer > summary::-webkit-details-marker { display: none; }
.offer[open] > summary { background: transparent; color: var(--accent); }
.offer__form { display: grid; gap: 10px; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.offer__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .offer__row { grid-template-columns: 1fr; } }
.eq-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.eq-chip { font-size: 12.5px; line-height: 1.3; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.car-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.car-photos img { width: 100%; height: 82px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }

/* галерея фото */
.car-photos figure { position: relative; margin: 0; }
.car-photos img { cursor: zoom-in; }
.car-photos__dl { position: absolute; right: 4px; bottom: 4px; padding: 0 6px; min-height: 22px; line-height: 20px; opacity: 0; transition: opacity 0.15s; }
.car-photos figure:hover .car-photos__dl { opacity: 1; }
/* на телефоне наведения нет — кнопку «сохранить это фото» показываем всегда, чуть прозрачной */
@media (pointer: coarse) { .car-photos__dl { opacity: 0.85; min-height: 28px; line-height: 26px; padding: 0 9px; } }
#photoSaveAll.is-ready { box-shadow: 0 0 0 3px var(--accent-soft); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.88); display: flex; align-items: center; justify-content: center; gap: 12px; padding: 24px; }
.lightbox img { max-width: calc(100% - 140px); max-height: calc(100vh - 120px); object-fit: contain; border-radius: 8px; }
.lightbox__close { position: absolute; top: 16px; right: 16px; }
.lightbox__bar { position: absolute; bottom: 16px; display: flex; gap: 12px; align-items: center; }
.lightbox__nav { min-width: 44px; font-size: 22px; line-height: 1; }
.lightbox img { touch-action: pinch-zoom; will-change: transform; }
html.lb-open, html.lb-open body { overflow: hidden; }
/* телефон: фото на всю ширину, стрелки и счётчик — внизу, листать можно свайпом */
@media (max-width: 720px) {
  .lightbox { padding: calc(56px + env(safe-area-inset-top)) 0 calc(76px + env(safe-area-inset-bottom)); }
  .lightbox img { max-width: 100%; max-height: 100%; width: 100%; height: 100%; border-radius: 0; }
  .lightbox__close { top: calc(12px + env(safe-area-inset-top)); right: 12px; }
  .lightbox__nav { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom)); min-width: 40px; min-height: 34px; font-size: 18px; padding: 0 12px; }
  .lightbox__prev { left: 12px; }
  .lightbox__next { right: 12px; }
  .lightbox__bar { left: 64px; right: 64px; bottom: calc(18px + env(safe-area-inset-bottom)); justify-content: center; gap: 10px; flex-wrap: wrap; }
  #lbSize { display: none; }
}

/* порядок фото: номер, булавка, перетаскивание; первые 10 — в КП */
.car-photos figure { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.car-photos figure img { -webkit-user-drag: none; }
@media (pointer: fine) { .car-photos figure:not(.is-pinned) img { cursor: grab; } }
.car-photos__num { position: absolute; left: 4px; top: 4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; pointer-events: none; }
.car-photos figure.is-cover .car-photos__num { background: var(--accent); color: var(--accent-ink); }
.car-photos__pin { position: absolute; right: 4px; top: 4px; padding: 0 5px; min-height: 22px; line-height: 20px; display: grid; place-items: center; opacity: 0; transition: opacity 0.15s; }
.car-photos figure:hover .car-photos__pin { opacity: 1; }
.car-photos figure.is-pinned .car-photos__pin { opacity: 1; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.car-photos figure.is-pinned img { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (pointer: coarse) { .car-photos__pin { opacity: 0.85; min-height: 28px; padding: 0 8px; } }
.car-photos figure.is-dragging { opacity: 0.3; }
.car-photos figure.is-drop-before::before, .car-photos figure.is-drop-after::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--accent); z-index: 2;
}
.car-photos figure.is-drop-before::before { left: -5px; }
.car-photos figure.is-drop-after::after { right: -5px; }
.car-photos__more { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 2px 4px; margin-top: 4px; border-top: 1px dashed var(--line); border-radius: 4px; }
.car-photos__more.is-drop { border-top: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.photo-ghost { position: fixed; left: 0; top: 0; z-index: 80; pointer-events: none; object-fit: cover; border-radius: 8px; opacity: 0.92; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45); }
body.is-photo-drag, body.is-photo-drag * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
/* фото проявляются по мере загрузки, а не вспыхивают; новые — мягко появляются */
.car-photos figure { background: var(--surface-2); border-radius: 6px; }
.car-photos figure img { opacity: 0; transition: opacity 0.25s ease; }
.car-photos figure img.is-loaded { opacity: 1; }
.car-photos figure.is-moving { z-index: 1; }
.car-photos figure.is-enter { animation: photo-in 0.26s ease both; }
@keyframes photo-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
/* пересчёт той же машины: прошлый результат приглушён, сверху — строка статуса */
#carResult.is-busy > :not(.car-busy) { opacity: 0.45; pointer-events: none; transition: opacity 0.2s; }
.car-busy { position: sticky; top: 76px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); font-weight: 600; }

/* форма калькулятора */
.car-form { gap: 18px; }
.car-form__top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.switches { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px 6px 10px; background: var(--surface-2); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { position: relative; width: 34px; height: 18px; border-radius: 999px; background: var(--line-strong); transition: background 0.15s; flex: none; }
.switch__track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); transition: transform 0.15s; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:checked ~ .switch__text { color: var(--text); }
.switch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* режим расчёта: на компьютере — как было («Китай вручную» одной строкой), подписи только для телефона */
.car-mode b { font-weight: inherit; }
.car-mode em { font-style: normal; }
.car-mode em.m-only, .switch__hint { display: none; }

@media (max-width: 720px) {
  .car-form__top { flex-direction: column; align-items: stretch; gap: 12px; }

  /* три равные кнопки в одну строку, как переключатель в iOS; выбранная — оранжевая, как активная вкладка */
  .car-mode { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px;
    border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); overflow: visible; }
  .car-mode label { display: flex; }
  .car-mode label + label span { border-left: 0; }
  .car-mode span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 9px 4px; border-radius: 10px; text-align: center; line-height: 1.2; font-size: 15px; color: var(--text);
    transition: background 0.15s, color 0.15s; }
  .car-mode b { font-weight: 600; }
  .car-mode em, .car-mode em.m-only { display: block; font-size: 12px; color: var(--muted); }
  .car-mode input:checked + span { background: var(--accent); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
  .car-mode input:checked + span em { color: var(--accent-ink); opacity: 0.7; }
  :root[data-theme='light'] .car-mode { border-color: var(--line); }

  /* переключатели — списком, как в настройках телефона: подпись слева, тумблер справа */
  .switches { margin-left: 0; flex-direction: column; flex-wrap: nowrap; gap: 0;
    border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
  .switch { flex-direction: row-reverse; justify-content: space-between; gap: 14px;
    border: 0; border-radius: 0; background: none; padding: 11px 14px; font-size: 15px; color: var(--text); }
  .switch + .switch { border-top: 1px solid var(--line); }
  .switches .switch:has(input:checked) { background: var(--accent-soft); border-color: var(--line); }
  .switch__text { flex: 1; min-width: 0; }
  .switch__hint { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.35; }
  .switch__track { width: 46px; height: 28px; }
  .switch__track::after { top: 3px; left: 3px; width: 22px; height: 22px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
  .switch input:checked + .switch__track::after { transform: translateX(18px); }
}

.car-form__params { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 16px; }
.car-form__caption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.car-form__caption h3 { margin: 0; }
.car-group { display: flex; flex-direction: column; gap: 10px; }
.car-group__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--faint); }
.car-group__title .hint { text-transform: none; letter-spacing: 0; }
/* ровная сетка: колонки одинаковой ширины, поля не «прыгают» при переключении режимов */
.form-grid--4 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px 10px; }
@media (max-width: 1240px) { .form-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .form-grid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .form-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .form-grid--4 { grid-template-columns: 1fr; } }
/* поля калькулятора — компактнее обычных */
.car-form .field { gap: 3px; }
.car-form .field > span { font-size: 11px; line-height: 1.25; }
.car-form .input, .car-form select.input { padding: 5px 8px; min-height: 30px; font-size: 13px; }
.car-form { gap: 14px; }
.car-form__params { padding-top: 12px; gap: 12px; }
.car-group { gap: 7px; }
.car-form__actions { padding-top: 12px; }
/* результат — отдельным блоком, с отступом от формы; когда расчёт есть,
   он занимает оставшийся экран, чтобы при прокрутке вниз смотрелся цельно */
#carResult { margin-top: 18px; scroll-margin-top: 142px; }
/* расчёт занимает оставшийся экран: карточки по содержимому, а свободное
   место распределяется между блоками, без дыр внутри карточек */
#carResult.is-full { min-height: calc(100vh - 196px); display: flex; flex-direction: column; gap: 14px; }
#carResult.is-full > p { margin: 0; }
.car-note { margin: 0; }
/* фото сохраняют пропорции кадра; на большом экране — крупнее */
#carResult .car-photos img { height: auto; aspect-ratio: 4 / 3; }
/* размер миниатюр подстраивается под высоту экрана: на большом мониторе фото крупнее */
#carResult .car-photos { grid-template-columns: repeat(auto-fill, minmax(clamp(105px, 11vh, 175px), 1fr)); }
#carResult.is-full > p { margin: 0; }
#carResult .lines > div { padding: 6px 0; }
#carResult .kv { row-gap: 2px; }
.car-form__actions { border-top: 1px solid var(--line); padding-top: 14px; }
/* стрелки у числовых полей только мешают */
.input.num::-webkit-outer-spin-button, .input.num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.input.num[type='number'] { -moz-appearance: textfield; appearance: textfield; }
.box--soft { background: var(--surface-2); }

/* поле, которое нужно заполнить для расчёта */
.input.is-missing { border-color: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 25%, transparent); }
.field:has(.is-missing) > span { color: var(--down); }

/* Комплектация объявления */
.eq-archive { grid-template-columns: repeat(3, minmax(0, 1fr) auto); gap: 6px 14px; }
.eq-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px 24px; }
.eq-group .car-group__title { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.eq-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.eq-item { display: grid; grid-template-columns: 16px 1fr; gap: 6px; align-items: baseline; line-height: 1.35; }
.eq-mark { font-weight: 700; text-align: center; }
.eq-item.is-yes .eq-mark { color: var(--up); }
.eq-item.is-opt .eq-mark { color: var(--warn); }
.eq-item.is-no { color: var(--faint); display: none; }
.eq-item.is-no .eq-mark { color: var(--faint); }
.eq--all .eq-item.is-no { display: grid; }
.eq-item.is-info .eq-mark::before { content: '·'; color: var(--muted); }
.eq-tag { font-size: 11px; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 2px; }
.eq-params > summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.eq-params .kv { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.eq-params .kv dt { white-space: normal; }
.eq-params .kv dd { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 900px) { .eq-archive { grid-template-columns: minmax(0, 1fr) auto; } }
.eq-unsure { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }
.eq-unsure .eq-mark { color: var(--warn); }

/* История авто Encar */
.hist-filter { gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.hist-filter .btn.is-on { border-color: var(--accent); color: var(--accent); }
.hist-line { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.hist-ev { display: grid; grid-template-columns: 74px 26px 1fr; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.hist-ev[hidden] { display: none; }
.hist-date { font-family: var(--font-num); color: var(--muted); font-size: 12px; padding-top: 3px; }
.hist-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.hist-ev.is-insurance .hist-dot { background: var(--tint-err); color: var(--down); }
.hist-ev.is-repair .hist-dot { background: var(--tint-warn); color: var(--warn); }
.hist-ev.is-recall .hist-dot { background: var(--tint-info); color: var(--info); }
.hist-ev.is-release .hist-dot, .hist-ev.is-inspection .hist-dot { background: var(--tint-ok); color: var(--up); }
.hist-title { font-weight: 600; }
.hist-more > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 4px; }
.hist-kv { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); margin-top: 6px; }
.hist-kv dt { white-space: normal; overflow-wrap: anywhere; }
.hist-kv dd { text-align: left; white-space: normal; overflow-wrap: anywhere; font-family: var(--font-ui); }
.hist-parts { font-size: 13px; margin-top: 4px; }
@media (max-width: 700px) {
  .hist-ev { grid-template-columns: 60px 24px 1fr; gap: 8px; }
  /* подробности события: подпись над значением, а не в узкой колонке рядом — иначе они наезжают друг на друга */
  .hist-kv { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .hist-kv dt { font-size: 11.5px; margin-top: 8px; }
  .hist-kv dt:first-child { margin-top: 0; }
  .hist-kv dd { font-size: 13.5px; line-height: 1.4; }
  /* владельцы и пробег: вместо широкой таблицы с прокруткой — строка на владельца */
  .hist-own, :root[data-theme] .table-wrap.hist-own { border: 0; background: none; box-shadow: none; overflow: visible; }
  .hist-own thead { display: none; }
  .hist-own table, .hist-own tbody { display: block; width: 100%; }
  .hist-own tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .hist-own td { padding: 0; border: 0; white-space: normal; text-align: left; }
  .hist-own td:nth-child(1) { grid-column: 1; grid-row: 1; font-family: var(--font-num); }
  .hist-own td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
  .hist-own td:nth-child(2) { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 13px; }
  .hist-own td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 13px; text-align: right; }
}

/* телефон: два столбца — первые 10 фото (для КП) ровно 5 рядами, фото крупнее */
@media (max-width: 720px) {
  #carResult .car-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}

/* подсказки у поля (Справочник ТХ, мощности): выбрать из списка или вписать своё */
.field.suggest { position: relative; }
.suggest__list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 40; max-height: 290px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35); padding: 4px;
  -webkit-overflow-scrolling: touch; }
@media (min-width: 721px) { .suggest__list { min-width: 300px; } }
.suggest__item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left;
  padding: 6px 10px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.suggest__item:hover, .suggest__item.is-active { background: var(--surface-2); }
.suggest__v { font-weight: 600; }
.suggest__h { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.suggest__more { padding: 6px 10px; font-size: 11.5px; }
@media (pointer: coarse) { .suggest__item { padding: 9px 12px; font-size: 14px; } }
