:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #1b2430;
  --ink-2: #4a5566;
  --ink-3: #7b8697;
  --line: #e1e5eb;
  --line-2: #eef1f5;
  --side: #17212e;
  --side-ink: #c4ccd8;
  --accent: #1f5fbf;
  --accent-2: #174a96;
  --accent-soft: #e7effb;
  --ok: #1d7a46;   --ok-bg: #e4f4ea;
  --warn: #9a6200; --warn-bg: #fff4d6;
  --bad: #b42318;  --bad-bg: #fde7e5;
  --info: #3b5b8a; --info-bg: #eaf0f8;
  --radius: 8px;
  --mono: "Consolas", "Cascadia Mono", "Menlo", monospace;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.strike { text-decoration: line-through; color: var(--ink-3); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side {
  background: var(--side); color: var(--side-ink); padding: 16px 10px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 10px 16px; display: block; }
.brand small { display: block; color: #8592a6; font-weight: 400; font-size: 11.5px; margin-top: 2px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between;
  color: var(--side-ink); padding: 8px 10px; border-radius: 6px; margin-bottom: 1px;
}
.nav a:hover { background: #22303f; text-decoration: none; color: #fff; }
.nav a.active { background: #2a3b52; color: #fff; }
.nav .sep { height: 1px; background: #26323f; margin: 10px 6px; }
.nav .cnt { background: #3a4d66; color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar form { flex: 1; max-width: 460px; }
.topbar .user { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--ink-2); }
.topbar .user .role { font-size: 11.5px; color: var(--ink-3); }
.content { padding: 20px 24px 60px; max-width: 1600px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 14px 16px 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.panel.flush .panel-head { padding: 12px 16px 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) { .g2, .g3, .g-main { grid-template-columns: 1fr; } }

/* ---------- key/values ---------- */
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; }

/* ---------- stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; color: var(--ink); display: block; min-width: 0; container-type: inline-size;
}
a.stat:hover { border-color: var(--accent); text-decoration: none; }
/* размер цифр подстраивается под ширину карточки — длинные суммы не вылезают за рамку */
.stat .v { font-size: 24px; font-size: clamp(15px, 11cqw, 24px); font-weight: 650; font-variant-numeric: tabular-nums;
  white-space: nowrap; line-height: 1.25; }
.stat .l { color: var(--ink-3); font-size: 12.5px; }
.stat.bad .v { color: var(--bad); }
.stat.warn .v { color: var(--warn); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th {
  text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12px;
  text-transform: none; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfc;
  white-space: nowrap;
}
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr:hover td { background: #fafcff; }
table.t tr.row-bad td { background: #fff8f7; }
table.t tr.row-warn td { background: #fffcf2; }
table.t tfoot td { font-weight: 650; border-top: 1px solid var(--line); background: #fafbfc; }
table.t.compact td, table.t.compact th { padding: 6px 8px; }
.empty { padding: 24px; text-align: center; color: var(--ink-3); }

/* ---------- badges ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: #eef1f5; color: var(--ink-2);
}
.st-new { background: #eef1f6; color: #3d4a5c; }
.st-sent { background: #ebe9fb; color: #4a3fb0; }
.st-diagnostics { background: #fff1d6; color: #8a5a00; }
.st-approval { background: #ffe6d5; color: #a24b06; }
.st-in_repair { background: #e2eefc; color: #1a56a8; }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-cancelled { background: #eceef1; color: #7b8697; text-decoration: line-through; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.gray { background: #eef1f5; color: var(--ink-3); }
.plate {
  font-family: var(--mono); font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  border: 1px solid #c9d0da; border-radius: 4px; padding: 0 5px; background: #fff; font-size: 12.5px;
}

/* ---------- check notes ---------- */
.notes { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12.5px; }
.notes li { display: flex; gap: 6px; align-items: baseline; margin-top: 2px; }
.notes .ic {
  flex: 0 0 16px; height: 16px; border-radius: 50%; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.notes .bad { color: var(--bad); } .notes .bad .ic { background: var(--bad); color: #fff; }
.notes .warn { color: var(--warn); } .notes .warn .ic { background: #e2a400; color: #fff; }
.notes .info { color: var(--ink-3); } .notes .info .ic { background: #c4ccd8; color: #fff; }
.notes .ok { color: var(--ok); } .notes .ok .ic { background: var(--ok); color: #fff; }
.lvl { font-weight: 700; }
.lvl.ok { color: var(--ok); } .lvl.bad { color: var(--bad); } .lvl.warn { color: var(--warn); }

/* ---------- alerts ---------- */
.alert { border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; border: 1px solid transparent; }
.alert.success { background: var(--ok-bg); border-color: #bfe3cc; color: #14532d; }
.alert.error, .alert.bad { background: var(--bad-bg); border-color: #f6c4bf; color: #7a1a12; }
.alert.warning, .alert.warn { background: var(--warn-bg); border-color: #f1d999; color: #6b4600; }
.alert.info { background: var(--info-bg); border-color: #cddbee; color: #22385a; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- forms ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit;
  font-weight: 550; cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.btn:hover { border-color: #b8c2cf; text-decoration: none; background: #fafbfc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); background: var(--bad-bg); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 0; }
.input, select.input, textarea.input {
  width: 100%; padding: 7px 10px; border: 1px solid #ccd3dd; border-radius: 6px; font: inherit;
  background: #fff; color: var(--ink);
}
textarea.input { resize: vertical; }
.input:focus { outline: 2px solid #b9d0f3; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.field .help { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.field .err { color: var(--bad); font-size: 12.5px; margin-top: 3px; }
.field.has-err .input { border-color: var(--bad); }
.field.check > label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 650; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; padding: 0;
  text-transform: uppercase; letter-spacing: .04em; font-size: 11.5px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; }
.filters label { display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.radio-list label, .check-list label { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-weight: 400; }
.check-list { max-height: 420px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.inline-input { width: 90px; padding: 4px 6px; border: 1px solid #ccd3dd; border-radius: 5px; font: inherit; }

/* ---------- tabs / chips ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

/* ---------- progress ---------- */
.bar { height: 7px; background: #e9edf2; border-radius: 4px; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.warn > i { background: #e2a400; }
.bar.bad > i { background: var(--bad); }

/* ---------- documents ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.doc-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fcfdfe; }
.doc-group.missing { border-color: #f1c8c3; background: #fffafa; }
.doc-group h3 { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.doc-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px dashed var(--line); }
.doc-item:first-of-type { border-top: 0; }
.doc-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb {
  width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: #eef1f5; flex: 0 0 44px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; color: var(--ink-3);
}
.thumb.pdf { background: #fde7e5; color: var(--bad); }
.thumb.video { background: #e7effb; color: var(--accent); }
.drop {
  border: 2px dashed #c8d1dd; border-radius: var(--radius); padding: 14px; text-align: center; color: var(--ink-3);
  background: #fafbfd; cursor: pointer;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input[type=file] { display: none; }
.drop .files { margin-top: 6px; color: var(--ink); font-size: 12.5px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(10, 15, 22, .85); display: none; z-index: 50;
  align-items: center; justify-content: center; flex-direction: column; gap: 10px; }
.lightbox.open { display: flex; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 84vh; border-radius: 4px; background: #000; }
.lightbox .cap { color: #dfe5ee; font-size: 13px; }
.lightbox .close { position: absolute; top: 14px; right: 20px; color: #fff; font-size: 28px; cursor: pointer; background: none; border: 0; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 12px; width: 8px; height: 8px;
  border-radius: 50%; background: #b8c2cf; }
.timeline li:first-child::before { background: var(--accent); }
.timeline .when { color: var(--ink-3); font-size: 12px; }

/* ---------- misc ---------- */
.totals { display: flex; gap: 22px; flex-wrap: wrap; }
.totals .item .l { color: var(--ink-3); font-size: 12px; }
.totals .item .v { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vinfo { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfcfe; font-size: 13px; }
.vinfo:empty { display: none; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 14px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login { width: 360px; max-width: calc(100vw - 24px); }
.login .brand { color: var(--ink); padding: 0 0 14px; font-size: 18px; }
.hl { background: #fff2b3; }
.search-select { margin-bottom: 4px; }
details summary { cursor: pointer; color: var(--accent); }
.wbox { border-left: 3px solid #e2a400; background: var(--warn-bg); padding: 6px 10px; border-radius: 0 6px 6px 0; margin-top: 6px; font-size: 12.5px; color: #6b4600; }
.wbox.bad { border-color: var(--bad); background: var(--bad-bg); color: #7a1a12; }
@media print {
  .side, .topbar, .actions, .btn, form { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .panel { border: 0; }
}

/* ---------- фото автомобиля ---------- */
.vthumb { width: 56px; height: 42px; border-radius: 5px; object-fit: cover; display: block; background: #eef1f5; }
.vthumb.empty { display: flex; align-items: center; justify-content: center; color: #a7b0bd; }
.vhero { display: grid; grid-template-columns: 360px 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 1000px) { .vhero { grid-template-columns: 1fr; } }
.vhero .mainphoto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: #eef1f5; display: block; cursor: zoom-in; }
.vhero .nophoto { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); border: 2px dashed #cfd6e0; background: #fafbfd;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ink-3); text-align: center; padding: 16px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.gallery .ph { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #eef1f5; }
.gallery .ph.main { outline: 2px solid var(--accent); outline-offset: 1px; }
.gallery .ph img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; cursor: zoom-in; }
.gallery .ph .bar-actions { display: flex; justify-content: space-between; align-items: center; padding: 4px 5px; background: #fff; gap: 4px; }
.gallery .ph .badge-main { position: absolute; top: 5px; left: 5px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.gallery .add { border: 2px dashed #c8d1dd; border-radius: 6px; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  flex-direction: column; color: var(--ink-3); cursor: pointer; font-size: 12.5px; background: #fafbfd; text-align: center; padding: 6px; }
.gallery .add:hover, .gallery .add.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.gallery .add input { display: none; }
.app-version { color: #66748a; font-size: 11px; padding: 12px 10px 0; }
.gallery .ph .ph-del { position: absolute; top: 4px; right: 4px; }
.gallery .ph .ph-del .btn { padding: 1px 7px; background: rgba(255,255,255,.92); }
.gallery .ph .bar-actions { justify-content: center; }

/* ---------- состояние ТС ---------- */
.g-state { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .g-state { grid-template-columns: 1fr; } }
.pct { display: inline-block; min-width: 54px; text-align: center; color: #fff; font-weight: 650; border-radius: 4px; padding: 1px 6px; font-size: 12.5px; }
.scale { height: 9px; border-radius: 3px; min-width: 4px; }
.scale-wrap { width: 120px; background: #eef1f5; border-radius: 3px; }
tr.total td { font-weight: 650; background: #f6f8fb; }
.st-ok { background: var(--ok-bg); color: var(--ok); }
.st-cond { background: #fff1c2; color: #8a5a00; }
.st-faulty { background: var(--bad-bg); color: var(--bad); }
.st-none { background: #eef1f5; color: var(--ink-3); }
.days { font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-svg text { font-size: 11px; fill: var(--ink-3); font-family: inherit; }

/* ---------- бренд ---------- */
.brand { display: flex !important; align-items: center; gap: 10px; }
.brand img { border-radius: 8px; flex: 0 0 auto; }
.brand span { display: block; line-height: 1.2; font-size: 16px; letter-spacing: -.01em; }
.login-brand { padding: 0 0 18px !important; gap: 12px; }
.login-brand span { font-size: 20px; }
.login-brand small { color: var(--ink-3) !important; }
.pctbar { display: flex; align-items: center; gap: 8px; }
.pctbar .scale-wrap { flex: 1 1 60px; min-width: 40px; }
.pctbar .pct { flex: 0 0 auto; }

/* ---------- реестр ТС (как в Excel) ---------- */
.reg-wrap { max-height: calc(100vh - 260px); overflow: auto; }
table.reg thead th { position: sticky; top: 0; z-index: 2; }
table.reg td { white-space: normal; }
table.reg td[data-field] { cursor: default; }
table.reg[data-editable="1"] td[data-field] { cursor: text; }
table.reg[data-editable="1"] td[data-field]:hover { box-shadow: inset 0 0 0 1px #b9cdec; }
.reg-st-ok .cell-state { background: #e2f4e8 !important; color: #1d6b3f; font-weight: 600; }
.reg-st-cond .cell-state { background: #fff1c2 !important; color: #855600; font-weight: 600; }
.reg-st-faulty .cell-state { background: #fbe0e6 !important; color: #a3172b; font-weight: 600; }
.reg-st-none .cell-state { background: #eef0f3 !important; color: #8a94a3; }
tr.reg-writeoff td { background: #fbe1cc; }
tr.reg-dtp td { background: #fff0e0; }
tr.reg-absent td { background: #f3f4f6; }
td.editing { padding: 2px !important; }
.cell-input { width: 100%; min-width: 120px; padding: 4px 6px; border: 2px solid var(--accent); border-radius: 4px; font: inherit; background: #fff; }
td.saving { opacity: .5; }
td.saved { animation: savedflash 1.2s ease-out; }
@keyframes savedflash { from { background: #c9f0d6; } to { background: inherit; } }
td.dup { background: #fff2a8 !important; }

/* ---------- аренда / дубли ---------- */
.plate.rent-plate { background: #f1ebff; border-color: #c4b0f0; color: #5b3aa8; }
.plate.dup-plate { background: #fde4e2; border-color: #e5948c; color: #b42318; }
.plate.plain { color: var(--ink); }
.tag.rent { background: #f1ebff; color: #5b3aa8; }
.dup-note { font-size: 11.5px; color: #8a5a00; margin-top: 3px; white-space: normal; max-width: 180px; }
.dup-note.bad { color: var(--bad); }
.dup-form { margin-top: 4px; }
.dup-form .btn { padding: 1px 7px; font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; color: var(--ink-3); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- иллюстрации автомобилей ---------- */
.vthumb.art { padding: 0; overflow: hidden; }
.vthumb.art svg { width: 100%; height: 100%; display: block; }
.artphoto { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #eef2f7; display: flex; align-items: center; }
.artphoto svg { width: 100%; display: block; }
.artcap { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }

/* ---------- фото моделей ---------- */
.mp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mp-card { padding: 0; overflow: hidden; margin: 0; }
.mp-img { aspect-ratio: 16 / 10; background: #eef2f7; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.mp-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-none { color: var(--ink-3); font-size: 13px; }
.mp-body { padding: 12px 14px; }
.mp-credit { margin-top: 4px; word-break: break-word; }
.mp-upload label { cursor: pointer; }
.photo-credit { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(15,20,28,.62); color: #e8edf3; font-size: 11px; padding: 4px 8px; line-height: 1.35; }
.photo-credit a { color: #cfe0ff; }
.modelphoto { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4 / 3; background: #eef2f7; }
.modelphoto img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.vthumb.mp img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- вход с кодом / доступ из интернета (1.6.0) ---------- */
.otp-input { font-size: 20px; letter-spacing: 4px; font-variant-numeric: tabular-nums; text-align: center; }
.code-setup { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.code-setup .qr { background: #fff; border-radius: 10px; padding: 8px; border: 1px solid var(--line, #e3e6ea); }
.code-setup .qr svg { width: 100%; height: auto; display: block; }
.code-setup .steps { padding-left: 18px; margin: 0 0 10px; }
.code-setup .steps li { margin-bottom: 8px; }
code.secret { display: inline-block; font-size: 15px; letter-spacing: 1px; padding: 4px 8px; background: #f1f3f5; border-radius: 6px; margin-top: 4px; user-select: all; word-break: break-all; }
.inet-url { font-size: 17px; font-weight: 600; margin: 0 8px; word-break: break-all; }
.logbox { max-height: 360px; overflow: auto; background: #111827; color: #d1d5db; font-size: 12px; padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; margin-top: 10px; }
@media (max-width: 720px) { .code-setup { grid-template-columns: 1fr; } .code-setup .qr { max-width: 240px; } }
.enroll-qr { background:#fff; border:1px solid #e3e6ea; border-radius:10px; padding:8px; width:220px; margin:6px auto 10px; }
.enroll-qr svg { width:100%; height:auto; display:block; }

/* ---------- выбор из вариантов (роль и т.п.) ---------- */
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-weight: 400; background: #fff; transition: border-color .15s, background .15s; }
.radio-card:hover { border-color: #b9c6d8; }
.radio-card input { margin: 2px 0 0; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--accent); }
.radio-card:has(input:checked) { border-color: var(--accent); background: #f2f7ff; box-shadow: 0 0 0 1px var(--accent) inset; }
.radio-card .rc-body { display: flex; flex-direction: column; gap: 3px; line-height: 1.35; }
.radio-card .rc-title { font-weight: 600; color: var(--ink); }
.radio-card .rc-text { font-size: 12.5px; color: var(--ink-3); }

/* ---------- главная: показатели в две строки ---------- */
.kpi { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.kpi-row { display: grid; grid-template-columns: 96px repeat(7, minmax(0, 1fr)); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.kpi-group { display: flex; flex-direction: column; justify-content: center; padding: 10px 14px;
  font-weight: 650; font-size: 13px; color: var(--ink-2); background: #f6f8fb; border-right: 1px solid var(--line); }
.kpi-group span { font-weight: 400; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi-cell { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 14px;
  color: inherit; text-decoration: none; border-left: 1px solid var(--line); min-height: 62px; transition: background .12s; }
.kpi-group + .kpi-cell { border-left: 0; }
a.kpi-cell:hover { background: #f4f8ff; }
.kpi-cell .v { font-size: 22px; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-cell .l { font-size: 12px; color: var(--ink-3); line-height: 1.25; }
.kpi-cell.main .v { color: var(--accent); }
.kpi-cell.bad .v { color: var(--bad); }
.kpi-cell.warn .v { color: var(--warn); }
.kpi-cell.zero .v { color: #b5bcc7; }
.kpi-cell .pct { color: #fff; font-size: 17px; padding: 1px 8px; border-radius: 6px; }
.kpi-cell.wide2 { grid-column: span 2; }
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-group { grid-column: 1 / -1; flex-direction: row; gap: 8px; align-items: baseline; border-right: 0; border-bottom: 1px solid var(--line); padding: 7px 14px; }
  .kpi-group { justify-content: flex-start; }
  .kpi-cell { border-top: 1px solid var(--line); }
  .kpi-cell:nth-child(4n+2) { border-left: 0; }
}
.custom-norm { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; background: #fafbfd; }
.custom-norm h3 { margin: 0 0 4px; font-size: 14px; }
/* полоса контракта: израсходовано + в работе */
.bar2 { display: flex; height: 8px; background: #e9edf2; border-radius: 4px; overflow: hidden; }
.bar2 i { display: block; height: 100%; }
.bar2 .sp { background: var(--accent); }
.bar2 .wk { background: #9cc0f0; }

/* ---------- отделы ---------- */
.dept-switch { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
.dept-switch form { display: flex; align-items: center; gap: 8px; max-width: none; }
.dept-switch select.input { width: auto; min-width: 200px; padding: 6px 10px; font-weight: 600; }
.dept-name { font-weight: 650; font-size: 13.5px; padding: 6px 12px; background: #eef3fb; color: var(--accent); border-radius: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-align: left; }
.linkbtn:hover { text-decoration: underline; }
/* ---------- страница «Отделы» ---------- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.dept-card { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.dept-card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.dept-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dept-title { font-size: 17px; font-weight: 700; }
.dept-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dept-stats > div { padding: 10px 12px; text-align: center; }
.dept-stats > div + div { border-left: 1px solid var(--line); }
.dept-stats .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.dept-stats .l { font-size: 12px; color: var(--ink-3); }
.dept-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.dept-actions form { max-width: none; margin: 0; }
.dept-rename summary { list-style: none; cursor: pointer; }
.dept-rename summary::-webkit-details-marker { display: none; }
.dept-rename[open] summary { display: none; }
.dept-rename .inline-form { margin: 0; }
.dept-rename .input { min-width: 200px; }
.dept-new { border-style: dashed; background: #fafbfd; }
.dept-new-form { display: flex; gap: 8px; max-width: none; }
.dept-new-form .input { flex: 1; min-width: 0; }
/* ---------- «Система» ---------- */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.sys-grid .panel { margin: 0 0 14px; }
.disk-bar { height: 10px; background: #e9edf2; border-radius: 5px; overflow: hidden; }
.disk-bar i { display: block; height: 100%; background: var(--accent); }
.disk-bar.low i { background: var(--bad); }
.upd-status { margin-top: 10px; }

/* =====================================================================
   АДАПТИВНОСТЬ (1.10): телефон · планшет · ноутбук · большой монитор
   ≥1024 — меню слева; <1024 — меню выезжает по кнопке ☰; ≤640 — телефон:
   нижняя панель, таблицы превращаются в карточки.
   ===================================================================== */
.main { overflow-x: clip; }
.phone-only { display: none !important; }
.tabbar, .search-toggle, .search-close, .nav-toggle, .top-brand, .side-close, .side-backdrop { display: none; }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; }
.nav { display: flex; flex-direction: column; }
.nav-label { color: #6f7d92; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }

/* ---- меню пользователя ---- */
.usermenu { position: relative; margin-left: auto; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 4px;
  border-radius: 8px; color: var(--ink-2); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover, .usermenu[open] summary { background: #f2f4f7; }
.usermenu .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.usermenu .who { display: flex; flex-direction: column; line-height: 1.25; text-align: left; max-width: 220px; }
.usermenu .who .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.usermenu .who .role { font-size: 11.5px; color: var(--ink-3); }
.usermenu .chev { color: var(--ink-3); flex: 0 0 auto; }
.usermenu .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 30, 45, .14); padding: 6px; z-index: 30; }
.usermenu .menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; display: flex; flex-direction: column; gap: 2px; }
.usermenu .menu-head span { font-size: 12px; color: var(--ink-3); }
.usermenu .menu a, .usermenu .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 6px;
  color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.usermenu .menu a:hover, .usermenu .menu button:hover { background: #f2f5f9; text-decoration: none; }
.usermenu .menu form { max-width: none; margin: 0; border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 4px; }
.usermenu .menu button { color: var(--bad); }

/* ---- большой монитор ---- */
@media (min-width: 1700px) {
  .content { margin: 0 auto; }
}

/* ---- планшет и узкий ноутбук: меню выезжает ---- */
@media (max-width: 1023px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 290px; max-width: 86vw; height: 100%; z-index: 60;
    transform: translateX(-102%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.25);
    padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  body.nav-open .side { transform: none; }
  .side-backdrop { display: block; position: fixed; inset: 0; background: rgba(12, 18, 26, .45); z-index: 55;
    opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .side-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .side-close { display: block; background: none; border: 0; color: #9aa6b8; font-size: 28px; line-height: 1; padding: 2px 8px; cursor: pointer; }
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-left: -6px;
    border: 0; background: none; color: var(--ink); border-radius: 8px; cursor: pointer; flex: 0 0 auto; }
  .nav-toggle:hover { background: #f2f4f7; }
  .top-brand { display: block; flex: 0 0 auto; }
  .top-brand img { display: block; border-radius: 7px; }
  .topbar { padding: 8px 16px; gap: 10px; padding-top: calc(8px + env(safe-area-inset-top)); }
  .content { padding: 16px 16px 48px; }
  .dept-switch { margin-left: 0; }
  .dept-switch label { display: none; }
  .dept-switch select.input { min-width: 0; max-width: 220px; }
  .usermenu .who { max-width: 150px; }
  .topbar form.top-search { min-width: 120px; }
}

/* ---- телефон ---- */
@media (max-width: 640px) {
  :root { font-size: 15px; }
  .phone-only { display: block !important; }
  .nav a.phone-only { display: flex !important; }
  .desk-only { display: none !important; }
  .top-search { display: none; }
  .search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto;
    border: 0; background: none; color: var(--ink); border-radius: 8px; cursor: pointer; }
  body.search-open .topbar form.top-search { display: flex; gap: 8px; align-items: center; position: absolute; inset: 0;
    max-width: none; background: #fff; padding: calc(8px + env(safe-area-inset-top)) 10px 8px 12px; z-index: 6; }
  body.search-open .top-search .input { flex: 1; }
  body.search-open .search-close { display: block; background: none; border: 0; color: var(--accent); font: inherit; font-size: 15px;
    padding: 8px 4px; cursor: pointer; white-space: nowrap; }
  .topbar { gap: 8px; padding-left: 12px; padding-right: 10px; }
  .dept-switch { flex: 1 1 auto; min-width: 0; }
  .dept-switch label { display: none; }
  .dept-switch form { flex: 1; min-width: 0; }
  .dept-switch select.input { min-width: 0; width: 100%; padding: 7px 8px; font-size: 14px; }
  .dept-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; font-size: 13px; }
  .usermenu .who, .usermenu .chev { display: none; }
  .usermenu summary { padding: 2px; }
  .usermenu .menu { position: fixed; left: 10px; right: 10px; top: calc(58px + env(safe-area-inset-top)); min-width: 0; }
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .page-head { margin-bottom: 12px; }
  .page-head > .actions, .page-head > div.actions { width: 100%; }
  .panel { padding: 12px; margin-bottom: 12px; }
  .panel.flush > h2, .panel.flush .panel-head { padding-left: 12px; padding-right: 12px; }
  .grid { gap: 12px; }
  .btn { padding: 9px 14px; }
  .btn.small { padding: 6px 10px; }
  .input, select.input, textarea.input { font-size: 16px; padding: 9px 10px; } /* 16px — iPhone не увеличивает страницу при вводе */
  .filters .input, .filters select { flex: 1 1 140px; min-width: 0; width: 100%; }
  .filters > * { flex: 1 1 140px; }
  .filters.f-mob:not(.open) > :not(.f-bar) { display: none; }
  .filters.f-mob.open > :not(.f-bar) { flex: 1 1 calc(50% - 8px); }
  .filters.f-mob.open > :last-child { flex: 1 1 100%; display: flex; gap: 8px; align-items: center; }
  .filters.f-mob.open > :last-child > label:first-child { display: none; }
  .filters.f-mob .f-bar { display: flex; gap: 8px; align-items: flex-end; flex: 1 1 100%; }
  .filters.f-mob .f-bar > div { flex: 1 1 auto; min-width: 0; }
  .filters.f-mob .f-toggle { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 6px; height: 42px; }
  .filters.f-mob .f-toggle b { background: var(--accent); color: #fff; border-radius: 9px; font-size: 11px; padding: 1px 6px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  dl.kv { grid-template-columns: minmax(96px, 38%) 1fr; }
  dl.kv dd { min-width: 0; overflow-wrap: anywhere; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dept-grid, .sys-grid, .mp-grid, .docs { grid-template-columns: 1fr; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs a { white-space: nowrap; }
  .totals { gap: 14px; }

  /* меню: частые пункты сверху, «тяжёлые» — в группе «Удобнее с компьютера» */
  .nav a { padding: 11px 12px; font-size: 15px; }
  .nav .heavy { order: 20; font-size: 14px; padding: 8px 12px; color: #8d99ab; }
  .nav .nav-label { order: 19; }
  .nav .sep { display: none; }
  .nav a.dup-tab { display: none; } /* уже есть в нижней панели */

  /* нижняя панель */
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.97); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    padding: 7px 2px 6px; min-height: 56px; color: #6b778a; font: inherit; font-size: 10.5px; font-weight: 550;
    background: none; border: 0; cursor: pointer; text-decoration: none; }
  .tabbar svg { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--accent); }
  body.nav-open .tabbar { visibility: hidden; }

  /* таблицы → карточки (класс cards ставит app.js; .no-cards — оставить таблицей с прокруткой) */
  table.t.cards, table.t.cards tbody, table.t.cards tfoot, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards thead { display: none; }
  table.t.cards tr { border-bottom: 1px solid var(--line); padding: 10px 12px; position: relative; }
  table.t.cards tbody tr:last-child { border-bottom: 0; }
  table.t.cards td { border: 0 !important; padding: 2px 0; text-align: left; white-space: normal; background: none !important; }
  /* подпись слева, значение справа — карточка вдвое короче */
  table.t.cards td[data-label]:not(.card-title) { position: relative; padding: 3px 0 3px 112px; min-height: 24px; }
  table.t.cards td[data-label]:not(.card-title)::before { content: attr(data-label); position: absolute; left: 0; top: 4px; width: 104px;
    font-size: 12px; line-height: 1.3; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  table.t.cards td[data-label] > .small, table.t.cards td[data-label] > div { font-size: 12.5px; }
  table.t.cards td.card-title { font-size: 15.5px; font-weight: 600; padding-bottom: 4px; }
  table.t.cards td.card-empty { display: none; }
  table.t.cards td.card-thumb { float: right; width: auto; margin: 0 0 6px 10px; padding: 0; }
  table.t.cards td.card-thumb .vthumb { width: 76px; height: 57px; }
  table.t.cards td.num { text-align: left; }
  table.t.cards tr.row-bad { background: #fff8f7; box-shadow: inset 3px 0 0 var(--bad); }
  table.t.cards tr.row-warn { background: #fffcf2; box-shadow: inset 3px 0 0 #e2a400; }
  table.t.cards tfoot tr { background: #fafbfc; }
  table.t.cards .bar, table.t.cards .bar2 { max-width: 260px; }
  .panel.flush .table-wrap { border-top: 1px solid var(--line-2); margin-top: 8px; }

  .lightbox img, .lightbox video { max-width: 100vw; max-height: 78vh; border-radius: 0; }
}
@media (max-width: 380px) {
  .top-brand { display: none; }
}

/* ---- главная: показатели на узких экранах (линии рисуются тенью — нет «дыр» в сетке) ---- */
@media (max-width: 1100px) {
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-cell, .kpi-cell:nth-child(4n+2) { border: 0; box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
  .kpi-group { box-shadow: 0 1px 0 var(--line); border: 0; }
}
@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-cell { padding: 9px 10px; min-height: 58px; }
  .kpi-cell .v { font-size: 20px; }
  .kpi-cell .l { font-size: 11.5px; }
  .kpi-cell.wide2 { grid-column: span 3; }
  .kpi-cell.main { grid-column: span 3; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; min-height: 0; }
  .kpi-cell.main .l { font-size: 13px; }
  .kpi-cell.zero:empty { display: none; }
}

/* ---- поиск на телефоне ---- */
.m-search { display: flex; gap: 8px; margin-bottom: 14px; }
.m-search .input { flex: 1; font-size: 17px; padding: 12px 14px; border-radius: 10px; border-color: #c3ccd8; }
.m-search .btn { padding: 0 16px; border-radius: 10px; }
.m-hint { color: var(--ink-3); font-size: 12.5px; margin: -6px 2px 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.chips a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.chips a b { color: var(--ink); }
.chips a:hover { text-decoration: none; border-color: var(--accent); }
.rcard { display: block; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; margin-bottom: 8px; color: var(--ink); }
.rcard:hover { text-decoration: none; border-color: #b8c6da; }
.rcard .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rcard .r2 { margin-top: 5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rcard .r3 { margin-top: 4px; color: var(--ink-3); font-size: 13px; }
.rcard .t1 { font-weight: 650; font-size: 15px; }
.vrow { display: flex; gap: 12px; align-items: center; }
.vrow .vthumb { width: 64px; height: 48px; flex: 0 0 64px; }
.vrow .vt { min-width: 0; }
.vrow .vt .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; margin: 18px 2px 8px; }
.search-page { max-width: 860px; }
@media (max-width: 640px) { .m-search.phone-only { display: flex !important; } }
@media (hover: none) {
  a.kpi-cell:hover { background: none; }
  a:hover { text-decoration: none; }
}
.zn-info { margin-top: 16px; }
.zn-info summary { font-weight: 600; margin-bottom: 8px; }
.zn-info[open] summary { margin-bottom: 10px; }
@media (max-width: 640px) {
  .drop { padding: 28px 14px; font-size: 15px; }
  .zn-go { width: 100%; justify-content: center; margin-top: 4px; padding: 12px; }
}

/* ---------- документы ТС / страхование ---------- */
.doc-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.doc-tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fcfdfe; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.doc-tile.ds-expired { border-color: #f1b8b1; background: #fff6f5; box-shadow: inset 3px 0 0 var(--bad); }
.doc-tile.ds-soon, .doc-tile.ds-nodate { border-color: #f1d999; background: #fffcf0; box-shadow: inset 3px 0 0 #e2a400; }
.doc-tile.ds-none { border-style: dashed; background: #fafbfd; }
.doc-tile.ds-na { background: #f6f7f9; }
.dt-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 2px; }
.dt-num { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.dt-files { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 12.5px; }
.dt-files .dt-edit { color: var(--ink-3); margin-left: auto; }
.dt-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.dt-actions form { margin: 0; max-width: none; }
.dt-empty { margin: 2px 0; }
.dt-hist { margin-top: 6px; font-size: 12px; }
.dt-hist summary { color: var(--ink-3); font-size: 12px; }
.ins-cell { white-space: nowrap; }
.ins-cell .d { font-variant-numeric: tabular-nums; }
.ins-cell.ds-expired .d { color: var(--bad); font-weight: 650; }
.ins-cell.ds-soon .d { color: var(--warn); font-weight: 650; }
.ins-cell .n { display: block; font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.warn-ic { display: inline-flex; width: 18px; height: 18px; border-radius: 50%; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; background: #e2a400; vertical-align: 1px; margin-left: 4px; cursor: help; }
.warn-ic.bad { background: var(--bad); }
.prev-table td { vertical-align: middle; }
.prev-table .input { padding: 5px 7px; font-size: 13px; }
.prev-table tr.need td { background: #fffcf2; }
.prev-table tr.dup td { background: #f6f7f9; color: var(--ink-3); }
.prev-table select.vsel { min-width: 190px; }
.upload-big { border: 2px dashed #c8d1dd; border-radius: 12px; padding: 36px 20px; text-align: center; background: #fafbfd; cursor: pointer; }
.upload-big.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-big input { display: none; }
.upload-big .big { font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.chips a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips a.on b { color: #fff; }
.chips a.bad:not(.on) b { color: var(--bad); }
.chips a.warn:not(.on) b { color: var(--warn); }
.kpi-row.kpi-9 { grid-template-columns: 96px repeat(9, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-row.kpi-9 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-row.kpi-9 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.nav-group { color: #66748a; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; padding: 14px 10px 5px; }
.nav-group:first-child { padding-top: 2px; }
.nav .cnt.bad { background: var(--bad); }
@media (max-width: 640px) { .nav .nav-group { display: none; } }

/* ---------- карточка автомобиля: заголовок и характеристики ---------- */
.vtitle { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.vtitle .plate { font-size: 19px; align-self: center; }
.vtitle .vbrand { font-weight: 700; }
.vtitle .vmodel { font-weight: 400; color: var(--ink-2); }
.vtitle .vyear { font-size: 15px; font-weight: 400; color: var(--ink-3); }
.vside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; margin: 0 0 8px; }
.sec-h a { text-transform: none; letter-spacing: 0; font-weight: 500; }
.specgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.spec { padding: 12px 14px; display: flex; gap: 11px; align-items: flex-start; min-width: 0;
  box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.spec .ic { width: 34px; height: 34px; border-radius: 9px; background: #f0f4fa; color: #4f6b94; display: flex;
  align-items: center; justify-content: center; flex: 0 0 34px; }
.spec .ic svg { width: 19px; height: 19px; }
.spec .k { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.spec .val { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.spec .sub { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.spec-empty { margin-top: 8px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--ink-3); font-size: 13px; background: #fafbfd; }
.ftag { display: inline-block; padding: 1px 8px; border-radius: 5px; font-weight: 650; font-size: 14px; background: #eef1f5; color: var(--ink-2); }
.ftag.f-pet { background: #e4f4ea; color: #1d7a46; }
.ftag.f-dsl { background: #e3e7ee; color: #2b3442; }
.ftag.f-gas { background: #e2effc; color: #1a56a8; }
.ftag.f-ev { background: #e6f6f4; color: #0f766e; }
@media (max-width: 640px) {
  .specgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec { padding: 10px; gap: 8px; }
  .spec .ic { width: 28px; height: 28px; flex-basis: 28px; }
  .spec .val { font-size: 15px; }
  .vtitle .plate { font-size: 16px; }
}
.vstats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
@media (max-width: 640px) {
  .vstats { gap: 6px; }
  .vstats .stat { padding: 9px 10px; }
  .vstats .stat .v { font-size: 17px; }
  .vstats .stat .l { font-size: 11.5px; }
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 2px; gap: 2px; }
.seg a { padding: 6px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 550; white-space: nowrap; }
.seg a:hover { text-decoration: none; background: #f2f5f9; }
.seg a.on { background: var(--accent); color: #fff; }
.seg a.on .muted { color: rgba(255,255,255,.75); }

/* ---------- карточка заявки ---------- */
.rq-car { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.rq-photo { display: block; border-radius: 8px; overflow: hidden; background: #eef2f7; aspect-ratio: 4 / 3; border: 1px solid var(--line); }
.rq-photo img, .rq-photo svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.rq-car-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 17px; }
.rq-car-title .vmodel { color: var(--ink-2); }
.rq-specs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.rq-specs .chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px;
  background: #f6f8fb; border: 1px solid var(--line); font-size: 13px; }
.rq-specs .chip svg { width: 16px; height: 16px; color: #6b7d96; }
.rq-specs .ftag { font-size: 12.5px; padding: 0 6px; }
.rq-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.rq-facts .k { display: block; font-size: 11.5px; color: var(--ink-3); }
.rq-problem { font-size: 15px; line-height: 1.5; margin-bottom: 12px; }
.rq-to { margin: -4px 0 12px; }
.rq-kv { grid-template-columns: 150px 1fr; }
.rq-warranty summary { cursor: pointer; list-style: none; color: var(--ink); }
.rq-warranty summary::-webkit-details-marker { display: none; }
.rq-warranty { background: #fffcf2; border-color: #f1d999; }
.checklist { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.cl-head { color: var(--ink-3); margin-bottom: 6px; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--ink-2); }
.cl-ic { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #c3ccd8; display: inline-flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 800; flex: 0 0 16px; }
.cl-item.ok { color: var(--ink-3); }
.cl-item.ok .cl-ic { background: var(--ok); border-color: var(--ok); color: #fff; }
@media (max-width: 640px) {
  .rq-car { grid-template-columns: 1fr; gap: 10px; }
  .rq-photo { aspect-ratio: 16 / 8; }
  .rq-photo img { object-fit: cover; }
  .rq-kv { grid-template-columns: minmax(96px, 38%) 1fr; }
}
.inline { display: inline; margin: 0; max-width: none; }
.rq-to { margin: -4px 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.to-next { padding: 8px 12px; border-radius: 8px; background: #f2f6fc; margin-bottom: 10px; font-size: 13.5px; }
.to-next.warn { background: var(--warn-bg); color: #6b4600; }
.to-next.bad { background: var(--bad-bg); color: #7a1a12; }
.to-rec { padding: 8px 0; border-top: 1px dashed var(--line); }
.to-rec-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.to-works { margin-top: 2px; }
.to-manual { margin-top: 12px; border-top: 1px solid var(--line-2); padding-top: 10px; }
.to-manual summary { font-size: 13px; }
/* ---------- главная: «Требует внимания» ---------- */
.att-list { padding: 4px 0 6px; max-height: 470px; overflow-y: auto; }
.att { display: flex; gap: 10px; align-items: baseline; padding: 8px 16px; color: var(--ink); border-top: 1px solid var(--line-2); }
.att:first-child { border-top: 0; }
.att:hover { background: #f7f9fc; text-decoration: none; }
.att-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; align-self: center; background: #c4ccd8; }
.att-bad .att-dot { background: var(--bad); }
.att-warn .att-dot { background: #e2a400; }
.att-kind { flex: 0 0 96px; font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; }
.att-text { min-width: 0; font-size: 13.5px; }
.att-bad .att-text { color: #7a1a12; }
.att-more summary { padding: 8px 16px; font-size: 13px; }
@media (max-width: 640px) { .att-kind { flex-basis: 74px; font-size: 11px; } .att { padding: 8px 12px; } }
/* ---------- состояние ТС: группы сворачиваются ---------- */
.state-tree .tree-child { display: none; }
.state-tree .tree-child td:first-child { padding-left: 34px; }
.state-tree tbody.open .tree-child { display: table-row; }
.tree-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.tree-ar { display: inline-block; transition: transform .15s; color: var(--ink-3); width: 12px; }
tbody.open .tree-ar { transform: rotate(90deg); }
.state-tree tr.tree-head td { background: #fafbfd; }
/* ---------- ТО: группы и окно ---------- */
.to-group > summary { list-style: none; cursor: pointer; padding: 14px 16px 10px; margin: 0; }
.to-group > summary::-webkit-details-marker { display: none; }
.to-group > summary h2::before { content: "▸ "; color: var(--ink-3); display: inline-block; transition: transform .15s; }
.to-group[open] > summary h2::before { content: "▾ "; }
.to-group.to-overdue { border-color: #f1c8c3; }
.to-group.to-soon { border-color: #f1d999; }
.dlg { border: 0; border-radius: 12px; padding: 20px; width: min(420px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(10,20,35,.25); }
.dlg::backdrop { background: rgba(12, 18, 26, .45); }
.dlg form { max-width: none; }
/* ---------- гарантия по заявкам ---------- */
.wgroup.soon { border-color: #f1d999; }
.wsum { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 12px 16px; }
.wsum::-webkit-details-marker { display: none; }
.wsum:hover { background: #fafcff; }
.wkinds { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.wgroup[open] .wsum { border-bottom: 1px solid var(--line-2); }
@media (max-width: 900px) { .wsum { grid-template-columns: 1fr; } }
.dept-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dept-flags:empty { display: none; }
/* ---------- кнопка «Наверх» ---------- */
.to-top { position: fixed; right: 20px; bottom: 24px; z-index: 35; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; box-shadow: 0 6px 18px rgba(20,30,45,.15); color: var(--ink-2); font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 640px) { .to-top { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; } }

/* кнопка «Фильтры» нужна только на телефоне */
.f-toggle { display: none; }
.f-bar { display: contents; }
