/* Оформление CRM автосервиса: тёмно-синий + синий акцент, шрифт Manrope,
   сворачивающееся меню, тёмная шапка раздела, на которую «наезжают» белые блоки. */
@font-face { font-family: "CRM Manrope"; src: url("/fonts/Manrope.ttf") format("truetype"); font-style: normal; font-weight: 200 800; font-display: swap; }
:root {
  --ink: #18212f; --ink-2: #222d3f; --ink-line: #334158; --ink-muted: #aeb6c0; --ink-tab: #c9cfd8;
  --accent: #1f6feb; --accent-d: #1558c0; --accent-soft: #e7eefc; --accent-lite: #7fb0ff; --on-accent: #fff; --yellow-soft: #fff4c2; --yellow-text: #6b5600;
  --red: #e5484d; --red-soft: #fde6e7; --red-text: #c4262e;
  --green: #18a058; --green-soft: #e3f6ea; --green-text: #12803f;
  --grey: #cfd5dc; --grey-soft: #eef0f4; --grey-text: #3d4450;
  --violet: #5946be; --violet-soft: #eeeaff;
  --bg: #eef0f4; --card: #fff; --line: #edf0f3; --field: #dfe3e8; --muted: #5d6672; --faint: #7a828d;
  --shadow: 0 6px 20px rgba(17,21,28,.06); --radius: 18px;
  --danger: var(--red-text);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body { background: var(--bg); color: var(--ink); font-family: "CRM Manrope", Arial, sans-serif; font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:is(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
h2 { font-size: 19px; font-weight: 800; margin-bottom: 12px; }
h3 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
p { margin-bottom: 10px; }
.muted { color: var(--faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
main a:not(.btn):not(.ocard) { font-weight: 800; }
main a:not(.btn):not(.ocard):hover { color: var(--violet); }

/* ---------- каркас ---------- */
.layout { min-height: 100vh; }
.side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: 76px; display: flex; flex-direction: column; gap: 14px; padding: 18px 12px 14px; background: var(--ink); color: #fff; overflow: hidden; transition: width .18s ease, box-shadow .18s ease; }
.side:hover, .side:has(:focus-visible) { width: 256px; box-shadow: 12px 0 40px rgba(17,21,28,.28); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 4px; white-space: nowrap; }
.mark { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--accent); color: var(--on-accent); font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.mark i { display: block; width: 18px; height: 18px; border-radius: 5px 5px 5px 0; background: var(--ink); }
.brand span { display: grid; line-height: 1.2; min-width: 0; }
.brand strong { font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 11px; color: var(--ink-muted); }
.nav { flex: 1; display: grid; align-content: start; gap: 2px; overflow: hidden auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 14px; min-height: 42px; padding: 0 13px; border-radius: 12px; color: var(--ink-tab); font-weight: 700; white-space: nowrap; }
.nav a i { flex: none; display: grid; place-items: center; width: 24px; height: 24px; }
svg.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.on { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px rgba(47,125,246,.25); }
.brand span, .nav a span, .user span, .user button { opacity: 0; transition: opacity .12s; }
.side:hover :is(.brand span, .nav a span, .user span, .user button), .side:has(:focus-visible) :is(.brand span, .nav a span, .user span, .user button) { opacity: 1; }
.user { display: flex; align-items: center; gap: 10px; padding: 12px 4px 0; border-top: 1px solid var(--ink-line); white-space: nowrap; }
.user > b { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--ink); font-size: 13px; font-weight: 800; }
.user span { display: grid; min-width: 0; flex: 1; }
.user strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.user small { font-size: 11px; color: var(--ink-muted); }
.user button { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--ink-2); color: #fff; cursor: pointer; }
.user button:hover { background: var(--accent); color: var(--on-accent); }
.main { margin-left: 76px; min-width: 0; padding: 0 28px 40px; }

/* шапка раздела — тёмная полоса со свечением; следующий блок наезжает на неё */
.head { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0 -28px; padding: 30px 32px 84px; background: var(--ink); color: #fff; }
.head::before { content: ""; position: absolute; right: -60px; top: -200px; width: 440px; height: 440px; border-radius: 50%; background: radial-gradient(circle, rgba(47,125,246,.22), rgba(47,125,246,0) 70%); pointer-events: none; }
.head > * { position: relative; }
.head + * { position: relative; margin-top: -52px; }
.head h1 { flex: 1 1 260px; min-width: 0; font-size: 34px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.head h1[data-eyebrow]::before { content: attr(data-eyebrow); display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-lite); }
.head h1 .muted { color: var(--ink-muted); font-size: 15px; font-weight: 600; letter-spacing: 0; }
.head-sub { flex: 1 1 100%; order: 9; margin: 0; font-size: 14px; color: var(--ink-muted); max-width: 760px; }
.head .btn:not(.primary) { border-color: var(--ink-line); background: var(--ink-2); color: #fff; }
.head .btn:not(.primary):hover { background: #2b3850; }
.head .btn.danger { color: #ff9a9e; }
.head :is(input, select) { border-color: transparent; }
.banner { margin: 0 -28px; padding: 10px 32px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.banner a { text-decoration: underline; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

/* ---------- блоки, таблицы ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 14px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 14px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; background: var(--ink); color: #fff; }
.card.flush th:last-child { color: var(--accent-lite); }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.right, th.right { font-variant-numeric: tabular-nums; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: #f2f6ff; }
/* таблицы внутри белых блоков — со светлой шапкой */
.card:not(.flush) th { background: transparent; color: var(--faint); font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.card:not(.flush) td { padding: 10px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

/* плитки-показатели */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 18px 20px; border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.kpi b { order: 2; font-size: 28px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi span { order: 1; font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi.t-dark { background: var(--ink-2); color: #fff; border: 2px solid var(--ink-line); box-shadow: none; }
.kpi.t-dark span { color: var(--ink-muted); }
.kpi.t-yellow { background: linear-gradient(135deg, #2f7df6, #1558c0); color: #fff; }
.kpi.t-yellow span { color: #dbe7ff; }
.kpi.t-green { background: linear-gradient(135deg, #2fb26a, #12803f); color: #fff; }
.kpi.t-green span { color: #dcf6e6; }
.kpi.t-red { background: linear-gradient(135deg, #e5484d, #b4232c); color: #fff; }
.kpi.t-red span { color: #ffe3e4; }
.card .kpi { background: var(--grey-soft); box-shadow: none; padding: 14px 16px; }
.card .kpi b { font-size: 22px; }

/* ---------- формы ---------- */
label.f { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
label.f > span { display: block; margin-bottom: 5px; }
input, select, textarea { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--field); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 600; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 1px; }
textarea { resize: vertical; min-height: 76px; padding: 11px 14px; font-weight: 500; }
select { cursor: pointer; font-weight: 700; }
::placeholder { color: #a3aab4; font-weight: 500; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 12px; }
.with-btn { display: flex; gap: 6px; }
.with-btn select { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 1px solid var(--grey); border-radius: 12px; background: #fff; color: var(--ink); font-weight: 800; font-size: 14px; white-space: nowrap; cursor: pointer; }
.btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-d); }
.btn.danger { color: var(--red-text); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red-soft); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.search { max-width: 300px; }
.filter { max-width: 210px; }

/* редактор заказ-наряда */
.lines input { min-height: 40px; padding: 0 10px; }
.lines td { padding: 4px 5px !important; border: 0; }
.lines .num { width: 120px; }
.lines .qty { width: 84px; }
.lines .sum { width: 120px; text-align: right; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; }
.lines .x { width: 44px; }
.lines + .btn, .lines ~ .btn { margin-top: 8px; }
.totals { margin-left: auto; max-width: 360px; }
.totals div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals input { width: 140px; text-align: right; }
.totals .big { font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; }

/* метки статусов */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.st-new { background: var(--violet-soft); color: var(--violet); }
.st-in_progress { background: var(--yellow-soft); color: var(--yellow-text); }
.st-waiting_parts { background: var(--red-soft); color: var(--red-text); }
.st-done { background: var(--green-soft); color: var(--green-text); }
.st-issued { background: var(--grey-soft); color: var(--grey-text); }
.st-cancelled { background: var(--grey-soft); color: var(--red-text); }

/* ---------- вход ---------- */
.login-wrap { position: relative; overflow: hidden; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--ink); }
.login-wrap::before { content: ""; position: absolute; right: -120px; top: -220px; width: 620px; height: 620px; border-radius: 50%; background: radial-gradient(circle, rgba(47,125,246,.22), rgba(47,125,246,0) 70%); }
.login { position: relative; width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.login .mark { margin: 0 auto 14px; }
.login h1 { text-align: center; font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 18px; }
.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: var(--ink); }
.tabs button { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-tab); font-weight: 600; cursor: pointer; }
.tabs button:hover { background: #2b3850; }
.tabs button.on { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.login label.f { margin-bottom: 12px; }
.login .btn { width: 100%; }
.login p { margin: 12px 0 0; }
.err { color: var(--red-text); font-size: 13px; font-weight: 700; min-height: 20px; margin: 6px 0; }

/* ---------- окна, уведомления ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 12px 12px; overflow: auto; background: rgba(17,21,28,.55); }
.modal { width: 100%; max-width: 520px; overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 30px 80px rgba(17,21,28,.35); }
.modal > h3 { margin: 0; padding: 20px 22px 16px; background: var(--ink); color: #fff; font-size: 20px; font-weight: 800; }
.modal-body { padding: 18px 22px 4px; }
.modal-body label.f { margin-bottom: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 70; padding: 12px 20px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 700; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.toast.bad { background: var(--red); }

/* ---------- кабинет клиента ---------- */
.cab-top { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding-bottom: 70px; }
.cab-top::before { content: ""; position: absolute; right: -60px; top: -220px; width: 440px; height: 440px; border-radius: 50%; background: radial-gradient(circle, rgba(47,125,246,.22), rgba(47,125,246,0) 70%); }
.cab-top .in { position: relative; max-width: 860px; margin: 0 auto; padding: 18px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cab-top .in > b { flex: 1; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.cab-top .in > span { color: var(--ink-muted); font-weight: 700; }
.cab-top .btn { border-color: var(--ink-line); background: var(--ink-2); color: #fff; }
.cab-top .btn:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.cab { position: relative; max-width: 860px; margin: -66px auto 0; padding: 0 16px 60px; }
.cab-nav { display: inline-flex; max-width: 100%; overflow-x: auto; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 14px; background: var(--ink-2); scrollbar-width: none; }
.cab-nav a { display: flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: 10px; color: var(--ink-tab); font-weight: 600; white-space: nowrap; }
.cab-nav a:hover { background: #2b3850; color: #fff; }
.cab-nav a.on { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.chead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chead h1 { flex: 1; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.ocard { display: block; border: 2px solid transparent; }
.ocard:hover { border-color: var(--accent); }
.ocard .top { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 6px; font-size: 16px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--faint); font-weight: 700; }
.kv dd { margin: 0; font-weight: 700; }

#print { display: none; }

@media (max-width: 760px) {
  .side { inset: auto 0 0 0; width: 100%; flex-direction: row; align-items: center; gap: 6px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); transition: none; }
  .side:hover, .side:has(:focus-visible) { width: 100%; box-shadow: none; }
  .brand, .user > b, .user span { display: none; }
  .nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav a { flex: none; flex-direction: column; justify-content: center; gap: 2px; min-width: 68px; min-height: 52px; padding: 6px 8px; font-size: 11px; }
  .nav a span, .user button { opacity: 1; }
  .user { padding: 0; border: 0; }
  .user button { width: 44px; height: 52px; }
  .main { margin-left: 0; padding: 0 12px 96px; }
  .head { margin: 0 -12px; padding: 20px 16px 64px; }
  .head + * { margin-top: -44px; }
  .head h1 { font-size: 26px; flex-basis: 100%; }
  .banner { margin: 0 -12px; padding: 10px 16px; }
  .search, .filter { max-width: none; flex: 1 1 140px; }
  .cols { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 20px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dd { margin-bottom: 8px; }
  .toast { bottom: 84px; }
}

@media print {
  body { background: #fff; font-size: 12pt; }
  #app, .toast, .modal-bg { display: none !important; }
  #print { display: block; color: #000; }
  #print h1 { font-size: 16pt; text-align: center; margin: 14pt 0 10pt; }
  #print table { margin: 6pt 0 10pt; }
  #print th, #print td { border: 1px solid #000; padding: 4pt 6pt; font-size: 10.5pt; color: #000; background: #fff; text-transform: none; letter-spacing: 0; }
  #print .p-head { display: flex; justify-content: space-between; gap: 20pt; border-bottom: 2px solid #000; padding-bottom: 6pt; }
  #print .p-kv { margin: 2pt 0; }
  #print .p-req { font-size: 9.5pt; }
  #print .p-sign { display: flex; justify-content: space-between; gap: 30pt; margin-top: 30pt; }
  #print .p-sign div { flex: 1; border-top: 1px solid #000; padding-top: 3pt; font-size: 10pt; }
  #print .p-note { font-size: 9.5pt; margin-top: 10pt; white-space: pre-wrap; }
  #print .p-total { text-align: right; font-size: 12pt; margin: 3pt 0; }
}

/* вкладки в шапке раздела и широкое окно для таблиц */
.head-tabs { flex: 1 1 100%; order: 8; display: flex; }
.head-tabs .cab-nav { margin: 4px 0 0; }
.modal:has(table) { max-width: 760px; }
.modal-body table { margin-bottom: 14px; }
.modal-body th { background: transparent; color: var(--faint); font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.modal-body td { padding: 10px; }

/* запись в сервис */
.checks { display: grid; gap: 8px; }
.checks.row { display: flex; gap: 16px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.chip-x { border: 0; background: transparent; cursor: pointer; padding: 0 4px; font-size: 12px; color: var(--grey-text); }
.chip-x:hover { color: var(--red-text); }
.cab-nav + .chead { margin-top: 18px; }

/* воронка заявок */
.board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.col { flex: 0 0 250px; min-height: 140px; padding: 10px; border-radius: 16px; background: #e4e7ec; border: 2px solid transparent; }
.col.over { border-color: var(--accent); background: var(--accent-soft); }
.col-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 6px 10px; }
.col-h b { font-size: 14px; font-weight: 800; }
.col-h span { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.col-empty { padding: 18px 6px; text-align: center; color: var(--faint); font-size: 13px; }
.lead { display: grid; gap: 4px; margin-bottom: 8px; padding: 12px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); font-weight: 500 !important; cursor: grab; }
.lead:hover { color: inherit !important; outline: 2px solid var(--accent); }
.lead-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lead-top b { font-weight: 800; overflow-wrap: anywhere; }
.lead-msg { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lead-foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.lead-foot b { font-weight: 800; }
.lead-foot span:last-child { margin-left: auto; }
.dot { flex: none; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 800; }
.src-telegram { background: #e1f1fd; color: #1474b8; }
.src-whatsapp { background: var(--green-soft); color: var(--green-text); }
.src-max { background: var(--violet-soft); color: var(--violet); }
.src-avito { background: #e6f7e9; color: #0a7a2f; }
.src-phone, .src-site, .src-other { background: var(--grey-soft); color: var(--grey-text); }
.chat-card { display: flex; flex-direction: column; }
.chat { display: flex; flex-direction: column; gap: 8px; height: 420px; overflow-y: auto; padding: 12px; border-radius: 12px; background: var(--bg); }
.msg { max-width: 82%; padding: 9px 12px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); align-self: flex-start; }
.msg.out { align-self: flex-end; background: var(--accent); color: #fff; }
.msg small { display: block; margin-top: 3px; font-size: 11px; opacity: .7; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-form textarea { flex: 1; min-height: 44px; }

[hidden] { display: none !important; }
.s-nav b.name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* раздел «Чаты» */
.chats { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 14px; align-items: start; }
.chats .card { margin: 0; }
.chat-list { max-height: calc(100vh - 150px); overflow-y: auto !important; }
.chat-item { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--line); border-left: 4px solid transparent; font-weight: 500 !important; }
.chat-item:hover { background: #f2f6ff; color: inherit !important; }
.chat-item.on { background: var(--accent-soft); border-left-color: var(--accent); }
.chat-item .lead-foot .dot { margin-left: auto; }
.chats .chat { height: calc(100vh - 330px); min-height: 280px; }
.chats .chat-card { min-height: 300px; }
.chat-back { display: none; }
.nav a i { position: relative; }
#nav-unread { position: absolute; top: -7px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 999px; background: var(--red); color: #fff; font-style: normal; font-size: 10px; font-weight: 800; }
@media (max-width: 760px) {
  .chats { grid-template-columns: 1fr; }
  .chats.open .chat-list, .chats:not(.open) .chat-card { display: none; }
  .chat-back { display: inline-flex; }
  .chat-list { max-height: none; }
  .chats .chat { height: calc(100vh - 380px); }
}

/* сворачиваемые блоки настроек */
details.fold > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; flex: 1; }
details.fold > summary::after { content: ""; width: 10px; height: 10px; margin-right: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold > summary:hover h2 { color: var(--accent); }
details.fold[open] > summary { margin-bottom: 16px; }
