/* Шрифт хранится на вашем сервере: Inter — строгий деловой шрифт (лицензия OFL) */
@font-face { font-family: "Inter"; src: url("fonts/InterVariable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
    /* Фирменные: чёрный как на сайте ninedetailing.md и латунный акцент */
    --black: #030504;
    --graphite: #15191d;
    --accent: #b8913f;
    --accent-ink: #030504;
    --accent-soft: #f3ead6;
    --bg: #eceef1;
    --panel: #ffffff;
    --ink: #111416;
    --muted: #5d6670;
    --line: #d7dbe0;
    --brand: #030504;
    --brand-ink: #ffffff;
    --plate-blue: #1d3e8a;
    --danger: #b3261e;
    --s-new: #6a5fb0;
    --s-accepted: #2c5aa8;
    --s-in_work: #b86e00;
    --s-ready: #1b7f47;
    --s-delivered: #6b7480;
    --s-cancelled: #b3261e;
    --r: 14px;
    --display: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: var(--ink);
    background: var(--bg);
    font-feature-settings: "kern", "case";
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--brand); }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .4rem 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .6rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.warn { background: #fdecea; color: var(--danger); padding: .6rem .8rem; border-radius: 8px; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

/* Верхняя панель */
.top { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; padding: .5rem 1rem; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { color: #fff; font-weight: 800; text-decoration: none; letter-spacing: .02em; margin-right: .5rem; white-space: nowrap; }
.menu { display: flex; align-items: center; gap: .5rem 1rem; flex: 1; min-width: 0; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { color: #c9d2dc; text-decoration: none; padding: .45rem .7rem; border-radius: 8px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.14); }
.logout { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.top .linkbtn { color: #c9d2dc; font-size: .875rem; white-space: nowrap; }
.menubtn { display: none; align-items: center; gap: .5rem; min-height: 40px; padding: .3rem .8rem; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; background: transparent; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.burger, .burger::before, .burger::after { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 1px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; } .burger::after { top: 6px; }
.top.open .burger { background: transparent; }
.top.open .burger::before { top: 0; transform: rotate(45deg); }
.top.open .burger::after { top: 0; transform: rotate(-45deg); }
.linkbtn.danger { color: var(--danger); font-size: .875rem; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 1rem; }
.flash { background: #e3f3e9; border-left: 4px solid var(--s-ready); padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #163172; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { min-height: 36px; padding: .3rem .7rem; font-size: .875rem; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; min-height: 44px; width: 100%; }
textarea { min-height: 0; resize: vertical; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); }
.f { display: flex; flex-direction: column; gap: .25rem; }
.f > span { font-size: .875rem; color: var(--muted); font-weight: 600; }
.f.inline { flex: 1; min-width: 160px; }
.check { display: flex; gap: .6rem; align-items: center; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.grid2, .grid3 { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.card { background: var(--panel); border-radius: var(--r); padding: 1.1rem 1.2rem; margin-bottom: 1rem; border: 1px solid #d8dee4; }
.card.narrow, .narrow { max-width: 520px; }
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols > * { min-width: 0; }
.cols + * { margin-top: 1rem; }

/* Номер как молдавский номерной знак — главный визуальный элемент */
.plate { display: inline-flex; align-items: stretch; border: 2px solid var(--ink); border-radius: 5px; background: #fff; overflow: hidden; line-height: 1; vertical-align: middle; box-shadow: inset 0 0 0 1px #fff; }
.plate-md { background: var(--brand); color: #fff; font-size: .6em; font-weight: 700; padding: .35em .3em; display: flex; align-items: flex-end; }
.plate-num { font-family: "DIN Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; font-weight: 700; letter-spacing: .06em; padding: .3em .45em .25em; font-size: 1.05em; color: var(--ink); }
h1 .plate { font-size: 1.35rem; }

/* Статусы */
.st { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; color: #fff; background: var(--muted); }
.st-new { background: var(--s-new); } .st-accepted { background: var(--s-accepted); } .st-in_work { background: var(--s-in_work); }
.st-ready { background: var(--s-ready); } .st-delivered { background: var(--s-delivered); } .st-cancelled { background: var(--s-cancelled); }

.seg { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 1rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.seg button { flex: 1 1 auto; min-height: 48px; border: 0; border-right: 1px solid var(--line); background: transparent; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; padding: .4rem .8rem; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: #f3f5f7; }
.seg button[aria-pressed="true"] { color: #fff; }
.seg .seg-new[aria-pressed="true"] { background: var(--s-new); } .seg .seg-accepted[aria-pressed="true"] { background: var(--s-accepted); }
.seg .seg-in_work[aria-pressed="true"] { background: var(--s-in_work); } .seg .seg-ready[aria-pressed="true"] { background: var(--s-ready); }
.seg .seg-delivered[aria-pressed="true"] { background: var(--s-delivered); } .seg .seg-cancelled[aria-pressed="true"] { background: var(--s-cancelled); }

/* Доска заказов */
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1; font-size: 1.05rem; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.col { background: #dde2e8; border-radius: var(--r); padding: .7rem; border-top: 4px solid var(--muted); min-height: 120px; }
.col-new { border-top-color: var(--s-new); } .col-accepted { border-top-color: var(--s-accepted); }
.col-in_work { border-top-color: var(--s-in_work); } .col-ready { border-top-color: var(--s-ready); }
.col h2 { font-size: 1rem; display: flex; justify-content: space-between; }
.count { color: var(--muted); font-weight: 600; font-size: .9em; }
.empty { color: var(--muted); font-size: .875rem; margin: 0; }
.ocard { display: flex; flex-direction: column; gap: .3rem; background: var(--panel); border-radius: 8px; padding: .7rem; margin-bottom: .5rem; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.ocard:hover { border-color: var(--brand); }
.ocard .plate { align-self: flex-start; }
.ocard-car { font-weight: 700; }
.ocard-meta { font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; gap: .5rem; }
.ocard-meta b { color: var(--ink); }

/* Таблицы */
.t { width: 100%; border-collapse: collapse; }
.t td, .t th { padding: .55rem .5rem; border-bottom: 1px solid #e3e8ed; text-align: left; vertical-align: middle; }
.t th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.t tr:last-child td { border-bottom: 0; }
.t .total td { font-weight: 800; border-top: 2px solid var(--ink); }
.num { text-align: right !important; white-space: nowrap; }
.off { opacity: .55; }
.scroll { overflow-x: auto; margin-bottom: 1rem; }
.price { table-layout: auto; }
.price input { width: 100%; min-width: 230px; }
.price input.numin { width: 96px; min-width: 96px; text-align: right; }
.price input.short { width: 70px; min-width: 70px; }
.price th.num, .price td:has(.numin) { width: 1%; }
.addform { margin: 1rem 0; padding-top: 1rem; border-top: 1px dashed var(--line); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 1rem 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.hist { padding: .6rem 0; border-bottom: 1px solid #e3e8ed; display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.hist div { flex-basis: 100%; }
.pager { align-items: center; margin-top: 1rem; }

/* Заказ */
.ohead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.ohead p { margin: .2rem 0; }
.contact { display: flex; flex-wrap: wrap; gap: .5rem; }
.notice { border-left: 5px solid var(--s-ready); }
.quote { background: #f3f5f7; padding: .6rem .8rem; border-radius: 8px; }
.dmg { display: grid; gap: .4rem; }
.dmg-row { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(120px, 1fr) 2fr; gap: .5rem; align-items: center; padding: .25rem .4rem; border-radius: 8px; }
.dmg-row.has { background: #fff4e0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; margin-bottom: .8rem; }
.photos figure { margin: 0; }
.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; background: #eef1f4; }
.photos form { margin: .2rem 0 0; }
.upload-btn { cursor: pointer; }
.uploader { margin-top: 1.2rem; }
.sigblock { margin-top: 1.2rem; }
.sigpad canvas { width: 100%; max-width: 640px; height: 200px; border: 2px dashed var(--line); border-radius: 8px; background: #fff; touch-action: none; display: block; margin-bottom: .6rem; }
.sigimg { max-width: 320px; width: 100%; border-bottom: 1px solid var(--ink); display: block; margin-bottom: .5rem; }
.danger-zone { margin: 2rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* Вход */
.login { max-width: 400px; margin: 12vh auto 0; }
.login-brand { font-weight: 800; font-size: 1.6rem; margin-bottom: 1rem; text-align: center; }

@media (max-width: 1000px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .board { grid-template-columns: 1fr; }
    .wrap { padding: .7rem; }
    .dmg-row { grid-template-columns: 1fr 1fr; }
    .dmg-row input { grid-column: 1 / -1; }
    .t td { padding: .45rem .3rem; }
    .cols { grid-template-columns: 1fr; }
}

/* Акт для печати */
.act-body { background: #d9dee3; }
.act-tools { max-width: 210mm; margin: 1rem auto; display: flex; gap: .5rem; padding: 0 .5rem; }
.act { background: #fff; max-width: 210mm; margin: 0 auto 2rem; padding: 14mm 14mm 12mm; font-size: 10.5pt; line-height: 1.35; color: #000; }
.act h1 { font-size: 14pt; display: block; margin: 5mm 0 4mm; }
.act h2 { font-size: 11pt; margin: 5mm 0 2mm; }
.act .ru { color: #444; font-weight: normal; }
.act-head { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.act-head td { vertical-align: top; border-bottom: 2px solid #000; padding-bottom: 3mm; }
.act-no { text-align: right; font-size: 12pt; font-weight: 700; }
.act-t { width: 100%; border-collapse: collapse; }
.act-t th, .act-t td { border: 1px solid #999; padding: 1.5mm 2mm; text-align: left; vertical-align: top; }
.act-t th { width: 38%; font-weight: 600; background: #f4f4f4; }
.act-t .total td { font-weight: 800; }
.act-photos { width: 100%; border-collapse: collapse; }
.act-photos td { width: 25%; padding: 1mm; vertical-align: top; }
.act-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.terms { padding-left: 5mm; font-size: 9pt; }
.terms li { margin-bottom: 1.5mm; }
.consent { font-size: 9.5pt; }
.signs { width: 100%; border-collapse: collapse; margin-top: 8mm; }
.signs td { width: 47%; vertical-align: top; }
.signs td.gap { width: 6%; }
.sigline { border-bottom: 1px solid #000; height: 22mm; display: flex; align-items: flex-end; }
.sigline img { max-height: 21mm; max-width: 100%; }
@media print {
    @page { size: A4; margin: 0; }
    .act-body { background: #fff; }
    .act-tools { display: none; }
    .act { margin: 0; max-width: none; }
    .act-photos, .signs { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: .8rem; }
fieldset.plain:disabled input, fieldset.plain:disabled select, fieldset.plain:disabled textarea { background: #f3f5f7; color: var(--ink); opacity: 1; }
.lock { background: #fff4e0; border-left: 4px solid var(--s-in_work); padding: .6rem .9rem; border-radius: 6px; margin: 0 0 1rem; }

/* Доска: просрочка */
.ocard.late { border-color: var(--danger); }
.late-txt { color: var(--danger); font-weight: 700; }

/* Оплата */
.paysum { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0 0 .8rem; }
.debt { color: var(--danger); font-weight: 700; }
.paid { color: var(--s-ready); font-weight: 700; }

/* Календарь */
.calhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem; }
.calhead h1 { margin-bottom: .4rem; }
.cal { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; background: var(--panel); border: 1px solid #d8dee4; border-radius: var(--r); }
.cal th, .cal td { border-right: 1px solid #e3e8ed; border-bottom: 1px solid #e3e8ed; vertical-align: top; padding: .4rem; width: 13%; }
.cal thead th { font-size: .875rem; color: var(--muted); text-align: left; background: #f3f5f7; }
.cal th.lane { width: 9%; text-align: left; font-size: .875rem; background: #f3f5f7; position: sticky; left: 0; z-index: 1; }
.cal .today { background: #eef3ff; }
.cal thead th.today { color: var(--brand); }
.calitem { display: flex; flex-direction: column; font-size: .8rem; line-height: 1.25; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 6px; padding: .3rem .4rem; margin-bottom: .3rem; text-decoration: none; color: var(--ink); }
.calitem b { font-size: .85rem; letter-spacing: .03em; }
.calitem.cont { opacity: .7; border-style: dashed; border-left-style: solid; }
.st-border-new { border-left-color: var(--s-new); } .st-border-accepted { border-left-color: var(--s-accepted); }
.st-border-in_work { border-left-color: var(--s-in_work); } .st-border-ready { border-left-color: var(--s-ready); }
.st-border-delivered { border-left-color: var(--s-delivered); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; }
.legend-item { display: inline-flex; margin: 0; }

/* Аналитика */
.periods input[type="date"] { width: auto; min-height: 36px; padding: .2rem .5rem; }
.btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--panel); border: 1px solid #d8dee4; border-radius: var(--r); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi b { font-size: 1.6rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .8rem; }
.kpi-bad b { color: var(--danger); }
.nowrow { display: flex; flex-wrap: wrap; gap: .5rem 1.2rem; align-items: center; }
.nowitem { display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; color: var(--ink); }
.nowitem.bad b { color: var(--danger); }
.daychart { display: flex; align-items: flex-end; gap: 3px; height: 200px; overflow-x: auto; padding-top: 1rem; }
.daycol { flex: 1 0 18px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.daybar { width: 100%; background: var(--brand); border-radius: 3px 3px 0 0; }
.dayval { font-size: .65rem; color: var(--muted); white-space: nowrap; }
.daylbl { font-size: .7rem; color: var(--muted); margin-top: 2px; }
.daylbl.we { color: var(--danger); }
.bars .barcell { width: 30%; }
.bar { display: block; height: 10px; background: var(--brand); border-radius: 5px; }

/* Смета и согласование */
.items .grp th { background: #f3f5f7; font-size: .8rem; color: var(--muted); padding: .35rem .5rem; }
.tags { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .2rem; }
.tag { display: inline-block; font-size: .72rem; line-height: 1.3; padding: .1rem .45rem; border-radius: 999px; background: #eef1f4; color: var(--muted); font-weight: 600; align-self: flex-start; }
.tag-detailing { background: #e8edf8; color: var(--brand); }
.tag-wash { background: #e0f2ea; color: #14633a; }
.tag-body { background: #fdeee0; color: #9a4d00; }
.tag-sto { background: #e7f3ec; color: #1b6a3d; }
.tag-ok { background: #e3f3e9; color: #1b6a3d; }
.tag-wait { background: #fff0cc; color: #8a5a00; }
.pending { margin: 1rem 0; padding: .9rem 1rem; border: 2px solid #f2b705; border-radius: var(--r); background: #fffaf0; display: flex; flex-direction: column; gap: .6rem; }
.pending h3 { margin: 0; }
.pend-item { align-items: flex-start; }
.pre { white-space: pre-line; }
.inline-del { margin: .2rem 0; }
.declined { margin: .6rem 0; }
.custom { border: 1px dashed var(--line); border-radius: 8px; padding: .5rem .8rem; }
.custom summary { cursor: pointer; font-weight: 600; }
.custom .grid3 { margin-top: .7rem; }

/* Прайс */
.price select { min-width: 150px; }
.cathead th { background: var(--ink); color: #fff; font-size: .9rem; padding: .5rem .6rem; }
.pc { display: flex; gap: .3rem; }
.pc label { display: flex; flex-direction: column; font-size: .7rem; color: var(--muted); }
.price .pc input.numin { width: 80px; min-width: 80px; }
tr[data-pricing="class"] .pc-unit, tr[data-pricing="class"] .pc-hours,
tr[data-pricing="unit"] .pc-class, tr[data-pricing="unit"] .pc-hours,
tr[data-pricing="hours"] .pc-class, tr[data-pricing="hours"] .pc-unit { display: none; }

.act .act-grp { background: #e9e9e9; width: auto; }
.act small { font-size: 8pt; color: #444; }
.advance { padding: .8rem; background: #f3f6fb; border-radius: 8px; border: 1px solid #d6dfee; }

/* Мастер у работы, повреждения → смета, прибыль */
.imaster { margin-top: .3rem; }
.imaster select { min-height: 32px; padding: .15rem .4rem; font-size: .8rem; width: auto; max-width: 220px; }
.dmg2est { margin-top: 1.2rem; padding: .9rem 1rem; border: 1px solid #f0c9a0; background: #fff8f0; border-radius: var(--r); display: flex; flex-direction: column; gap: .6rem; }
.dmg2est h3 { margin: 0; }
.dmgpart { border: 0; border-top: 1px solid #f0d9c0; padding: .5rem 0 0; margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.dmgpart legend { font-weight: 700; padding: 0; margin-bottom: .3rem; }
.dmgpart .check { font-size: .9rem; }
.profit { background: #f3f5f7; padding: .5rem .8rem; border-radius: 8px; }

/* Расходы */
.expform:not([data-cat="stock"]) .only-stock { display: none; }
.expform:not([data-cat="order_part"]) .only-order { display: none; }
.docpick { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; padding: .8rem; border: 2px dashed var(--line); border-radius: var(--r); }
.lines select { min-width: 200px; }
.lines input { min-width: 140px; }
.lines input.numin { min-width: 90px; width: 90px; text-align: right; }
.pdfdoc { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; background: #fdecea; color: var(--danger); font-weight: 800; border-radius: 6px; text-decoration: none; }
.inline-form { display: inline; }
.exp-cols { grid-template-columns: minmax(280px, 1fr) minmax(320px, 2fr); }
.t tr.sel td { background: #eef3ff; }
.pnl td:first-child { width: 70%; }
@media (max-width: 640px) { .exp-cols { grid-template-columns: 1fr; } }
.lines tr:not([data-dest="stock"]) .for-stock, .lines tr:not([data-dest="order"]) .for-order { display: none; }
.lines .extra { min-width: 220px; }
.lines .for-order { display: flex; gap: .3rem; }
.lines tr:not([data-dest="order"]) .for-order { display: none; }
.lines .short-in { min-width: 110px; width: 120px; }
.lines select { min-width: 180px; }
.lines tfoot td { border-top: 2px solid var(--ink); }


/* Telegram */
.tgbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: 0 0 1rem; padding: .6rem .9rem; background: var(--panel); border: 1px solid #d8dee4; border-left: 4px solid #2a9ed8; border-radius: var(--r); }
.tg-on { font-weight: 600; }
.tgqr { margin-left: auto; }
.tgqr summary { list-style: none; }
.tgqr summary::-webkit-details-marker { display: none; }
.tgqr-box { margin-top: .6rem; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.tgqr-box svg { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; }
.tgapprove, .tgphotos { margin-top: .6rem; align-items: center; }
.howto { padding-left: 1.2rem; display: flex; flex-direction: column; gap: .4rem; margin: 0; }
.howto code { background: #eef1f4; padding: .05rem .35rem; border-radius: 4px; }
.narrow-wide { max-width: 760px; }
.sub-row { align-items: center; margin: 0; }
.act-qr { width: 100%; margin-top: 5mm; border: 1px solid #999; border-collapse: collapse; break-inside: avoid; font-size: 9.5pt; }
.act-qr td { padding: 3mm; vertical-align: middle; }
.act-qr svg { width: 28mm; height: 28mm; display: block; }

/* Телефон */
@media (max-width: 1320px) {
    .top { padding: .45rem .7rem; gap: .5rem; }
    .brand { flex: 1 1 0; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; }
    .menubtn { display: inline-flex; }
    .newbtn { min-height: 40px; padding: .3rem .8rem; order: 2; }
    .menubtn { order: 3; }
    .menu { display: none; order: 5; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: .3rem 0 .5rem; }
    .top.open .menu { display: flex; }
    .nav { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; }
    .nav a { padding: .7rem .8rem; background: rgba(255,255,255,.06); font-size: 1.05rem; }
    .logout { padding: .6rem .2rem 0; }
}
@media (max-width: 640px) {
    h1 { font-size: 1.35rem; }
    h1 .plate { font-size: 1.1rem; }
    .card { padding: .9rem .8rem; }
    .btn { padding: .5rem .8rem; }
    .newbtn { font-size: .85rem; padding: .3rem .6rem; }
    .menubtn { padding: .3rem .6rem; }
    .brand { font-size: .95rem; }
    .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
    .seg button { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .4rem .2rem; font-size: .9rem; }
    .seg button:nth-child(3n + 1) { border-right: 1px solid var(--line); }
    .contact { width: 100%; }
    .contact .btn { flex: 1; }
    .ohead h1 { font-size: 1.2rem; }
    .tgqr { margin-left: 0; width: 100%; }
    .tgqr summary { width: 100%; }
    .kpis { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .kpi b { font-size: 1.25rem; }
    /* Слова в таблицах не рвутся по буквам: если столбцы не помещаются, таблица листается внутри карточки */
    .t td, .t th { overflow-wrap: break-word; word-break: normal; }
    .t code { overflow-wrap: anywhere; }
    .search { flex-wrap: wrap; }
    .btn { white-space: normal; text-align: center; }
    .t td.num { white-space: nowrap; overflow-wrap: normal; }
    .card { overflow-x: auto; }
    .imaster select { max-width: 100%; }
    /* Смета: строка позиции на телефоне = название сверху, ниже количество, сумма и «Убрать» */
    .items tbody { display: block; }
    .items tr { display: grid; grid-template-columns: 1fr auto auto; gap: .3rem .8rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid #e3e8ed; }
    .items tr.grp { display: block; padding: 0; border: 0; }
    .items tr.grp th { display: block; }
    .items td { display: block; padding: 0; border: 0; }
    .items td:empty { display: none; }
    .items td:has(.tags) { grid-column: 1 / -1; }
    .items td.num:first-of-type, .items td:has(.tags) + td.num { text-align: left !important; color: var(--muted); }
    .items tr.total { border-top: 2px solid var(--ink); border-bottom: 0; }
    .items tr.total td { border: 0; font-size: 1.1rem; }

    /* Таблицы с полями ввода превращаются в карточки */
    .price, .lines { min-width: 0; }
    .price thead, .lines thead { display: none; }
    .price tbody, .lines tbody, .lines tfoot { display: block; }
    .price tr, .lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
    .price tr.cathead { display: block; padding: 0; margin-top: .8rem; border-radius: 6px; overflow: hidden; }
    .price tr.cathead th { display: block; }
    .price td, .price td:has(.numin), .lines td, .lines td:has(.numin) { width: auto; }
    .price td, .lines td { display: flex; flex-direction: column; gap: .2rem; padding: 0; border: 0; min-width: 0; }
    .price td[data-l]::before, .lines td[data-l]::before { content: attr(data-l); font-size: .75rem; color: var(--muted); font-weight: 600; }
    .price td.wide, .lines td.wide { grid-column: 1 / -1; }
    .price input, .price select, .price input.numin, .price input.short, .price .pc input.numin,
    .lines input, .lines select, .lines input.numin, .lines .short-in { width: 100%; min-width: 0; }
    .pc { flex-wrap: wrap; }
    .pc label { flex: 1 1 60px; }
    .lines tr:not([data-dest="order"]):not([data-dest="stock"]) td.extra { display: none; }
    .lines .for-order { flex-direction: column; }
    .lines tfoot tr { grid-template-columns: 1fr auto; border: 0; }
    .lines tfoot td:empty { display: none; }
    .scroll { overflow: visible; }
    .card.scroll { overflow-x: auto; }
}

.tgunlink { flex-basis: 100%; }
.tgunlink summary { font-size: .875rem; color: var(--muted); cursor: pointer; }
.tgunlink .stack { margin-top: .5rem; gap: .5rem; }
.qrno { font-size: 1.3rem; font-weight: 800; margin: 0; letter-spacing: .02em; }
.act-qr-code { width: 32mm; text-align: center; }
.act-qr-no { font-size: 13pt; font-weight: 800; margin-top: 1mm; }
.kpi b.botname { font-size: 1.1rem; overflow-wrap: anywhere; }
.tgacts { flex-basis: 100%; align-items: center; }


/* ===== Фирменный стиль Nine Detailing ===== */
a { color: var(--ink); text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: #000; }
h1, h2, .col h2, .kpi b, .qrno, .login-sub { font-family: var(--display); font-weight: 650; letter-spacing: -.015em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Верхняя панель: чёрная, как сайт студии, с латунной линией */
.top { background: var(--black); border-bottom: 2px solid var(--accent); padding: .45rem 1rem; }
.brandlink { text-decoration: none; display: flex; align-items: center; min-width: 0; margin-right: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: .02em; white-space: nowrap; }
.brand .logo { height: 30px; width: auto; display: block; }
.brand.has-logo .brand-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav a { color: #aeb4ba; border-radius: 0; padding: .7rem .7rem .55rem; border-bottom: 2px solid transparent; font-weight: 500; }
.nav a:hover { color: #fff; background: transparent; border-bottom-color: #4a4f55; }
.nav a[aria-current="page"] { color: #fff; background: transparent; border-bottom-color: var(--accent); }
.top .linkbtn { color: #8d949b; }
.top .newbtn, .btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.top .newbtn:hover, .btn-accent:hover { background: #cda651; border-color: #cda651; }
.nav { flex-wrap: nowrap; gap: 0; }
.top .uname { display: none; }
.menu .logout { margin-left: auto; padding-left: .5rem; }
.nav a { font-size: .94rem; padding: .7rem .55rem .55rem; white-space: nowrap; }
.menubtn { border-color: #3a3f44; }

/* Кнопки */
.btn { border-radius: 10px; border-color: var(--line); font-weight: 600; transition: background-color .15s, border-color .15s; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--black); border-color: var(--black); color: #fff; }
.btn-primary:hover { background: #262b30; border-color: #262b30; }
.btn-danger:hover { background: #8f1d17; }
input, select, textarea { border-radius: 10px; border-color: var(--line); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

/* Карточки */
.card, .kpi { border: 1px solid #dde1e6; border-radius: var(--r); box-shadow: 0 1px 0 rgba(3, 5, 4, .04); }
.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi-bad::before { background: var(--danger); }
.kpi b { font-size: 1.55rem; }

/* Номер машины: синяя полоса как на молдавском номере */
.plate-md { background: var(--plate-blue); }
.plate-num { font-family: var(--display); font-weight: 700; letter-spacing: .06em; }

/* Доска заказов */
.col { background: #e3e6ea; border-radius: var(--r); }
.col h2 { font-size: 1rem; }
.ocard { border-radius: 10px; border: 1px solid #dfe3e7; box-shadow: 0 1px 0 rgba(3, 5, 4, .05); }
.ocard:hover { border-color: var(--black); }

/* Статусы заказа */
.seg { border-radius: 12px; }
.seg button { font-weight: 600; }

/* Сообщения */
.flash { border-left-color: var(--accent); background: #fbf6ea; }

/* Вход: тёмный экран с логотипом */
body.guest { background: var(--black) radial-gradient(ellipse at 50% -10%, #23282d 0%, var(--black) 60%) no-repeat; min-height: 100vh; }
body.guest .login { margin-top: 14vh; }
.login-brand { text-align: center; margin-bottom: .4rem; }
.brand-lg { font-size: 1.8rem; justify-content: center; }
.brand-lg .logo { height: 56px; }
.login-sub { color: #8d949b; text-align: center; font-size: .95rem; margin: 0 0 1.4rem; }
body.guest .card { border-color: #2a2f34; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
body.guest .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
body.guest .flash, body.guest .warn { margin-bottom: 1rem; }

@media (max-width: 1320px) {
    .top .uname { display: inline; }
    .menu .logout { margin-left: 0; padding-left: .2rem; }
    .nav { flex-wrap: wrap; gap: .3rem; }
    .nav a { border-bottom: 0; border-radius: 8px; background: rgba(255, 255, 255, .06); padding: .7rem .8rem; font-size: 1.05rem; }
    .nav a[aria-current="page"] { background: rgba(184, 145, 63, .22); color: #fff; }
    .brand .logo { height: 26px; }
    .brandlink { flex: 1 1 0; min-width: 0; margin: 0; overflow: hidden; }
    .brandlink .brand { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 640px) {
    h1 { font-size: 1.4rem; }
}


/* ===== Каркас: боковое меню слева, как в профессиональных CRM ===== */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--black); color: #c3c8cd; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 1rem .75rem .75rem; border-right: 1px solid #1d2125; }
.side-brand { display: flex; justify-content: center; padding: .3rem .4rem 1rem; text-decoration: none; border-bottom: 1px solid #1f2327; }
.side-brand .brand { font-size: 1.15rem; }
.side-brand .brand .logo { height: 40px; max-width: 180px; }
.side-user { display: flex; align-items: center; gap: .7rem; padding: 1rem .5rem .9rem; }
.avatar { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: #23282d; color: #fff; font-family: var(--display); font-size: 1.15rem; border: 1px solid var(--accent); }
.side-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.side-who b { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-who small { color: #8d949b; font-size: .8rem; }
.btn.side-new { width: 100%; gap: .4rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); margin-bottom: .6rem; }
.btn.side-new:hover { background: #cda651; border-color: #cda651; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-group { font-size: .72rem; color: #6e757c; padding: .9rem .75rem .35rem; letter-spacing: .04em; }
.side-nav a, .side-bottom a, .side-out { display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 9px; color: #c3c8cd; text-decoration: none; font-weight: 500; font-size: .96rem; position: relative; }
.side-nav a:hover, .side-bottom a:hover, .side-out:hover { background: #15191c; color: #fff; }
.side-nav a[aria-current="page"], .side-bottom a[aria-current="page"] { background: #1b1f23; color: #fff; }
.side-nav a[aria-current="page"]::before, .side-bottom a[aria-current="page"]::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-nav a[aria-current="page"] .ico, .side-bottom a[aria-current="page"] .ico { color: var(--accent); }
.ico { flex: none; }
.side-bottom { border-top: 1px solid #1f2327; padding-top: .6rem; margin-top: .8rem; display: flex; flex-direction: column; gap: 2px; }
.side-bottom form { margin: 0; }
.side-out { width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; color: #8d949b; }
.main { min-width: 0; }
.main .wrap { max-width: 1360px; padding: 1.4rem 1.6rem 2rem; }
.mtop { display: none; }
.side-shade { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Заголовок страницы и подразделы */
.pagehead { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; margin-bottom: .6rem; }
.pagehead h1 { margin: 0; }
.subnav { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--line); margin: -.2rem 0 1.2rem; }
.subnav a { padding: .55rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.subtitle { margin: 0 0 1rem; }
.settings-grid { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 760px); gap: 1.2rem 2rem; align-items: start; }
.settings-aside h2 { margin-bottom: .3rem; }
.logo-preview { background: var(--black); border-radius: 12px; padding: 1.4rem; display: flex; justify-content: center; }

/* Цветные плитки со сводкой, как на панели RO App */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .7rem; margin-bottom: 1.1rem; }
.tile { display: flex; flex-direction: column; gap: .15rem; padding: .85rem 1rem; border-radius: 12px; text-decoration: none; color: var(--ink); border: 1px solid transparent; min-height: 86px; }
.tile span { font-size: .86rem; color: #3d454d; }
.tile b { font-family: var(--display); font-weight: 650; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; }
.tile small { font-size: .78rem; color: #4d555c; }
.tile:hover { border-color: rgba(3, 5, 4, .25); }
.t-blue { background: #dde8f7; } .t-violet { background: #e7e2f6; } .t-orange { background: #fbe6cc; }
.t-green { background: #d9efe0; } .t-red { background: #f8d9d6; } .t-yellow { background: #f7ecc9; } .t-gray { background: #e4e7ea; }
.t-red b { color: #8f1d17; }

@media (max-width: 1000px) {
    .app { display: block; }
    .side { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; }
    body.nav-open .side { transform: none; }
    body.nav-open .side-shade { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
    .mtop { display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 20; background: var(--black); border-bottom: 2px solid var(--accent); padding: .45rem .7rem; }
    .mtop .menubtn { display: inline-flex; padding: .45rem .6rem; }
    .mtop-brand { flex: 1; min-width: 0; text-decoration: none; overflow: hidden; }
    .mtop-brand .brand { font-size: 1rem; }
    .mtop-brand .brand .logo { height: 26px; }
    .mtop .newbtn { display: inline-flex; gap: .3rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); min-height: 40px; padding: .3rem .8rem; }
    .main .wrap { padding: .9rem .75rem 1.5rem; }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
.nav-open .burger { background: transparent; }
.nav-open .burger::before { top: 0; transform: rotate(45deg); }
.nav-open .burger::after { top: 0; transform: rotate(-45deg); }
.mtop .menubtn { border: 1px solid #3a3f44; border-radius: 8px; background: transparent; color: #fff; min-height: 40px; cursor: pointer; align-items: center; }
@media (max-width: 640px) {
    .tiles { grid-template-columns: 1fr 1fr; gap: .5rem; }
    .tile { min-height: 0; padding: .6rem .75rem; }
    .tile span { font-size: .78rem; }
    .tile b { font-size: 1.25rem; }
}

/* Боковое меню: пункты во всю ширину, как в RO App */
.side { padding: 0 0 .75rem; }
.side-brand { padding: 1rem 1rem .9rem; }
.side-user { flex-direction: column; text-align: center; gap: .5rem; padding: 1.1rem 1rem .9rem; }
.side-user .avatar { width: 76px; height: 76px; font-size: 2rem; background: #e9ebee; color: #6b7178; border: 0; }
.side-who { align-items: center; }
.btn.side-new { width: auto; margin: 0 .9rem .7rem; }
.side-nav { gap: 0; }
.side-nav a, .side-bottom a, .side-out { border-radius: 0; padding: .72rem 1.25rem; font-size: 1rem; gap: .85rem; }
.side-nav a[aria-current="page"], .side-bottom a[aria-current="page"] { background: #1d2226; }
.side-nav a[aria-current="page"]::before, .side-bottom a[aria-current="page"]::before { left: 0; top: 0; bottom: 0; width: 4px; border-radius: 0; }
.side-sep { display: block; height: 1px; background: #23282c; margin: .45rem 1.25rem; }
.side-bottom { gap: 0; margin-top: .5rem; }

/* Моя студия: сводка */
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles-5 { grid-template-columns: 1fr 1fr 1fr 1fr 2fr; }
.tile { min-height: 96px; }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.badge { font-style: normal; font-size: .75rem; font-weight: 700; padding: .12rem .45rem; border-radius: 4px; color: #fff; }
.b-green { background: #1b7f47; } .b-red { background: #c0392b; } .b-orange { background: #c77700; } .b-blue { background: #2c5aa8; } .b-gray { background: #7a828a; }
.panels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.panels .card { margin: 0; }
.panel h2 { font-size: 1rem; }
.empty-state { text-align: center; padding: 1.4rem .5rem 1rem; }
.empty-state p { margin: .2rem 0; }
.empty-state a { display: inline-block; margin-top: .5rem; font-weight: 600; }
.prow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid #eceff2; text-decoration: none; color: var(--ink); }
.prow:last-child { border-bottom: 0; }
.pbar { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.pfill { display: block; height: 100%; background: var(--graphite); border-radius: 4px; }
.pfill.st-new { background: var(--s-new); } .pfill.st-accepted { background: var(--s-accepted); } .pfill.st-in_work { background: var(--s-in_work); } .pfill.st-ready { background: var(--s-ready); }
.charts2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.mini-chart { margin: 0; }
.mini-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .5rem; color: var(--muted); font-size: .9rem; }
.mini-chart figcaption b { font-family: var(--display); font-weight: 650; font-size: 1.2rem; color: var(--ink); }
.mini-chart .bars { display: flex; align-items: flex-end; gap: 2px; height: 140px; border-bottom: 1px solid var(--line); }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; cursor: default; }
.bar-col:hover { background: #f4f5f7; }
.bar-fill { width: 100%; background: var(--graphite); border-radius: 4px 4px 0 0; }
.bar-col:hover .bar-fill { background: var(--accent); }
.bars-axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-top: .3rem; }
.section-title { margin: 1.4rem 0 .7rem; }
@media (max-width: 1200px) {
    .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tiles-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panels { grid-template-columns: 1fr; }
}

/* ===== Чаты: переписка с клиентами из всех мессенджеров ===== */
.nbadge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; font-style: normal; }
.nbadge[hidden] { display: none; }
.mdot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.mdot[hidden] { display: none; }
.mtop .menubtn { position: relative; }
.chbadge { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 4px; border-radius: 5px; font-size: .62rem; font-weight: 800; letter-spacing: .02em; color: #fff; background: #6b7480; font-family: "Inter", system-ui, sans-serif; line-height: 1; }
.ch-telegram { background: #229ed9; } .ch-viber { background: #7360f2; } .ch-whatsapp { background: #1fa855; }
.ch-instagram { background: linear-gradient(45deg, #f09433, #dc2743 55%, #bc1888); } .ch-messenger { background: #0a7cff; } .ch-meta { background: #0866ff; }

.chatapp { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100vh - 3.4rem); min-height: 480px; background: var(--panel); border: 1px solid #d8dee4; border-radius: var(--r); overflow: hidden; }
.chatside { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.tm-only { display: none !important; }
.chatside-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .9rem 1rem .4rem; }
.chatside-head h1 { margin: 0; }
.chatfilter { padding: .3rem 1rem .6rem; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .5rem; }
.chtabs { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; }
.chtabs a { flex: none; padding: .28rem .65rem; border-radius: 999px; background: #eef0f3; color: var(--ink); text-decoration: none; font-size: .82rem; font-weight: 600; }
.chtabs a[aria-current="page"] { background: var(--black); color: #fff; }
.clist { flex: 1; overflow-y: auto; }
.chat-empty { padding: 1rem; }
.citem { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid #eef0f3; position: relative; }
.citem:hover { background: #f6f7f9; }
.citem.on { background: #f3ead6; }
.citem.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.cava { position: relative; flex: none; width: 44px; height: 44px; border-radius: 50%; background: #e4e7ea; color: #4d555c; display: grid; place-items: center; font-family: var(--display); font-size: 1.15rem; }
.cava .chbadge { position: absolute; right: -6px; bottom: -3px; border: 2px solid var(--panel); height: 20px; }
.cbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.ctop { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ctop b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctop time { flex: none; font-size: .75rem; color: var(--muted); }
.cprev { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citem.new .ctop b { font-weight: 800; }
.citem.new .cprev { color: var(--ink); }
.citem .nbadge { margin-left: 0; }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #f4f5f7; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); padding: 2rem; max-width: 380px; }
.thread-empty .ico { width: 48px; height: 48px; color: #b6bcc2; }
.thead { display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tback { display: none; font-size: 2rem; line-height: 1; text-decoration: none; color: var(--ink); padding: 0 .3rem; }
.twho { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.twho b { font-size: 1.05rem; }
.tlinks { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.tmenu { position: relative; }
.tmenu summary { list-style: none; }
.tmenu summary::-webkit-details-marker { display: none; }
.tmenu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .6rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); width: max-content; gap: .4rem; }
.tmenu-pop form { margin: 0; }
.tmenu-pop .btn { width: 100%; }
.tlink { background: #fff8e8; border-bottom: 1px solid #efe0bb; padding: .5rem 1rem; }
.tlink summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.tlink form.row { margin-top: .5rem; align-items: center; }
.tlink input[type="search"] { flex: 1; min-width: 180px; }
.tfound { justify-content: space-between; background: #fff; border-radius: 8px; padding: .4rem .6rem; }

.msgs { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.mday { text-align: center; margin: .6rem 0 .3rem; }
.mday span { background: #e2e5e9; color: #4d555c; font-size: .75rem; font-weight: 600; padding: .2rem .7rem; border-radius: 999px; }
.msys { align-self: center; text-align: center; font-size: .78rem; color: var(--muted); max-width: 90%; padding: .1rem 0; }
.msg { display: flex; }
.msg .bub { max-width: min(72%, 560px); padding: .5rem .75rem .35rem; border-radius: 14px; background: #fff; border: 1px solid #e3e6ea; overflow-wrap: anywhere; }
.msg-in .bub { border-bottom-left-radius: 4px; }
.msg-out, .msg-auto { justify-content: flex-end; }
.msg-out .bub { background: #f3ead6; border-color: #e8d9b5; border-bottom-right-radius: 4px; }
.msg-auto .bub { background: #eceef1; border-style: dashed; border-color: #c9ced4; border-bottom-right-radius: 4px; color: #3d454d; font-size: .92rem; }
.mtext { white-space: normal; }
.mtext a { color: #1d4ed8; }
.mmeta { font-size: .72rem; color: var(--muted); text-align: right; margin-top: .15rem; white-space: nowrap; }
.mst { font-style: normal; letter-spacing: -.12em; margin-left: .1rem; }
.mst-read { color: #1d8fe1; }
.mst-bad { color: #fff; background: var(--danger); border-radius: 50%; display: inline-grid; place-items: center; width: 15px; height: 15px; letter-spacing: 0; font-weight: 700; }
.merr { font-size: .78rem; color: var(--danger); margin-top: .2rem; }
.mimg { display: block; margin: -.2rem -.45rem .3rem; }
.mimg img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; }
.mfile { display: inline-block; font-weight: 600; margin-bottom: .2rem; }
.msg audio { width: 260px; max-width: 100%; }
.msg video { max-width: 100%; max-height: 320px; border-radius: 10px; }
.twin { margin: 0; padding: .45rem 1rem; font-size: .85rem; background: #fff8e8; color: #7a5a12; border-top: 1px solid #efe0bb; }
.twin-bad { background: #fdecea; color: var(--danger); border-color: #f5c6c1; }
.tfirst { margin: 0; padding: .75rem 1rem; gap: .5rem; font-size: .88rem; background: #fff8e8; color: #5c4510; border-top: 1px solid #efe0bb; max-height: 45vh; overflow-y: auto; }
.tfirst p { margin: 0; }
.tfirst-text { background: #fff; border: 1px solid #efe0bb; border-radius: 10px; padding: .55rem .7rem; color: var(--ink); }
.tfirst .row { flex-wrap: wrap; gap: .5rem; }
.reply { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .5rem; align-items: end; padding: .7rem 1rem; background: var(--panel); border-top: 1px solid var(--line); }
.reply textarea { min-height: 44px; max-height: 180px; resize: none; }
.rattach { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 1.2rem; background: #fff; }
.rattach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.rattach:focus-within { outline: 3px solid #f2b705; outline-offset: 2px; }
.rattach.has { background: #f3ead6; border-color: var(--accent); }
.rfname { grid-column: 1 / -1; }
.rfname:empty { display: none; }

.chan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.chan-grid > .card { margin: 0; }
.chan-wide { grid-column: 1 / -1; }
.chan-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.chan-head h2 { margin: 0; }
.chan-head .chbadge { height: 24px; min-width: 30px; font-size: .75rem; }
.chan h3 { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 0; }
.pill { font-size: .75rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; }
.pill-on { background: #d9efe0; color: #14633a; }
.pill-off { background: #eceef1; color: var(--muted); }
.chan details > summary { cursor: pointer; }
.chan code { overflow-wrap: anywhere; }
.chat-links { display: flex; flex-wrap: wrap; gap: .4rem; }

@media (max-width: 1000px) {
    .main:has(.chatapp) .wrap { padding: 0; }
    .chatapp { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 58px); border: 0; border-radius: 0; min-height: 0; }
    .thead { flex-wrap: nowrap; }
    .twho small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
    .tlinks { flex-wrap: nowrap; }
    .tlinks > a.btn { display: none; }
    .tm-only { display: inline-flex !important; }
    .chatapp.has-thread .chatside { display: none; }
    .chatapp:not(.has-thread) .thread { display: none; }
    .chatside { border-right: 0; }
    .tback { display: block; }
    .thead { padding: .5rem .6rem; gap: .5rem; }
    .thead .cava { width: 38px; height: 38px; }
    .tlinks .plate { display: none; }
    .msgs { padding: .8rem .7rem; }
    .msg .bub { max-width: 86%; }
    .reply { padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
    .chan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .reply .rsend { padding: .5rem .7rem; }
    .twho small { font-size: .75rem; }
}
.btn .nbadge { margin-left: .45rem; background: var(--black); color: #fff; }
.scroll:has(> .cal) { overflow-x: auto !important; } /* календарь на телефоне листается внутри, а не вся страница */

/* Моя студия: вкладки Расписание / Услуги / Товары */
.panels-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.panels-2 > .stack { gap: .8rem; }
.sday { margin: 1rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.sday:first-of-type { margin-top: .2rem; }
.srow { display: grid; grid-template-columns: 3.2rem 6.5rem minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .5rem 0; border-bottom: 1px solid #eceff2; text-decoration: none; color: var(--ink); }
.srow:hover { background: #f7f8fa; }
.srow time { font-family: var(--display); font-size: 1.05rem; }
.prow-4 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto 6.5rem; }
.prow-4 b { text-align: right; }
@media (max-width: 1200px) { .panels-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
    .srow { grid-template-columns: 3rem minmax(0, 1fr) auto; row-gap: .15rem; }
    .srow .srow-what { display: none; }
    .srow > time { grid-column: 1; grid-row: 1; }
    .srow > :nth-child(3) { grid-column: 2; grid-row: 1; }
    .srow > .st { grid-column: 3; grid-row: 1; white-space: nowrap; }
    .srow > :nth-child(4) { grid-column: 2 / -1; grid-row: 2; }
    .srow > :nth-child(5) { grid-column: 2 / -1; grid-row: 3; }
    .srow > :nth-child(5):empty { display: none; }
    .prow-4 { grid-template-columns: minmax(0, 1fr) auto auto; }
    .prow-4 .pbar { display: none; }
}

/* Деловой стиль: цифры одинаковой ширины (суммы и количества стоят ровно друг под другом) */
.tile b, .kpi b, .mini-chart figcaption b, .num, td.num, .nbadge, .srow time, .ctop time, .mmeta, .prow b, .bars-axis { font-variant-numeric: tabular-nums; }
h1 { font-weight: 700; }
h3 { font-weight: 600; }
.avatar, .cava { font-weight: 600; }
.srow time { font-weight: 600; }
.cols > #services { grid-column: 1 / -1; } /* смета во всю ширину: таблица не обрезается */

/* Настройки: меню разделов слева, как в RO App */
.setwrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.setnav { display: flex; flex-direction: column; background: var(--panel); border: 1px solid #d8dee4; border-radius: var(--r); padding: .4rem 0; position: sticky; top: 1rem; }
.setnav a { padding: .65rem 1.1rem; color: var(--ink); text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
.setnav a:hover { background: #f4f5f7; }
.setnav a[aria-current="page"] { background: #eef0f3; border-left-color: var(--accent); font-weight: 600; }
.setmain { min-width: 0; }
.setmain > .subtitle:first-child, .setmain > h2:first-child { margin-top: 0; }

/* Интеграции: карточки по группам */
.igroup { margin-bottom: 1.8rem; }
.igroup h2 { margin: 0 0 .2rem; font-size: 1.2rem; }
.igroup > p { margin: 0 0 .9rem; font-size: .9rem; }
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.icard { display: flex; flex-direction: column; gap: .35rem; padding: 1rem 1.05rem; background: var(--panel); border: 1px solid #d8dee4; border-radius: 12px; text-decoration: none; color: var(--ink); min-height: 150px; transition: border-color .15s, box-shadow .15s; }
.icard:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .06); }
.ilogo { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .02em; flex: none; margin-bottom: .35rem; }
.chan-head .ilogo { margin-bottom: 0; }
.ch-auto { background: var(--black); color: var(--accent); }
.ititle { font-weight: 600; font-size: 1rem; display: flex; align-items: center; gap: .4rem; }
.icheck { font-style: normal; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #1b7f47; color: #fff; font-size: .7rem; font-weight: 700; }
.idesc { font-size: .87rem; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inote { margin-top: auto; font-size: .8rem; color: #14633a; font-weight: 600; }
.iback { margin: 0 0 .8rem; }
.iback a { text-decoration: none; font-weight: 600; }
@media (max-width: 1000px) {
    .setwrap { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
    .setnav { flex-direction: row; overflow-x: auto; padding: .3rem; position: static; scrollbar-width: none; }
    .setnav a { flex: none; border-left: 0; border-radius: 8px; padding: .5rem .8rem; }
    .igrid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    .icard { min-height: 0; }
}
.fbbtn { gap: .6rem; background: #0866ff; border-color: #0866ff; }
.fbbtn:hover { background: #0657d6; border-color: #0657d6; }

/* Регистрация студии (бета) */
.reg { max-width: 980px; margin: 1.5rem auto 3rem; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 2rem; align-items: start; }
.reg-head h1 { font-size: 1.9rem; line-height: 1.2; }
.reg-kicker { margin: 0 0 .4rem; color: var(--accent); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .8rem; }
.reg-points { padding-left: 1.1rem; display: flex; flex-direction: column; gap: .45rem; }
.reg-form legend { font-weight: 600; margin-bottom: .5rem; }
.tplgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tpl { position: relative; cursor: pointer; }
.tpl input { position: absolute; opacity: 0; }
.tpl-box { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.tpl-box small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.tpl input:checked + .tpl-box { border-color: var(--accent); background: #fbf6ea; box-shadow: 0 0 0 1px var(--accent); }
.tpl input:focus-visible + .tpl-box { outline: 3px solid #f2b705; outline-offset: 2px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn-big { min-height: 52px; font-size: 1.05rem; }
.login-reg { text-align: center; margin-top: 1rem; color: #aab0b6; }
.login-reg a { color: var(--accent); font-weight: 600; }
.terms { max-width: 760px; margin: 1.5rem auto; }
.terms h2 { margin: .6rem 0 0; font-size: 1.05rem; }
@media (max-width: 860px) { .reg { grid-template-columns: 1fr; gap: 1rem; margin-top: .5rem; } .reg-head h1 { font-size: 1.45rem; } }

/* Панель владельца: студии */
.srow-t { border-bottom: 1px solid #eceff2; }
.srow-t summary { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .65rem 0; cursor: pointer; list-style: none; }
.srow-t summary::-webkit-details-marker { display: none; }
.srow-t[open] summary { background: #f7f8fa; }
.srow-body { padding: .3rem 0 1rem; }
@media (max-width: 1000px) { .srow-t summary { grid-template-columns: 1fr auto; } .srow-t summary > :nth-child(2), .srow-t summary > :nth-child(3), .srow-t summary > :nth-child(4) { grid-column: 1 / -1; } }

/* Первые шаги в новой студии */
.welcome { border-left: 4px solid var(--accent); }
.welcome ol { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.welcome li.done { color: var(--muted); text-decoration: line-through; }
body.guest .reg-head { color: #e7e9eb; }
body.guest .reg-head .muted { color: #a3a9af; }
body.guest .reg-head a { color: var(--accent); }
body.guest .terms a { color: var(--brand); }
/* Прайс: цены по 4 классам машин помещаются в карточку (2×2 на ноутбуке, в строку на широком экране) */
.pc-class { display: grid; grid-template-columns: repeat(2, 80px); gap: .25rem .35rem; }
@media (min-width: 1700px) { .pc-class { grid-template-columns: repeat(4, 80px); } }
@media (max-width: 1000px) { .pc-class { display: flex; } }
.price .pc label span { white-space: nowrap; }
.price input { min-width: 200px; }
.price input.numin { min-width: 0; }
.price .pc input.numin { width: 80px; }
.price select { min-width: 170px; }
.stackcell { display: table-cell; }
.stackcell > * + * { margin-top: .35rem; }
.stackcell input.ro { font-size: .92rem; color: #3d454d; }
.stackcell select { display: block; }

/* ---------- Запись клиента ---------- */
.side-news { display: grid; gap: .45rem; margin: 0 .9rem .7rem; }
.side-news .btn.side-new { margin: 0; width: auto; gap: .4rem; }
.side-news .btn.side-new svg { width: 17px; height: 17px; }
.btn.side-new2 { background: transparent; color: #fff; border-color: var(--accent); }
.btn.side-new2:hover { background: rgba(184, 145, 63, .16); color: #fff; }
.mtop .newbtn.newbtn2 { background: transparent; color: #fff; border-color: var(--accent); }
@media (max-width: 400px) {
    .mtop { gap: .4rem; }
    .mtop .newbtn { padding: .3rem .5rem; font-size: .82rem; }
}
.book .svcpick summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.svcgrid { columns: 3 230px; column-gap: 1.2rem; padding-top: .4rem; }
.svcgrid .check { break-inside: avoid; padding: .28rem 0; font-size: .95rem; align-items: flex-start; }
.svcgrid .check input { margin-top: .2rem; flex: none; }
.svccat { break-after: avoid; font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: .7rem 0 .15rem; }
.svccat:first-child { margin-top: 0; }
.dayload { font-size: .9rem; }
.dayload:empty { display: none; }
.dayload ul { list-style: none; margin: .35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.dayload li { display: flex; gap: .6rem; align-items: baseline; padding: .35rem .55rem; border-radius: 8px; background: var(--bg); }
.dayload li b { font-variant-numeric: tabular-nums; min-width: 3rem; }
.dayload li.busy { outline: 2px solid var(--s-in_work); }
.carpick { display: flex; flex-wrap: wrap; gap: .4rem; }
.carpick button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: .45rem .7rem; font: inherit; cursor: pointer; text-align: left; line-height: 1.25; }
.carpick button small { display: block; color: var(--muted); font-size: .8rem; }
.carpick button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.found:empty { display: none; }
.booking { border-left: 4px solid var(--s-new); }
.book-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.book-head > div { min-width: 0; }
.book-head h2 { margin: .1rem 0 .35rem; }
.book-note { margin: .5rem 0 0; padding: .5rem .7rem; background: var(--bg); border-radius: 8px; font-size: .95rem; }
.book-msgs { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.book-msg p { margin: 0 0 .4rem; }
.book-msg .row { align-items: center; gap: .4rem; }
.book-msg form { margin: 0; }
.book-actions { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); align-items: flex-start; }
.book-actions form { margin: 0; }
.book-move summary { list-style: none; }
.book-move summary::-webkit-details-marker { display: none; }
.book-move[open] { flex-basis: 100%; order: 5; }
.book-move[open] summary { display: none; }
.book-move form { padding: .7rem; background: var(--bg); border-radius: 10px; }
.remindbox { border-left: 4px solid var(--s-in_work); }
.remindbox ul { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.remindbox li { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; padding-top: .5rem; border-top: 1px solid var(--line); }
.remindbox li .who { flex: 1 1 220px; min-width: 0; }
.remindbox li form { margin: 0; }
@media (max-width: 640px) {
    .book-head .btn-big { width: 100%; }
    .book-head form { width: 100%; }
}
[hidden] { display: none !important; }
.cal th a.calday { color: inherit; text-decoration: none; display: block; }
.cal th a.calday span { color: var(--accent); font-weight: 700; margin-left: .2rem; }
.cal th a.calday:hover { color: var(--accent); }
.calitem .badge { font-size: .68rem; padding: .05rem .35rem; }
.sched-top { justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.sched-top p { margin: 0; flex: 1 1 260px; }
.srow-what .badge + .badge { margin-left: .2rem; }
.homenote { display: flex; flex-direction: column; gap: .3rem; text-decoration: none; color: inherit; margin-bottom: 1rem; }
.homenote:hover { border-color: var(--accent); }
.srow-what .badge { white-space: nowrap; }
.ch-sms { background: #e8543f; font-size: .8rem; }
.nowrap { white-space: nowrap; }
ol.steps { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
ol.steps code { word-break: break-all; }
/* Отдельная страница QR для печати */
.qr-sheet { max-width: 120mm; margin: 0 auto; padding: 8mm 6mm; text-align: center; background: #fff; border: 1px dashed #bbb; }
.qr-brand { font-size: 1.3rem; font-weight: 800; letter-spacing: .04em; margin: 0; }
.qr-code svg { width: 70mm; height: 70mm; max-width: 100%; display: block; margin: 3mm auto; }
.qr-no { font-size: 1.5rem; font-weight: 800; margin: 0 0 3mm; }
.qr-txt { font-size: .95rem; margin: 0 0 2mm; }
.qr-txt.ru { color: #333; }
.qr-note { font-size: .75rem; color: #555; margin: 3mm 0 0; }
@media print { .qr-sheet { border: 1px dashed #999; margin-top: 0; } }
.intake-qr { align-items: center; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line); }

/* ---------- Смета: несколько услуг из прайса ---------- */
.svcadd { border: 1px solid var(--line); border-radius: 10px; padding: .8rem; background: #fafbfc; }
.svcadd-head { align-items: center; gap: .4rem .8rem; }
.svcadd-find { margin-left: auto; flex: 0 1 240px; min-width: 0; }
.svcadd-list { max-height: 440px; overflow: auto; border-top: 1px solid var(--line); padding-top: .2rem; }
.svcadd-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 110px; gap: .2rem .6rem; align-items: end; padding: .35rem .2rem; border-bottom: 1px solid #edf0f3; }
.svcadd-row.on { background: var(--accent-soft); }
.svcadd-row .check { align-self: center; align-items: flex-start; }
.svcadd-row .check input { margin-top: .2rem; flex: none; }
.svcadd-row .f span { font-size: .72rem; }
.svcadd-row .f input { padding: .35rem .5rem; min-height: 34px; }
.pc-entry { align-items: center; }
@media (max-width: 640px) {
    .svcadd-row { grid-template-columns: 1fr 1fr; }
    .svcadd-row .check { grid-column: 1 / -1; }
    .svcadd-find { flex-basis: 100%; margin-left: 0; }
}

/* ---------- Калькулятор окраски ---------- */
.pc-row { display: grid; grid-template-columns: minmax(150px, 2fr) minmax(90px, 1fr) minmax(150px, 1.6fr) 90px 100px 100px 32px; gap: .5rem; align-items: end; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.pc-row:last-child { border-bottom: 0; }
.pc-del { align-self: center; font-size: 1.1rem; padding: .3rem; }
.pc-rows:has(> .pc-row:only-child) .pc-del { visibility: hidden; }
.pc-res td.num, .pc-res th.num { text-align: right; white-space: nowrap; }
.pc-total { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: .8rem; padding: .8rem 1rem; background: var(--black); color: #fff; border-radius: 10px; }
.pc-total b { font-size: 1.6rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.pc-save { margin: .6rem 0 0; padding: .5rem .7rem; background: #e8f5ee; border-radius: 8px; }
.pc-inside { margin-top: .8rem; padding: .6rem .8rem; border: 1px dashed var(--line); border-radius: 10px; }
.pc-inside p { margin: 0 0 .3rem; }
.pc-detail { margin-top: .6rem; }
.pc-detail summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.pc-detail .t { margin-top: .4rem; }
.pc-print h2 { font-size: 11pt; margin: 5mm 0 2mm; }
.pc-print .act-t td.num { text-align: right; }
.pcref-t input { width: 100%; min-width: 110px; padding: .35rem .5rem; }
.pcref-t input.nin { min-width: 70px; max-width: 110px; }
.pcref-t input.nin.sm { min-width: 56px; max-width: 70px; }
.pcref-t input.wide { min-width: 260px; }
.pcref-t input[type=checkbox] { width: auto; min-width: 0; }
.pcref-t td { padding: .3rem .3rem; }
@media (max-width: 900px) {
    .pc-row { grid-template-columns: 1fr 1fr; }
    .pc-row .pc-el, .pc-row .pc-cat { grid-column: 1 / -1; }
    .pc-del { grid-column: 2; justify-self: end; }
}
/* Результат расчёта на телефоне: элемент — заголовок карточки, суммы — подписанными строками */
@media (max-width: 760px) {
    .pc-res thead, .pc-ops thead { display: none; }
    .pc-res, .pc-res tbody, .pc-ops, .pc-ops tbody { display: block; width: 100%; }
    .pc-res tr, .pc-ops tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; padding: .7rem 0; border-bottom: 1px solid #e3e8ed; }
    .pc-res td, .pc-ops td, .pc-res td.num, .pc-ops td.num { display: block; padding: 0; border: 0; text-align: right; white-space: normal; overflow-wrap: normal; min-width: 0; }
    .pc-res td[data-l]::before, .pc-ops td[data-l]::before { content: attr(data-l); float: left; margin-right: .5rem; color: var(--muted); font-size: .8rem; font-weight: 600; line-height: 1.6; }
    .pc-res td.pc-name, .pc-ops td.pc-name { grid-column: 1 / -1; text-align: left; }
    .pc-res td.pc-sum { grid-column: 1 / -1; padding-top: .3rem; border-top: 1px dashed var(--line); }
    .pc-ops td.muted:empty { display: none; }
    .pc-res tr.total, .pc-ops tr.total { border-top: 2px solid var(--ink); border-bottom: 0; }
    .pc-res .total td, .pc-ops .total td { border-top: 0; }
    .pc-res .total td.pc-sum { font-size: 1.1rem; }
}
@media (max-width: 380px) {
    .pc-res tr { grid-template-columns: 1fr; }
}
@media screen and (max-width: 640px) {
    .pc-print .act-t { table-layout: fixed; font-size: .78rem; }
    .pc-print .act-t th, .pc-print .act-t td { overflow-wrap: anywhere; padding: .25rem .3rem; }
    .pc-print .signs td { font-size: .78rem; }
}

/* ---------- Заявки, согласия, рассылки ---------- */
.consent-ok { margin: 0; padding: .5rem .7rem; border-radius: 8px; background: #e8f5ee; color: #14623a; font-weight: 600; }
.consent-no { margin: 0; padding: .5rem .7rem; border-radius: 8px; background: #fff4e0; color: #7a4a00; font-size: .92rem; }
.lead-phone { font-size: 1.4rem; font-weight: 800; margin: 0; }
.lead-phone a { color: inherit; text-decoration: none; font-variant-numeric: tabular-nums; }
.notice-line { margin: 0; padding: .6rem .8rem; border-radius: 10px; background: var(--accent-soft); border-left: 4px solid var(--accent); }
.legal-list { margin: 0; padding-left: 1.2rem; color: var(--muted); display: flex; flex-direction: column; gap: .25rem; }
.camp-sum { margin: 0; font-weight: 700; }
.callres { gap: .3rem; align-items: center; flex-wrap: wrap; }
.callres input { min-width: 140px; flex: 1 1 140px; padding: .35rem .5rem; }
.camp-t td { vertical-align: top; }
.pub-body { background: var(--black); min-height: 100vh; display: grid; place-items: center; padding: 1rem; margin: 0; }
.pub-card { background: #fff; max-width: 520px; width: 100%; border-radius: 16px; padding: 1.6rem 1.4rem; display: flex; flex-direction: column; gap: .8rem; }
.pub-card h1 { font-size: 1.35rem; margin: 0; }
.pub-card p { margin: 0; }
.pub-card .ru { color: var(--muted); }
.pub-card form .btn { width: 100%; white-space: normal; }
.pub-brand { font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.pub-note { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .7rem; }
.lead-set summary { cursor: pointer; } .lead-set form { margin-top: .8rem; }
.staff-tg { border-left: 4px solid #229ed9; }
.keyline { word-break: break-all; }

/* Отзывы на сайте (Настройки → Интеграции → Отзывы Google) */
.warn-soft { background: #fff7e0; color: #7a5200; padding: .6rem .8rem; border-radius: 8px; }
.stars { color: #f5a300; letter-spacing: .05em; white-space: nowrap; }

/* ---------- Коммерческие предложения и счета ---------- */
.qnew { margin: 0 0 1rem; align-items: center; }
.qtotal { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .3rem 1rem; margin: 0 0 1rem; padding: .8rem 1rem; background: var(--black); color: #fff; border-radius: 10px; }
.qtotal span { color: rgba(255,255,255,.8); min-width: 0; overflow-wrap: anywhere; }
.qtotal b { font-size: 1.6rem; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qkind { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.qkind label { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .4rem .6rem; font-weight: 600; color: var(--muted); cursor: pointer; text-align: center; }
.qkind label + label { border-left: 1px solid var(--line); }
.qkind label:has(input:checked) { background: var(--black); color: #fff; }
.qkind input { accent-color: var(--accent); }
.qfirm summary { cursor: pointer; font-weight: 600; margin-bottom: .5rem; }
.qitems input { width: 100%; min-width: 0; }
.qitems td:first-child { min-width: 260px; }
.qitems input.numin { width: 90px; min-width: 90px; text-align: right; }
.qitems tfoot td { border-top: 2px solid var(--ink); }
.qlink { flex: 1 1 260px; min-width: 0; font-size: .9rem; color: var(--muted); }
.qwide { grid-column: span 2; }
.qlist td.num { white-space: nowrap; }
@media (max-width: 640px) {
    .qwide { grid-column: auto; }
    .qitems td:first-child { min-width: 0; }
    .qitems tbody tr { grid-template-columns: 1fr 1fr auto; align-items: end; }
    .qitems td.wide { grid-column: 1 / -1; }
    .qitems td[data-l="Тип"] { grid-column: 1 / -1; flex-direction: row; gap: .4rem; }
    .qitems td.num { grid-column: 1 / 3; flex-direction: row; justify-content: space-between; align-items: baseline; }
    .qitems tfoot tr { grid-template-columns: 1fr auto; }
    .qlist thead { display: none; }
    .qlist, .qlist tbody { display: block; }
    .qlist tr { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; padding: .7rem 0; border-bottom: 1px solid #e3e8ed; }
    .qlist td { display: block; padding: 0; border: 0; min-width: 0; }
    .qlist td:first-child { grid-row: span 2; }
    .qlist td[data-l="Создано"], .qlist td[data-l="Автомобиль"] { grid-column: 2; }
    .qlist td.num { text-align: left; }
}

/* Предложение у клиента */
.offer-body { margin: 0; }
.offer-bar { max-width: 210mm; margin: 1rem auto; padding: 1rem; background: #fff; border-radius: 12px; display: flex; flex-direction: column; gap: .8rem; box-sizing: border-box; }
.offer-act { display: flex; flex-direction: column; gap: .6rem; }
.offer-ok { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: #e8f5ee; color: #14623a; font-weight: 700; }
.offer-no { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: #fff4e0; color: #7a4a00; font-weight: 600; }
.offer-links .btn { flex: 1 1 auto; }
.q-note { border-left: 3px solid #999; padding-left: 3mm; }
.q-lead { margin: 0 0 3mm; }
@media screen and (max-width: 640px) {
    .act { padding: 6mm 4mm; font-size: 10pt; }
    .act-t th { width: 34%; }
    .act-head td, .act-t td, .act-t th { overflow-wrap: anywhere; }
    .act-tools { flex-wrap: wrap; }
    .offer-bar { margin: .5rem; border-radius: 10px; }
    .offer-act .row .btn { flex: 1 1 100%; }
}
@media print { .offer-bar { display: none; } }
.pc-total b { white-space: nowrap; }
.offer-sum { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .2rem 1rem; margin: 0; }
.offer-sum span { font-weight: 700; }
.offer-sum b { font-size: 1.6rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
    .pc-total { flex-wrap: wrap; }
    .pc-inside .dl { grid-template-columns: minmax(0, 1fr) auto; }
    .pc-inside .dl dd { text-align: right; white-space: nowrap; }
    .act-no { white-space: nowrap; overflow-wrap: normal !important; }
}
.qtotal-adv { flex-basis: 100%; text-align: right; color: rgba(255,255,255,.75); font-size: .85rem; }
.qtools { margin: -.4rem 0 1rem; }
.qadv, .qadv-pay { align-items: flex-end; }
.qadv input { width: 150px; }
.offer-adv { margin: 0; padding: .5rem .7rem; border-radius: 8px; background: var(--accent-soft); }
.q-adv td { background: #fff7e0; }
@media (max-width: 640px) {
    .qtools .btn { flex: 1 1 45%; }
    .qadv .f.inline, .qadv-pay .f.inline { flex: 1 1 100%; }
    .qadv input { width: 100%; }
    .qadv-pay .btn { flex: 1 1 100%; }
}
@media (max-width: 640px) {
    .qitems tfoot tr { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .35rem 0; border: 0; }
    .qitems tfoot td { border: 0 !important; padding: 0; }
    .qitems tfoot td:empty { display: none; }
    .qitems tfoot tr.total { border-top: 2px solid var(--ink); margin-top: .3rem; padding-top: .5rem; }
}
.q-signs { margin-top: 5mm; }
.q-signs .sigline { height: 12mm; }

/* Кнопки в таблицах не ломаются по буквам */
.t .btn, .t .linkbtn { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
/* Адреса для копирования (интеграции): на телефоне — название, адрес, кнопка друг под другом */
.copyt code { overflow-wrap: anywhere; }
@media (max-width: 760px) {
    .copyt, .copyt tbody, .copyt tr, .copyt td { display: block; width: auto; }
    .copyt tr { padding: .6rem 0; border-bottom: 1px solid #e3e8ed; }
    .copyt td { padding: .15rem 0; border: 0; }
    .copyt td:first-child { font-weight: 600; }
}

/* Заявки: написать в WhatsApp / Viber прямо из списка */
.btn-wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-wa:hover { background: #178a45; color: #fff; }
.btn-vb { background: #7360f2; border-color: #7360f2; color: #fff; }
.btn-vb:hover { background: #5d4bd6; color: #fff; }
.lt-btns { display: flex; flex-wrap: wrap; gap: .3rem; }
.lead-msg summary { cursor: pointer; color: var(--muted); }
.lead-msg p { margin: .4rem 0; padding: .5rem .7rem; background: #f3f5f7; border-radius: 8px; }
@media (min-width: 761px) { .lt-call { display: none; } }
@media (max-width: 760px) {
    .leads-t thead { display: none; }
    .leads-t, .leads-t tbody { display: block; }
    .leads-t tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .8rem; padding: .8rem 0; border-bottom: 1px solid #e3e8ed; }
    .leads-t td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: normal; }
    .leads-t .lt-who { grid-column: 1; grid-row: 1; }
    .leads-t .lt-sum { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; white-space: nowrap; }
    .leads-t .lt-what { grid-column: 1 / -1; overflow-wrap: anywhere; }
    .leads-t .lt-when { grid-column: 1; font-size: .85rem; }
    .leads-t .lt-st { grid-column: 2; text-align: right; }
    .leads-t .lt-mkt { display: none; }
    .leads-t .lt-go { grid-column: 1 / -1; }
    .leads-t .lt-btns .btn { flex: 1 1 0; min-height: 44px; }
}

/* Мастера у работы */
.iworkers { margin-top: .3rem; font-size: .85rem; }
.iworkers > summary { display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 999px; background: #f6f8fa; list-style: none; max-width: 100%; }
.iworkers > summary::-webkit-details-marker { display: none; }
.iworkers > summary svg { width: 15px; height: 15px; flex: none; }
.iworkers > summary span { overflow-wrap: anywhere; }
.iworkers[open] > summary { background: var(--accent-soft); }
.iw-form { margin-top: .5rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; gap: .45rem; }
.iw-form p { margin: 0; }
.iw-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.iw-share { display: inline-flex; align-items: center; gap: .25rem; color: var(--muted); }
.iw-share input { width: 78px; min-height: 34px; padding: .2rem .4rem; text-align: right; }
.pay-rates { flex-basis: 100%; }
.pay-rates summary { cursor: pointer; color: var(--muted); }
.sal-orders td { vertical-align: top; }
.sal-check { margin-bottom: 1rem; }
.sal-check summary { cursor: pointer; }
.sal-check .t { margin-top: .6rem; }
.sal-checkt td { vertical-align: top; }
.b-violet { background: #6b4fd8; }
.lead-ch { white-space: normal; display: inline-block; margin-top: .2rem; }
.lead-src { margin-bottom: 1rem; }
.lead-src summary { cursor: pointer; }
.lead-src .t { margin-top: .5rem; }
.lead-from { margin: 0; }
.pc-full summary { cursor: pointer; }
.pc-full > .stack { margin-top: .8rem; }
.pc-full-checks { gap: .4rem 1.2rem; }

/* Задачи «Позвонить» */
.tasks { display: grid; gap: .8rem; margin-bottom: 1rem; }
.task { display: flex; flex-direction: column; gap: .5rem; border-left: 4px solid var(--line); }
.task.task-due { border-left-color: var(--accent); }
.task p { margin: 0; }
.task-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; }
.task-title { font-size: 1.02rem; }
.task-who { font-size: 1.1rem; }
.task-who a { font-weight: 700; font-variant-numeric: tabular-nums; }
.task-when { white-space: nowrap; font-size: .9rem; }
.task-note { background: #f3f5f7; border-radius: 8px; padding: .4rem .6rem; }
.task-res { border-top: 1px dashed var(--line); padding-top: .6rem; gap: .5rem; }
.task-more summary { cursor: pointer; color: var(--muted); }
.task-more .row { margin-top: .5rem; align-items: flex-end; }
.task-add summary { cursor: pointer; }
.task-add form { margin-top: .8rem; }
@media (max-width: 760px) {
    .task-call .btn { flex: 1 1 30%; justify-content: center; }
    .tasks-t thead { display: none; }
    .tasks-t, .tasks-t tbody { display: block; }
    .tasks-t tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
    .tasks-t td { display: block; padding: 0; border: 0; min-width: 0; }
    .tasks-t td[data-l]::before { content: attr(data-l); display: block; font-size: .75rem; color: var(--muted); font-weight: 600; }
}

/* Автосообщение по заявке */
.auto-st { display: block; margin-top: .25rem; font-size: .8rem; color: var(--muted); white-space: normal; }
.auto-box { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; background: #f8fafb; }
.auto-box p { margin: 0; }
.auto-box .auto-st { font-size: .9rem; margin: 0; color: inherit; }
.tpl-prev { white-space: pre-line; background: #e7f6ec; border-radius: 10px; padding: .6rem .8rem; max-width: 560px; font-size: .92rem; }
.tpl-prev small { display: block; color: var(--muted); margin-top: .3rem; }
.tpl-st td { vertical-align: top; }
.es-box { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .6rem; }
.es-box p { margin: 0; }
.chain { margin: 0; padding-left: 1.2rem; }
.chain li { margin: .25rem 0; }
.hours-days { gap: .3rem .9rem; }
@media (max-width: 760px) {
    .consent-t, .consent-t tbody { display: block; }
    .consent-t tr:first-child { display: none; }
    .consent-t tr { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
    .consent-t td { display: block; padding: 0; border: 0; min-width: 0; white-space: normal; }
    .consent-t td.consent-text { grid-column: 1 / -1; }
}

/* Чаты: панель клиента справа (на широком экране — третья колонка, иначе выезжает по кнопке «Клиент») */
.cpanel { display: none; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border-left: 1px solid var(--line); padding: 1rem 1rem 1.5rem; }
.cp-head { position: relative; display: flex; align-items: center; gap: .7rem; padding-right: 2rem; }
.cp-head b { display: block; font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.cp-head small { display: block; margin-top: .1rem; }
.cp-close { position: absolute; top: -.2rem; right: -.2rem; width: 2.1rem; height: 2.1rem; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.cp-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin: .7rem 0 0; }
.cp-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.cp-note { margin-top: 1rem; gap: .4rem; }
.cp-note .f span { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cp-note textarea { min-height: 4.6rem; resize: vertical; }
.cpanel h3 { margin: 1.15rem 0 .5rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.cp-list a { display: flex; flex-direction: column; gap: .2rem; overflow-wrap: anywhere; min-width: 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none; }
.cp-list a:hover { border-color: var(--accent); background: #fbf8f1; }
.cp-list a > span:first-child { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.cp-list b { font-size: .92rem; }
.cp-hist time { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cp-cars { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.cp-cars a { display: flex; align-items: center; gap: .45rem; color: var(--ink); text-decoration: none; }
.cp-chats { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
@media (min-width: 1300px) {
    .main:has(.chatapp.has-panel) .wrap { max-width: 1680px; }
    .chatapp.has-panel { grid-template-columns: 300px minmax(0, 1fr) 330px; }
    .chatapp.has-panel .cpanel { display: block; }
    .cp-open, .cp-close { display: none; }
}
@media (max-width: 1299px) {
    .tl-client { display: none !important; }
    .cpanel { display: block; position: fixed; top: 0; right: 0; bottom: 0; z-index: 70; width: min(380px, 100%); border-left: 0; box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
        padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translateX(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
    .chatapp.cp-show .cpanel { transform: none; visibility: visible; }
    .chatapp.cp-show::after { content: ''; position: fixed; inset: 0; z-index: 65; background: rgba(3, 5, 4, .35); }
}

/* ИИ читает чек: статус над строками и подсветка заполненных строк */
.ai-status { padding: .65rem .9rem; border-radius: 8px; font-size: .92rem; line-height: 1.45; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.ai-status.ai-ok { background: #e3f3e9; border-left-color: var(--s-ready); }
.ai-status.ai-warn { background: #fff4e0; border-left-color: var(--s-in_work); }
.ai-status.ai-bad { background: #fdecea; border-left-color: var(--danger); color: var(--danger); }
.ai-spin { display: inline-block; width: .9em; height: .9em; margin-right: .35em; vertical-align: -.1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ai-spin { animation: none; } }
table.lines tr.ai-filled td { background: #f7fbf8; }

/* Нормы расхода */
.norm-svc { border-top: 1px solid var(--line, #e6e3dc); padding: .55rem 0; }
.norm-svc > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: baseline; }
.norm-svc > summary .tag { white-space: normal; }
.norm-svc form { margin-top: .6rem; }
table.norms select { max-width: 100%; min-width: 0; }
table.norms td { vertical-align: middle; }
table.norms input.numin { width: 6.5rem; min-width: 0; display: inline-block; }
@media (max-width: 700px) {
    table.norms { min-width: 0; }
    table.norms thead { display: none; }
    table.norms, table.norms tbody { display: block; }
    table.norms tr { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); }
    table.norms td { display: block; padding: .2rem 0; border: 0; }
    table.norms td[data-l="Товар на складе"]::before, table.norms td[data-l="Материал"]::before { content: attr(data-l); display: block; font-size: .75rem; color: var(--muted); font-weight: 600; }
    table.norms select { width: 100%; }
}

/* ===== Моя студия: блок «Деньги» ===== */
.money-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin-bottom: 1rem; }
.money-head h2 { margin: 0; }
.mper { display: flex; flex-wrap: wrap; gap: .3rem; }
.mper a { padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); font-weight: 600; font-size: .85rem; }
.mper a:hover { color: var(--ink); }
.mper a[aria-current] { background: var(--ink); border-color: var(--ink); color: #fff; }
.money-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.mk { border: 1px solid #d8dee4; border-radius: var(--r); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; border-left-width: 4px; }
.mk span { font-size: .85rem; color: var(--muted); }
.mk b { font-size: 1.5rem; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mk small { color: var(--muted); font-size: .8rem; }
.mk-in { border-left-color: #1f9d55; } .mk-out { border-left-color: var(--danger); } .mk-res { border-left-color: var(--graphite); } .mk-owe { border-left-color: #e08a00; }
.money-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.money-cols h3 { margin: 0 0 .3rem; font-size: 1rem; }
.money-cols h3 ~ h3 { margin-top: 1.1rem; }
.money-cols .prow b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.owe-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.owe-more summary { cursor: pointer; padding: .5rem 0; color: var(--muted); font-weight: 600; }
@media (max-width: 1100px) { .money-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .money-cols { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .money-kpis { grid-template-columns: 1fr; } .mk b { font-size: 1.3rem; } }
.money-cols small.block { display: block; font-size: .8rem; }

/* ===== Гарантийный талон ===== */
.act .w-title { text-align: center; font-size: 17pt; margin: 6mm 0 5mm; }
.act .w-lines th { width: auto; }
.act.warranty .terms li { margin-bottom: 1.6mm; }
.wtable td.num { width: 1%; white-space: nowrap; }
.wsel { min-width: 9.5rem; }
.w-cat { margin: .6rem 0 0; font-size: 1rem; }
.wbtns { margin-top: .8rem; }
.wbtns form { display: contents; }
.offer-body .offer-bar { flex-direction: row; flex-wrap: wrap; }
@media (max-width: 640px) {
    .act .w-lines .w-head { display: none; }
    .act .w-lines tr { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #999; border-bottom: 0; }
    .act .w-lines tr:last-child { border-bottom: 1px solid #999; }
    .act .w-lines td { border: 0; }
    .act .w-lines td:first-child { grid-column: 1 / -1; font-weight: 600; padding-bottom: 0; }
    .act .w-lines td.num { text-align: left; white-space: normal; }
    .act .w-lines td.num::before { content: attr(data-l); display: block; font-size: 8pt; color: #666; }
}

/* ===== Оплаты: способы, поля оплаты, отчёт ===== */
.tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.payset input:not([type="checkbox"]), .payset select { width: 100%; min-width: 9rem; }
.payset td.c, .paylist td.c { text-align: center; }
.payset-new td { background: #f7f9fb; }
.payx { display: contents; }
.payx [hidden] { display: none !important; }
.payx-fiscal { align-self: end; padding-bottom: .55rem; white-space: nowrap; }
.prow.on { background: #f3f6f9; border-radius: 8px; padding-left: .4rem; padding-right: .4rem; }
.pay-hd { border-bottom: 1px solid var(--line); }
.paylist .nowrap { white-space: nowrap; }
.paycheck { margin-top: .35rem; gap: .35rem; }
.paycheck input { width: 7rem; }
@media (max-width: 640px) {
    .paylist tr { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
    .paylist td { border: 0; padding: 0; }
    .paylist td:nth-child(1) { grid-column: 1 / -1; }
    .paylist td:nth-child(3) { grid-column: 1 / -1; }
    .paylist td.c { text-align: left; }
}
.kpi-nocheck::before { background: #e08a00; }
.payedit td { background: #f7f9fb; }
.payedit form { margin: .2rem 0; }
.payacts { white-space: nowrap; }
.payacts form { display: inline; }
.kpi-nocheck::before { background: #e08a00; }
.payedit td { background: #f7f9fb; }
.payedit form { margin: .2rem 0; }
.payacts { white-space: nowrap; }
.payacts form { display: inline; }

/* ===== Лист в машину и чек-листы ===== */
.ws { font-size: 10.5pt; }
.ws h2 { font-size: 12pt; margin: 4mm 0 2mm; border-bottom: 1.5px solid #000; padding-bottom: 1mm; }
.ws h3 { font-size: 9.5pt; margin: 0 0 1mm; text-transform: uppercase; letter-spacing: .04em; color: #444; }
.ws-head { width: 100%; border-collapse: collapse; }
.ws-head td { vertical-align: top; }
.ws-plate { font-size: 30pt; font-weight: 900; letter-spacing: .04em; line-height: 1; border: 2.5px solid #000; border-radius: 6px; display: inline-block; padding: 1mm 4mm; }
.ws-car { font-size: 15pt; font-weight: 700; margin: 2mm 0 1mm; }
.ws-qr { width: 30mm; text-align: center; font-size: 9pt; font-weight: 700; }
.ws-qr svg { width: 26mm; height: 26mm; display: block; margin: 0 auto 1mm; }
.ws-dates { width: 100%; border-collapse: collapse; margin-top: 3mm; }
.ws-dates td { border: 1px solid #999; padding: 1.5mm 2.5mm; vertical-align: top; }
.ws-dates span { display: block; font-size: 8pt; color: #555; text-transform: uppercase; letter-spacing: .04em; }
.ws-dates b { font-size: 11.5pt; }
.ws-due { background: #fff4d6; }
.ws-due b { font-size: 14pt; }
.ws-note { border: 2px solid #000; padding: 2mm 3mm; margin: 1mm 0 2mm; font-size: 11pt; }
.ws-stop { border: 2px dashed #c00; color: #a00; padding: 2mm 3mm; margin: 3mm 0; }
.ws-job { border: 1px solid #999; border-radius: 4px; padding: 2mm 3mm; margin: 0 0 2.5mm; break-inside: avoid; page-break-inside: avoid; }
.ws-job-h { display: flex; flex-wrap: wrap; align-items: center; gap: 1.5mm 2mm; font-size: 11.5pt; margin-bottom: 1mm; }
.ws-who { margin-left: auto; font-size: 9.5pt; color: #333; }
.ws-tag { font-size: 8pt; border: 1px solid #999; border-radius: 3px; padding: 0 1.5mm; font-weight: normal; }
.ws-box { width: 4mm; height: 4mm; border: 1.5px solid #000; border-radius: 1px; flex: none; }
.ws-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 1.5mm; }
.ws-cl { list-style: none; margin: 0; padding: 0; }
.ws-cl li { position: relative; padding-left: 5.5mm; margin: 0 0 1mm; line-height: 1.3; font-size: 9.5pt; }
.ws-cl li::before { content: ""; position: absolute; left: 0; top: .5mm; width: 3.2mm; height: 3.2mm; border: 1.2px solid #000; border-radius: 1px; }
.ws-goods td { padding: 1mm 2mm; }
@media (max-width: 640px) { .ws-cols { grid-template-columns: 1fr; } .ws-plate { font-size: 22pt; } .ws-dates td { display: block; } }
@media print { .ws { padding: 8mm 10mm; } .ws-cols { grid-template-columns: 1fr 1fr !important; } }
.cl-svc { border-bottom: 1px solid var(--line); padding: .5rem 0; }
.cl-svc summary { cursor: pointer; }
.cl-svc[open] summary { margin-bottom: .5rem; }
@media print { html, body.act-body { background: #fff !important; } }

/* ===== Комментарии к позициям, правка позиции, RU/RO в листе ===== */
.svcadd-row { grid-template-columns: minmax(0, 1fr) 96px 110px 170px; }
@media (max-width: 760px) { .svcadd-row { grid-template-columns: 1fr 1fr; } .svcadd-row .svcadd-n { grid-column: 1 / -1; } }
.inote { margin: .25rem 0; padding: .2rem .5rem; border-left: 3px solid var(--accent); background: #fafbfc; font-size: .88rem; color: var(--ink); }
.iedit { margin-top: .25rem; }
.iedit summary { cursor: pointer; font-size: .82rem; color: var(--muted); display: inline-block; }
.iedit[open] { background: #f7f9fb; border-radius: 8px; padding: .5rem; margin: .4rem 0; }
.ws .ro { color: #555; font-weight: normal; font-style: italic; }
.ws h2 .ro, .ws h3 .ro { font-style: normal; }
.ws-cl li .ro { display: block; font-size: 8.5pt; }
.ws-job h2 { margin-top: 0; border-bottom-width: 1px; }
.ws-items { margin: 0 0 1.5mm; padding-left: 5mm; }
.ws-items li { margin: 0 0 1.5mm; }
.ws-ro { font-size: 9pt; margin-left: 6mm; }
.ws-cmt { margin: .8mm 0 0 6mm; padding: 1mm 2.5mm; border-left: 2.5px solid #000; background: #f4f4f4; font-size: 10pt; }
.ws-common { margin-top: 3mm; }
.cl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; }
@media (max-width: 760px) { .cl-grid { grid-template-columns: 1fr; } }
.savebar { position: sticky; bottom: 0; background: var(--bg, #eef0f3); padding: .6rem 0; }
.ws-job { break-inside: auto; page-break-inside: auto; }
.ws-job h2, .ws-job h3 { break-after: avoid; page-break-after: avoid; }
.ws-items li, .ws-cl li { break-inside: avoid; page-break-inside: avoid; }

/* ===== Лист в машину: компактно, чтобы помещалось на один лист ===== */
.ws { font-size: 8.6pt; line-height: 1.25; }
.ws-title { display: flex; flex-wrap: wrap; align-items: center; gap: 1mm 3mm; }
.ws-plate { font-size: 20pt; border-width: 2px; padding: .5mm 2.5mm; }
.ws-car { font-size: 12pt; margin: 0; }
.ws-head .small { margin-top: 1mm; font-size: 8pt; }
.ws-qr { width: 20mm; font-size: 7.5pt; }
.ws-qr svg { width: 17mm; height: 17mm; margin-bottom: .5mm; }
.ws-dates { margin-top: 1.5mm; }
.ws-dates td { padding: .8mm 2mm; }
.ws-dates span { display: inline; font-size: 7pt; margin-right: 1.5mm; }
.ws-dates b, .ws-due b { font-size: 9.5pt; }
.ws h2 { font-size: 9.5pt; margin: 2mm 0 1mm; padding-bottom: .5mm; }
.ws h3 { font-size: 7.5pt; margin: 0 0 .5mm; }
.ws p { margin: .6mm 0; }
.ws-note { padding: 1mm 2mm; margin: .5mm 0 1mm; font-size: 9pt; border-width: 1.5px; }
.ws-stop { padding: 1mm 2mm; margin: 1.5mm 0; }
.ws-job { padding: 1.2mm 2mm; margin: 0 0 1.5mm; border-radius: 3px; }
.ws-job h2 { margin: 0 0 .8mm; }
.ws-items { margin: 0 0 .8mm; padding-left: 4.5mm; }
.ws-items li { margin: 0 0 .6mm; }
.ws-job-h { font-size: 9.2pt; gap: .5mm 1.5mm; margin: 0; align-items: flex-start; }
.ws-who { font-size: 8pt; }
.ws-tag { font-size: 7pt; }
.ws-box { width: 3mm; height: 3mm; border-width: 1.2px; margin-top: .4mm; }
.ws-cmt { margin: .4mm 0 0 4.5mm; padding: .4mm 2mm; font-size: 8.5pt; border-left-width: 2px; }
.ws-cols { gap: 3mm; margin-top: .6mm; }
.ws-cl li { padding-left: 4mm; margin: 0 0 .5mm; line-height: 1.2; font-size: 8pt; }
.ws-cl li::before { top: .3mm; width: 2.6mm; height: 2.6mm; border-width: 1px; }
.ws-cl li .ro { display: inline; font-size: 7.3pt; }
.ws-goods td { padding: .5mm 1.5mm; }
.ws-common { margin-top: 1.5mm; }
.ws .signs { margin-top: 2mm; }
.ws .signs .sigline { height: 8mm; }
.ws-foot { margin: 1mm 0 0; font-size: 7pt; }
@media print {
    .ws { padding: 6mm 7mm !important; }
    .ws-job, .ws-cols > div { break-inside: auto; }
}
.ws-cl li { font-size: 7.8pt; }
.ws-cl li .ro { font-size: 7pt; }
.ws-job { padding: 1mm 1.8mm; margin-bottom: 1.2mm; }
@media print { .ws-foot { display: none; } }
@media print { .ws { padding: 5mm 6mm !important; } }
.ws h2 { margin: 1.2mm 0 .6mm; }
.ws-cl li { margin-bottom: .3mm; line-height: 1.15; }
.ws .signs { margin-top: 1.5mm; }
.ws .signs .sigline { height: 6mm; }
.ws .signs td { font-size: 8pt; }
.ws-sign { display: flex; align-items: flex-end; gap: 2mm; margin: 2.5mm 0 0 !important; font-size: 8pt; white-space: nowrap; }
.ws-line { flex: 1; border-bottom: 1px solid #000; height: 4mm; }
.ws-head .small { margin-top: .5mm; }
.ws-cl li { font-size: 7.6pt; margin-bottom: .2mm; }
.ws-cl li .ro { font-size: 6.8pt; }
.ws-job-h { font-size: 8.8pt; }
.ws-cmt { font-size: 8.2pt; }
.ws-job { padding: .8mm 1.6mm; margin-bottom: 1mm; }
@media print { .ws { padding: 4.5mm 5.5mm !important; } }
.ws-qr { width: 16mm; }
.ws-qr svg { width: 14mm; height: 14mm; }
.ws-sign { margin-top: 1.5mm !important; }
.ws-cols { margin-top: .3mm; }
.ws-items { margin-bottom: .4mm; }
.ws-cl li { line-height: 1.12; margin-bottom: .15mm; }
.ws-job h2 { margin-bottom: .4mm; }
.ws > .ws-items { margin: 0 0 1.5mm; }
.ws-check { margin-top: 1.5mm; }
.ws-kind { margin: 1mm 0 .3mm !important; font-size: 7.6pt; font-weight: 700; border-bottom: .5px solid #bbb; }
.ws-kind .ro { font-weight: normal; }
.ws-cols > div > .ws-kind:first-of-type { margin-top: 0 !important; }

/* ===== Фото из калькулятора на сайте ===== */
.lp-thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.lp-thumbs img { width: 110px; height: 82px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.lp-page { max-width: 46rem; }
.lp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin: 1rem 0; }
.lp-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; }
.lp-acts { margin-top: 1rem; }

/* Зарплата по операциям внутри работы */
.iops-form { margin-top: .5rem; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; gap: .45rem; }
.iops-form p { margin: 0; }
.iops-t { font-size: .82rem; margin: .2rem 0; }
.iops-t th, .iops-t td { padding: .25rem .3rem; vertical-align: middle; }
.iops-t select { max-width: 10.5rem; padding: .25rem .3rem; }
.iops-n { width: 4.6rem; padding: .25rem .35rem; }
.iops-new td { border-top: 1px dashed var(--line); }
.iops-one { margin-top: .4rem; align-items: end; }
.sal-late { display: inline-block; font-size: .72rem; padding: 0 .4rem; border-radius: 999px; background: #fff3cd; color: #7a5200; white-space: nowrap; }
.sal-carry td { background: #fffaf0; }
.sal-ops { display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.sal-ops label { font-size: .85rem; }
@media (max-width: 640px) {
    .iops-t thead { display: none; }
    .iops-t tr { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .4rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
    .iops-t td { padding: 0; border: 0; }
    .iops-t select { max-width: 100%; width: 100%; }
}

/* Fișa postului */
.fisa { font-size: 10pt; line-height: 1.35; }
.fisa-top { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.fisa-top td { vertical-align: top; width: 50%; }
.fisa-aprob { text-align: right; line-height: 1.7; }
.fisa-blank { display: inline-block; min-width: 42mm; border-bottom: 1px solid #000; height: 1em; vertical-align: bottom; }
.fisa-h { font-size: 15pt; text-align: center; margin: 2mm 0 0; letter-spacing: .02em; }
.fisa-h span { font-weight: 600; }
.fisa-sub { text-align: center; margin: 0 0 4mm; font-size: 9pt; color: #444; }
.fisa h2 { font-size: 11pt; margin: 4mm 0 1.5mm; }
.fisa-t { width: 100%; border-collapse: collapse; }
.fisa-t th, .fisa-t td { border: 1px solid #999; padding: 1.2mm 2mm; vertical-align: top; text-align: left; }
.fisa-t td { width: 50%; }
.fisa-meta th { width: 30%; font-weight: 600; background: #f4f4f4; }
.fisa-meta td { width: 35%; }
.fisa-duties td.fisa-nr { width: 7mm; text-align: center; }
.fisa-duties td:not(.fisa-nr) { width: 48%; }
.fisa-sec td { background: #f4f4f4; font-size: 9.5pt; }
.fisa-sign th { width: 30%; background: #f4f4f4; }
.fisa-sign td { width: 35%; }
.fisa-sign td { height: 9mm; }
.fisa-ack { margin-top: 4mm; }
.fisa-note { font-size: 8.5pt; color: #555; }
.fisa-tools { flex-wrap: wrap; }
.fisa-set { flex-basis: 100%; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .8rem; }
.fisa-set summary { cursor: pointer; font-weight: 600; }
.fisa-set form { margin-top: .6rem; }
@media print {
    .fisa { padding: 9mm 11mm; font-size: 9pt; line-height: 1.28; }
    .fisa-t th, .fisa-t td { padding: .9mm 1.8mm; }
    .fisa h2 { margin: 3mm 0 1.2mm; }
    .fisa-t tr, .fisa-sign, .fisa-ack { break-inside: avoid; }
    .fisa-t th, .fisa-t td { border-color: #666; }
}

/* Расход: накладная уже внесена */
.ai-dup { background: #fdecec; border-left: 4px solid #c0392b; padding: .45rem .7rem; border-radius: 6px; margin-bottom: .5rem; }
.ai-dup a { font-weight: 600; }

/* Операцию делят двое: доля помощника */
.iops-shared td { background: #f7fbf5; }
.iops-sh { width: 3.6rem; }
.iops-help summary { cursor: pointer; color: var(--muted, #666); white-space: nowrap; }
.iops-help[open] { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.iops-split { margin: 0; }
.iops-sub td { border-top: 0; }
.iops-sub td:first-child { padding-left: 1.2rem; }

/* «Что делаем»: позиции списком, кузов по деталям, акция */
.pos { display: grid; gap: .8rem; }
.pos-body { display: grid; gap: .6rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: #fafbf9; }
.pos-bodyrow { display: grid; gap: .5rem; grid-template-columns: 2fr 1fr 2fr; }
.pos-bodyops { display: flex; flex-wrap: wrap; gap: .5rem; }
.pos-op { display: flex; align-items: center; gap: .45rem; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pos-op span { display: grid; line-height: 1.15; font-weight: 600; font-size: .9rem; }
.pos-op small { font-weight: 400; color: var(--muted, #666); font-size: .75rem; }
.pos-num { width: 6.5rem; }
.pos-t td { vertical-align: top; }
.pos-t input:not([type=checkbox]):not(.pos-num) { width: 100%; }
.pos-cat select { margin-top: .25rem; font-size: .8rem; padding: .2rem .3rem; }
.pos-new td { background: #f6f8f5; }
.pos-promo-line { align-items: end; }
@media (max-width: 700px) {
    .pos-bodyrow { grid-template-columns: 1fr 1fr; }
    .pos-bodyrow label:first-child { grid-column: 1 / -1; }
    .pos-op { flex: 1 1 100%; justify-content: space-between; }
    .pos-t thead { display: none; }
    .pos-t tr { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .3rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
    .pos-t tfoot tr:last-child { display: flex; gap: .5rem; }
    .pos-t td { padding: 0; border: 0; }
    .pos-t td:first-child { grid-column: 1 / -1; }
    .pos-num { width: 100%; }
}

/* Эфир TikTok */
.live-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .live-grid { grid-template-columns: 1fr; } }
.live-seg, .live-iseg { display: flex; flex-wrap: wrap; gap: .3rem; }
.live-seg button, .live-iseg button, .live-els button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .4rem .75rem; font: inherit; font-size: .85rem; cursor: pointer; }
.live-seg button.on, .live-iseg button.on { background: #111; color: #fff; border-color: #111; }
.live-els { display: flex; flex-wrap: wrap; gap: .35rem; }
.live-els button { border-radius: 10px; padding: .55rem .7rem; font-weight: 600; }
.live-els button:active { background: #eaffe3; }
.live-items { display: grid; gap: .5rem; }
.live-item { display: grid; grid-template-columns: minmax(8rem, 1fr) auto auto auto auto; gap: .5rem; align-items: center; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 12px; background: #fafbf9; }
.live-iname { display: grid; line-height: 1.2; }
.live-iseg button { padding: .3rem .55rem; font-size: .78rem; }
.live-iprice { white-space: nowrap; }
@media (max-width: 760px) { .live-item { grid-template-columns: 1fr auto; } .live-iseg { grid-column: 1 / -1; } }
.live-total { font-size: 1.2rem; } .live-total b { font-size: 1.8rem; }
.live-row { display: grid; grid-template-columns: 4.2rem 1fr; gap: .7rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.live-row.on { background: #f3fff0; }
.live-code { font-size: 1.35rem; font-weight: 900; letter-spacing: .04em; text-align: center; align-self: start; background: #111; color: #39ff14; border-radius: 10px; padding: .35rem 0; }
.live-acts { margin-top: .35rem; gap: .35rem; align-items: center; }
.live-acts select { padding: .25rem .35rem; font-size: .8rem; }
.live-phone summary { list-style: none; }
.live-phone[open] form { margin-top: .35rem; }

/* Отчёты: вкладки «Общее / Финансы и прибыль / Воронка» */
.rep-tabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }
.rep-tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.rep-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.kpi-link { text-decoration: none; color: inherit; }
.kpi-link:hover { border-color: var(--accent); }
.fin-kpis .kpi small { line-height: 1.3; }

/* Экономика заказа */
.econ { margin-top: .6rem; background: #f3f5f7; border-radius: 8px; padding: .5rem .8rem; }
.econ > summary { cursor: pointer; line-height: 1.5; }
.econ[open] > summary { margin-bottom: .5rem; }
.econ-t td, .econ-t th { vertical-align: top; }
.econ-t .econ-h { width: 3.6rem; display: inline-block; padding: .15rem .3rem; min-height: 0; }
.econ-notes { margin: .5rem 0; line-height: 1.5; }
.econ-list tr.econ-low td { background: #fff4f2; }
.econ-sort { align-items: center; gap: .3rem; margin-bottom: .5rem; }

/* Воронка */
.funnel { display: grid; gap: .35rem; margin: .4rem 0 .8rem; }
.fn-row { display: grid; grid-template-columns: 9.5rem 1fr 3rem 6.5rem; gap: .6rem; align-items: center; }
.fn-bar { background: #eef1f4; border-radius: 4px; height: 1.4rem; overflow: hidden; }
.fn-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.fn-n { text-align: right; font-variant-numeric: tabular-nums; }
.fn-lost { border-top: 1px solid var(--line); padding: .5rem 0; }
.fn-lost > summary { cursor: pointer; }
@media (max-width: 560px) {
    .fn-row { grid-template-columns: 6.5rem 1fr 2.2rem; }
    .fn-pc { grid-column: 2 / 4; margin-top: -.3rem; }
}
@media (min-width: 900px) { .fin-kpis { grid-template-columns: repeat(3, 1fr); } }

/* Накладная: строка в своей валюте (смешанные накладные: лей + евро) и пересчёт в леи */
.lines .sumcell { display: flex; gap: .25rem; align-items: center; }
.lines select.lcur { min-width: 0; width: 4.2rem; padding-left: .3rem; padding-right: .2rem; }
form[data-cur="MDL"] .lines select.lcur, form:not([data-cur]) .lines select.lcur { display: none; }
.lines .lei-out { margin-top: .15rem; white-space: nowrap; }
.doc-pages { display: flex; flex-wrap: wrap; gap: .5rem; }
.doc-page { position: relative; width: 74px; height: 96px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.doc-page img { width: 100%; height: 100%; object-fit: cover; }
.doc-pdf { display: flex; align-items: center; justify-content: center; height: 100%; font-weight: 700; color: var(--muted); }
.doc-del { position: absolute; top: 2px; right: 2px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.warn-txt { color: #a35d00; }
.econ-t .econ-mat { min-width: 8rem; }
.econ-how { line-height: 1.5; padding-left: 1.1rem; }
.econ-mp { align-items: flex-end; gap: .6rem 1rem; flex-wrap: wrap; }
.econ-mp .short-in { width: 6rem; }
.paint-mix { margin-top: .6rem; }
.pm-add { display: grid; grid-template-columns: 2fr 1fr 1fr auto auto; gap: .5rem .8rem; align-items: end; margin-top: .5rem; }
.pm-add .pm-sum { padding-bottom: .6rem; white-space: nowrap; }
.pm-t td { vertical-align: middle; }
@media (max-width: 640px) { .pm-add { grid-template-columns: 1fr 1fr; } .pm-add label:first-of-type { grid-column: 1 / 3; } }
.econ-t td.econ-mat .small { white-space: normal; max-width: 13rem; margin-left: auto; line-height: 1.3; }
.econ-t td:first-child { min-width: 11rem; }
.econ-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: .8rem 1.4rem; margin-top: .4rem; }
.econ-grid h3 { margin: .2rem 0 .4rem; font-size: 1rem; }
.econ-mats td { padding-top: .3rem; padding-bottom: .3rem; }
.econ-mats tr.econ-work td { padding-top: .6rem; border-bottom: 0; font-weight: 600; }
.econ-mats tr.debt td { color: var(--debt, #b42318); }
.econ-works { margin-top: .6rem; border-top: 1px solid var(--line); padding-top: .4rem; }
.econ-works > summary { cursor: pointer; font-weight: 600; }
/* Касса и счёт */
.flow tr.sec td { padding-top: .9rem; font-weight: 700; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); border-bottom: 0; }
.flow tr.sub td { background: #f3f5f7; }
.flow tr.small td { padding-top: 0; border-bottom: 0; }
.money-form { gap: .5rem 1rem; align-items: flex-end; flex-wrap: wrap; }
.money-form .row { gap: .5rem 1rem; flex-wrap: wrap; }
.money-now .kpi small { line-height: 1.3; }
#ops form + h2 { margin-top: 1.4rem; }
/* Главная: быстро записать деньги */
.quick-money h2 { margin-bottom: .5rem; }
.qm-what { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.qm-what label { display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; }
.qm-what label:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.qm-what label { position: relative; }
.qm-what input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.qm-fields { display: flex; flex-wrap: wrap; gap: .5rem .8rem; align-items: flex-end; }
.qm-fields .f { min-width: 9rem; }
.qm-fields .qm-note { flex: 1 1 14rem; }
.qm-form:has([value="draw"]:checked) .qm-cat, .qm-form:has([value="draw"]:checked) .qm-uid,
.qm-form:has([value="expense"]:checked) .qm-uid,
.qm-form:has([value="payout"]:checked) .qm-cat, .qm-form:has([value="payout"]:checked) .qm-acc { display: none; }
@media (max-width: 640px) {
    .money-moves tr { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
    .money-moves td { border: 0; padding: 0; }
    .money-moves td:nth-child(4) { display: none; }
    .money-moves td:nth-child(5) { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
}
.exp-method { min-width: 0; padding: .2rem .4rem; font-size: .85rem; }
.sal-settle { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; margin: .5rem 0 .8rem; }
/* Деньги: поток */
.cf-kpis { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.cf-kpis .kpi small { line-height: 1.35; }
.cf-forecast { background: #f3f5f7; }
.cf-staff { border-top: 1px solid var(--line); padding: .55rem 0; }
.cf-staff > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: baseline; }
.cf-staff > summary .cf-st { color: var(--muted); font-size: .9rem; }
.cf-staff > summary .cf-owed { margin-left: auto; }
.cf-pay { gap: .5rem .8rem; align-items: flex-end; flex-wrap: wrap; margin-top: .5rem; }
.cf-recpay { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.cf-recpay .short-in, .cf-addform .short-in, .cf-recedit .short-in { width: 6.5rem; }
.cf-recedit > summary { cursor: pointer; color: var(--muted); margin-top: .2rem; }
.cf-add { margin-top: .6rem; }
.cf-add > summary { display: inline-block; list-style: none; }
.cf-addform { gap: .5rem .8rem; align-items: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.money-sync { border-left: 4px solid var(--accent); }
/* План месяца и итог */
.cf-month-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.cf-month-grid > div { display: flex; flex-direction: column; gap: .15rem; padding: .7rem .8rem; border-radius: 10px; background: #f6f7f9; min-width: 0; }
.cf-month-grid span { font-size: .85rem; color: #5b6470; }
.cf-month-grid b { font-size: 1.25rem; }
.cf-month-grid small { font-size: .78rem; color: #6b7480; line-height: 1.35; }
.cf-plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem 1.4rem; }
.cf-plan-col { min-width: 0; }
.cf-plan-col h3, .cf-ai h3 { font-size: 1rem; margin: .2rem 0 .5rem; }
.cf-plan .t td, .cf-oblig .t td { overflow-wrap: anywhere; }
.cf-be { padding: .55rem .7rem; border-radius: 8px; background: #eef4ff; }
.cf-need { padding: .55rem .7rem; border-radius: 8px; background: #fff4e5; margin: .6rem 0 0; }
.cf-need.paid { background: #e9f7ef; }
.cf-actions { padding-left: 1.3rem; }
.cf-actions li { margin: .45rem 0; }
.cf-typical .t input:not([type=checkbox]), .cf-typical .t select { width: 100%; min-width: 4.5rem; }
.cf-typical .t { margin-bottom: .6rem; }
.money-since { list-style: none; margin: .45rem 0 0; padding: .45rem 0 0; border-top: 1px dashed #d9dde3; }
.money-since li { display: flex; justify-content: space-between; gap: .6rem; padding: .1rem 0; }
.money-since li.total { border-top: 1px solid #d9dde3; margin-top: .2rem; padding-top: .25rem; }
.kpi .money-since b { font-size: .9rem; font-weight: 700; white-space: nowrap; line-height: 1.3; }
.kpi .money-since span { min-width: 0; }
/* Выплаты по машинам */
.po-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .3rem 1rem; }
.po-head h2 { margin: 0; }
.po-t td { vertical-align: top; overflow-wrap: anywhere; }
.po-t td:first-child input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin-top: .15rem; }
.po-week td { background: #f6f7f9; font-size: .9rem; padding-top: .45rem; padding-bottom: .45rem; }
.po-foot { margin-top: .6rem; align-items: flex-end; }
.po-more { margin-top: .7rem; }
.po-more summary { cursor: pointer; font-weight: 600; padding: .3rem 0; }
.pay-all { margin: 0 0 1rem; align-items: flex-end; }
.po-m { display: none; }
@media (max-width: 640px) {
    .po-t .po-x { display: none; }
    .po-m { display: block; }
    .po-intro { font-size: .9rem; }
}
.sal-car { font-weight: 600; font-size: .9rem; }
.f.inline.sal-pcar { flex: 2.4 1 300px; min-width: 0; } .sal-pcar select { width: 100%; }
@media (max-width: 640px) { .f.inline.sal-pcar { flex-basis: 100%; } }
/* Клиент ушёл без оплаты */
.lost-box { margin-top: 1rem; border-top: 1px dashed #d9dde3; padding-top: .7rem; }
.lost-box summary { cursor: pointer; color: #a12a1f; font-weight: 600; }
.lost-box form { margin-top: .7rem; }
.lost-box .chk { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .95rem; }
.lost-box .chk select { width: auto; }
.lost-box legend { padding: 0; margin-bottom: .2rem; }
.lost-box .chk input[type=radio] { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; margin: 0; padding: 0; }
.lost-box .chk { flex-wrap: nowrap; align-items: flex-start; }
.lost-box .chk select { margin-top: .3rem; }
.u-rename { margin-top: .2rem; }
.u-rename summary { cursor: pointer; color: var(--muted, #6b7480); }
.u-rename form { margin-top: .35rem; }
.u-rename input { max-width: 16rem; }
.sal-ren { text-decoration: none; font-weight: 400; opacity: .6; }
