/* Кабинет Aibaza. Палитра снята с референса пользователя (askona.kz):
   бирюзовый акцент, белый и почти-белый серый, тёплый серый текст. */

@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-lat.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+20B8, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/manrope-cyr.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Акцент задаётся одной переменной --accent (из настроек «Оформление»),
   остальные оттенки выводятся из него: тёмный для текста, светлый для подложек. */
:root {
  --accent: #00b9bf;
  --bg: #ffffff;
  --panel: #f6f6f6;
  --panel-2: #fbfbfb;
  --text: #1a1a18;
  --muted: #7e7e7e;
  --line: #e4e4e4;
  --accent-ink: color-mix(in srgb, var(--accent) 72%, #000);
  --accent-tint: color-mix(in srgb, var(--accent) 16%, var(--bg));
  --alert: #e93368;
  --alert-tint: #fde7ee;
  --warm: #d98a12;
  --warm-tint: #fff2dc;
  --ok: #2f9e5b;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 6px 20px rgba(0, 0, 0, .07);
  --top-h: 56px;
  color-scheme: light;
}
/* Тёмная тема — полоса #08–#18, как у тёмных интерфейсов, к которым привыкли. */
:root[data-theme="dark"] {
  --bg: #121415;
  --panel: #1a1d1f;
  --panel-2: #161819;
  --text: #ececea;
  --muted: #8f8f8c;
  --line: #2a2e31;
  --accent-ink: color-mix(in srgb, var(--accent) 78%, #fff);
  --accent-tint: color-mix(in srgb, var(--accent) 22%, var(--bg));
  --alert-tint: #3a1a25;
  --warm-tint: #3a2a12;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="dark"] .tab.is-active { background: var(--accent); color: #0b0b0b; }
:root[data-theme="dark"] .toast { background: #f2f2f0; color: #111; }
:root[data-theme="dark"] .toast--error { background: var(--alert); color: #fff; }
:root[data-theme="dark"] .modal { background: rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .chip--btn.is-active { background: var(--accent); color: #0b0b0b; border-color: var(--accent); }
:root[data-theme="dark"] .btn--primary { color: #0b0b0b; }

/* --- Оформление в настройках ---------------------------------------------------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 2px var(--bg); }
.swatch.is-active { border-color: var(--text); }
.swatch--custom { width: auto; height: auto; border: 0; box-shadow: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); background: none; }
.swatch--custom input { width: 30px; height: 30px; border: 0; padding: 0; background: none; cursor: pointer; }
.theme-pick { display: flex; gap: 6px; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 500 15px/1.45 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }

/* --- Общие элементы -------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand__mark { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }

.btn {
  border: 1px solid var(--line); background: var(--bg); border-radius: 999px;
  padding: 9px 16px; font-weight: 700; font-size: 14px; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--panel); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn--alert { background: var(--alert); border-color: var(--alert); color: #fff; }
.btn--alert:hover { filter: brightness(.92); }
.btn--ghost { border-color: transparent; }
.btn--wide { width: 100%; padding: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.link { border: 0; background: none; color: var(--muted); padding: 4px 6px; }
.link:hover { color: var(--text); }

.field { display: block; margin-bottom: 12px; }
.field > span, .field__label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--bg);
  padding: 9px 11px; font-size: 14px;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }
/* Автозаполнение браузера красит поле в жёлтый — возвращаем свои цвета. */
input:-webkit-autofill, input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--panel); color: var(--muted); }
.chip--accent { background: var(--accent-tint); color: var(--accent-ink); }
.chip--alert { background: var(--alert-tint); color: var(--alert); }
.chip--warm { background: var(--warm-tint); color: var(--warm); }

/* --- Вход ------------------------------------------------------------------- */
.login { min-height: 100%; display: grid; place-items: center; background: var(--panel); padding: 24px; }
.login__card { width: 100%; max-width: 360px; background: var(--bg); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login__title { font-size: 22px; font-weight: 800; margin: 18px 0 20px; letter-spacing: -.02em; }
.login__error { color: var(--alert); font-size: 13px; margin: -4px 0 12px; }

/* --- Каркас ----------------------------------------------------------------- */
.app { height: 100%; display: flex; flex-direction: column; }
.top {
  height: var(--top-h); display: flex; align-items: center; gap: 28px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: var(--bg); flex: 0 0 auto;
}
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: none; padding: 8px 14px; border-radius: 999px; font-weight: 700; color: var(--muted);
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--text); color: #fff; }
.tab__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 12px; display: inline-grid; place-items: center; }
.top__user { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

.view { flex: 1 1 auto; min-height: 0; }

/* --- Диалоги ---------------------------------------------------------------- */
.view--dialogs { display: grid; grid-template-columns: 320px 1fr 300px; }

.list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--panel-2); }
.list__search { padding: 12px; border-bottom: 1px solid var(--line); }
.list__search input { width: 100%; border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; background: var(--bg); }
.list__items { overflow-y: auto; overflow-x: hidden; flex: 1 1 auto; }
.lead > span { min-width: 0; }
.lead {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 0 10px; align-items: start;
  padding: 12px 14px; border: 0; background: none; width: 100%; text-align: left;
  border-bottom: 1px solid var(--line); cursor: pointer;
}
.lead:hover { background: var(--panel); }
.lead.is-active { background: var(--accent-tint); }
.lead__dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--accent); }
.lead__dot--human { background: var(--alert); animation: pulse 1.6s ease-in-out infinite; }
.lead__dot--manager { background: var(--warm); }
.lead__dot--off { background: var(--line); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(233, 51, 104, .45); } 50% { box-shadow: 0 0 0 6px rgba(233, 51, 104, 0); } }
.lead__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead__last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.lead__last--client { color: var(--text); }
.lead__time { color: var(--muted); font-size: 12px; }
.lead__unread { margin-top: 4px; justify-self: end; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--alert); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.lead__stage { grid-column: 2; margin-top: 4px; }
.list__empty { padding: 32px 20px; color: var(--muted); text-align: center; }

.thread { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.thread__empty { margin: auto; text-align: center; max-width: 380px; color: var(--muted); padding: 24px; }
.thread__body { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.thread__name { font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.thread__meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; margin-top: 2px; }
.thread__actions { display: flex; gap: 8px; }
.thread__messages { flex: 1 1 auto; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--panel-2); }
.msg { max-width: 68%; padding: 10px 14px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg__who { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; letter-spacing: .02em; }
.msg--CLIENT { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg--BOT { align-self: flex-end; background: var(--accent-tint); border-bottom-right-radius: 6px; }
.msg--MANAGER { align-self: flex-end; background: var(--warm-tint); border-bottom-right-radius: 6px; }
.msg__time { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); font-weight: 700; padding: 6px 0; }

.composer { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--bg); align-items: flex-end; }
.composer textarea { flex: 1 1 auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; resize: none; max-height: 160px; }
.composer textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-tint); }

.card { border-left: 1px solid var(--line); overflow-y: auto; background: var(--panel-2); }
.card__section { padding: 16px; border-bottom: 1px solid var(--line); }
.card__section .field:last-child { margin-bottom: 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { display: flex; gap: 10px; padding: 5px 0; }
.timeline time { color: var(--muted); flex: 0 0 48px; }

/* --- Воронка ---------------------------------------------------------------- */
.view--funnel { overflow: auto; background: var(--panel); display: flex; flex-direction: column; }
.board__title { padding: 14px 20px 0; font-weight: 800; font-size: 16px; letter-spacing: -.01em; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: 250px; gap: 12px; padding: 12px 16px 16px; flex: 1 1 auto; }
.col__num { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--bg); border-radius: 999px; width: 20px; height: 20px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.col--closed .col__num { color: var(--alert); }
.col--closed .col__title { color: var(--muted); }
.col__hint { font-size: 11px; color: var(--muted); padding: 0 8px 8px; line-height: 1.35; }
.kcard__reason { margin-top: 8px; font-size: 12px; color: var(--alert); }
.col { display: flex; flex-direction: column; min-height: 0; }
.col__head { padding: 6px 8px 10px; display: flex; align-items: baseline; gap: 8px; }
.col__title { font-weight: 800; font-size: 14px; }
.col__count { color: var(--muted); font-size: 13px; }
.col__sum { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; }
.col__body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; border-radius: var(--radius); padding: 4px; transition: background .15s; }
.col__body.is-over { background: var(--accent-tint); }
.kcard { background: var(--bg); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.05); cursor: grab; border: 1px solid transparent; }
.kcard:hover { border-color: var(--line); }
.kcard.is-dragging { opacity: .5; }
.kcard__name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kcard__name .lead__dot { margin-top: 0; flex: 0 0 auto; }
.kcard__last { font-size: 13px; color: var(--muted); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.kcard__foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.kcard__sum { font-weight: 800; color: var(--text); }
.col--WON .kcard__sum { color: var(--ok); }

/* --- Отчёт ------------------------------------------------------------------- */
.view--report { overflow-y: auto; }
.report { max-width: 760px; margin: 0 auto; padding: 32px 24px 60px; }
.report__head { display: flex; align-items: center; gap: 8px; margin-bottom: 28px; }
.report__title { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; min-width: 200px; }
.report__head .btn:last-child { margin-left: auto; }

.strip { margin-bottom: 32px; }
.strip__bars { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; height: 96px; align-items: end; }
.strip__bar { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .9; position: relative; }
.strip__bar--night { background: var(--alert); }
.strip__bar--zero { background: var(--line); }
.strip__bar span { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); font-weight: 700; }
.strip__hours { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; padding: 0 2px; }
.strip__caption { color: var(--muted); font-size: 13px; margin: 10px 0 0; }

.ledger { margin: 0 0 32px; display: grid; grid-template-columns: 1fr auto; row-gap: 0; }
.ledger > div { display: contents; }
.ledger dt, .ledger dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger dd { font-weight: 800; font-size: 22px; text-align: right; letter-spacing: -.01em; }
.ledger dd small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 8px; }
.ledger .is-head dt { font-weight: 800; padding-top: 24px; color: var(--muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; border: 0; }
.ledger .is-head dd { border: 0; }

.waiting h3 { font-size: 15px; margin: 0 0 8px; }
.waiting ul { list-style: none; padding: 0; margin: 0; }
.waiting li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--alert-tint); border-radius: var(--radius-s); margin-bottom: 6px; }
.waiting li button { border: 0; background: none; font-weight: 700; color: var(--alert); padding: 0; }
.waiting .muted { padding: 10px 0; }

/* --- Тост -------------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 700; box-shadow: var(--shadow); z-index: 10; }
.toast--error { background: var(--alert); }

/* --- Фильтры, чипы-кнопки, меню ------------------------------------------------ */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip--btn { border: 1px solid var(--line); background: var(--bg); cursor: pointer; }
.chip--btn:hover { border-color: var(--accent); }
.chip--btn.is-active { background: var(--text); color: #fff; border-color: var(--text); }
.chip--select { border: 1px solid var(--line); background: var(--bg); padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); }
.btn--small { padding: 6px 12px; font-size: 13px; }
.tab__badge--warm { background: var(--warm); }
.lead__tags { grid-column: 2 / 4; margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.lead__tags .chip { font-size: 11px; padding: 1px 7px; }
.lead__task { color: var(--warm); font-size: 11px; font-weight: 700; margin-top: 4px; }

/* Пометки «оплата поступила» и «созвон» — заметнее этапа, потому что это события,
   на которые менеджер должен отреагировать. */
.mark { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mark--paid { background: color-mix(in srgb, var(--ok) 16%, var(--bg)); color: var(--ok); }
.mark--call { background: var(--warm-tint); color: var(--warm); }
.mark--past { opacity: .65; }
.lead__marks { grid-column: 2 / 4; margin-top: 5px; display: flex; gap: 4px; flex-wrap: wrap; }
.kcard__marks { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.thread__meta .mark { margin-left: 2px; }

.composer { flex-wrap: wrap; }
.composer__tools { flex: 0 0 100%; position: relative; display: flex; justify-content: flex-end; margin-bottom: -4px; }
.menu { position: absolute; right: 0; bottom: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 260px; max-width: 420px; z-index: 6; padding: 6px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: var(--radius-s); }
.menu button:hover { background: var(--panel); }
.menu button small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu__empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* --- Задачи ----------------------------------------------------------------- */
.tasklist { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; }
.tasklist li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tasklist li.is-done { color: var(--muted); text-decoration: line-through; }
.tasklist li.is-late .task__due { color: var(--alert); }
.tasklist input[type=checkbox] { margin-top: 3px; accent-color: var(--accent); }
.task__due { color: var(--muted); font-size: 12px; margin-left: auto; white-space: nowrap; }
.taskform { display: flex; gap: 6px; flex-wrap: wrap; }
.taskform input, .taskform select { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 7px 10px; font-size: 13px; background: var(--bg); min-width: 0; }
.taskform input:first-child { flex: 1 1 100%; }
.taskform--wide { margin: 0 0 20px; }
.taskform--wide input:first-child { flex: 1 1 260px; }

.view--tasks { overflow-y: auto; }
.tasks { max-width: 760px; margin: 0 auto; padding: 28px 24px 60px; }
.tasks__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tasks__head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.tasks__group { margin-bottom: 22px; }
.tasks__group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 6px; }
.tasks__group--late h3 { color: var(--alert); }
.trow { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius-s); margin-bottom: 6px; }
.trow.is-done { opacity: .55; text-decoration: line-through; }
.trow__lead { color: var(--accent-ink); font-size: 13px; border: 0; background: none; padding: 0; text-align: left; }
.trow__who { color: var(--muted); font-size: 12px; }
.trow__due { color: var(--muted); font-size: 12px; white-space: nowrap; }
.trow__del { border: 0; background: none; color: var(--muted); padding: 0 4px; }
.trow__del:hover { color: var(--alert); }

/* --- Аналитика ---------------------------------------------------------------- */
.report__head--sub { margin-top: 40px; }
.report__head--sub .report__title { font-size: 20px; }
.funnel { margin-bottom: 24px; }
.frow { display: grid; grid-template-columns: 150px 1fr 60px; gap: 12px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.frow__bar { height: 26px; background: var(--accent-tint); border-radius: 6px; overflow: hidden; }
.frow__bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; min-width: 2px; }
.frow--WON .frow__bar i { background: var(--ok); }
.frow__n { text-align: right; font-weight: 800; }
.frow__n small { color: var(--muted); font-weight: 600; margin-left: 4px; }
.sources { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.sources h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sources ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.sources li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--line); }

/* --- Настройки --------------------------------------------------------------- */
.view--settings { overflow-y: auto; }
.settings { max-width: 860px; margin: 0 auto; padding: 28px 24px 60px; }
.sblock { margin-bottom: 36px; }
.sblock h2 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.sblock > p { color: var(--muted); font-size: 14px; margin: 0 0 14px; max-width: 640px; }
.srow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; background: var(--panel-2); border-radius: var(--radius-s); margin-bottom: 6px; font-size: 14px; }
.srow .grow { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.srow code { background: var(--panel); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.srow .link { margin-left: auto; }
.sform { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.sform input, .sform select, .sform textarea { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; font-size: 14px; background: var(--bg); }
.sform input { flex: 1 1 160px; }
.sform textarea { flex: 1 1 100%; }
.sform label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.keybox { background: var(--accent-tint); border-radius: var(--radius-s); padding: 12px 14px; margin-top: 10px; font-size: 14px; word-break: break-all; }
.keybox code { display: block; font-size: 15px; font-weight: 700; margin-top: 4px; color: var(--accent-ink); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 6px; }
.status-dot--off { background: var(--line); }
.status-dot--bad { background: var(--alert); }
.hint { font-size: 13px; color: var(--muted); }

/* --- Модалка ---------------------------------------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(26, 26, 24, .45); display: grid; place-items: center; z-index: 20; padding: 20px; }
.modal__card { background: var(--bg); border-radius: 16px; padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.modal__card h3 { margin: 0 0 16px; font-size: 20px; font-weight: 800; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* --- Адаптив ----------------------------------------------------------------- */
@media (max-width: 1100px) {
  .view--dialogs { grid-template-columns: 280px 1fr; }
  .card { position: fixed; right: 0; top: var(--top-h); bottom: 0; width: 300px; box-shadow: var(--shadow); z-index: 5; }
}
/* Кнопки, которые нужны только на телефоне. */
.back { display: none; border: 0; background: var(--panel); color: var(--text); width: 36px; height: 36px; border-radius: 50%; font-size: 18px; flex: 0 0 auto; }
.only-mobile { display: none !important; }
.thread__title { min-width: 0; flex: 1 1 auto; }
.card__bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 800; background: var(--bg); position: sticky; top: 0; z-index: 2; }

@media (max-width: 720px) {
  html, body, .app { height: 100dvh; }
  .top { gap: 8px; padding: 0 10px; height: 52px; --top-h: 52px; }
  .tabs { overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 8px 11px; font-size: 14px; white-space: nowrap; }
  .top__user span { display: none; }
  .top__user .link { display: none; }
  .brand { font-size: 0; }
  .brand__mark { width: 16px; height: 16px; }
  .back { display: inline-grid; place-items: center; }
  .only-mobile { display: inline-flex !important; }
  .thread__head { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .thread__actions .btn { padding: 8px 12px; font-size: 13px; }
  .thread__name { font-size: 16px; }
  .thread__meta { flex-wrap: wrap; gap: 6px; }

  /* Три панели диалогов превращаются в три экрана: список → переписка → карточка. */
  .view--dialogs { grid-template-columns: 1fr; }
  .list, .thread, .card { display: none; }
  .view--dialogs[data-pane="list"] .list { display: flex; }
  .view--dialogs[data-pane="thread"] .thread { display: flex; }
  .view--dialogs[data-pane="card"] .card { display: block; position: static; width: auto; box-shadow: none; }
  .thread__messages { padding: 12px; }
  .msg { max-width: 88%; }
  .composer { padding: 8px 10px; gap: 8px; }
  .composer .btn { padding: 9px 12px; }
  .composer__tools { margin-bottom: -2px; }

  .board { grid-auto-columns: 82vw; gap: 10px; padding: 10px; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .kcard { cursor: pointer; }

  .tasks, .report, .settings { padding: 18px 14px 40px; }
  .report__title { font-size: 22px; min-width: 0; }
  .report__head { flex-wrap: wrap; }
  .report__head .btn:last-child { margin-left: 0; flex: 1 1 100%; }
  .strip__bars { height: 72px; }
  .ledger dd { font-size: 19px; }
  .frow { grid-template-columns: 110px 1fr 54px; font-size: 13px; }
  .trow { grid-template-columns: 22px 1fr auto; }
  .trow__due { grid-column: 2; }
  .srow .link { margin-left: 0; }
  .sform input { flex: 1 1 100%; }
  .modal__card { padding: 18px; }
  .taskform input:first-child, .taskform--wide input:first-child { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .lead__dot--human { animation: none; }
  .btn { transition: none; }
}
