:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --ink: #1b2130;
  --ink-2: #3b4456;
  --muted: #6b7385;
  --line: #e2e5eb;
  --line-2: #eef0f4;
  --side: #1d2230;
  --side-ink: #c9cfdb;
  --accent: #d9480f;
  --accent-2: #b93d0c;
  --accent-soft: #fff1ea;
  --blue: #1c64c8;
  --blue-soft: #e8f0fc;
  --green: #2b8a3e;
  --green-soft: #e8f6ec;
  --amber: #b35c00;
  --amber-soft: #fff4e0;
  --red: #c92a2a;
  --red-soft: #fdecec;
  --violet: #6741d9;
  --violet-soft: #f0ebff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 25, 40, .06), 0 4px 16px rgba(20, 25, 40, .05);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 2px 0 4px; line-height: 1.2; }
h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 10px; }
.ic { flex: none; }
.mono { font-family: var(--mono); font-size: .95em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.ok { color: var(--green); }
.warn { color: var(--amber); font-weight: 600; }
.danger { color: var(--red); }
.plus { color: var(--green); }
.minus { color: var(--red); }
.grow { flex: 1 1 auto; }
.inline { display: inline; }
.lead { font-size: 16px; }
.note { background: #fffbea; border: 1px solid #f3e3a1; border-radius: 8px; padding: 8px 12px; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 14px 10px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 8px 16px; }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 17px; letter-spacing: .2px; }
.brand small { display: block; color: #8d95a8; font-size: 11.5px; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px; flex: none; }
.nav-h { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: #7d869a; margin: 16px 10px 6px; }
.nav-a { display: flex; align-items: center; gap: 10px; color: var(--side-ink); padding: 8px 10px; border-radius: 8px; position: relative; }
.nav-a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-a.on { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-a.on::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-badge { margin-left: auto; background: var(--accent); color: #fff; font-style: normal; font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(217, 72, 15, .5); } 50% { box-shadow: 0 0 0 6px rgba(217, 72, 15, 0); } }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.top-title { font-weight: 650; font-size: 15px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { color: var(--ink-2); font-weight: 600; }
.menu-btn { display: none; background: none; border: 0; font-size: 20px; cursor: pointer; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill-demo { background: var(--violet-soft); color: var(--violet); font-weight: 700; }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill.flash-on { background: var(--green-soft); color: var(--green); }
.content { padding: 20px; max-width: 1480px; width: 100%; }
body.wide .content { max-width: none; }

/* ---------- элементы ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card.empty { text-align: center; padding: 40px 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 10px; }
.card-h h2 { margin: 0; }
.card-h + .tbl, .card .tbl + .card-h { margin-top: 0; }
.card .card-h:not(:first-child) { margin-top: 22px; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-h { margin: 24px 0 10px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: #f7f8fa; border-color: #cfd4dc; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn-ok:hover { background: #237032; }
.btn-warn { background: var(--amber-soft); border-color: #f0c98a; color: var(--amber); }
.btn-danger-o { color: var(--red); border-color: #f1b7b7; }
.btn-danger-o:hover { background: var(--red-soft); }
.btn-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-on:hover { background: var(--ink-2); }
.btn-on .cnt { background: rgba(255, 255, 255, .2); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 12.5px; }
.btn-lg { padding: 11px 18px; font-size: 15px; }
.btn.block { width: 100%; margin-top: 8px; }
.btn-link { background: none; border: 0; color: var(--blue); cursor: pointer; font: inherit; padding: 0; }
.btn-link.danger { color: var(--red); font-size: 12px; margin-left: 6px; }
.btn-x { background: none; border: 0; color: #9aa1b0; font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.btn-x:hover { color: var(--red); background: var(--red-soft); }
.cnt { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--line-2); color: var(--muted); font-size: 12px; }

input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #d3d8e0; border-radius: 8px; padding: 8px 10px; background: #fff; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(28, 100, 200, .25); border-color: var(--blue); }
input[readonly] { background: var(--line-2); }
input.big { font-size: 17px; padding: 12px 14px; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }
label.inline-l { flex-direction: row; align-items: center; gap: 6px; margin: 0; }
label.inline-l input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
legend { font-weight: 700; padding: 0 6px; }
fieldset label.check { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-grid h2 { grid-column: 1 / -1; }
.row-input { display: flex; gap: 6px; }
.sep { text-align: center; color: var(--muted); margin: 6px 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.w-s { width: 70px; flex: none; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; }
.toolbar input.grow { flex: 1 1 260px; }
.quick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.card:not(.flush) .tbl th { background: none; padding-left: 4px; padding-right: 4px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.card:not(.flush) .tbl td { padding-left: 4px; padding-right: 4px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { border-top: 1px solid var(--line); border-bottom: 0; padding-top: 10px; }
.tbl.hover tbody tr { cursor: pointer; }
.tbl.hover tbody tr:hover td { background: #f8f9fb; }
.num, .tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .empty-cell { text-align: center; color: var(--muted); padding: 22px; }
.tbl tr.struck td { color: #9aa1b0; text-decoration: line-through; }
.tbl.lines td { vertical-align: middle; }
.tbl.lines input { padding: 6px 8px; }
.w-qty { width: 92px; }
.w-price { width: 110px; }
.w-cell { width: 120px; }
.w-disc { width: 76px; }
.w-sup { width: 150px; margin-top: 4px; padding: 4px 6px; font-size: 12.5px; }
.w-date { width: 150px; margin-top: 4px; padding: 4px 6px; font-size: 12.5px; }
ul.plain { list-style: none; padding: 0; margin: 0 0 10px; }
ul.plain li { padding: 4px 0; }
ol.steps { margin: 0; padding-left: 20px; }
ol.steps li { margin-bottom: 8px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--line-2); color: var(--ink-2); vertical-align: middle; }
.st-new, .ln-to_order { background: #eef0f4; color: #4b5466; }
.st-ordered, .ln-ordered { background: var(--blue-soft); color: var(--blue); }
.st-arrived, .ln-arrived { background: var(--accent-soft); color: var(--accent); }
.st-notified { background: var(--violet-soft); color: var(--violet); }
.st-issued, .ln-issued, .ln-reserved { background: var(--green-soft); color: var(--green); }
.st-cancelled, .ln-cancelled { background: var(--red-soft); color: var(--red); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--line-2); color: var(--ink-2); vertical-align: 1px; white-space: nowrap; }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-orange { background: var(--accent-soft); color: var(--accent); }
.plate { font-family: var(--mono); border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 5px; font-size: 12px; white-space: nowrap; }
.tel { font-weight: 700; white-space: nowrap; }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.flash-ok { background: var(--green-soft); border-color: #b7e0c1; color: #1f6b30; }
.flash-error { background: var(--red-soft); border-color: #f2c0c0; color: #9b1f1f; }
.flash-info { background: var(--blue-soft); border-color: #c4d8f5; }
.flash-call { background: var(--accent-soft); border-color: #f7c6ae; color: #8a2f08; font-size: 15px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpis.small { grid-template-columns: repeat(auto-fit, minmax(160px, 220px)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; box-shadow: var(--shadow); color: var(--ink); display: flex; flex-direction: column; gap: 2px; }
a.kpi:hover { border-color: #c9ced8; text-decoration: none; }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi b { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi-hot { border-color: #f5b899; background: linear-gradient(0deg, #fff 0%, #fff6f1 100%); }
.kpi-hot b { color: var(--accent); }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cols > *, .screen > * { min-width: 0; }
.cols-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.cols-wide { grid-template-columns: minmax(0, 1fr) 320px; }

/* рабочие экраны: продажа, приёмка, новый заказ */
.screen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.screen-side { position: sticky; top: 70px; }
.empty-hint { text-align: center; color: var(--muted); padding: 30px 10px 14px; }
.empty-hint .ic { color: #b7bdc9; }
.total-box { background: var(--ink); color: #fff; border-radius: 10px; padding: 14px 16px; margin: 6px 0 12px; display: flex; flex-direction: column; }
.total-box span { color: #aab2c3; font-size: 12.5px; }
.total-box b { font-size: 30px; font-variant-numeric: tabular-nums; }
.total-box small { color: #aab2c3; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 6px; margin-bottom: 12px; }
.pay { border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 9px 6px; font: inherit; font-weight: 650; cursor: pointer; text-align: center; flex-direction: row; justify-content: center; margin: 0; }
.pay.on, .pay:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.pay input { position: absolute; opacity: 0; width: 1px; }
.change { font-size: 18px; font-weight: 700; color: var(--green); min-height: 4px; margin-bottom: 4px; }
.client-box { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; background: var(--blue-soft); border-radius: 8px; padding: 9px 12px; margin: -2px 0 12px; }
.client-box.big { font-size: 15px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid #d3d8e0; border-radius: 8px; overflow: hidden; }
.stepper button { border: 0; background: #f4f5f7; width: 28px; height: 34px; cursor: pointer; font-size: 16px; }
.stepper input { border: 0; border-radius: 0; width: 52px; text-align: center; padding: 6px 2px; }
.free-line { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; }
.free-line summary { cursor: pointer; color: var(--blue); font-weight: 600; margin-bottom: 10px; }

/* подсказки поиска */
.picker { position: absolute; z-index: 100; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 25, 40, .16); max-height: 420px; overflow-y: auto; }
.pk-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.pk-row.on, .pk-row:hover { background: var(--blue-soft); }
.pk-side { text-align: right; white-space: nowrap; }
.pk-empty { padding: 12px; color: var(--muted); }
.pk-foot { padding: 10px 12px; cursor: pointer; color: var(--blue); background: #fafbfc; }
.pk-foot:hover { background: var(--blue-soft); }

/* звонки и заказы */
.call-list { display: flex; flex-direction: column; }
.call-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
.call-item:hover { background: var(--accent-soft); text-decoration: none; }
.call-item.later { opacity: .6; }
.call-card { border-left: 4px solid var(--accent); }
.call-card.later { border-left-color: #c8cdd6; opacity: .85; }
.call-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.call-head .tel { font-size: 17px; }
.card-call { border: 2px solid #f5b899; background: linear-gradient(180deg, #fff6f1 0%, #fff 60%); }
.card-call h2 { color: var(--accent-2); }
.card-ok { border: 2px solid #c7e6cf; }
.call-who { font-size: 18px; margin-bottom: 8px; }
.call-who .tel { font-size: 20px; margin-left: 6px; }
.call-form { margin-top: 10px; }
.call-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.call-more { margin-top: 10px; }
.call-more summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.call-log { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.call-log:last-child { border-bottom: 0; }
.big-num { font-size: 22px; }
.vehicle { padding: 8px 0; border-bottom: 1px solid var(--line-2); }

.progress { list-style: none; display: flex; padding: 0; margin: 0 0 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.progress li { flex: 1; padding: 10px 14px; position: relative; color: var(--muted); border-right: 1px solid var(--line-2); display: flex; flex-direction: column; }
.progress li:last-child { border-right: 0; }
.progress li b { font-size: 13px; }
.progress li small { font-size: 11.5px; min-height: 16px; }
.progress li.done { color: var(--green); background: #f6fbf7; }
.progress li.now { color: var(--accent-2); background: var(--accent-soft); }
.progress li.now b::before { content: "● "; }
.progress li.skip { opacity: .45; }

/* ячейки */
.cell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.cell { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; color: var(--ink); background: #fafbfc; display: flex; flex-direction: column; }
.cell:hover { border-color: var(--blue); text-decoration: none; }
.cell small { color: var(--muted); font-size: 11.5px; }
.cell.full { background: var(--green-soft); border-color: #c7e6cf; }
.cell.k-out { background: var(--accent-soft); border-color: #f7c6ae; }
.cell.k-def { background: var(--red-soft); }
.scan-test { font-size: 16px; padding: 18px; border: 2px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); }
.scan-test b { color: var(--ink); font-size: 18px; }

/* окна */
dialog.modal { border: 0; border-radius: 14px; padding: 20px 22px; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(10, 15, 30, .3); }
dialog.modal::backdrop { background: rgba(15, 20, 35, .45); }
dialog.modal .actions { margin-top: 8px; }
.modal-receipt { width: min(420px, 94vw) !important; }
.modal-receipt iframe { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.modal-receipt .r-head { margin-bottom: 10px; }
.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg label { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; margin: 0; cursor: pointer; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg input { width: auto; }

#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, 90vw); }
.toast { background: var(--ink); color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: 0 8px 24px rgba(10, 15, 30, .25); transition: opacity .35s, transform .35s; }
.toast a { color: #fff; text-decoration: underline; font-weight: 700; }
.toast-error { background: #9b1f1f; }
.toast-ok { background: #1f6b30; }
.toast-call { background: var(--accent); font-weight: 600; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- автосервис и шиномонтаж ---------- */
h3 { font-size: 14px; margin: 14px 0 8px; }
.tag-violet { background: var(--violet-soft); color: var(--violet); }
.wo-open { background: #eef0f4; color: #4b5466; }
.wo-in_work { background: var(--blue-soft); color: var(--blue); }
.wo-ready { background: var(--accent-soft); color: var(--accent); }
.wo-ready.wo-notified { background: var(--violet-soft); color: var(--violet); }
.wo-closed { background: var(--green-soft); color: var(--green); }
.wo-cancelled { background: var(--red-soft); color: var(--red); }
.tire-on_car { background: var(--green-soft); color: var(--green); }
.tire-storage { background: var(--violet-soft); color: var(--violet); }
.tire-with_client { background: var(--blue-soft); color: var(--blue); }
.tire-disposed { background: var(--red-soft); color: var(--red); }
.plate-lg { font-size: 17px; padding: 1px 8px; vertical-align: 3px; }
.add-row { margin: 12px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip { border: 1px solid var(--line); background: #fafbfc; border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip b { margin-left: 4px; color: var(--ink); }
.sub-form { background: #f7f8fa; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 12px 2px; margin: 4px 0 10px; }
.avail-order { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--accent-soft); border: 1px solid #f7c6ae; border-radius: 10px; padding: 9px 12px; margin: 8px 0; }
.row-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; }
.inline-details { flex: 1 1 260px; }
.inline-details summary { list-style: none; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] .sub-form { margin-top: 8px; }
.att-order { margin-top: 8px; }
.wo-pay .total-box { margin-top: 0; }
.tire-log { list-style: none; padding: 0; margin: 0 0 10px; }
.tire-log li { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.tire-log li:last-child { border-bottom: 0; }
.tire-change summary { cursor: pointer; color: var(--blue); font-weight: 600; margin: 4px 0 12px; }
.tire-change fieldset { margin-bottom: 12px; }
.tire-change fieldset > label.check { align-items: flex-start; }
.tire-change .tire-fields { margin: 4px 0 8px 24px; }
.tire-change .r-more, .tire-change .m-more { margin-top: 8px; }
.tire-set { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; background: #fafbfc; border-left: 3px solid var(--line); }
.tire-set.st-on_car { border-left-color: var(--green); }
.tire-set.st-storage { border-left-color: var(--violet); }
.tire-set.st-with_client { border-left-color: var(--blue); }
.tire-set.st-disposed { opacity: .6; }
.card-h.pad { padding: 14px 18px 0; }
.tbl.kv th { width: 40%; text-transform: none; letter-spacing: 0; font-size: 13px; background: none; color: var(--muted); }
details.card > summary { cursor: pointer; }
details.card[open] > summary { margin-bottom: 12px; }

/* история машины */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); position: relative; }
.tl-item:last-child { border-bottom: 0; }
.tl-date { display: flex; flex-direction: column; border-right: 3px solid var(--blue); padding-right: 10px; }
.tl-tire .tl-date { border-right-color: var(--violet); }
.tl-shop .tl-date { border-right-color: var(--line); }
.tl-open .tl-date { border-right-color: var(--accent); }
.tl-date small { color: var(--muted); font-size: 12px; }
.tl-sum { float: right; font-weight: 700; }
.tl-lines { list-style: none; padding: 0; margin: 6px 0; font-size: 13px; }
.tl-lines li { padding: 2px 0; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.tl-lines .ic { color: var(--muted); align-self: center; }

/* тарифы шиномонтажа */
.matrix-h { margin-top: 22px; }
.matrix-wrap { overflow-x: auto; }
.tbl.matrix th { background: none; }
.tbl.matrix tbody th { text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.tbl.matrix td { padding: 4px 3px; }
.tbl.matrix input { width: 72px; padding: 5px 6px; text-align: right; }

/* запись: сетка дня по постам */
.day-chip { flex-direction: column; gap: 0; padding: 5px 10px; line-height: 1.2; }
.day-chip.today:not(.btn-on) { border-color: var(--accent); }
.sched-card { overflow-x: auto; }
.sched { --slot-h: 30px; display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(170px, 1fr)); min-width: calc(56px + var(--cols) * 170px); }
.sched-corner, .sched-post { position: sticky; top: 0; background: #fafbfc; border-bottom: 1px solid var(--line); padding: 8px 10px; z-index: 2; }
.sched-corner { font-size: 12px; color: var(--muted); text-align: center; }
.sched-post { border-left: 1px solid var(--line-2); display: flex; flex-direction: column; }
.sched-post small { color: var(--muted); font-size: 11.5px; }
.sched-times { display: flex; flex-direction: column; }
.sched-t:first-child { transform: none; }
.bk > * { flex: none; }
.bk-h { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nowrap { white-space: nowrap; }
.sched-t { height: var(--slot-h); font-size: 11.5px; color: var(--muted); text-align: right; padding: 0 8px 0 0; transform: translateY(-7px); }
.sched-col { position: relative; border-left: 1px solid var(--line-2); display: flex; flex-direction: column; }
.slot { height: var(--slot-h); border: 0; border-bottom: 1px dashed var(--line-2); background: none; cursor: pointer; padding: 0; flex: none; }
.slot.hour { border-top: 1px solid var(--line); }
.slot:hover { background: var(--blue-soft); }
.slot.pick { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.bk { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; border-left: 4px solid; z-index: 1; }
.bk:hover, .bk:focus { z-index: 3; box-shadow: 0 6px 18px rgba(20, 25, 40, .18); outline: none; height: auto !important; min-height: 30px; }
.bk small { color: inherit; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-booked { background: var(--blue-soft); border-color: var(--blue); color: #154a95; }
.bk-work { background: var(--accent-soft); border-color: var(--accent); color: #8a2f08; }
.bk-done { background: var(--green-soft); border-color: var(--green); color: #1f6b30; }
.bk-noshow { background: #f1f2f5; border-color: #b7bdc9; color: #7d869a; text-decoration: line-through; }
.bk-wo { font-weight: 700; }
.sched-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.sched-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* вход */
body.bare { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at 30% 20%, #2a3144 0%, #161a25 70%); }
body.bare > .flash { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); }
.card.login { width: min(380px, 92vw); padding: 28px; display: flex; flex-direction: column; gap: 4px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-brand b { display: block; font-size: 22px; }
.login-brand small { color: var(--muted); }

/* ---------- узкие экраны и ТСД ---------- */
@media (max-width: 1100px) {
  .screen { grid-template-columns: 1fr; }
  .screen-side { position: static; }
  .cols, .cols-side, .cols-wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .menu-btn { display: block; }
  .content { padding: 14px 12px; }
  .top { padding: 8px 12px; }
  .top-right .who, #scan-pill { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .card { overflow-x: auto; }
  .tbl th, .tbl td { padding: 8px; }
  .progress { flex-wrap: wrap; }
  .progress li { flex: 1 1 33%; }
  .avail-order { flex-wrap: wrap; }
  .tl-item { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; }
}

@media print {
  .side, .top, .toolbar, .actions, .quick, #toasts, .call-form { display: none !important; }
  .app { display: block; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}
