@import url('https://fonts.googleapis.com/css2?family=Unbounded:wght@500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

/*
  GTO Review — оформление по брендбуку GTO GROUP и экранам GTO CONNECT:
  почти чёрный фон с модульной сеткой, алый акцент, широкий жирный шрифт
  заголовков, крупные иконки, капслок-микроподписи.

  Тема одна — тёмная: брендбук называет её основной, и весь продукт живёт
  в ней. Анимации и переходов нет намеренно — состояния меняются сразу.
*/

:root {
  color-scheme: dark;

  /* Основные (GTO: Black / Dark / City) */
  --bg: #111115;
  --surface: #1a1920;
  --surface-2: #22212a;
  --surface-3: #2a2833;
  --border: #2c2a36;
  --border-strong: #3d3a4a;

  --text: #f4f4f6;
  --text-muted: #a3a2b2;
  --text-dim: #74728a;

  /* Акцент — тёплая гамма GTO: Scarlet / Aperol */
  --scarlet: #ff2700;
  --aperol: #ff4300;
  --joy: #ff6600;
  --accent-contrast: #ffffff;

  /* Типы изменений: тёплое — тревожное, холодное и серое — спокойное */
  --created: #4a4cff;
  --updated: #9997b0;
  --cancelled: #ff6600;
  --deleted: #ff2700;
  --unknown: #74728a;

  --success: #2fbf71;
  --warn: #ff6600;
  --error: #ff2700;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-display: 'Unbounded', 'Montserrat', sans-serif;
  --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --grid: rgba(255, 255, 255, 0.026);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Модульная сетка как элемент фирстиля + один тёплый ореол сверху */
body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}
body::before {
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 112px 112px;
}
body::after {
  top: -360px;
  left: 50%;
  width: 1100px;
  height: 780px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 39, 0, 0.13), rgba(255, 39, 0, 0) 62%);
}

header.app-header,
main.container { position: relative; z-index: 1; }

a { color: var(--text); text-decoration: none; }
a:hover { color: var(--aperol); }

:focus-visible { outline: 2px solid var(--aperol); outline-offset: 2px; border-radius: 4px; }

.icon { display: inline-flex; flex: none; width: 18px; height: 18px; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- Шапка и логотип ---------- */

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 28px;
  background: rgba(17, 17, 21, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

/* Логотип — готовый лок GTO Review из брендбука, отдельной плашки не нужно */
.brand { display: inline-flex; align-items: center; flex: none; padding-right: 12px; }
.brand:hover { color: inherit; }
.brand-mark { display: block; height: 38px; width: auto; }

header.app-header nav { display: flex; gap: 4px; flex: none; }
header.app-header nav a {
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}
header.app-header nav a:hover { color: var(--text); background: var(--surface-2); }
header.app-header nav a.active {
  color: #fff;
  background: linear-gradient(180deg, var(--scarlet), var(--aperol));
}

main.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600;}
h3 { font-size: 17px; margin: 0 0 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}

/* Капслок-микроподпись — как «НАЗВАНИЕ ВСТРЕЧИ» на экранах продукта */
.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 34px 0 12px;
}

/* ---------- Поля ввода ---------- */

input[type="date"],
input[type="text"],
input[type="password"],
input[type="number"] {
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
input::placeholder { color: var(--text-dim); }
input:hover { border-color: var(--border-strong); }
input:focus { outline: none; border-color: var(--aperol); background: var(--surface-3); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.65); cursor: pointer; }

.search-field { position: relative; display: inline-flex; align-items: center; }
.search-field .icon { position: absolute; left: 12px; color: var(--text-dim); width: 16px; height: 16px; }
.search-field input[type="text"] { padding-left: 38px; min-width: 200px; }

/* ---------- Выпадающий список и выбор периода ---------- */

.dropdown, .range { position: relative; flex: none; }

.dropdown-trigger,
.range-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 178px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.dropdown-trigger:hover,
.range-trigger:hover { background: var(--surface-3); border-color: var(--border-strong); }
.dropdown.open .dropdown-trigger,
.range.open .range-trigger { border-color: var(--aperol); background: var(--surface-3); }
.dropdown-chevron, .range-chevron { width: 16px; height: 16px; color: var(--text-dim); }
.dropdown.open .dropdown-chevron,
.range.open .range-chevron { color: var(--aperol); transform: rotate(180deg); }
.dropdown-lead, .range-lead { width: 17px; height: 17px; color: var(--text-dim); }
.dropdown-value, .range-value { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Фильтр сузили — лента показывает не всё, и это видно по самой кнопке */
.dropdown.narrowed .dropdown-trigger,
.range.narrowed .range-trigger {
  border-color: color-mix(in srgb, var(--scarlet) 55%, transparent);
  background: color-mix(in srgb, var(--scarlet) 12%, var(--surface-2));
  font-weight: 600;
}
.dropdown.narrowed .dropdown-lead,
.range.narrowed .range-lead { color: var(--aperol); }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 5px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 40;
}

.dropdown-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-option.active { background: var(--surface-3); color: var(--text); }
.dropdown-option.selected { color: var(--text); font-weight: 600; }
.dropdown-check { width: 15px; height: 15px; color: var(--aperol); visibility: hidden; }
.dropdown-option.selected .dropdown-check { visibility: visible; }

/* ---------- Период: панель с барабанами ---------- */

.range-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  width: 330px;
  max-width: calc(100vw - 32px);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}
/* display: flex выше сильнее браузерного [hidden] — без этой строки
   панель была бы раскрыта всегда */
.range-panel[hidden] { display: none; }

.range-presets { display: flex; flex-wrap: wrap; gap: 5px; }
.range-preset {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-muted);
}
.range-preset:hover { color: var(--text); }
.range-preset.active {
  border-color: color-mix(in srgb, var(--scarlet) 55%, transparent);
  background: color-mix(in srgb, var(--scarlet) 16%, transparent);
  color: var(--text);
}

/* «С» и «По» подписаны прямо на кнопках — по двум одинаковым полям
   с датой было не понять, где начало периода, а где конец */
.range-tabs { display: flex; gap: 6px; }
.range-tab {
  flex: 1 1 0;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.range-tab-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-dim); }
.range-tab-value { font-size: 14px; font-weight: 600; color: var(--text); }
.range-tab.active {
  border-color: color-mix(in srgb, var(--scarlet) 55%, transparent);
  background: color-mix(in srgb, var(--scarlet) 12%, var(--surface));
}
.range-tab.active .range-tab-label { color: var(--aperol); }

.range-actions { display: flex; gap: 8px; }
.range-actions button { flex: 1 1 0; padding: 9px 14px; font-size: 13.5px; }

/* ---------- Барабаны даты (как колёса в iPhone) ---------- */

.wheels { position: relative; display: flex; gap: 4px; }
.wheel-col { flex: 1 1 0; min-width: 0; }
.wheel-col-month { flex: 1.5 1 0; }

/* Окно выбора: значение под этой полосой и есть выбранное */
.wheel-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 34px;
  transform: translateY(-50%);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-strong);
  pointer-events: none;
}

.wheel {
  --wheel-item: 34px;
  height: calc(var(--wheel-item) * 5);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  text-align: center;
  /* Края колеса гаснут — иначе список выглядит обычным списком */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 26%, #000 74%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 26%, #000 74%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-track { padding-block: calc(var(--wheel-item) * 2); }

.wheel-item {
  height: var(--wheel-item);
  line-height: var(--wheel-item);
  scroll-snap-align: center;
  font-size: 15px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}
.wheel-item[data-dist="0"] { color: var(--text); font-weight: 600; font-size: 16px; }
.wheel-item[data-dist="1"] { color: var(--text-muted); }
.wheel-item[data-dist="2"] { opacity: 0.6; }
.wheel-item[data-dist="3"] { opacity: 0.35; }

/* ---------- Фильтры ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
  align-items: center;
}
.filters .spacer { flex: 1 1 auto; }

/*
  Типы изменений — обычные галочки: отмечено или нет, видно с одного взгляда.
  Раньше это была группа пилюль, и «выключено» отличалось от «включено»
  только оттенком серого — понять, что отфильтровано, было нельзя.
*/
.chip-toggle-group {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.chip-toggle {
  --tint: var(--unknown);
  --tint-ink: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.chip-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-box {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
}
.chip-check { width: 14px; height: 14px; }
.chip-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.chip-toggle:has(input:focus-visible) { outline: 2px solid var(--aperol); outline-offset: 2px; }
.chip-toggle:has(input:checked) {
  color: var(--text);
  border-color: color-mix(in srgb, var(--tint) 55%, transparent);
  background: color-mix(in srgb, var(--tint) 14%, var(--surface-2));
}
.chip-toggle:has(input:checked) .chip-box {
  background: var(--tint);
  border-color: var(--tint);
  color: var(--tint-ink);
}
.chip-toggle[data-type="created"] { --tint: var(--created); }
/* «Изменено» кодируется светло-серым — галочка на нём должна быть тёмной */
.chip-toggle[data-type="updated"] { --tint: var(--updated); --tint-ink: var(--bg); }
.chip-toggle[data-type="cancelled"] { --tint: var(--cancelled); }
.chip-toggle[data-type="deleted"] { --tint: var(--deleted); }

.chip-count {
  min-width: 18px;
  margin-left: auto;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.chip-toggle:has(input:checked) .chip-count { background: rgba(255, 255, 255, 0.15); color: var(--text); }

/* ---------- Кнопки ---------- */

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 21px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
}
button:hover { background: var(--surface-3); border-color: var(--text-dim); }
button .icon { width: 17px; height: 17px; }

button.primary {
  background: linear-gradient(180deg, var(--scarlet), var(--aperol));
  border-color: transparent;
  color: var(--accent-contrast);
}
button.primary:hover { background: linear-gradient(180deg, #ff3b16, #ff5714); border-color: transparent; }
button:disabled { opacity: 0.45; cursor: default; }

/*
  Ручная проверка — вспомогательное действие: календарь и так опрашивается
  сам. Поэтому не алая пилюля, а прямоугольная кнопка с алой иконкой
  в собственной плитке — заметная, но не спорящая с автоматикой.
*/
button.btn-fetch {
  gap: 0;
  padding: 0 16px 0 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-color: var(--border-strong);
  font-weight: 600;
  overflow: hidden;
}
button.btn-fetch .icon {
  width: 40px;
  height: 40px;
  padding: 11px;
  margin-right: 14px;
  background: color-mix(in srgb, var(--scarlet) 16%, transparent);
  border-right: 1px solid var(--border-strong);
  color: var(--aperol);
  box-sizing: border-box;
}
button.btn-fetch:hover { background: var(--surface-3); border-color: var(--text-dim); }
button.btn-fetch:hover .icon { background: color-mix(in srgb, var(--scarlet) 26%, transparent); }
button.btn-fetch:disabled .icon { color: var(--text-dim); background: transparent; }

.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.card-note {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- Сводка над лентой ---------- */

.feed-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.summary-total { font-family: var(--font-display); font-size: 16px; font-weight: 600; }

/* ---------- Таймлайн ---------- */

.date-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 32px 0 16px;
}
.date-divider::before,
.date-divider::after { content: ""; height: 1px; background: var(--border); }
.date-divider::before { width: 30px; flex: none; }
.date-divider::after { flex: 1; }
.date-divider:first-child { margin-top: 24px; }

.rail { position: relative; }
.rail::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 21px;
  width: 1px;
  background: linear-gradient(180deg, var(--border), transparent);
}

.rail-item {
  position: relative;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 12px;
}
.rail-item:last-child { padding-bottom: 0; }

/* Маркер-плитка с крупным глифом — как плитки-иконки на экранах продукта */
.rail-marker {
  position: relative;
  z-index: 1;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--unknown);
}
.rail-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0.12;
}
.rail-marker svg { width: 22px; height: 22px; position: relative; z-index: 1; }
.rail-marker.created { color: var(--created); border-color: color-mix(in srgb, var(--created) 45%, transparent); }
.rail-marker.updated { color: var(--updated); border-color: color-mix(in srgb, var(--updated) 45%, transparent); }
.rail-marker.cancelled { color: var(--cancelled); border-color: color-mix(in srgb, var(--cancelled) 45%, transparent); }
.rail-marker.deleted { color: var(--deleted); border-color: color-mix(in srgb, var(--deleted) 45%, transparent); }
.rail-marker.restored { color: var(--success); border-color: color-mix(in srgb, var(--success) 45%, transparent); }

.rail-card {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px 18px;
  transition: border-color 0.14s ease, background-color 0.14s ease, transform 0.14s ease;
}

/* Открывать в карточке нечего — она не ссылка. При наведении никакого цвета:
   только лёгкое движение и чуть более светлый край, чтобы было видно,
   где курсор. Цветом кодируется тип изменения, и спорить с ним нельзя. */
.rail-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: translateY(-1px);
}
@media (prefers-reduced-motion: reduce) {
  .rail-card { transition: none; }
  .rail-card:hover { transform: none; }
}

.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }
.event-title { font-weight: 600; color: var(--text); font-size: 16px; }
.meta { color: var(--text-muted); font-size: 13.5px; }

.subline {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: 13.5px;
}
.subline .meta { color: var(--text-dim); }

/* Календарь — в собственном цвете, как в Яндекс.Календаре */
.cal-chip {
  --cal-color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--cal-color) 16%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--cal-color) 45%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.cal-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--cal-color);
}

/* Строки «поле — было → стало» и строка автора живут в одной сетке */
.diff-rows { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.diff-row { display: flex; align-items: center; gap: 14px; font-size: 14.5px; flex-wrap: wrap; }
.diff-label {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-dim);
  flex: none;
  width: 128px;
  font-size: 14px;
}
.diff-label .field-icon { width: 18px; height: 18px; color: var(--text-muted); }
.diff-values { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; min-width: 0; }
.diff-sep { color: var(--text-dim); width: 16px; height: 16px; }

/* Дата и время — отдельными капсулами: слитная строка «13.08.2026, 18:30»
   читается как одно длинное значение, и в ней теряется то, что поменялось */
.chip-group { display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.chip {
  display: inline-block;
  padding: 4px 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.45;
}
.chip-old {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  text-decoration: line-through;
}
.chip-new {
  background: color-mix(in srgb, var(--scarlet) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--scarlet) 44%, transparent);
  color: #fff;
  font-weight: 600;
}

.actor-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.actor-name { color: var(--text-muted); font-size: 14px; }
.actor-row.unknown { cursor: help; }
.actor-row.unknown .actor-name { color: var(--text-dim); }
.avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--scarlet) 28%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--scarlet) 36%, transparent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 600;
}
.avatar-unknown { width: 22px; height: 22px; color: var(--text-dim); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  color: var(--text-muted);
  padding: 72px 20px;
  font-size: 14.5px;
}
.empty-state p { margin: 0; }
.empty-state .empty-icon { width: 34px; height: 34px; color: var(--text-dim); opacity: 0.55; margin-bottom: 12px; }
.empty-state .empty-hint { font-size: 13.5px; color: var(--text-dim); }

/* ---------- Формы и настройки ---------- */

.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 7px; }
.form-row label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
}

.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  position: relative;
  flex: none;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-dim);
}
.switch:has(input:checked) .switch-track {
  background: linear-gradient(180deg, var(--scarlet), var(--aperol));
  border-color: transparent;
}
.switch:has(input:checked) .switch-thumb { left: 21px; background: #fff; }
.switch:has(input:focus-visible) .switch-track { outline: 2px solid var(--aperol); outline-offset: 2px; }

.calendar-list { display: flex; flex-direction: column; }
.calendar-list .calendar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.calendar-list .calendar-row:last-child { border-bottom: none; }
.calendar-list .calendar-name { font-weight: 500; font-size: 14.5px; }

.status-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 17px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.status-banner .icon { flex: none; }
.status-banner.ok { border-color: color-mix(in srgb, var(--success) 45%, transparent); color: var(--success); }
.status-banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.status-banner.error { border-color: color-mix(in srgb, var(--error) 45%, transparent); color: var(--error); }
.status-banner span.text { color: var(--text); }

.loading-text { color: var(--text-dim); font-size: 14px; }

code.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--aperol);
}

pre.raw-ics {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  background: var(--surface-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  max-height: 260px;
  overflow: auto;
}

/* ---------- Карточка события ---------- */

.event-summary-card { display: flex; flex-direction: column; gap: 14px; }
.event-summary-card .event-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
}
.event-fields {
  display: grid;
  grid-template-columns: 128px 1fr;
  row-gap: 9px;
  column-gap: 14px;
  font-size: 14.5px;
  margin: 0;
}
.event-fields dt {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  padding-top: 3px;
}
.event-fields dd { margin: 0; color: var(--text); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}
.status-pill .icon { width: 15px; height: 15px; }
.status-pill.cancelled { background: linear-gradient(180deg, var(--joy), var(--aperol)); }
.status-pill.deleted { background: linear-gradient(180deg, var(--scarlet), #d81f00); }

/* ---------- Точки календарей ---------- */

.option-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.calendar-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.calendar-list .calendar-name { display: flex; align-items: flex-start; gap: 10px; }
.calendar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calendar-note { color: var(--text-dim); font-size: 12.5px; font-weight: 400; }
.calendar-dot { margin-top: 5px; }

/* ---------- Вход ---------- */

.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.auth-logo { display: block; width: 190px; height: auto; }
.auth-card { width: 100%; padding: 26px 26px 28px; }
.auth-card h1 { font-size: 21px; margin: 0 0 6px; }
.auth-submit { width: 100%; margin-top: 4px; }

/* ---------- Учётная запись в шапке ---------- */

.account { display: inline-flex; align-items: center; gap: 12px; margin-left: 12px; padding-left: 16px; border-left: 1px solid var(--border); }
.account-name { color: var(--text-muted); font-size: 13.5px; font-weight: 600; }
.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-button:hover { color: var(--aperol); background: none; }

/* ---------- Админка ---------- */

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }

.user-list { display: flex; flex-direction: column; }
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.user-main { min-width: 0; }
.user-name { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-weight: 600; font-size: 14.5px; }
.user-meta { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.user-actions button { padding: 8px 14px; font-size: 13px; }
.user-actions button.danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 45%, transparent); }
.user-actions button.danger:hover { background: color-mix(in srgb, var(--error) 14%, transparent); }

.tag {
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
}
.tag-admin { background: color-mix(in srgb, var(--scarlet) 18%, transparent); border-color: color-mix(in srgb, var(--scarlet) 45%, transparent); color: var(--aperol); }
.tag-off { color: var(--text-dim); }

/* Тип изменения — своим цветом, иначе тонул в серой строке */
.change-type { font-weight: 700; font-size: 13.5px; }
.change-type.created { color: var(--created); }
.change-type.updated { color: #b9b7cc; }
.change-type.cancelled { color: var(--cancelled); }
.change-type.deleted { color: var(--deleted); }
.change-type.restored { color: var(--success); }

.actor-text { display: inline-flex; flex-direction: column; line-height: 1.3; }
.actor-hint { color: var(--text-dim); font-size: 12px; }

/* ---------- Всплывающие сообщения ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  font-size: 13.5px;
  color: var(--text);
}
.toast .icon { flex: none; }
.toast-text { flex: 1; min-width: 0; }
.toast-ok { border-color: color-mix(in srgb, var(--success) 55%, transparent); }
.toast-ok .icon { color: var(--success); }
.toast-error { border-color: color-mix(in srgb, var(--error) 55%, transparent); }
.toast-error .icon { color: var(--error); }
.toast-warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.toast-warn .icon { color: var(--warn); }
.toast-close {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.toast-close:hover { color: var(--text); background: none; }

.diagnose { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.diagnose-row {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.diagnose-url { font-size: 12.5px; color: var(--text-muted); word-break: break-all; margin-bottom: 6px; }
.diagnose-line { font-size: 13px; font-variant-numeric: tabular-nums; }
.diagnose-line.ok { color: var(--success); }
.diagnose-line.bad { color: var(--warn); }
.diagnose-line.muted { color: var(--text-dim); }

/* ---------- Адаптив ---------- */

@media (max-width: 900px) {
  header.app-header { padding: 12px 18px; }
  main.container { padding: 24px 18px 64px; }
}

@media (max-width: 720px) {
  header.app-header { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
  header.app-header nav { flex-wrap: wrap; width: 100%; gap: 6px; }
  .brand-mark { height: 32px; }
  .account { margin-left: auto; padding-left: 0; border-left: none; }

  main.container { padding: 20px 14px 56px; }
  .field-grid { grid-template-columns: 1fr; }

  .filters { gap: 8px; }
  .dropdown, .dropdown-trigger, .range, .range-trigger { width: 100%; }
  .search-field, .search-field input[type="text"] { width: 100%; min-width: 0; }
  .filters .spacer { display: none; }
  #btn-refresh { width: 100%; justify-content: flex-start; }

  .chip-toggle-group { width: 100%; }
  .chip-toggle { flex: 1 1 auto; }

  .user-row { align-items: flex-start; }
  .user-actions { width: 100%; }
  .user-actions button { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .rail-item { gap: 12px; }
  .rail-marker { width: 40px; height: 40px; border-radius: 12px; }
  .rail-marker svg { width: 20px; height: 20px; }
  .rail::before { left: 19px; }
  .rail-card { padding: 14px 16px 16px; }

  .row-top { flex-direction: column; align-items: flex-start; gap: 4px; }
  .diff-row { gap: 6px; }
  .diff-label { width: 100%; }
  .event-fields { grid-template-columns: 1fr; row-gap: 3px; }
  .event-fields dt { margin-top: 8px; }

  /* Галочки в две колонки: подписи важнее, чем один ряд */
  .chip-toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .chip-toggle { padding: 7px 10px 7px 8px; gap: 7px; }
  .chip-label { overflow: hidden; text-overflow: ellipsis; }

  .button-row { width: 100%; }
  .button-row button { flex: 1 1 auto; justify-content: center; }

  .auth-logo { width: 160px; }
  .auth-card { padding: 22px 20px 24px; }
}

@media (max-width: 380px) {
  main.container { padding: 16px 12px 48px; }
  .card { padding: 16px 16px; }
  .brand-mark { height: 28px; }
}
