/* OLIMPTRANS CRM — фирменные цвета: глубокий фиолетовый, бирюза, сиреневый. */
:root {
  --bg: #f3f1f6;
  --surface: #ffffff;
  --surface-2: #f8f6fa;
  --line: #ddd7e6;
  --ink: #1d1726;
  --ink-2: #574f63;
  --ink-3: #8a8296;
  --asphalt: #2e1b4d;
  --asphalt-2: #3e2a63;
  --on-asphalt: #ece7f3;
  --signal: #1fa89e;
  --signal-ink: #1b0f30;
  --signal-soft: #ddf3f1;
  --steel: #7b3f8c;
  --steel-soft: #f2e8f5;
  --danger: #b42318;
  --danger-soft: #fbe9e7;
  --ok: #2e7d4f;
  --ok-soft: #e4f2e9;
  --warn: #9a6700;
  --warn-soft: #fdf3d6;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 28, .06), 0 4px 16px rgba(20, 24, 28, .06);
  --brand-font: Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font: "Segoe UI", "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #150f1d; --surface: #1f1729; --surface-2: #1a1323; --line: #362a45;
    --ink: #ebe6f1; --ink-2: #b2a8bf; --ink-3: #81778e;
    --asphalt: #110a1a; --asphalt-2: #24183a; --on-asphalt: #ebe6f1;
    --signal: #2cc3b6; --signal-ink: #0f0819; --signal-soft: #15332f;
    --steel: #cf9fe0; --steel-soft: #33213f;
    --danger: #f08a7e; --danger-soft: #3a2220; --ok: #6cc391; --ok-soft: #1f3328;
    --warn: #e8c15a; --warn-soft: #3a3120;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #150f1d; --surface: #1f1729; --surface-2: #1a1323; --line: #362a45;
    --ink: #ebe6f1; --ink-2: #b2a8bf; --ink-3: #81778e;
    --asphalt: #110a1a; --asphalt-2: #24183a; --on-asphalt: #ebe6f1;
    --signal: #2cc3b6; --signal-ink: #0f0819; --signal-soft: #15332f;
    --steel: #cf9fe0; --steel-soft: #33213f;
  --danger: #f08a7e; --danger-soft: #3a2220; --ok: #6cc391; --ok-soft: #1f3328;
  --warn: #e8c15a; --warn-soft: #3a3120;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--steel); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); font-size: .86rem; }
[hidden] { display: none !important; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--asphalt); color: var(--on-asphalt); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 1.05rem; }
.brand-mark { width: 42px; height: 30px; flex: none; }
.wordmark { font-family: var(--brand-font); font-weight: 800; letter-spacing: .02em; font-size: 1.02rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-s);
  color: inherit; text-decoration: none; opacity: .78; position: relative;
}
.nav a:hover { opacity: 1; background: var(--asphalt-2); }
.nav a.on { opacity: 1; background: var(--asphalt-2); }
.nav a.on::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
  background: repeating-linear-gradient(var(--signal) 0 6px, transparent 6px 10px);
}
.nav svg { width: 20px; height: 20px; flex: none; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--asphalt-2); font-size: .88rem; }
.side-foot .who { font-weight: 600; }
.side-foot button { background: none; border: 0; color: var(--on-asphalt); opacity: .7; padding: 6px 0; cursor: pointer; }
.side-foot button:hover { opacity: 1; }

.main { min-width: 0; padding: 26px 32px 60px; max-width: 1280px; width: 100%; }
.topbar { display: none; }
.bottomnav { display: none; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-right: auto; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }

/* ---------- элементы ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: var(--radius-s); cursor: pointer; text-decoration: none; color: var(--ink);
  font-weight: 550; white-space: nowrap; min-height: 38px;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; cursor: default; }

.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-s);
  padding: 8px 10px; min-height: 38px;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px var(--steel-soft); }
.search { max-width: 280px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--asphalt); color: var(--on-asphalt); }
.scroll-x { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: .8rem;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.chip.steel { background: var(--steel-soft); border-color: transparent; color: var(--steel); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip.dark { background: var(--asphalt); color: var(--on-asphalt); border-color: transparent; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.panel-pad { padding: 16px 18px; }
.panel h2 { margin-bottom: 12px; }

.empty { padding: 34px 18px; text-align: center; color: var(--ink-2); }
.empty .btn { margin-top: 12px; }

/* ---------- сводка ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; margin-bottom: 18px; }
.kpi { background: var(--surface); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.kpi:hover { background: var(--surface-2); }
.kpi b { display: block; font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--ink-2); font-size: .9rem; }
.kpi.alert b { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 9px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.feed li:first-child { border-top: 0; }

/* ---------- заявки: дорожная линия ---------- */
.orders { display: flex; flex-direction: column; gap: 8px; container-type: inline-size; }
.order {
  display: grid; grid-template-columns: 110px minmax(0, 2.2fr) minmax(0, 1.3fr) 130px 120px; gap: 16px;
  align-items: center; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); cursor: pointer; text-align: left; width: 100%;
}
.order:hover { border-color: var(--ink-3); }
.order .no { font-weight: 650; font-variant-numeric: tabular-nums; }
.order .who { min-width: 0; }
.order .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order .money { text-align: right; }
.order .money b { display: block; font-variant-numeric: tabular-nums; }

.route { min-width: 0; }
.route-cities { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: .95rem; }
.route-cities span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.road { position: relative; height: 14px; margin: 5px 0 3px; }
.road::before {
  content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 6px; border-radius: 3px; background: var(--asphalt);
}
.road::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 6.5px; height: 1px;
  background: repeating-linear-gradient(90deg, var(--signal) 0 8px, transparent 8px 14px);
}
.road .truck {
  position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--signal); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--asphalt); z-index: 1;
}
.road.done .truck { background: var(--ok); }
.road.stop .truck { background: var(--ink-3); }
.route-meta { font-size: .82rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@container (max-width: 980px) {
  .order { grid-template-columns: 100px minmax(0, 2fr) minmax(0, 1.2fr) 150px; }
  .order .money { display: none; }
}
@container (max-width: 700px) {
  .order { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 14px; }
  .order .route { grid-column: 1 / -1; grid-row: 2; }
  .order .who { grid-column: 1 / -1; grid-row: 3; font-size: .88rem; }
  .order .stat { grid-column: 2; grid-row: 1; justify-self: end; }
}

/* ---------- задачи ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px; min-height: 120px; }
.col.drop { border-color: var(--signal); background: var(--signal-soft); }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-weight: 600; }
.tcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px;
  margin-bottom: 8px; cursor: pointer; border-left: 4px solid var(--line);
}
.tcard:hover { border-color: var(--ink-3); }
.tcard.p1 { border-left-color: var(--danger); }
.tcard.p2 { border-left-color: var(--signal); }
.tcard.p3 { border-left-color: var(--steel); }
.tcard.is-done .t-title { text-decoration: line-through; color: var(--ink-3); }
.t-title { font-weight: 550; margin-bottom: 6px; }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .82rem; color: var(--ink-2); }
.t-move { display: none; gap: 4px; margin-top: 8px; }
.tlist .tcard { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; }
.tlist .t-title { margin: 0; }
.check {
  width: 22px; height: 22px; border: 2px solid var(--ink-3); border-radius: 50%; background: none; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.overdue { color: var(--danger); font-weight: 600; }

/* ---------- участники, этапы, ход выполнения ---------- */
.members { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.members .chip { padding: 3px 4px 3px 10px; font-size: .86rem; }
.chip-x { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px; font-size: .8rem; opacity: .7; }
.chip-x:hover { opacity: 1; }
.members-add { width: auto; min-width: 220px; flex: 1; }
.steps, .tlog { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.steps-head { display: flex; justify-content: space-between; align-items: baseline; }
.steps .progress { margin: 8px 0 10px; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; }
.step.is-done .step-title { color: var(--ink-3); text-decoration: line-through; }
.step-add { display: flex; gap: 8px; margin-top: 8px; }
.tlog h3 { margin-bottom: 10px; }
.tlog-new { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.tlog-new textarea { min-height: 62px; }
.tlog-list { list-style: none; margin: 0; padding: 0; }
.tlog-list li { padding: 8px 0 8px 12px; border-left: 3px solid var(--line); margin-bottom: 6px; }
.tlog-list li.tlog-note { border-left-color: var(--signal); }
.tlog-list li.tlog-step { border-left-color: var(--ok); }
.tlog-list li.tlog-status { border-left-color: var(--steel); }
.tlog-list li:not(.tlog-note) .tlog-text { color: var(--ink-2); font-size: .9rem; }
.tlog-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tlog-meta { font-size: .86rem; margin-bottom: 2px; }

/* ---------- согласование ---------- */
.appr { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.appr-card { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 12px 14px; margin: 8px 0; background: var(--surface); }
.appr-card.active { border-color: var(--warn); box-shadow: inset 4px 0 0 var(--warn); }
.appr-card.approved { box-shadow: inset 4px 0 0 var(--ok); }
.appr-card.rejected { box-shadow: inset 4px 0 0 var(--danger); }
.appr-card.cancelled { opacity: .7; }
.appr-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.appr-note { margin: 8px 0; white-space: pre-wrap; background: var(--surface-2); padding: 8px 10px; border-radius: var(--radius-s); }
.appr-steps { margin: 10px 0 0; padding: 0 0 0 20px; display: flex; flex-direction: column; gap: 8px; }
.appr-step-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.appr-step.turn .appr-step-head b { text-decoration: underline var(--warn) 2px; }
.appr-comment { margin-top: 4px; padding: 6px 10px; border-left: 3px solid var(--line); white-space: pre-wrap; }
.appr-step.rejected .appr-comment { border-color: var(--danger); }
.appr-step.remarks .appr-comment { border-color: var(--warn); }
.appr-decide { margin-top: 12px; padding: 12px; border-radius: var(--radius-s); background: var(--warn-soft); display: flex; flex-direction: column; gap: 8px; }
.appr-ok { border-color: var(--ok); color: var(--ok); } .appr-warn { border-color: var(--warn); color: var(--warn); } .appr-bad { border-color: var(--danger); color: var(--danger); }
.pend-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.appr-pending { border-color: var(--warn); }
/* ---------- журнал изменений ---------- */
.jr-day { margin: 16px 0 6px; font-weight: 650; color: var(--ink-2); }
.jr-day::first-letter { text-transform: uppercase; }
.jr-row { display: grid; grid-template-columns: 48px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.jr-time { color: var(--ink-3); font-size: .88rem; padding-top: 1px; }
.jr-diff { margin-top: 6px; border-collapse: collapse; font-size: .88rem; }
.jr-diff td { padding: 2px 10px 2px 0; vertical-align: top; }
.jr-old { color: var(--ink-3); text-decoration: line-through; }
.jr-new { font-weight: 600; }
.form.jr-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ---------- перечень в задаче ---------- */
.step { grid-template-columns: 28px 1fr auto auto; }
.step > .check { order: 0; } .step > .step-text { order: 1; } .step > .step-list, .step > .step-list-add { order: 2; }
.step > [aria-label="Удалить этап"] { order: 3; }
.step-list { min-height: 30px; padding: 3px 9px; font-size: .82rem; white-space: nowrap; }
.step-list.has { border-color: var(--signal); }
.step-list.ok { border-color: var(--ok); color: var(--ok); }
.step-list-add { opacity: .35; padding: 2px 6px; }
.step:hover .step-list-add { opacity: 1; }
.step-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 8px 36px; padding: 8px 10px;
  background: var(--signal-soft); border-radius: var(--radius-s); font-size: .9rem; }
.step-suggest span { margin-right: auto; }
.items.items-step { margin: 2px 0 10px 36px; padding: 10px; border: 1px dashed var(--line); border-radius: var(--radius-s); border-top: 1px dashed var(--line); }
.items-step-title { font-size: .9rem; }
.items { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.items h3 { display: inline-flex; align-items: center; gap: 4px; }
.items .progress { margin: 8px 0 10px; }
.item-list { display: flex; flex-direction: column; gap: 6px; }
.item { display: grid; grid-template-columns: 26px minmax(0, 4fr) 80px minmax(0, 2fr) auto auto; gap: 6px; align-items: center;
  padding: 4px; border-radius: var(--radius-s); }
.item.ok { background: var(--ok-soft); }
.item .input { min-height: 34px; padding: 5px 8px; }
.item.ok .item-name { font-weight: 600; }
.item-no { text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.item-ok { display: inline-flex; align-items: center; gap: 4px; font-size: .82rem; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.item-ok input { width: 18px; height: 18px; accent-color: var(--ok); }
.item-tools { display: inline-flex; }
.item-tools .btn { padding: 2px 7px; min-height: 30px; }
.tlog-tools { float: right; display: inline-flex; gap: 2px; }
.tlog-tools .btn { padding: 0 6px; min-height: 26px; font-size: .8rem; }

/* ---------- заявки: документы, флаги, деньги ---------- */
.stat { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.flags { display: flex; flex-wrap: wrap; gap: 4px; }
.docs { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.docs h3 { margin-bottom: 8px; }
.doc { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; cursor: pointer; }
.doc input { width: 18px; height: 18px; accent-color: var(--ok); }
.money-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 6px; }
.money-kpis > div { display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--radius-s); padding: 10px 12px; }
.money-kpis b { font-size: 1.25rem; }
h3.mini { font-size: .9rem; color: var(--ink-2); margin: 14px 0 4px; }

/* ---------- календарь ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: var(--radius-m);
  overflow: hidden; background: var(--line); gap: 1px; min-width: 860px; }
.cwd { background: var(--surface-2); padding: 6px 8px; font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.cday { background: var(--surface); min-height: 112px; padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cday.out { background: var(--surface-2); }
.cday { cursor: copy; }
.cday:hover { box-shadow: inset 0 0 0 2px var(--signal-soft); }
.cday.out .cnum { color: var(--ink-3); }
.cnum { font-size: .82rem; font-weight: 600; padding: 2px 3px; align-self: flex-start; border-radius: 10px; min-width: 22px; text-align: center; }
.cday.today .cnum { background: var(--signal); color: var(--signal-ink); }
.cev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid; border-radius: 3px; padding: 2px 5px;
  font-size: .76rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; background: var(--surface-2); color: var(--ink); }
.cev.load { border-color: var(--signal); background: var(--signal-soft); }
.cev.unload { border-color: var(--ok); background: var(--ok-soft); }
.cev.task { border-color: var(--steel); background: var(--steel-soft); }
.cev.done { opacity: .55; text-decoration: line-through; }
.cmore { border: 0; background: none; color: var(--steel); font-size: .76rem; text-align: left; padding: 2px 5px; cursor: pointer; }
.agenda { display: flex; flex-direction: column; gap: 10px; }
.agenda-day { display: flex; flex-direction: column; gap: 5px; }
.agenda .agenda-day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 10px 12px; }
.agenda-day.today { border-color: var(--signal); }
.agenda-day h3 { font-size: .9rem; color: var(--ink-2); margin-bottom: 2px; }
.agenda-day .cev { font-size: .9rem; padding: 6px 8px; white-space: normal; }

/* ---------- поиск, печать ---------- */
.search-big { font-size: 1.1rem; min-height: 48px; margin-bottom: 16px; }
.sr-h { margin: 18px 0 10px; font-size: 1rem; color: var(--ink-2); }
.print-frame { width: 100%; height: 66vh; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }

/* ---------- уведомления ---------- */
.bell { position: relative; margin-left: auto; background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; border-radius: var(--radius-s); opacity: .85; }
.bell:hover { opacity: 1; background: var(--asphalt-2); }
.bell-badge { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--signal); color: var(--signal-ink); font-size: .72rem; font-weight: 700; display: grid; place-items: center; }
.notif { list-style: none; margin: -6px 0 0; padding: 0; }
.notif li button { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 4px 10px 14px; cursor: pointer; position: relative; }
.notif li button:hover { background: var(--surface-2); }
.notif li.unread button { font-weight: 600; }
.notif li.unread button::before { content: ""; position: absolute; left: 2px; top: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--signal); }
.notif li .faint { font-weight: 400; }

/* ---------- контрагенты ---------- */
.clist { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.ccard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px;
  cursor: pointer; text-align: left; }
.ccard:hover { border-color: var(--ink-3); }
.ccard h3 { margin-bottom: 4px; }
.ccard .row { display: flex; gap: 10px; flex-wrap: wrap; font-size: .88rem; color: var(--ink-2); margin-top: 8px; }

/* ---------- аналитика ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar-track { height: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--steel); }
.bar-fill.sig { background: var(--signal); }
.bar-fill.bad { background: var(--danger); }
.bar-fill.ok { background: var(--ok); }
.cols-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.cols-chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; min-width: 0; }
.cols-chart .c i { display: block; width: 100%; max-width: 46px; background: var(--steel); border-radius: 3px 3px 0 0; position: relative; }
.cols-chart .c i b { position: absolute; left: 0; right: 0; bottom: 0; background: var(--signal); border-radius: 3px 3px 0 0; }
.cols-chart .c span { font-size: .78rem; color: var(--ink-2); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: .84rem; color: var(--ink-2); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
table.t { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.t th, table.t td { padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; }
table.t th { color: var(--ink-2); font-weight: 600; border-top: 0; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- модальные окна ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(15, 18, 20, .5); display: grid; place-items: center; z-index: 50;
  padding: 20px; animation: fade .12s ease-out;
}
.modal {
  background: var(--surface); border-radius: var(--radius-m); width: min(640px, 100%); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; box-shadow: var(--shadow); animation: rise .16s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin-right: auto; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .spacer { margin-right: auto; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.field-hint { margin-top: 4px; font-size: .8rem; }
.field label { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 4px; font-weight: 550; }
.form-sep { grid-column: 1 / -1; font-weight: 650; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.calc { grid-column: 1 / -1; background: var(--surface-2); border-radius: var(--radius-s); padding: 10px 12px; font-variant-numeric: tabular-nums; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--asphalt); color: var(--on-asphalt); padding: 10px 16px; border-radius: var(--radius-s); z-index: 80;
  box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
.toast.err { background: var(--danger); color: #fff; }

/* ---------- вход ---------- */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; padding: 20px;
  background: radial-gradient(1200px 500px at 50% 0%, #3e2a63 0%, transparent 70%), #2e1b4d; }
.login-logo { display: flex; align-items: center; gap: 12px; color: #fff; }
.login-logo .brand-mark { width: 64px; height: 46px; }
.login-logo .wordmark { font-size: 2rem; }
.login {
  width: min(380px, 100%); background: var(--surface); border-radius: var(--radius-m); padding: 28px; box-shadow: var(--shadow);
}
.login h1 { font-size: 1.25rem; margin-bottom: 6px; }
.login p { margin: 0 0 20px; color: var(--ink-2); }
.login .field { margin-bottom: 12px; }
.login .btn { width: 100%; justify-content: center; margin-top: 6px; }
.login-road { height: 10px; margin: -28px -28px 24px; border-radius: var(--radius-m) var(--radius-m) 0 0;
  background: linear-gradient(90deg, var(--signal) 0 55%, #9a5aa8 55% 100%); height: 6px; }

/* ---------- майнд-карты ---------- */
.maps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.mapcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px;
  text-decoration: none; color: inherit; display: block; }
.mapcard:hover { border-color: var(--ink-3); }
.mapcard h3 { margin-bottom: 8px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 10px 0 6px; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; background: var(--ok); }

.mm { display: flex; flex-direction: column; height: calc(100vh - 52px); margin: -26px -32px -60px; }
.mm-bar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mm-bar h2 { margin-right: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32ch; }
.mm-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 8px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); }
.mm-tools .input { width: 260px; min-height: 34px; padding: 5px 9px; }
.mm-tools .btn { min-height: 34px; padding: 5px 10px; }
.mm-colors { display: inline-flex; gap: 4px; }
.mm-colors button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.mm-canvas { flex: 1; position: relative; overflow: hidden; touch-action: none; background:
  radial-gradient(circle, var(--line) 1px, transparent 1.2px) 0 0 / 22px 22px, var(--bg); cursor: grab; }
.mm-canvas.panning { cursor: grabbing; }
.mm-canvas svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; }
.mm-node rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.mm-node text { fill: var(--ink); font-size: 14px; font-family: var(--font); dominant-baseline: middle; }
.mm-node.root rect { fill: var(--asphalt); stroke: var(--asphalt); }
.mm-node.root text { fill: var(--on-asphalt); font-weight: 650; font-size: 15px; }
.mm-node.sel rect { stroke: var(--signal); stroke-width: 3; }
.mm-node { cursor: pointer; }
.mm-link { fill: none; stroke: var(--ink-3); stroke-width: 1.6; }
.mm-badge { font-size: 11px; font-family: var(--font); }
.mm-status { position: absolute; right: 14px; bottom: 12px; background: var(--surface); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: var(--radius-s); font-size: .84rem; color: var(--ink-2); box-shadow: var(--shadow); }
.mm-hint { position: absolute; left: 14px; bottom: 12px; font-size: .8rem; color: var(--ink-3); max-width: 60%; }

/* ---------- адаптив ---------- */
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(4, 260px); }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .shell { display: block; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    background: var(--asphalt); color: var(--on-asphalt); padding: 10px 14px; height: 52px;
  }
  body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--asphalt); }
  .topbar .brand { padding: 0; font-size: 1rem; margin-right: auto; }
  .topbar .brand .bell { display: none; }
  .topbar button { background: none; border: 0; color: inherit; padding: 6px; }
  .main { padding: 16px 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 8px;
    font-size: .7rem; color: var(--ink-2); text-decoration: none; }
  .bottomnav a.on { color: var(--ink); font-weight: 650; }
  .bottomnav a.on svg { color: var(--signal-ink); background: var(--signal); border-radius: 12px; }
  .bottomnav svg { width: 40px; height: 26px; padding: 3px 10px; }
  h1 { font-size: 1.3rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .board { display: flex; flex-direction: column; }
  .board .col { width: 100%; }
  .col { min-height: 0; }
  .t-move { display: flex; }
  .search { max-width: none; flex: 1 1 100%; }
  .form { grid-template-columns: 1fr; }
  .tlog-new { flex-direction: column; align-items: stretch; }
  .item { grid-template-columns: 22px 76px minmax(0, 1fr) auto; grid-template-areas: "no name name ok" ". qty note tools"; }
  .item-no { grid-area: no; } .item-name { grid-area: name; } .item-ok { grid-area: ok; }
  .item-qty { grid-area: qty; } .item-tools { grid-area: tools; justify-self: end; } .item-note { grid-area: note; }
  .item { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
  .members-add { min-width: 0; width: 100%; }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal-foot { gap: 6px; padding: 10px 14px; }
  .modal-foot .spacer { flex-basis: 100%; height: 0; margin: 0; }
  .modal-foot .spacer ~ .btn:not(.primary) { display: none; }
  .modal-foot .btn { min-height: 34px; padding: 4px 10px; font-size: .88rem; }
  .modal-foot .btn.primary { flex: 1; justify-content: center; min-height: 44px; font-size: 1rem; }
  .toast { bottom: auto; top: calc(62px + env(safe-area-inset-top, 0px)); }
  .modal { width: 100%; max-height: 92vh; border-radius: var(--radius-m) var(--radius-m) 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .mm { margin: -16px -14px calc(-84px - env(safe-area-inset-bottom, 0px)); height: calc(100vh - 52px - 62px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); }
  .mm-bar { padding: 8px 10px; gap: 6px; flex-wrap: nowrap; }
  .mm-bar h2 { font-size: 1rem; min-width: 0; flex: 1; max-width: none; }
  .mm-bar .chip { display: none; }
  .mm-bar .btn, .mm-tools .btn { min-height: 34px; padding: 4px 9px; font-size: .86rem; }
  .mm-tools { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px; -webkit-overflow-scrolling: touch; }
  .mm-tools .input { position: sticky; left: 0; z-index: 1; min-width: 180px; width: 46vw; }
  .mm-tools .zoom-btn { display: none; }
  .mm-hint { display: none; }
  .bar { grid-template-columns: 96px 1fr auto; }
  .form.jr-filters { grid-template-columns: 1fr 1fr; }
  .jr-row { grid-template-columns: 40px 1fr; }
  .items.items-step, .step-suggest { margin-left: 0; }
  .print-frame { height: 60vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- ссылки, подзадачи ---------- */
.ext-link { color: var(--steel); text-decoration: underline; overflow-wrap: anywhere; }
.msg.mine .ext-link { color: inherit; }
.t-parent { font-size: .78rem; color: var(--ink-3); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parent-banner { display: flex; align-items: center; gap: 6px; background: var(--steel-soft); color: var(--steel); border-radius: var(--radius-s);
  padding: 8px 10px; margin-bottom: 14px; font-size: .9rem; }
.parent-banner a { color: inherit; font-weight: 600; }
.desc-links { margin-top: 8px; font-size: .9rem; overflow-wrap: anywhere; }
.subtasks, .files-block { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.subtasks .progress { margin: 8px 0 10px; }
.sub-row { grid-template-columns: 28px 1fr 0; }
.sub-open { background: none; border: 0; padding: 2px 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; min-width: 0; color: inherit; }
.sub-open .faint { font-size: .8rem; }
.sub-open:hover .step-title { text-decoration: underline; }

/* ---------- файлы ---------- */
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 8px; }
.ftile { position: relative; min-width: 0; }
.ftile-main { display: block; width: 100%; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden;
  background: var(--surface-2); padding: 0; cursor: pointer; }
.ftile-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ftile-ico { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--ink-2); font-size: .72rem; font-weight: 700; }
.ftile-name { font-size: .75rem; color: var(--ink-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftile-del { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(20, 12, 30, .65);
  color: #fff; cursor: pointer; font-size: .75rem; }
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(10, 6, 16, .94); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.viewer-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; }
.viewer-bar .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.viewer-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-count { font-size: .8rem; opacity: .7; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 12px; touch-action: pan-y pinch-zoom; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.viewer-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 4px; }
.viewer-other { color: #fff; text-align: center; }
.viewer-other .faint { color: rgba(255, 255, 255, .7); }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 8px;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 2rem; cursor: pointer; }
.viewer-nav.prev { left: 10px; } .viewer-nav.next { right: 10px; }

/* ---------- чаты ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--signal); color: var(--signal-ink);
  font-size: .72rem; font-weight: 700; display: inline-grid; place-items: center; }
.bottomnav a { position: relative; }
.bottomnav .nav-badge { position: absolute; top: 2px; left: 55%; margin: 0; }
.nav-badge.static { margin-left: 8px; flex: none; }
.chat-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 52px); margin: -26px -32px -60px;
  border-left: 1px solid var(--line); }
.chat-side { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 12px; }
.chat-list { overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 10px 16px; text-decoration: none; color: inherit; border-top: 1px solid var(--line); }
.chat-item:hover { background: var(--surface-2); }
.chat-item.on { background: var(--steel-soft); }
.chat-item-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.chat-item-top, .chat-item-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-width: 0; }
.chat-item-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-top .faint { font-size: .75rem; flex: none; }
.chat-preview { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--asphalt); color: var(--on-asphalt); display: grid; place-items: center;
  font-weight: 700; font-size: .85rem; }
.avatar.emoji { background: var(--steel-soft); font-size: 1.15rem; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.chat-placeholder { align-items: center; justify-content: center; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.msg-more { align-self: center; margin-bottom: 8px; }
.msg-day { align-self: center; font-size: .75rem; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2px 10px; margin: 10px 0 6px; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 560px); }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg-author { font-size: .78rem; color: var(--steel); font-weight: 600; margin: 6px 0 2px 10px; }
.msg-bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: 7px 10px 5px; position: relative; min-width: 64px; }
.msg.mine .msg-bubble { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); border-radius: 14px 14px 4px 14px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-time { display: block; text-align: right; font-size: .68rem; opacity: .65; margin-top: 2px; }
.msg-imgs { display: grid; gap: 4px; margin: -2px -5px 4px; }
.msg-imgs.multi { grid-template-columns: 1fr 1fr; }
.msg-imgs button { border: 0; padding: 0; background: none; cursor: zoom-in; }
.msg-imgs img { display: block; width: 100%; max-height: 280px; object-fit: cover; border-radius: 10px; }
.msg-imgs:not(.multi) img { max-width: 300px; }
.msg-file { display: flex; align-items: center; gap: 8px; border: 1px solid currentColor; border-radius: 10px; background: none; color: inherit;
  padding: 6px 10px; margin-bottom: 4px; cursor: pointer; text-align: left; opacity: .9; max-width: 100%; }
.msg-file span { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.msg-file small { opacity: .7; }
.msg-empty { margin: auto; }
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.chat-input { min-height: 40px; max-height: 160px; resize: none; padding: 9px 12px; border-radius: 20px; line-height: 1.35; }
.icon-btn { width: 40px; height: 40px; min-height: 40px; padding: 0; justify-content: center; flex: none; border-radius: 50%; }
.pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 8px; }
.people { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; margin-top: 8px; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border: 0; background: none; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--line); color: inherit; width: 100%; }
.person:hover { background: var(--surface-2); }
.person input { width: 18px; height: 18px; accent-color: var(--signal); }

/* ---------- карточка узла майнд-карты ---------- */
.mm-pop { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; max-height: 70%; overflow-y: auto; }
.mm-pop-title { font-size: .98rem; }
.mm-pop-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mm-pop .progress { margin: 4px 0 2px; }
.mm-pop-subs { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.mm-pop-subs li.done { color: var(--ink-3); text-decoration: line-through; }
.mm-pop-note { background: var(--surface-2); border-radius: var(--radius-s); padding: 6px 8px; overflow-wrap: anywhere; }
.mm-pop-actions { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .chat-wrap { grid-template-columns: 1fr; margin: -16px -14px calc(-84px - env(safe-area-inset-bottom, 0px));
    height: calc(100vh - 52px - 62px - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); border: 0; }
  .chat-wrap.has-active .composer { padding-bottom: 8px; }
  .msg { max-width: 88%; }
  .viewer-nav { display: none; }
  .mm-pop { max-height: 55%; }
}

/* ---------- уведомления, значки, отметки прочтения ---------- */
.ticks { margin-left: 4px; font-size: .78rem; letter-spacing: -3px; padding-right: 3px; cursor: default; color: var(--ink-3); }
.msg.mine .ticks { color: rgba(27, 15, 48, .5); }
.ticks.tick-read { color: var(--signal); font-weight: 800; }
.msg.mine .ticks.tick-read { color: #3d1a78; font-weight: 800; }
.tick-read-t { color: var(--signal); }
.hpop { position: fixed; z-index: 90; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow); padding: 10px 12px; font-size: .86rem; max-height: 60vh; overflow: auto; }
.hpop ul { margin: 2px 0 6px; padding-left: 16px; }
.hpop-sec + .hpop-sec { margin-top: 4px; }
.npop-wrap { position: fixed; right: 16px; top: calc(16px + env(safe-area-inset-top, 0px)); z-index: 85; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.npop { display: flex; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--signal);
  border-radius: var(--radius-m); box-shadow: var(--shadow); animation: rise .2s ease-out; }
.npop-main { flex: 1; text-align: left; background: none; border: 0; padding: 10px 12px; cursor: pointer; color: inherit; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.npop-main span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--ink-2); }
.npop-x { background: none; border: 0; padding: 8px 10px; cursor: pointer; color: var(--ink-3); }
.push-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; border-color: var(--signal); background: var(--signal-soft); }
.chat-item.has-unread b { font-weight: 800; }
.prefs .doc { grid-template-columns: 22px 1fr; }
@media (max-width: 760px) { .npop-wrap { right: 8px; left: 8px; width: auto; top: calc(60px + env(safe-area-inset-top, 0px)); } }

/* ---------- карта задачи ---------- */
.mm-node.auto rect:first-child { stroke-dasharray: none; }
.mm-node.private rect:first-child { stroke-dasharray: 5 3; }
.mm-node.done text.mm-done { fill: var(--ink-3); text-decoration: line-through; }
.mm-node.auto:not(.root) rect:first-child { fill: var(--surface-2); }

/* ---------- кто в сети ---------- */
.avatar { position: relative; }
.pdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); border: 2px solid var(--surface); vertical-align: middle; flex: none; }
.pdot.on { background: #22c55e; }
.avatar .pdot { position: absolute; right: -2px; bottom: -2px; }
.plabel { color: var(--ink-3); font-size: .86rem; }
.plabel.on { color: #16a34a; font-weight: 600; }
.online-list { list-style: none; margin: 0 0 6px; padding: 0; }
.online-list li { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.online-list li:first-child { border-top: 0; }
.online-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- смайлы, GIF, вложения ---------- */
.emo-pop { position: fixed; z-index: 95; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 6px; }
.emo-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; overflow-x: auto; }
.emo-tabs button { border: 0; background: none; font-size: 1.15rem; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.emo-tabs button.on { background: var(--signal-soft); }
.emo-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 220px; overflow-y: auto; }
.emo { border: 0; background: none; font-size: 1.35rem; padding: 4px 0; border-radius: 6px; cursor: pointer; line-height: 1.2; }
.emo:hover { background: var(--surface-2); }
.gif-btn { font-weight: 800; font-size: .78rem; letter-spacing: .02em; }
.gif-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; max-height: 60vh; overflow-y: auto; }
.gif { border: 0; padding: 0; background: var(--surface-2); border-radius: 6px; overflow: hidden; cursor: pointer; aspect-ratio: 1; }
.gif img { width: 100%; height: 100%; object-fit: cover; display: block; }
.composer-row { position: relative; }
.attach-menu { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 240px; padding: 4px; }
.attach-menu button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: .95rem; color: var(--ink); }
.attach-menu button:hover { background: var(--surface-2); }
.dict-chip { margin: 0 0 6px; cursor: pointer; background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.rec { color: var(--danger); background: var(--danger-soft); }
.tlog-tools-col { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

/* ---------- голосовые и видео ---------- */
.rec-bar { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-time { font-variant-numeric: tabular-nums; margin-right: auto; }
.msg-audio { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.msg-audio audio { width: 100%; max-width: 280px; height: 36px; }
.msg-video { max-width: 280px; width: 100%; border-radius: 10px; background: #000; display: block; }
.msg-video.note { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; }
.vrec { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.vrec-preview { width: min(320px, 80vw); aspect-ratio: 1; border-radius: 50%; object-fit: cover; background: #000; }
.vrec-row { display: flex; gap: 10px; align-items: center; }

/* ---------- реакции ---------- */
.msg { position: relative; }
.msg-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.react { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 1px 7px; font-size: .9rem; cursor: pointer; display: inline-flex; gap: 3px; align-items: center; }
.react span { font-size: .78rem; color: var(--ink-2); }
.react.mine { border-color: var(--signal); background: var(--signal-soft); }
.react-bar { position: absolute; top: -34px; z-index: 5; display: none; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 6px; box-shadow: var(--shadow); }
.msg:not(.mine) .react-bar { left: 0; } .msg.mine .react-bar { right: 0; }
.react-bar button { border: 0; background: none; font-size: 1.15rem; padding: 2px 3px; cursor: pointer; border-radius: 6px; }
.react-bar button:hover { background: var(--surface-2); transform: scale(1.15); }
@media (hover: hover) { .msg:hover .react-bar { display: flex; } }
.react-bar.show { display: flex; }

/* ---------- удаление, правка, «не уведомлять» ---------- */
.msg.deleted .msg-bubble { background: var(--surface-2) !important; border: 1px dashed var(--line) !important; color: var(--ink-3) !important; }
.msg.deleted .msg-text { font-style: italic; }
.msg-edited { opacity: .75; }
.msg-edit { min-width: min(320px, 70vw); }
.react-bar .rb-act { font-size: 1rem; border-left: 1px solid var(--line); border-radius: 0; padding: 2px 6px; }
.btn.muted-on { color: var(--ink-3); }
.chat-item.is-muted .nav-badge { background: var(--ink-3); }
.muted-ico { font-size: .8rem; }
