/* ============================================================
   Админка агентства — «пульт».
   Правило палитры: насыщенный оранжевый (--signal) появляется
   только там, где что-то просрочено или горит сегодня. Всё
   остальное в интерфейсе приглушённое, поэтому глаз ловит
   срочное с одного взгляда.
   Числа везде моноширинные с табличными цифрами — суммы и
   счётчики выстраиваются в ровную колонку.
   ============================================================ */

:root {
  color-scheme: dark;

  --bg: #0d1017;
  --surface: #141922;
  --surface-2: #1a2029;
  --surface-3: #212936;
  --line: #242c38;
  --line-soft: #1c232d;

  --text: #e8edf4;
  --text-dim: #98a3b3;
  --text-faint: #66717f;

  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --signal: #ff8a3d;
  --signal-soft: rgba(255, 138, 61, 0.14);
  --ok: #35c98a;
  --danger: #f2555a;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.75);

  --rail: 236px;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Roboto Mono', Menlo, Consolas, monospace;
}

[data-theme='light'] {
  color-scheme: light;

  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eef1f5;
  --line: #dde3ea;
  --line-soft: #e8ecf1;

  --text: #131822;
  --text-dim: #5b6675;
  --text-faint: #8a94a3;

  --accent: #5b3ff0;
  --accent-soft: rgba(91, 63, 240, 0.1);
  --signal: #e26314;
  --signal-soft: rgba(226, 99, 20, 0.12);
  --ok: #14976a;
  --danger: #d93a41;

  --shadow: 0 16px 40px -20px rgba(19, 24, 34, 0.35);
}

* { box-sizing: border-box; }

/* Любой display из наших классов перебивает hidden из браузерных стилей,
   поэтому атрибут приходится защищать явно. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Табличные цифры — основа всей вёрстки чисел */
.num, .money, td.num, .metric-value, .kpi-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line); background-clip: content-box; }

/* ---------- Вход ---------- */

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(120% 80% at 50% 0%, rgba(124, 92, 255, 0.12), transparent 60%), var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: var(--shadow);
}

.login-card h1 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.02em; }
.login-card .sub { margin: 0 0 26px; color: var(--text-dim); font-size: 13px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.brand-mark::before {
  content: '';
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- Каркас ---------- */

.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100dvh; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.rail .brand-mark { margin: 4px 10px 22px; }

.rail-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.rail-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.rail-link.active { background: var(--accent-soft); color: var(--text); }
.rail-link svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.rail-link .badge { margin-left: auto; }

.rail-foot { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 12px; }

.rail-user { display: flex; align-items: center; gap: 10px; padding: 8px 11px; }
.rail-user .who { min-width: 0; }
.rail-user .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user .role { font-size: 11px; color: var(--text-faint); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.08em; }

.avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  flex: none;
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}

.topbar h1 { margin: 0; font-size: 17px; letter-spacing: -0.015em; }
.topbar .spacer { flex: 1; }

/* Полоса дня: единственное место, где живёт сигнальный цвет */
.daystrip {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 9px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.daystrip .item { display: flex; align-items: baseline; gap: 7px; color: var(--text-dim); }
.daystrip .item b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  color: var(--text);
}
.daystrip .item.hot b { color: var(--signal); }
.daystrip .item.hot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--signal);
  align-self: center;
  box-shadow: 0 0 0 3px var(--signal-soft);
}
.daystrip .today { margin-left: auto; color: var(--text-faint); font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.05em; }

.content { padding: 22px 26px 60px; flex: 1; min-width: 0; }

/* ---------- Общие элементы ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn-ghost { background: none; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: transparent; background: none; }
.btn-danger:hover { background: rgba(242, 85, 90, 0.1); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }

.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 76px; font-family: inherit; }
.select { cursor: pointer; }
.input[type='number'], .input[type='datetime-local'], .input[type='date'] { font-family: var(--mono); }

.field { display: grid; gap: 5px; margin-bottom: 13px; }
.field > label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

.search {
  position: relative;
  min-width: 200px;
}
.search .input { padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.card-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  background: var(--surface-3);
  color: var(--text-dim);
  line-height: 1.6;
}
.badge.hot { background: var(--signal-soft); color: var(--signal); }
/* класс .badge задаёт display, поэтому атрибут hidden надо вернуть в силу явно */
.badge[hidden] { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-dim);
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 8px; border: 1px solid var(--line); }
.tabs button {
  padding: 6px 13px; border: none; background: none; border-radius: 6px;
  color: var(--text-dim); cursor: pointer; font-size: 13px; font-weight: 500;
}
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .select, .toolbar .input { width: auto; min-width: 130px; }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty h3 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.empty p { margin: 0 0 16px; font-size: 13px; }

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.hint { font-size: 12px; color: var(--text-faint); }
.row { display: flex; align-items: center; gap: 9px; }
.stack { display: grid; gap: 14px; }

/* ---------- Таблица ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-2);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
/* запас первой колонке нужен только в широких списках (заявки, клиенты):
   во встроенных таблицах отчётов он бы вытеснил колонку с суммой */
.table-wide table.data th:first-child, .table-wide table.data td:first-child { min-width: 170px; }
table.data .title { font-weight: 600; }

/* ---------- Канбан ---------- */

.kanban {
  display: flex;
  gap: 13px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: flex-start;
}

.column {
  flex: 0 0 282px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 230px);
}
.column.drag-over { border-color: var(--accent); background: var(--accent-soft); }

.column-head {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
  border-top: 2px solid var(--col, var(--line));
  border-radius: var(--radius) var(--radius) 0 0;
}
.column-head .t { display: flex; align-items: center; gap: 8px; }
.column-head .name { font-weight: 600; font-size: 13px; }
.column-head .count {
  margin-left: auto;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-faint);
}
.column-head .sum {
  margin-top: 3px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--text-dim);
}

.column-body { padding: 10px; display: grid; gap: 9px; overflow-y: auto; min-height: 70px; }

.lead-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: grab;
  display: grid;
  gap: 7px;
}
.lead-card:hover { border-color: var(--accent); }
.lead-card.dragging { opacity: 0.4; }
.lead-card .lc-title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.lead-card .lc-client { font-size: 12px; color: var(--text-dim); }
.lead-card .lc-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lead-card .lc-budget {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 600;
}
.lead-card .lc-when {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.lead-card .lc-when.hot { color: var(--signal); font-weight: 600; }
.lead-card .prio-high { color: var(--signal); }

/* ---------- Дашборд ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 13px; margin-bottom: 20px; }

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
}
.kpi .kpi-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.kpi .kpi-value { font-size: 25px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; }
.kpi .kpi-sub { margin-top: 5px; font-size: 12px; color: var(--text-dim); }
.kpi.is-hot .kpi-value { color: var(--signal); }

/* minmax(0, …) обязателен: без него колонка с длинными заголовками
   раздувается по min-content и отбирает ширину у соседней. */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; }
.grid-halves { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
/* у grid-элементов min-width по умолчанию auto — без сброса карточка
   с длинными заголовками вылезает за свою колонку */
.grid-2 > *, .grid-halves > *, .stack > * { min-width: 0; }

/* Воронка */
.funnel { display: grid; gap: 9px; }
.funnel-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-row { display: grid; grid-template-columns: minmax(78px, 118px) minmax(24px, 1fr) auto; align-items: center; gap: 11px; font-size: 13px; }
.funnel-bar { height: 22px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.funnel-bar span { display: block; height: 100%; border-radius: 5px; transition: width 0.4s ease; }
.funnel-row .v { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-dim); }

/* Столбики по дням */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 92px; }
.spark .bar { flex: 1; min-width: 3px; background: var(--surface-3); border-radius: 2px 2px 0 0; position: relative; }
.spark .bar i { position: absolute; inset: auto 0 0 0; background: var(--ok); border-radius: 2px 2px 0 0; display: block; }
.spark-legend { display: flex; justify-content: space-between; margin-top: 7px; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

/* без явной колонки auto-трек тянется по max-content и вылезает из карточки */
.list-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.list-row {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 2px; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .grow .s { font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .when { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.list-row .when.hot { color: var(--signal); font-weight: 600; }

/* ---------- Задачи ---------- */

.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.task-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.task-row:last-child { border-bottom: none; border-radius: 0 0 var(--radius) var(--radius); }
.task-row.done .task-title { text-decoration: line-through; color: var(--text-faint); }
.task-row .task-title { font-weight: 500; }
.task-row .task-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
/* в строке задачи громким должен быть только срок — ссылка на заявку приглушена */
.task-row .task-meta a { color: var(--text-dim); }
.task-row .task-meta a:hover { color: var(--accent); }
.task-row .task-when { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.task-row .task-when.hot { color: var(--signal); font-weight: 600; }

.check {
  appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  cursor: pointer;
  flex: none;
  margin-top: 2px;
  display: grid; place-items: center;
}
.check:checked { background: var(--ok); border-color: var(--ok); }
.check:checked::after { content: '✓'; color: #06130d; font-size: 12px; font-weight: 800; line-height: 1; }

/* ---------- Дровер и модалка ---------- */

.overlay {
  position: fixed; inset: 0;
  background: rgba(4, 6, 10, 0.6);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  animation: fade 0.15s ease;
}
.overlay.center { align-items: center; justify-content: center; padding: 20px; }

@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }

.drawer {
  width: min(720px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line);
  height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slide-in 0.2s ease;
}

.modal {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: 90dvh;
  overflow-y: auto;
  animation: slide-in 0.18s ease;
}

.sheet-head {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 2;
}
.sheet-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.015em; }
.sheet-head .sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; }
.sheet-body { padding: 20px 22px; }
.sheet-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 15px 22px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: var(--surface);
}

.drawer .sheet-head { background: var(--bg); }

/* Свойства заявки */
.props { display: grid; grid-template-columns: 132px 1fr; gap: 9px 14px; font-size: 13px; align-items: center; }
.props dt { color: var(--text-faint); font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; }
.props dd { margin: 0; }

/* Лента событий */
.feed { display: grid; gap: 0; }
.feed-item { display: grid; grid-template-columns: 24px 1fr; gap: 11px; padding-bottom: 16px; position: relative; }
.feed-item::before {
  content: ''; position: absolute; left: 11px; top: 22px; bottom: 0; width: 1px; background: var(--line);
}
.feed-item:last-child::before { display: none; }
.feed-dot {
  width: 23px; height: 23px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-dim);
  display: grid; place-items: center; font-size: 11px;
  border: 1px solid var(--line);
  z-index: 1;
}
.feed-dot.status { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.feed-body .who { font-size: 12px; color: var(--text-faint); margin-bottom: 2px; }
.feed-body .who b { color: var(--text-dim); font-weight: 600; }
.feed-body .txt { font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* ---------- Карточка о новой заявке ---------- */

/* Правый нижний угол: место, где всплывашка не перекрывает работу —
   ни канбан слева, ни кнопки в шапке. */
.alerts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
}

.alert-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 15px 13px;
  cursor: pointer;
  position: relative;
  animation: alert-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.alert-card:hover { border-color: var(--accent); background: var(--surface-2); }
.alert-card.hot { border-left-color: var(--signal); }

@keyframes alert-in {
  from { transform: translateX(24px); opacity: 0; }
}

.alert-card .ac-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 9px;
}
.alert-card.hot .ac-head { color: var(--signal); }
.alert-card .ac-head::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.alert-card.hot .ac-head::before { box-shadow: 0 0 0 3px var(--signal-soft); }

.alert-card .ac-name {
  font-weight: 650;
  font-size: 14.5px;
  line-height: 1.3;
  margin-bottom: 6px;
  word-break: break-word;
}

.alert-card .ac-row {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 3px;
}
.alert-card .ac-row .k { color: var(--text-faint); flex: none; min-width: 62px; }
.alert-card .ac-row .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-card .ac-row .v.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 600;
}

/* Ссылка на страницу — во всю ширину и с переносом: адреса длинные,
   обрезать их многоточием бессмысленно, важен весь путь. */
.alert-card .ac-link {
  display: block;
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--accent);
  word-break: break-all;
}
.alert-card .ac-link:hover { text-decoration: underline; }

.alert-card .ac-foot {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--text-faint);
}

.alert-card .ac-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border: none;
  background: none;
  color: var(--text-faint);
  border-radius: 5px;
  cursor: pointer;
  line-height: 1;
  font-size: 15px;
}
.alert-card .ac-close:hover { background: var(--surface-3); color: var(--text); }

@media (max-width: 760px) {
  /* на телефоне нижнее меню занимает низ экрана — поднимаем карточки над ним */
  .alerts { bottom: 84px; right: 12px; left: 12px; width: auto; }
}

/* ---------- Тост ---------- */

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast {
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: fade 0.15s ease;
}
.toast.err { border-color: var(--danger); color: var(--danger); }

/* ---------- Адаптив ---------- */

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

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0;
    height: auto; flex-direction: row; overflow-x: auto;
    border-right: none; border-top: 1px solid var(--line);
    padding: 7px 8px; z-index: 40; gap: 2px;
  }
  .rail .brand-mark, .rail-foot { display: none; }
  .rail-link { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 10px; }
  .rail-link .badge { margin: 0; position: absolute; top: 2px; right: 4px; }
  .rail-link { position: relative; }
  .content { padding: 16px 14px 92px; }
  .topbar, .daystrip { padding-left: 14px; padding-right: 14px; }
  .field-row { grid-template-columns: 1fr; }
  .daystrip { gap: 14px; }
  .daystrip .today { display: none; }
  .props { grid-template-columns: 1fr; gap: 2px 0; }
  .props dd { margin-bottom: 10px; }
  .column { flex-basis: 84vw; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
