:root {
  --bg: #F2F4F4; --panel: #fff; --ink: #0A0D0E; --ink2: #3A4444; --muted: #6E7979; --line: #E2E7E7; --line2: #D3DADA;
  --accent: #3FE3D4; --accent-ink: #0A0D0E; --accent-d: #0B3F3D; --accent-soft: #E3FAF8;
  --danger: #D9534F; --warn: #F0A030; --ok: #1E9E57; --side: #0A0D0E;
  --r: 8px; --sh: 0 1px 2px rgba(10,13,14,.06), 0 4px 16px rgba(10,13,14,.06);
  --f: 'Golos Text', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--f); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-d); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line2); background: var(--panel); cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--ink2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: #2fd3c4; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(10,13,14,.05); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.inp, select.inp, textarea.inp { height: 34px; padding: 0 10px; border: 1px solid var(--line2); border-radius: var(--r); background: #fff; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.inp { height: auto; min-height: 70px; padding: 8px 10px; resize: vertical; overflow: hidden; }
.inp:focus { border-color: var(--accent-d); box-shadow: 0 0 0 3px rgba(63,227,212,.25); }
.inp.sm { height: 28px; font-size: 13px; padding: 0 8px; }
label.chk { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
label.chk input { width: 16px; height: 16px; accent-color: var(--accent-d); }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; color: var(--muted); }

/* вход */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--side); }
.login form { width: min(360px, 100%); background: #fff; border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login h1 { margin: 0 0 4px; font-size: 22px; }
.login .err { color: var(--danger); min-height: 20px; font-size: 13px; }

/* каркас */
.shell { display: grid; grid-template-columns: 216px 1fr; height: 100%; }
.side { background: var(--side); color: #C9D2D2; display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 15px; padding: 4px 10px 16px; display: flex; gap: 10px; align-items: center; }
.brand i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); flex: none; }
.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; cursor: pointer; position: relative; }
.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav.on { background: rgba(63,227,212,.14); color: #fff; }
.nav.on::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav .badge { margin-left: auto; }
.side .sp { flex: 1; }
.side .me { padding: 10px; font-size: 13px; color: #9AA5A5; border-top: 1px solid rgba(255,255,255,.08); margin-top: 8px; display: grid; gap: 2px; }
.side .me b { color: #fff; font-weight: 500; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.top { display: flex; gap: 10px; align-items: center; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; flex-wrap: wrap; }
.top h2 { margin: 0; font-size: 18px; font-weight: 600; margin-right: 6px; }
.top .search { width: 260px; }
.view { flex: 1; overflow: auto; padding: 16px 20px; min-height: 0; }

/* канбан */
.board { display: flex; gap: 10px; height: 100%; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.col { flex: 0 0 272px; background: #E9EDED; border-radius: 10px; display: flex; flex-direction: column; max-height: 100%; }
.col-h { padding: 10px 12px 8px; border-top: 3px solid var(--c, var(--line2)); border-radius: 10px 10px 0 0; }
.col-h b { font-weight: 600; display: block; }
.col-h .small { display: flex; justify-content: space-between; }
.col-b { padding: 4px 8px 10px; overflow-y: auto; display: grid; gap: 6px; align-content: start; min-height: 60px; flex: 1; }
.col.over .col-b { background: rgba(63,227,212,.15); border-radius: 0 0 10px 10px; }
.card { background: #fff; border-radius: 8px; padding: 10px 11px; box-shadow: 0 1px 2px rgba(10,13,14,.08); cursor: pointer; display: grid; gap: 4px; border: 1px solid transparent; transition: border-color .12s, box-shadow .12s; }
.card:hover { border-color: var(--line2); box-shadow: var(--sh); }
.card.drag { opacity: .4; }
.card .t { font-weight: 500; line-height: 1.3; }
.card .meta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.card .price { font-weight: 600; color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: inline-block; flex: none; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; background: #EEF1F1; color: var(--ink2); font-size: 11px; font-weight: 500; white-space: nowrap; }
.tag.src-site { background: #E3FAF8; color: var(--accent-d); }
.tag.src-avito { background: #E8F0FF; color: #2A55B8; }
.tag.src-telegram { background: #E6F4FC; color: #1F7AB3; }
.tag.src-max { background: #EFE9FF; color: #5B3CC4; }
.tag.src-vk { background: #E7EEF8; color: #2E5C99; }
.tag.src-phone { background: #FFF2E0; color: #9A5B00; }
.tag.star { background: #FFF3C9; color: #8A6400; }
.tag.late { background: #FDE8E7; color: var(--danger); }
.tag.today { background: #FFF2E0; color: #9A5B00; }
.ava { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-d); color: #fff; font-size: 10px; font-weight: 600; display: inline-grid; place-items: center; flex: none; }
.drops { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 10px; z-index: 30; }
.drops div { padding: 16px 28px; border-radius: 10px; background: #fff; box-shadow: var(--sh); border: 2px dashed var(--line2); font-weight: 600; }
.drops div.over { border-color: currentColor; }
.drops .won { color: var(--ok); } .drops .lost { color: var(--danger); }

/* таблица */
.tbl-wrap { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 100%; }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 0 10px; height: 36px; text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.grid th { position: sticky; top: 0; background: #F7F9F9; font-weight: 600; color: var(--ink2); z-index: 2; cursor: pointer; user-select: none; }
.grid th.sorted::after { content: ' ↓'; color: var(--accent-d); }
.grid th.sorted.asc::after { content: ' ↑'; }
.grid td.ed { cursor: pointer; }
.grid tr.bs-row { cursor: pointer; }
.grid tr.bs-row:hover td { background: #F7FBFB; }
.grid td.ed:hover { background: #F7FBFB; }
.grid td.focus { outline: 2px solid var(--accent-d); outline-offset: -2px; background: var(--accent-soft); }
.grid td.editing { padding: 0; outline: 2px solid var(--accent-d); outline-offset: -2px; }
.grid td.editing .inp { border: 0; border-radius: 0; height: 35px; box-shadow: none; min-width: 140px; }
.grid tr:hover td { background: #FAFCFC; }
.grid tr.sel td { background: var(--accent-soft); }
.grid td.chkc, .grid th.chkc { width: 36px; padding: 0 10px; position: sticky; left: 0; background: inherit; z-index: 1; }
.grid th.chkc { z-index: 3; background: #F7F9F9; }
.grid .lnk { color: var(--ink); text-decoration: none; font-weight: 500; }
.grid .lnk:hover { color: var(--accent-d); text-decoration: underline; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; }
.stage-pill::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.bulk { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: 10px; margin-top: 10px; flex-wrap: wrap; }
.bulk .inp { width: auto; color: var(--ink); }
.foot { display: flex; gap: 12px; align-items: center; padding: 10px 2px; color: var(--muted); font-size: 13px; }

/* выезжающая карточка */
.scrim { position: fixed; inset: 0; background: rgba(10,13,14,.35); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(1040px, 100vw); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.15); animation: slide .22s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.dr-h { background: #fff; padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dr-h .title { font-size: 18px; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -6px; flex: 1; min-width: 200px; background: transparent; outline: none; }
.dr-h .title:hover { border-color: var(--line2); }
.dr-h .title:focus { border-color: var(--accent-d); background: #fff; }
.dr-b { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.dr-l { overflow-y: auto; padding: 16px 20px; background: #fff; border-right: 1px solid var(--line); display: grid; gap: 14px; align-content: start; }
.dr-r { display: flex; flex-direction: column; min-height: 0; }
.sec { display: grid; gap: 8px; }
.sec > h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; align-items: center; }
.kv > span { color: var(--muted); font-size: 13px; }
.kv .inp { height: 30px; }
.client { background: var(--bg); border-radius: 10px; padding: 12px; display: grid; gap: 6px; }
.client .nm { font-weight: 600; font-size: 15px; }
.client a.tel { font-weight: 500; text-decoration: none; color: var(--ink); }
.feed { flex: 1; overflow-y: auto; padding: 16px 20px; display: grid; gap: 10px; align-content: start; }
.ev { display: grid; gap: 2px; max-width: 640px; }
.ev .when { font-size: 11px; color: var(--muted); }
.ev .bub { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; white-space: pre-wrap; word-break: break-word; }
.ev.msg_in .bub { border-color: #BFEDE8; background: #F3FDFC; }
.ev.msg_out { justify-self: end; }
.ev.msg_out .bub { background: var(--ink); color: #fff; border-color: var(--ink); }
.ev.note .bub { background: #FFFBEA; border-color: #F2E3A6; }
.ev.system, .ev.stage, .ev.audit, .ev.task { max-width: none; }
.ev.system .bub, .ev.stage .bub, .ev.audit .bub, .ev.task .bub { background: transparent; border: 0; padding: 0 2px; color: var(--muted); font-size: 13px; }
.ev.call_missed .bub { border-color: #F5C6C4; background: #FEF3F2; }
.tasks-box { padding: 10px 20px; border-bottom: 1px solid var(--line); background: #FAFBFB; display: grid; gap: 6px; }
.task { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.task.late .due { color: var(--danger); font-weight: 600; }
.composer { border-top: 1px solid var(--line); background: #fff; padding: 10px 20px 14px; display: grid; gap: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 5px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); border: 0; background: transparent; }
.tab.on { background: var(--ink); color: #fff; }
.tab:not(.on):hover { background: rgba(10,13,14,.06); color: var(--ink); }

/* модалка, тосты */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(10,13,14,.4); animation: fade .12s; }
.modal > div { background: #fff; border-radius: 12px; padding: 20px; width: min(520px, 100%); max-height: 95vh; overflow-y: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0; font-size: 17px; }
.modal .acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--sh); max-width: 360px; animation: slide .2s; cursor: pointer; }
.toast.err { background: var(--danger); }

/* блоки страниц */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.stat b { display: block; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 14px; align-content: start; }
.list-row { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.list-row:last-child { border-bottom: 0; }
.group-h { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin: 8px 2px 6px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { order: 2; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); overflow-x: auto; gap: 0; }
  .side .brand, .side .me, .side .sp { display: none; }
  .nav { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 8px; flex: 1; min-width: 62px; }
  .nav.on::before { display: none; }
  .nav .badge { position: absolute; top: 2px; right: 8px; min-width: 16px; height: 16px; font-size: 10px; }
  .top { padding: 10px 12px; }
  .top .search { width: 100%; order: 9; }
  .view { padding: 12px; }
  .dr-b { grid-template-columns: 1fr; overflow-y: auto; }
  .dr-l { border-right: 0; border-bottom: 1px solid var(--line); }
  .feed { overflow: visible; }
  .kv { grid-template-columns: 110px 1fr; }
}

/* park, reports, settings */
.park { max-height: calc(100% - 44px); }
.grid.pk th, .grid.pk td { padding: 0; border-right-color: #EEF1F1; }
.grid.pk .pk-car { position: sticky; left: 0; background: #fff; z-index: 2; min-width: 200px; max-width: 200px; padding: 4px 10px; border-right: 1px solid var(--line2); }
.grid.pk th.pk-car { z-index: 4; background: #F7F9F9; }
.grid.pk th.pk-d { width: 40px; min-width: 40px; text-align: center; line-height: 1.1; padding: 4px 0; cursor: default; }
.grid.pk th.we, .grid.pk td.we { background: #F1F3F3; }
.grid.pk .td { background: var(--accent-soft) !important; }
.grid.pk td.pk-c { height: 40px; cursor: pointer; }
.grid.pk td.pk-c:hover { background: #F3FBFA; }
.pk-b { margin: 4px 2px; height: 30px; border-radius: 6px; padding: 0 8px; display: flex; align-items: center; font-size: 12px; font-weight: 500; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pk-b.crm { background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.pk-b.busy { background: #C9D0D0; color: var(--ink2); }
.pk-b.req { background: repeating-linear-gradient(135deg, #FFF2E0 0 6px, #FFE3BC 6px 12px); color: #8A5300; }
.pk-l { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.pk-l::before { content: ''; width: 18px; height: 10px; border-radius: 3px; }
.pk-l.crm::before { background: var(--accent); } .pk-l.busy::before { background: #C9D0D0; } .pk-l.req::before { background: #FFE3BC; }
.rep-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rep-bar { height: 8px; background: #EEF1F1; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.rep-bar i { display: block; height: 100%; border-radius: 4px; }
.rep-days { display: flex; align-items: flex-end; gap: 3px; overflow-x: auto; padding-top: 8px; }
.rep-days > div { display: grid; justify-items: center; gap: 3px; min-width: 22px; flex: 1; }
.rep-days i { width: 100%; max-width: 26px; background: var(--accent-d); border-radius: 3px 3px 0 0; display: block; }
@media (max-width: 860px) { .rep-2 { grid-template-columns: 1fr; } }

/* карточка: поля не вылезают */
.dr-b { grid-template-columns: minmax(340px, 400px) 1fr; }
.kv > * { min-width: 0; }
.kv .row > .inp { flex: 1 1 0; min-width: 0; padding: 0 6px; }
.dr-h .row select.inp { width: auto; max-width: 240px; }
.dr-l { overflow-x: hidden; }

/* базы колл-центра */
.bs-chips { flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line2); background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.bs-add { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; }
.bs-add .inp.sm { width: 150px; }
.tbl-wrap.bs { max-height: calc(100% - 140px); }
.grid.bs-grid td, .tbl-wrap.bs td { max-width: 220px; }
.tbl-wrap.bs td.wide { max-width: 320px; }
.tbl-wrap.bs tr td:first-child { box-shadow: inset 4px 0 0 var(--a); }
.bs-st { width: 170px; }
.bs-status { appearance: none; border: 0; height: 26px; border-radius: 13px; padding: 0 12px; font: 500 12px var(--f); background: color-mix(in srgb, var(--c) 22%, #fff); color: var(--ink); cursor: pointer; max-width: 160px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, #fff); }
.bs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--a, #B8C2C2); margin-right: 6px; vertical-align: middle; }
.bs-act { white-space: nowrap; }
.bs-act .btn.sm { padding: 0 7px; }
.tbl-wrap.bs td.editing { padding: 0; outline: 2px solid var(--accent-d); outline-offset: -2px; }
.tbl-wrap.bs td.editing .inp { border: 0; border-radius: 0; height: 35px; box-shadow: none; min-width: 160px; }

/* общий поиск */
.gs { position: fixed; inset: 0; z-index: 70; background: rgba(10,13,14,.45); display: grid; justify-items: center; align-items: start; padding: 8vh 16px 16px; animation: fade .12s; }
.gs > div { width: min(760px, 100%); background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); overflow: hidden; display: flex; flex-direction: column; max-height: 80vh; }
.gs input { border: 0; outline: none; font-size: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.gs .res { overflow-y: auto; padding: 6px 0 12px; }
.gs .gh { padding: 10px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.gs .it { display: flex; gap: 10px; align-items: baseline; padding: 8px 20px; cursor: pointer; }
.gs .it:hover, .gs .it.on { background: var(--accent-soft); }
.gs .it b { font-weight: 600; }
.gs .it .px { margin-left: auto; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gs-btn { margin: 0 0 10px; display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05); color: #C9D2D2; cursor: pointer; font-size: 13px; }
.gs-btn kbd { margin-left: auto; font: 11px var(--f); opacity: .7; }
@media (max-width: 860px) { .gs-btn { display: none; } }

/* сотрудники: цвета, выданный доступ */
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px var(--line2); cursor: pointer; padding: 0; }
.sw.on { box-shadow: 0 0 0 2px var(--ink); }
.issued { background: var(--accent-soft); border-color: #BFEDE8; }
.issued pre { margin: 6px 0 10px; padding: 10px 12px; background: #fff; border-radius: 8px; font: 14px/1.5 var(--f); white-space: pre-wrap; user-select: all; }

/* занятость: «сегодня» тонкой рамкой, а не заливкой цвета брони */
.grid.pk .td { background: transparent !important; box-shadow: inset 2px 0 0 #7AA7FF, inset -2px 0 0 #7AA7FF; }
.grid.pk th.td { color: #2A55B8; }
.pk-l.today::before { background: transparent; box-shadow: inset 0 0 0 2px #7AA7FF; }
.pk-empty { padding: 12px 16px; background: #FFF8E6; border-bottom: 1px solid #F2E3A6; font-size: 13px; position: sticky; left: 0; }

/* плашки: оператор цветом сотрудника, поступление оплаты цветом варианта */
.chip-v { display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 11px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--c) 20%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 45%, #fff); white-space: nowrap; }
.scr { display: grid; gap: 10px; max-width: 900px; }
.scr .panel { display: grid; gap: 8px; }
.scr pre { margin: 0; white-space: pre-wrap; font: 14px/1.55 var(--f); color: var(--ink2); }

/* номер уже есть в таблице */
.dup-hint { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #FDE8E7; color: #9B1C17; font-size: 13px; font-weight: 500; }

/* карточка подрядчика: главное сверху, техника строками */
.rc { gap: 14px !important; }
.rc-head { display: flex; gap: 10px; align-items: flex-start; }
.rc-head h3 { margin: 0; font-size: 20px; }
.rc-status { appearance: none; border: 0; height: 30px; border-radius: 15px; padding: 0 14px; font: 600 13px var(--f); cursor: pointer; background: color-mix(in srgb, var(--c) 22%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, #fff); }
.rc-sec { display: grid; gap: 6px; }
.rc-sec .group-h { margin: 0; }
.rc-items { display: grid; gap: 6px; }
.rc-item { display: grid; grid-template-columns: minmax(150px, 1.3fr) auto minmax(150px, 1.6fr) auto; gap: 6px; align-items: center; background: var(--bg); padding: 6px; border-radius: 8px; }
.rc-price { display: flex; gap: 4px; align-items: center; }
.rc-price .inp { width: 82px; text-align: right; }
.rc-price select { width: auto; }
.rc-terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 14px; font-size: 13px; }
.rc-all summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.rc-all .kv { margin-top: 8px; }
@media (max-width: 640px) { .rc-item { grid-template-columns: 1fr; } }
/* поиск: подрядчик с техникой */
.gs-rec { display: grid; gap: 3px; width: 100%; }
.gs-items { display: grid; gap: 1px; font-size: 13px; padding-left: 2px; }
.gs-items > div::before { content: '— '; color: var(--muted); }
.gs-more { padding: 10px 20px; color: var(--accent-d); cursor: pointer; font-size: 13px; font-weight: 500; }
.gs-more:hover { background: var(--accent-soft); }

/* активный фильтр в шапке заметен */
select.inp.on { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }

/* объявление для всех */
.notice { display: flex; gap: 10px; align-items: center; background: var(--danger); color: #fff; padding: 9px 20px; font-size: 14px; }
.notice[hidden] { display: none; }
.notice .btn { background: #fff; color: var(--danger); border: 0; font-weight: 600; }
/* длинный текст в таблицах: «Текст целиком» переносит строки, при правке поле большое */
.tbl-wrap.bs.full td { white-space: normal; max-width: 360px; height: auto; padding-top: 6px; padding-bottom: 6px; vertical-align: top; overflow: visible; text-overflow: clip; word-break: break-word; }
.tbl-wrap.bs td.editing textarea.inp { height: auto; min-height: 130px; width: 380px; max-width: 70vw; white-space: pre-wrap; resize: vertical; padding: 8px 10px; }
.tbl-wrap.bs td.auto { color: var(--muted); cursor: default; }
.btn.on { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* есть новая заявка: пункт «Сделки» горит красным */
.nav.alert { background: color-mix(in srgb, var(--danger) 22%, transparent); color: #fff; box-shadow: inset 3px 0 0 var(--danger); }
.nav.alert .badge { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .nav.alert .badge { animation: none; } }

/* пожелание дня */
.greet { position: fixed; z-index: 120; top: 24px; left: 50%; width: min(440px, calc(100vw - 32px)); transform: translateX(-50%);
  padding: 26px 26px 22px; border-radius: 22px; overflow: hidden; color: #2A2320;
  background: linear-gradient(160deg, #FFF8EC 0%, #FFE9D6 55%, #FFDCCB 100%);
  box-shadow: 0 24px 60px -18px rgba(120, 60, 20, .45), 0 0 0 1px rgba(255, 255, 255, .7) inset;
  animation: greet-in .7s cubic-bezier(.16, 1, .3, 1) both; }
.greet.out { animation: greet-out .35s ease-in forwards; }
@keyframes greet-in { from { opacity: 0; transform: translate(-50%, -24px) scale(.96); } }
@keyframes greet-out { to { opacity: 0; transform: translate(-50%, -16px) scale(.97); } }
.greet-sun { position: absolute; right: -38px; top: -38px; width: 130px; height: 130px; border-radius: 50%;
  background: radial-gradient(circle, #FFD36B 0 38%, rgba(255, 196, 92, .35) 39% 58%, rgba(255, 196, 92, 0) 60%);
  animation: greet-glow 4s ease-in-out infinite alternate; pointer-events: none; }
@keyframes greet-glow { to { transform: scale(1.08) rotate(20deg); } }
.greet-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .6); color: #6B4A36; font-size: 20px; line-height: 1; cursor: pointer; transition: background .15s, transform .15s; }
.greet-x:hover { background: #fff; transform: rotate(90deg); }
.greet-x:focus-visible, .greet-ok:focus-visible { outline: 2px solid #E07A3F; outline-offset: 2px; }
.greet-hi { position: relative; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: #B4602F; margin-bottom: 10px; }
.greet-t { position: relative; font-size: 19px; line-height: 1.45; font-weight: 500; white-space: pre-line; }
.greet-a { position: relative; margin-top: 10px; font-size: 13px; font-style: italic; color: #8A6A55; }
.greet-ok { position: relative; margin-top: 18px; height: 40px; padding: 0 20px; border: 0; border-radius: 20px; background: #2A2320; color: #FFF3E6; font: 600 14px var(--f); cursor: pointer; transition: transform .15s, background .15s; }
.greet-ok:hover { background: #4A3A32; transform: translateY(-1px); }
.greet-ok:active { transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { .greet, .greet.out, .greet-sun { animation: none; } }

/* статистика */
.st-grid tr.st-sub td { background: #FAFCFC; font-size: 12.5px; }
.st-grid tr.st-sub[hidden] { display: none; }
.cards .stat b { overflow-wrap: anywhere; }

.st-grid th.sorted::after { content: ' ↓'; color: var(--accent-d); }
.st-grid th[title] { user-select: none; }

/* кнопка «Дальше» на карточке доски */
.card .btn.next { width: 100%; justify-content: center; margin-top: 4px; background: var(--accent-soft); color: var(--accent-d); border: 0; font-weight: 600; opacity: .9; }
.card .btn.next:hover { opacity: 1; background: var(--accent); color: var(--accent-ink); }

/* кнопка «сбросить фильтр»: заметная, чтобы не думать, что сделок нет */
.btn.warn { background: #FFF1D6; color: #8A5A00; border-color: #F0C76A; font-weight: 600; }
.btn.warn[hidden] { display: none; }

/* жирное уведомление о новой заявке */
.lead-alerts { position: fixed; z-index: 150; top: 16px; right: 16px; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.lead-alert { background: #D62F2F; color: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: 0 18px 44px -12px rgba(214, 47, 47, .65), 0 0 0 3px rgba(255, 255, 255, .85) inset; animation: la-in .45s cubic-bezier(.16, 1, .3, 1) both, la-pulse 1.6s ease-in-out infinite 0.5s; }
@keyframes la-in { from { opacity: 0; transform: translateX(40px) scale(.96); } }
@keyframes la-pulse { 50% { box-shadow: 0 18px 44px -8px rgba(214, 47, 47, .95), 0 0 0 3px rgba(255, 255, 255, .85) inset; } }
.la-top { display: flex; align-items: center; gap: 10px; font-size: 13px; letter-spacing: .06em; }
.la-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: la-blink 1s steps(2) infinite; }
@keyframes la-blink { 50% { opacity: .2; } }
.la-src { margin-left: auto; background: rgba(255, 255, 255, .2); padding: 3px 10px; border-radius: 12px; font-size: 12px; letter-spacing: 0; }
.la-title { font-size: 20px; font-weight: 700; line-height: 1.25; margin-top: 8px; word-break: break-word; }
.la-open, .la-ok { height: 40px; padding: 0 20px; border-radius: 20px; border: 0; font: 700 14px var(--f); cursor: pointer; transition: transform .15s; }
.la-open { background: #fff; color: #B31F1F; flex: 1; }
.la-ok { background: rgba(255, 255, 255, .22); color: #fff; }
.la-open:hover, .la-ok:hover { transform: translateY(-1px); } .la-open:active, .la-ok:active { transform: translateY(1px); }
.la-open:focus-visible, .la-ok:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .lead-alert, .la-dot { animation: none; } }

/* занятость автопарка */
.fl-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 0 10px; }
.fl-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: #fff; font: 600 13px var(--f); cursor: pointer; }
.fl-chip i { width: 12px; height: 12px; border-radius: 4px; background: var(--c); }
.fl-chip.on { background: color-mix(in srgb, var(--c) 18%, #fff); border-color: var(--c); }
.fl-chip:hover { border-color: var(--c); } .fl-chip:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.fl-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: 6px; }
.fl-key .k { width: 18px; height: 10px; border-radius: 3px; background: #6B7676; display: inline-block; }
.fl-key .k.hatch { background: repeating-linear-gradient(135deg, #D4DADA 0 4px, #EEF1F1 4px 8px); }
.fl-key .k.rep { background: repeating-linear-gradient(135deg, #8B1E1E 0 4px, #C75A5A 4px 8px); }
.grid.fl { width: 100%; table-layout: fixed; }
.grid.fl td.pk-h { min-width: 0; padding: 0; height: 38px; }
.grid.fl th.pk-d { width: auto; min-width: 0; }
.grid.fl td.pk-h.r { border-right: 1px solid var(--line); }
.grid.fl td.pk-h:not(.r) { border-right: 1px dashed #EDF0F0; }
.grid.fl td.pk-h.td { background: #EAF3FF; }
.grid.fl td.fl-car { box-shadow: inset 6px 0 0 var(--c); padding-left: 16px; cursor: pointer; width: 170px; min-width: 170px; max-width: 170px; }
.grid.fl td.fl-car:hover { background: #F3FBFA; }
.fl-b { background: var(--c); color: #fff; margin: 4px 1px; height: 30px; cursor: pointer; text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
.fl-b.req { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 28%, #fff) 0 7px, color-mix(in srgb, var(--c) 12%, #fff) 7px 14px); color: #2A2A2A; text-shadow: none; box-shadow: inset 0 0 0 1.5px var(--c); }
.fl-b.repair { background: repeating-linear-gradient(135deg, #8B1E1E 0 7px, #C75A5A 7px 14px); }
/* фото машин */
.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.ph { position: relative; border-radius: 10px; overflow: hidden; background: #EEF1F1; aspect-ratio: 4/3; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-act { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.ph:hover .ph-act, .ph:focus-within .ph-act { opacity: 1; }
@media (hover: none) { .ph-act { opacity: 1; } }

/* документы клиента */
.tag.ok { background: #E1F6EA; color: #17784A; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 8px; }
.doc { border: 1.5px dashed #C9D0D0; border-radius: 12px; padding: 10px; display: grid; gap: 8px; align-content: start; background: #FAFCFC; }
.doc.has { border-style: solid; border-color: #9BD8B5; background: #F4FBF7; }
.doc:focus-visible { outline: 2px solid var(--accent-d); outline-offset: 2px; }
.doc-t { font-weight: 600; font-size: 13px; }
.doc-f img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 4px; }
.clash { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: #FDECEC; color: #A32020; font-size: 13px; font-weight: 600; }
.clash[hidden] { display: none; }
.sum { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.svc { padding: 3px 0; font-size: 13px; }

/* карточка сделки Автопроката: левая колонка шире, чтобы поля читались */
.drawer.rent { width: min(1180px, 100vw); }
.drawer.rent .dr-b { grid-template-columns: minmax(440px, 500px) 1fr; }
.drawer.rent .kv { grid-template-columns: 130px 1fr; }
.svc-list { display: grid; gap: 2px; }
.svc-list .svc > span.grow { white-space: normal; line-height: 1.25; }

.free { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.free[hidden] { display: none; }
.fl-loose td.fl-car { background: #F7F9F9; }

.modal .tag { white-space: normal; max-width: 100%; }
.modal .row { flex-wrap: wrap; }
.modal .kv .row { flex-wrap: nowrap; }
.grid.fl th.pk-car { width: 170px; min-width: 170px; max-width: 170px; }
