/* ==========================================================================
   Клиентовка — единая дизайн-система веб-кабинета и админки.
   Отдаётся роутом GET /cabinet/style.css (см. CabinetLayout.kt / WebRoutes.kt).
   Без внешних шрифтов, иконок и CDN.
   ========================================================================== */

:root {
  /* Бренд-палитра приложения */
  --primary: #2563EB;
  --primary-600: #1D4ED8;
  --primary-700: #1E40AF;
  --primary-50: #EFF6FF;
  --secondary: #0EA5E9;
  --tertiary: #14B8A6;

  /* Нейтральные */
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #ECEFF1;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --border: #E2E8F0;
  --border-soft: #F1F5F9;
  --chip-bg: #E2E8F0;
  --chip-bg-hover: #CBD5E1;
  --chip-fg: #475569;
  --hover-row: #F8FAFC;
  --on-primary: #FFFFFF;

  /* Семантика */
  --success: #16A34A;
  --warning: #F59E0B;
  --danger: #DC2626;

  /* Подложки статусов (заливка/текст/рамка) */
  --success-bg: #DCFCE7;
  --success-fg: #166534;
  --success-soft: #F0FDF4;
  --success-border: #BBF7D0;
  --warning-bg: #FEF3C7;
  --warning-fg: #92400E;
  --danger-bg: #FEE2E2;
  --danger-fg: #991B1B;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;
  --info-border: #BFDBFE;
  --today-bg: #C7D2FE;

  /* Геометрия */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .10);

  /* Типографика */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3, h4 { color: var(--text); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; margin-top: 1.5em; }
h3 { font-size: 16px; font-weight: 600; margin-top: 1.2em; }

p { margin: .5em 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--muted); }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
strong, b { font-weight: 650; }
code, pre { font-family: var(--font-mono); font-size: .92em; }
img { max-width: 100%; }

.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ---------- Каркас (layout) ---------- */

.layout {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 6px 0 24px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar--dark {
  background: linear-gradient(180deg, #1E3A8A 0%, #1E40AF 100%);
  border-right: none;
  color: #E0E7FF;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .2px;
  padding: 18px 18px 12px;
  color: var(--primary-700);
}
.sidebar--dark .brand { color: #FFFFFF; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.sidebar--dark .brand small { color: #BFDBFE; }
.brand img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }

/* Фирменный знак в шапке кабинета/админки (не круглый, в отличие от аватара). */
.brand .brand-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; flex: none; }
.brand .brand-title { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-title small { margin-top: 2px; }

/* Ссылка на админку — слева под логотипом, только для платформенных админов (V84). */
.admin-entry { padding: 0 14px 8px; }
.admin-entry .btn { width: 100%; justify-content: center; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; }
.nav a {
  display: block;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav a:hover { background: var(--primary-50); color: var(--primary-700); text-decoration: none; }
.nav a.active { background: var(--primary); color: var(--on-primary); }
.nav .nav-divider { height: 1px; background: var(--border); margin: 10px 14px; }
.nav .nav-title {
  padding: 12px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.sidebar--dark .nav a { color: #CBD5E1; }
.sidebar--dark .nav a:hover { background: rgba(255, 255, 255, .1); color: #FFFFFF; }
.sidebar--dark .nav a.active { background: rgba(255, 255, 255, .20); color: #FFFFFF; }
.sidebar--dark .nav .nav-divider { background: rgba(255, 255, 255, .18); }
.sidebar--dark .nav .nav-title { color: #BFDBFE; }

.content {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin: 0; }
.page-head .page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Публичные страницы ---------- */

body.public-body { background: var(--bg); }
.public {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 56px;
}
.public-footer {
  margin-top: 32px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Экран входа ---------- */

body.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: linear-gradient(160deg, var(--primary-50), var(--bg));
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 30px;
}
.auth-logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 12px; }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card .auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.auth-top { position: absolute; top: 12px; right: 12px; }
.auth-top .theme-toggle { margin-left: 0; }

/* ---------- Карточки и сетки ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 12px 0;
}
.card > :first-child { margin-top: 0; }
a.card { display: block; color: inherit; }
a.card:hover { text-decoration: none; box-shadow: var(--shadow-md); }

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 12px 0;
}
.grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin: 12px 0;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat .stat-value { font-size: 28px; font-weight: 800; color: var(--primary-700); line-height: 1.1; }
.stat .stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* ---------- Таблицы ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 12px 0 20px;
}
.table-wrap > table { margin: 0; }

table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0 18px;
  font-size: 14px;
  background: var(--surface);
}
th, td {
  padding: 9px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--primary-50);
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--hover-row); }
td .muted { font-weight: 400; }

/* ---------- Кнопки ---------- */

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
button:hover, .btn:hover { background: var(--primary-600); border-color: var(--primary-600); text-decoration: none; }
button:active, .btn:active { background: var(--primary-700); }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .25);
}

.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--secondary, button.btn--secondary {
  background: var(--surface); color: var(--primary-700); border-color: var(--border);
}
.btn--secondary:hover, button.btn--secondary:hover { background: var(--primary-50); border-color: var(--primary); }
.btn--danger, button.btn--danger { background: var(--surface); color: var(--danger); border-color: var(--danger-border); }
.btn--danger:hover, button.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--ghost, button.btn--ghost {
  background: transparent; color: var(--primary-700); border-color: transparent; padding: 6px 8px;
}
.btn--ghost:hover, button.btn--ghost:hover { background: var(--primary-50); border-color: transparent; }
.btn--sm, button.btn--sm { padding: 5px 10px; font-size: 13px; }

/* ---------- Вход через внешние сервисы (Яндекс/ВК/MAX) ---------- */

.sso { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 0; }
.sso .btn, a.btn--block { width: 100%; }
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
}
.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Формы ---------- */

form { margin: 8px 0; }
form.inline { display: inline; margin: 0; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 2px 0;
  max-width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; margin: 0 6px 0 0; accent-color: var(--primary); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-50);
}
input[type="file"] { padding: 6px; background: var(--bg); }
textarea { min-height: 90px; resize: vertical; width: 100%; }

label { display: inline-block; font-size: 13px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.field > label { font-weight: 600; }
.field > input, .field > select, .field > textarea { width: 100%; }

/* ---------- Бейджи и подсказки ---------- */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--chip-bg);
  color: var(--chip-fg);
  white-space: nowrap;
}
.badge--primary { background: var(--primary-50); color: var(--primary-700); }
.badge--success { background: var(--success-bg); color: var(--success-fg); }
.badge--warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge--danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge--muted { background: var(--chip-bg); color: var(--muted); }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin: 10px 0;
  font-size: 14px;
}
.alert--error { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-fg); font-weight: 600; }
.alert--success { background: var(--success-soft); border-color: var(--success-border); color: var(--success-fg); font-weight: 600; }
.alert--info { background: var(--primary-50); border-color: var(--info-border); color: var(--primary-700); }

/* ---------- Вкладки ---------- */

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.tab:hover { background: var(--chip-bg-hover); text-decoration: none; }
.tab.active { background: var(--primary); color: var(--on-primary); }

/* ---------- Пустое состояние, аватары, строки ---------- */

.empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 12px 0;
}

.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
.avatar--sm { width: 24px; height: 24px; }
.avatar--lg { width: 56px; height: 56px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }

/* ---------- Выбор услуг в форме записи (чекбоксы) ---------- */

.checkbox-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 760px) { .checkbox-list { grid-template-columns: 1fr; } }

.checkbox-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-size: 13px;
}
.checkbox-item:hover { border-color: var(--primary); background: var(--primary-50); }
.checkbox-item input[type="checkbox"] { margin: 0; flex: none; }
.checkbox-item .svc-name { font-weight: 500; }
.checkbox-item .svc-meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.field-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Расписание: сетка «дни × время» (как в Android) ---------- */

.schedule { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: 74vh; background: var(--surface); }

/* Шапка липкая: остаётся сверху при прокрутке вниз. */
.schedule-head { display: flex; position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.schedule-body { display: flex; align-items: stretch; }

.schedule-gutter { width: 52px; flex: none; background: var(--surface-2); }
.schedule-gutter.head-corner { position: sticky; left: 0; z-index: 5; }
/* Часовая линейка липкая слева: не уезжает при горизонтальной прокрутке. */
.schedule-body > .schedule-gutter { position: sticky; left: 0; z-index: 2; }

.schedule-hour { height: 48px; border-bottom: 1px solid var(--border-soft); font-size: 10px; color: var(--muted); text-align: right; padding-right: 6px; }

.schedule-colhead {
  flex: 1 1 0; min-width: 120px; text-align: center;
  padding: 6px 4px; font-weight: 600; font-size: 12px; color: var(--text-2);
  border-left: 1px solid var(--border-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.schedule-colhead.is-today { color: var(--primary); background: var(--today-bg); }
.schedule-colhead.is-weekend { background: var(--surface-2); }

.schedule-col { flex: 1 1 0; min-width: 120px; position: relative; border-left: 1px solid var(--border-soft); }
.schedule-col.is-today { background: var(--today-bg); }
.schedule-col.is-weekend { background: var(--surface-2); }

.schedule-line { height: 48px; border-bottom: 1px solid var(--border-soft); }

/* Линия «сейчас» в колонке сегодняшнего дня. */
.schedule-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; }
.schedule-now::before {
  content: ""; position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}

.schedule-event {
  position: absolute; z-index: 1;
  display: flex; flex-direction: column; gap: 1px;
  border-radius: 6px;
  padding: 3px 6px;
  font-size: 11px; line-height: 1.15;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .25);
  border-left: 3px solid rgba(0, 0, 0, .25);
}
.schedule-event:hover { text-decoration: none; box-shadow: var(--shadow-md); z-index: 5; }
.schedule-event .ev-time { font-size: 10px; opacity: .85; }
.schedule-event .ev-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schedule-event .ev-badge {
  align-self: flex-start; margin-top: 1px; padding: 0 4px; border-radius: 4px;
  background: rgba(255, 255, 255, .28); font-size: 9px; font-weight: 700; text-transform: uppercase;
}

/* Заявка (REQUEST) — яркая прерывистая рамка. */
.schedule-event.is-request { border: 2px dashed #B45309; border-left-width: 3px; }
/* Отменённые/удалённые/прошедшие — приглушённые и зачёркнутые. */
.schedule-event.is-cancelled, .schedule-event.is-deleted, .schedule-event.is-past {
  color: #0F172A; text-decoration: line-through; box-shadow: none;
}
.schedule-event.is-company-event { font-style: italic; }

/* Публичное расписание «дни × часы» */
.cal { border-collapse: collapse; font-size: 12px; width: 100%; }
.cal th { background: var(--surface-3); color: var(--text-2); text-transform: none; letter-spacing: 0; font-size: 12px; }
.cal td { padding: 0; text-align: center; border: 1px solid var(--border); }
.cal .cal-today { background: var(--today-bg); }
.cal .cal-hour { background: var(--surface-2); color: var(--muted); font-weight: 400; padding: 2px 4px; }
.cal-free { display: block; padding: 4px 0; background: var(--success-bg); color: var(--success-fg); text-decoration: none; }
.cal-free:hover { background: var(--success-border); text-decoration: none; }
.cal-busy { padding: 4px 0; background: var(--danger-bg); color: var(--danger-fg); }
.cal-none { padding: 4px 0; background: var(--surface-2); color: var(--muted); }

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 860px) {
  .layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 4px 0 6px;
    box-shadow: var(--shadow);
  }

  .brand { padding: 12px 16px 8px; font-size: 16px; }
  .brand img { width: 36px; height: 36px; }

  .nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 2px 10px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .nav a { white-space: nowrap; padding: 8px 12px; }
  .nav .nav-divider, .nav .nav-title { display: none; }

  .content { padding: 16px 16px 48px; overflow-x: auto; }
  .page-head { margin-bottom: 12px; }

  h1 { font-size: 21px; }

  table { min-width: 520px; }
}

/* ==========================================================================
   Служебные раскладки страниц
   ========================================================================== */

/* Панель фильтров над списками. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin: 12px 0 16px;
}
.filter-bar .field { margin: 0; min-width: 150px; }
.filter-bar label { font-weight: 600; }

/* Строка действий в ячейке/карточке (кнопки, мелкие формы). */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions form { margin: 0; display: inline-flex; }

/* Поле в одну строку (подпись слева, контроль справа). */
.field--inline { flex-direction: row; align-items: center; gap: 8px; }
.field--inline > label { font-weight: 600; }

/* Подсказка «?» рядом с подписью настройки (title во всплывающей подсказке). */
.hint-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
}

/* Заголовок-ссылка публичных страниц с фирменным знаком. */
.public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-weight: 800;
  font-size: 18px;
  color: var(--primary-700);
}
.public-brand img { width: 34px; height: 34px; border-radius: 9px; }
.public-brand a { color: inherit; }

/* Списки ссылок в карточках-поверхностях. */
.card ul { margin: 6px 0; padding-left: 20px; }

/* ==========================================================================
   Юридические документы (страницы /terms, /offer, /privacy и др.)
   ========================================================================== */

.legal { font-size: 15px; line-height: 1.62; }
.legal > :first-child { margin-top: 0; }
.legal h1 { font-size: 26px; margin-bottom: .6em; }
.legal h2 { margin-top: 1.7em; }
.legal h3 { margin-top: 1.3em; }
.legal p { margin: .7em 0; }
.legal ul, .legal ol { margin: .6em 0; padding-left: 22px; }
.legal li { margin: .25em 0; }
.legal hr { margin: 20px 0; }
.legal code {
  font-size: .92em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.legal pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
}
.legal pre code { background: none; border: none; padding: 0; }
.legal blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--primary);
  background: var(--primary-50);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.legal blockquote p { margin: .35em 0; }
.legal table { margin: 0; }

/* Юридические ссылки во футере публичных страниц. */
.public-footer-legal { margin-top: 8px; }

/* ==========================================================================
   Cookie-баннер согласия (публичные страницы и кабинет)
   ========================================================================== */

.cookie-banner {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  width: calc(100% - 32px);
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  color: var(--text);
}

/* Атрибут hidden должен побеждать display:flex. */
.cookie-banner[hidden] { display: none; }

.cookie-banner__text { flex: 1 1 320px; min-width: 0; }
.cookie-banner__text a { font-weight: 600; }
.cookie-banner__actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 520px) {
  .cookie-banner { flex-direction: column; align-items: stretch; }
  .cookie-banner__actions { justify-content: flex-end; }
}

/* ===== Каталог (главная страница) в стиле лендинга ===== */

.hero-lite {
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--primary-50), var(--bg));
  margin-bottom: 20px;
}

.hero-lite .badge { margin-bottom: 10px; }

.hero-lite h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.15; }

.hero-lite .lead {
  margin: 0 0 16px;
  max-width: 640px;
  font-size: 15px;
  color: var(--muted);
}

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin: 12px 0 24px;
}

.catalog-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15, 23, 42, .06));
  transition: border-color .15s, transform .15s;
}

.catalog-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  text-decoration: none;
}

.catalog-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Фото компании в карточке каталога/витрины: вписывается в тот же квадрат, что и буква-заглушка. */
.catalog-avatar__img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
}

/* Увеличенный аватар на публичной странице компании (`/c/{id}`). */
.catalog-avatar--lg {
  flex-basis: 72px;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  font-size: 30px;
  margin-bottom: 8px;
}

.catalog-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.catalog-body strong { color: var(--text); }
.catalog-body p { margin: 0; font-size: 13px; }
.catalog-cta { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--primary); }

/* Рейтинг компании: звёзды + «4,8 · 12 отзывов» (каталог и публичная страница). */
.catalog-rating { display: flex; align-items: center; gap: 6px; margin: 2px 0 0; font-size: 13px; }
.catalog-rating__stars { color: #F59E0B; letter-spacing: 1px; line-height: 1; }
.catalog-rating__value { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Тёмная тема
   Включается атрибутом `data-theme="dark"` на <html>. Значение ставится
   инлайн-скриптом в <head> (см. themeBootstrap) до первой отрисовки, поэтому
   страница не «мигает». Выбор хранится в localStorage, без атрибута — светлая.
   ========================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;

  /* Бренд: в темноте чуть светлее для контраста */
  --primary: #3B82F6;
  --primary-600: #2563EB;
  --primary-700: #93C5FD;
  --primary-50: #17254A;
  --secondary: #38BDF8;
  --tertiary: #2DD4BF;

  --bg: #0B1220;
  --surface: #121C31;
  --surface-2: #0F1830;
  --surface-3: #1A2540;
  --text: #E7EDF7;
  --text-2: #C6D2E6;
  --muted: #93A3BD;
  --border: #26334D;
  --border-soft: #1C2740;
  --chip-bg: #1E2B47;
  --chip-bg-hover: #2A3A5C;
  --chip-fg: #C6D2E6;
  --hover-row: #16203A;

  --success: #34D399;
  --success-bg: #10301F;
  --success-fg: #6EE7B7;
  --success-soft: #10301F;
  --success-border: #1E5B3E;
  --warning-bg: #35260A;
  --warning-fg: #FCD34D;
  --danger: #F87171;
  --danger-bg: #3A1620;
  --danger-fg: #FCA5A5;
  --danger-soft: #33141D;
  --danger-border: #6B2436;
  --info-border: #2C4270;
  --today-bg: #2A3A66;

  --shadow: 0 1px 3px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .55);
}

/* Светлые градиенты, которым в темноте нужна своя подложка. */
html[data-theme="dark"] body.auth-body,
html[data-theme="dark"] .hero-lite {
  background: linear-gradient(160deg, #16233F, var(--bg));
}

/* ---------- Переключатель темы ---------- */

.theme-toggle {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--primary-50); border-color: var(--primary); color: var(--primary-700); }
.theme-toggle:active { background: var(--chip-bg); }
.theme-toggle svg { display: block; }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

/* На тёмном (индиго) сайдбаре админки кнопка должна быть «стеклянной». */
.sidebar--dark .theme-toggle {
  background: rgba(255, 255, 255, .10);
  border-color: rgba(255, 255, 255, .22);
  color: #E0E7FF;
}
.sidebar--dark .theme-toggle:hover { background: rgba(255, 255, 255, .20); color: #FFFFFF; }

