/* Админка «Ты как?»: тёмная тема, как у админки ЛитГолоса. */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #0f0f12;
  --raised: #161619;
  --hover: #1c1c21;
  --active: #232329;
  --line: #1f1f24;
  --line-2: #27272d;
  --line-3: #3f3f47;
  --ink: #fafafa;
  --ink-2: #a1a1ab;
  --muted: #6b6b76;
  --accent: #6366f1;
  --accent-2: #818cf8;
  --accent-soft: rgba(99, 102, 241, .15);
  --good: #10b981;
  --good-2: #34d399;
  --good-soft: rgba(16, 185, 129, .14);
  --warn: #f59e0b;
  --warn-2: #fbbf24;
  --warn-soft: rgba(245, 158, 11, .14);
  --bad: #ef4444;
  --bad-2: #f87171;
  --bad-soft: rgba(239, 68, 68, .14);
  --info-soft: rgba(59, 130, 246, .14);
  --info-2: #60a5fa;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --side: 232px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 14.5px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 4px; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: #a5b4fc; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 10px; }
code, .mono, kbd { font-family: var(--mono); font-size: .92em; }
code { padding: 1px 6px; border-radius: 5px; background: var(--raised); border: 1px solid var(--line-2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
#i-play path { fill: currentColor; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--bad-2); }
.wrap { white-space: normal; min-width: 180px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.end { text-align: right; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; }

/* Каркас */

.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--side);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 12px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; font-size: 16px; padding: 0 6px; }
.brand:hover { color: var(--ink); }
.brand small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; margin-top: -2px; }
.logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  background: #f4f7f5;
  overflow: hidden;
}
.logo img { width: 78%; height: 78%; display: block; }
.search-open {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--raised);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.search-open:hover { border-color: var(--line-3); color: var(--ink-2); }
.search-open span { flex: 1; text-align: left; }
kbd { padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px; font-size: 11px; color: var(--muted); }
.agent-down {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--bad-soft);
  color: var(--bad-2);
  font-weight: 600;
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .6; } }

.menu { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.menu > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-weight: 500;
}
.menu > a span:first-of-type { flex: 1; }
.menu > a .i { opacity: .75; }
.menu > a:hover { background: var(--hover); color: var(--ink); }
.menu > a.active { background: var(--accent-soft); color: var(--accent-2); }
.menu > a.active .i { opacity: 1; }
.menu > a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
.menu-tabs { display: flex; flex-direction: column; margin: 2px 0 6px 21px; padding-left: 12px; border-left: 1px solid var(--line-2); }
.menu-tabs a { display: flex; justify-content: space-between; padding: 5px 10px; border-radius: var(--r-sm); color: var(--muted); font-size: 13.5px; }
.menu-tabs a:hover { color: var(--ink); background: var(--hover); }
.menu-tabs a.active { color: var(--ink); }
.count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 650;
  line-height: 16px;
  text-align: center;
}

.main { margin-left: var(--side); min-width: 0; }
.page { max-width: 1400px; padding: 26px 30px 60px; }
.topbar, .tabbar, .scrim { display: none; }

.tabs {
  display: flex;
  gap: 4px;
  margin: -6px 0 22px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs a {
  padding: 9px 14px 11px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--accent); }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs .current { color: var(--ink-2); }

.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 4px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions form { margin: 0; }

/* Карточки */

.card {
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head .row { gap: 6px; }
.card-body { padding: 18px; }
.card-body > :last-child { margin-bottom: 0; }
.card > .scroll { border-radius: 0; }
.card.danger { border-color: rgba(239, 68, 68, .3); }
.card.danger .card-head h2 { color: var(--bad-2); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; margin-bottom: 18px; }
.grid > .card { margin-bottom: 0; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.grid-2-1 > div > .card:last-child { margin-bottom: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}
a.stat:hover { border-color: var(--line-3); background: var(--raised); color: var(--ink); }
.stat b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-title { color: var(--muted); font-size: 12.5px; }
.stat-note { color: var(--muted); font-size: 12px; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.stat.bad::before { background: var(--bad); }
.stat.bad b { color: var(--bad-2); }
.stat.good::before { background: var(--good); }
.stat.good b { color: var(--good-2); }
.stat.warn::before { background: var(--warn); }
.stat.warn b { color: var(--warn-2); }

.facts { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.empty { padding: 28px 18px; color: var(--muted); text-align: center; }
.calm { display: flex; align-items: center; gap: 12px; padding: 22px; color: var(--good-2); font-weight: 600; }
.calm .i { width: 26px; height: 26px; }

/* Таблицы */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); background: var(--surface); }
th.num { text-align: right; }
td { border-bottom: 1px solid var(--line); }
tbody tr:last-child td, table tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .015); }
td .inline { margin: 0; }

/* Метки */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--raised);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  vertical-align: 1px;
}
.badge.good { background: var(--good-soft); border-color: transparent; color: var(--good-2); }
.badge.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad-2); }
.badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn-2); }
.badge.info { background: var(--info-soft); border-color: transparent; color: var(--info-2); }
h1 .badge { font-size: 13px; padding: 3px 11px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 13px;
}
.chip .i { width: 14px; height: 14px; }

/* Кнопки и поля */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--r);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
button:hover, .btn:hover { background: #5458e8; color: #fff; }
button:disabled { opacity: .5; cursor: default; }
button.ghost, .btn.ghost, button.quiet {
  background: var(--raised);
  border-color: var(--line-2);
  color: var(--ink-2);
}
button.ghost:hover, .btn.ghost:hover, button.quiet:hover { background: var(--hover); border-color: var(--line-3); color: var(--ink); }
button.danger, .btn.danger { background: var(--bad-soft); border-color: rgba(239, 68, 68, .35); color: var(--bad-2); }
button.danger:hover { background: var(--bad); color: #fff; }
button.good { background: var(--good-soft); border-color: rgba(16, 185, 129, .35); color: var(--good-2); }
button.good:hover { background: var(--good); color: #fff; }
button.warn { background: var(--warn-soft); border-color: rgba(245, 158, 11, .35); color: var(--warn-2); }
button.warn:hover { background: var(--warn); color: #111; }
button.small, .btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }
button.wide { width: 100%; }
button.icon-only { padding: 7px; min-width: 36px; }
form { margin: 0; }
form.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

input, select, textarea {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 64px; }
textarea.instruction-text { min-height: 180px; field-sizing: content; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { min-height: 0; width: 17px; height: 17px; accent-color: var(--accent); }
input[type=date], input[type=time] { color-scheme: dark; }
.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.field input, .field select, .field textarea { color: var(--ink); font-size: 14.5px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.days-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.days-pick label { position: relative; }
.days-pick input { position: absolute; opacity: 0; }
.days-pick span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.days-pick input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.days-pick input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; }
.filters .search { flex: 1; min-width: 220px; }
.filters .check { min-height: 38px; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); }

.copy {
  display: inline-flex;
  gap: 6px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
}
.copy .i { width: 14px; height: 14px; opacity: 0; transition: opacity .15s; color: var(--muted); }
.copy:hover { background: none; color: var(--accent-2); }
.copy:hover .i { opacity: 1; }
.copy.copied .i { opacity: 1; color: var(--good-2); }

/* Вкладки внутри страницы */

.seg {
  display: flex;
  gap: 2px;
  margin-bottom: 18px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow-x: auto;
  scrollbar-width: none;
  width: fit-content;
  max-width: 100%;
}
.seg a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: var(--r-sm); color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg a:hover { background: var(--hover); color: var(--ink); }
.seg a.on { background: var(--active); color: var(--ink); }
.seg button {
  min-height: 32px;
  padding: 5px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.seg button:hover { background: var(--hover); color: var(--ink); }
.seg button.on, .seg a.on { background: var(--accent-soft); color: var(--accent-2); }
[data-ready] [data-panel]:not(.on) { display: none; }

/* Сообщение после действия */

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: var(--r);
  background: var(--good-soft);
  border: 1px solid rgba(16, 185, 129, .3);
  color: var(--good-2);
  font-weight: 500;
  animation: toast-in .25s ease-out;
}
.toast.err { background: var(--bad-soft); border-color: rgba(239, 68, 68, .3); color: var(--bad-2); }
.toast.gone { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }
.flash { padding: 11px 14px; border-radius: var(--r); background: var(--bad-soft); color: var(--bad-2); margin-bottom: 16px; }

/* Окна */

dialog {
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.confirm { width: min(420px, calc(100vw - 32px)); padding: 22px; }
.confirm #confirm-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.confirm .row { margin-top: 18px; }

#palette { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 4px 14px; border-bottom: 1px solid var(--line); color: var(--muted); }
#palette input { flex: 1; border: 0; background: none; box-shadow: none; padding: 12px 0; font-size: 16px; }
#palette ul { list-style: none; margin: 0; padding: 6px; max-height: 55vh; overflow-y: auto; }
#palette li a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r); color: var(--ink); }
#palette li a.selected, #palette li a:hover { background: var(--active); }
#palette li b { font-weight: 550; }
#palette li .muted { margin-left: auto; font-size: 13px; }
#palette .hint { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); }

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 100vw);
  height: 100dvh;
  max-height: none;
  margin: 0;
  border-radius: 0;
  border-width: 0 0 0 1px;
  background: var(--bg);
}
.drawer[open] { display: flex; flex-direction: column; animation: slide .22s cubic-bezier(.4, 0, .2, 1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.drawer-head a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: var(--r); color: var(--ink-2); }
.drawer-head a:hover { background: var(--hover); color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.drawer-body .grid { grid-template-columns: 1fr; }
.drawer-body .grid-2-1 { grid-template-columns: 1fr; }
.drawer-body.loading { opacity: .5; }

/* Сегодня */

.todo { display: flex; flex-direction: column; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.todo-item:last-child { border-bottom: 0; }
.todo-icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r); background: var(--raised); color: var(--ink-2); }
.todo-item.bad .todo-icon { background: var(--bad-soft); color: var(--bad-2); }
.todo-item.warn .todo-icon { background: var(--warn-soft); color: var(--warn-2); }
.todo-text { flex: 1; min-width: 0; }
.todo-text b { display: block; font-weight: 600; }
.todo-text span { color: var(--muted); font-size: 13px; }
.todo-item .row { flex-wrap: nowrap; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px; gap: 12px; align-items: center; }
.bar-row a { color: inherit; }
.bar-track { height: 8px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--accent); }
.bar-fill.good { background: var(--good); }
.bar-fill.bad { background: var(--bad); }
.bar-fill.warn { background: var(--warn); }
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; } .w25 { width: 25%; }
.w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w55 { width: 55%; }
.w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; }
.w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }

.schedule { display: flex; flex-direction: column; }
.schedule-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.schedule-item:last-child { border-bottom: 0; }
.schedule-item time { width: 48px; color: var(--ink-2); font-family: var(--mono); font-size: 13px; }
.schedule-item .grow { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Люди */

.person { display: flex; align-items: center; gap: 14px; }
.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 17px;
  font-weight: 650;
}
.avatar.small { width: 32px; height: 32px; font-size: 13px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.meta > * { display: inline-flex; align-items: center; gap: 6px; }
.meta .i { width: 15px; height: 15px; }

.wards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ward {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.ward-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ward-top a { color: var(--ink); font-weight: 600; font-size: 15.5px; }
.ward-top a:hover { color: var(--accent-2); }
.ward .facts { font-size: 13.5px; gap: 4px 14px; }
.ward .row { margin-top: auto; }

.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 92px 104px 1fr auto; gap: 12px; align-items: center; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-item time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.feed-kind { color: var(--muted); font-size: 12.5px; }
.feed-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Звонок и разбор */

.intents { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.intents button { justify-content: space-between; min-height: 44px; background: var(--raised); border-color: var(--line-2); color: var(--ink); }
.intents button:hover { border-color: var(--accent); background: var(--accent-soft); }
.intents button.current { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.intents kbd { color: var(--muted); }
.turn { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.turn:last-child { border-bottom: 0; }
.turn-q { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.turn-a { display: grid; grid-template-columns: 70px 1fr; gap: 2px 10px; }
.turn-a span { color: var(--muted); font-size: 12.5px; }
.sound { display: flex; flex-direction: column; gap: 10px; }
.sound-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
audio { width: 100%; height: 40px; }

/* Аналитика */

table.funnel td.bar-cell { width: 40%; min-width: 120px; }
svg.bar { width: 100%; height: 8px; display: block; border-radius: 4px; background: var(--raised); }
svg.bar rect { fill: var(--accent); }
tr.minor td { color: var(--muted); }
tr.minor svg.bar rect { fill: var(--line-3); }
svg.days { width: 100%; height: 140px; display: block; }
svg.days rect { fill: var(--accent); opacity: .85; }
svg.days rect:hover { opacity: 1; fill: var(--accent-2); }
.delta { color: var(--muted); font-size: 12px; margin-left: 4px; }
table.keys td:first-child { white-space: normal; overflow-wrap: anywhere; }

/* Вход */

.login { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 30px; text-align: center; }
.login .logo { width: 52px; height: 52px; margin: 0 auto 16px; font-size: 22px; border-radius: var(--r-lg); }
.login h1 { font-size: 20px; margin-bottom: 18px; }
.login button { width: 100%; min-height: 44px; }
.login .stack { text-align: left; }

/* Телефон */

@media (max-width: 1100px) {
  .grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side { transform: translateX(-100%); box-shadow: var(--shadow); width: min(290px, 85vw); }
  body.menu-open .side { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); }
  body.menu-open .scrim { display: block; }
  .main { margin-left: 0; }
  .page { padding: 16px 14px 30px; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    padding-top: calc(10px + env(safe-area-inset-top));
    background: rgba(9, 9, 11, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .logo { width: 30px; height: 30px; font-size: 14px; }
  .topbar-title { flex: 1; font-weight: 650; font-size: 16px; }
  .agent-dot { color: var(--bad-2); animation: pulse 2s infinite; }
  .tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    background: rgba(15, 15, 18, .95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-height: 54px;
    padding: 6px 2px;
    border: 0;
    border-radius: var(--r);
    background: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }
  .tabbar .i { width: 22px; height: 22px; }
  .tabbar .active { color: var(--accent-2); }
  .tabbar button:hover { background: none; color: var(--ink); }
  .dot {
    position: absolute;
    top: 3px;
    left: calc(50% + 6px);
    min-width: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--bad);
    color: #fff;
    font-size: 10.5px;
    line-height: 17px;
  }
  .tabs { margin: -4px -14px 16px; padding: 0 10px; }
  h1 { font-size: 21px; }
  .head { margin-bottom: 16px; }
  .head-actions { width: 100%; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat b { font-size: 21px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card { border-radius: var(--r); margin-bottom: 14px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  th, td { padding: 9px 10px; }
  .opt { display: none; }
  .facts { grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); gap: 7px 12px; }
  .facts dt { font-size: 13px; }
  .feed-item { grid-template-columns: 70px 1fr auto; padding: 9px 14px; }
  .feed-kind { display: none; }
  .todo-item { flex-wrap: wrap; padding: 12px 14px; }
  .todo-item .row { width: 100%; padding-left: 50px; flex-wrap: wrap; }
  .filters .field, .filters .search { flex: 1 1 140px; min-width: 0; }
  .bar-row { grid-template-columns: 100px 1fr 34px; }
  .drawer-body { padding: 16px 14px 40px; }
  .wards { grid-template-columns: 1fr; }
  input, select, textarea { font-size: 16px; }
  #palette { margin-top: 8px; }
}
