/* БрайтДент — админ-панель. Современный десктопный интерфейс. */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --border: #e4e9f0;
  --border-strong: #d3dbe6;
  --text: #101828;
  --muted: #667085;

  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-strong: #14b8a6;
  --primary-soft: #f0fdfa;
  --primary-ring: rgba(13, 148, 136, 0.22);

  --danger: #dc2626;
  --danger-dark: #b91c1c;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;

  --sidebar-bg: #0f172a;
  --sidebar-text: #9fb0c7;
  --sidebar-active-bg: rgba(20, 184, 166, 0.16);
  --sidebar-active-text: #6ee7d8;

  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, 0.04),
               0 10px 24px -12px rgba(16, 24, 40, 0.14);
  --shadow-lg: 0 24px 60px rgba(2, 20, 30, 0.35);
  --control-h: 38px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); }
.nowrap { white-space: nowrap; }

/* SVG-иконки (инлайновые, наследуют цвет текста) */
.icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-block; vertical-align: -3px;
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--control-h); padding: 0 16px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--panel); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; user-select: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: #f6f8fb; border-color: #c2cddb; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn .icon { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(180deg, var(--primary-strong) 0%, var(--primary) 100%);
  border-color: var(--primary-dark); color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #10a795 0%, #0c8377 100%);
  border-color: var(--primary-dark);
}

.btn-danger {
  background: var(--danger); border-color: var(--danger); color: #fff;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.3);
}
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.22); }

/* Синяя кнопка для второстепенного действия (например, «Перенести») */
.btn-info {
  background: #2563eb; border-color: #2563eb; color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3);
}
.btn-info:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-info:focus-visible { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22); }

.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: rgba(16, 24, 40, 0.06); border-color: transparent; }
.btn-ghost:focus-visible { box-shadow: 0 0 0 3px var(--primary-ring); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-block { width: 100%; }

/* ===== Экран входа ===== */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px 650px at 12% -10%, rgba(20, 184, 166, 0.30), transparent 55%),
    radial-gradient(900px 600px at 110% 115%, rgba(37, 99, 235, 0.25), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #12253a 100%);
}
.login-card {
  width: 400px; padding: 40px 36px; background: var(--panel);
  border-radius: 20px; box-shadow: var(--shadow-lg);
  text-align: center;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; border-radius: 18px;
  background: linear-gradient(135deg, #d9f7f2 0%, #e8f1fd 100%);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.15);
}
.login-card h1 { font-size: 24px; letter-spacing: -0.02em; margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 24px; }
.login-card label {
  display: block; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.login-card input {
  width: 100%; height: 42px; padding: 0 14px; margin-bottom: 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: var(--panel); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-card input:hover { border-color: #b9c4d4; }
.login-card input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.login-error {
  margin-bottom: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-size: 13px; text-align: left;
}

/* ===== Каркас приложения ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 252px; flex-shrink: 0; background: var(--sidebar-bg);
  color: var(--sidebar-text); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px; border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.brand-logo {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.30), rgba(37, 99, 235, 0.24));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}
.brand-text { color: #fff; font-size: 16px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.brand-text small { display: block; font-size: 11px; font-weight: 500; color: var(--sidebar-text); opacity: 0.8; }
.nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px; color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item .icon { width: 18px; height: 18px; opacity: 0.85; }
.nav-item:hover { background: rgba(148, 163, 184, 0.10); color: #dbe4ef; text-decoration: none; }
.nav-item.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-text); font-weight: 600;
}
.nav-item.active .icon { opacity: 1; }
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(148, 163, 184, 0.14); }
.clinic-info { font-size: 12px; color: var(--sidebar-text); margin-bottom: 12px; line-height: 1.45; }
.clinic-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 6px; }
.clinic-row:last-child { margin-bottom: 0; }
.clinic-row .icon { width: 14px; height: 14px; margin-top: 2px; opacity: 0.75; }
.sidebar .btn-ghost { color: var(--sidebar-text); }
.sidebar .btn-ghost:hover { background: rgba(148, 163, 184, 0.14); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 28px; background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.topbar-meta { color: var(--muted); font-size: 13px; }
.content { padding: 24px 28px; }

/* ===== Карточки и сетки ===== */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-body { padding: 20px; }
.settings-card { max-width: 640px; }
.settings-card .field { margin-bottom: 4px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.dash-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }

.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon .icon { width: 19px; height: 19px; }
.stat-icon.tint-teal   { background: #e3f8f4; color: #0d9488; }
.stat-icon.tint-blue   { background: #e8f1fd; color: #2563eb; }
.stat-icon.tint-violet { background: #f0ecfd; color: #7c3aed; }
.stat-icon.tint-amber  { background: #fdf3e2; color: #d97706; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.45; }

/* ===== Панели инструментов и поля ===== */
.toolbar {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar-spacer { flex: 1; }
.toolbar .hint { align-self: center; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1; min-width: 240px; }
.field.block { display: block; }
.field span { font-size: 12px; font-weight: 600; color: var(--muted); }
.field.block span { display: block; margin-bottom: 6px; }
/* Блочные поля (например, ссылка на политику в Настройках) — на всю ширину */
.field.block input { width: 100%; }

input[type="text"], input[type="search"], input[type="date"], input[type="tel"],
input[type="number"], input[type="url"], select, textarea {
  height: var(--control-h);
  padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 13px; font-family: inherit;
  background: var(--panel); color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { height: auto; min-height: 96px; padding: 10px 12px; width: 100%; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #b9c4d4; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
input::placeholder, textarea::placeholder { color: #9aa5b5; }

/* Селекты: нативные, но с собственным шевроном */
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
select[size] {
  appearance: auto; -webkit-appearance: auto;
  background-image: none; padding-right: 12px; height: auto;
}

/* ===== Кастомный селект (CSelect) ===== */
.csel { position: relative; }
.csel-native { display: none !important; }
.csel-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: var(--control-h); padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--panel); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 400; text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.csel-btn:hover { border-color: #b9c4d4; }
.csel.open .csel-btn {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.csel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-btn .icon { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; transition: transform 0.15s ease; }
.csel.open .csel-btn .icon { transform: rotate(180deg); }
.csel-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 80;
  max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md);
  padding: 4px;
}
.csel-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px;
  font-size: 13px; cursor: pointer;
  transition: background 0.1s ease;
}
.csel-opt:hover { background: #f1f5fb; }
.csel-opt.selected { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.csel-opt.disabled { color: var(--muted); cursor: default; }
.csel-opt.disabled:hover { background: none; }

/* Выпадающие подсказки поиска клиента в модалке записи */
.suggest-wrap { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 80;
  max-height: 280px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-md);
  padding: 4px;
}
.suggest .csel-opt { flex-direction: column; align-items: stretch; gap: 2px; }
.suggest-name { font-weight: 600; }
.suggest-meta { color: var(--muted); font-size: 12px; }
.suggest-opt-new { color: var(--primary-dark); font-weight: 600; flex-direction: row; align-items: center; }
.suggest-opt-new .icon { width: 15px; height: 15px; }

/* Выбранный клиент (чип в модалке записи) */
.picked-client {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: #f8fafc;
}
.picked-client > .icon { color: var(--primary-dark); }
.picked-info { min-width: 0; }
.picked-info b { display: block; font-size: 13px; }
.picked-info .sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.picked-clear {
  margin-left: auto; border: none; background: none; cursor: pointer;
  color: var(--muted); width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.picked-clear:hover { background: #eef2f7; color: var(--text); }
.picked-clear .icon { width: 14px; height: 14px; }

/* Текстовая кнопка-ссылка */
.btn-link {
  border: none; background: none; padding: 0; margin-top: 8px;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--primary-dark); cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* Дейтпикер */
input[type="date"] { min-width: 150px; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.55; cursor: pointer; transition: opacity 0.15s ease;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

input[type="checkbox"] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }

.hint { color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 560px; }
.bc-meta { margin: 8px 0 14px; color: var(--muted); font-size: 12px; text-align: right; }

/* ===== Таблицы ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: #f7fafc; }
td .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
/* «Перенести» и «Отменить» — одинаковая ширина, в одну строку */
.actions.appt-actions { flex-wrap: nowrap; }
.appt-actions .btn { min-width: 112px; }

/* ===== Бейджи статусов ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3.5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-active { background: var(--primary-soft); color: var(--primary-dark); }
.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); }
/* Статусы записей — компонент одной ширины для всех значений */
.badge-appt { min-width: 96px; justify-content: center; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-error { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--primary-soft); color: var(--primary-dark); }
.badge-partial { background: var(--warning-soft); color: var(--warning); }
.badge-role-admin { background: var(--danger-soft); color: var(--danger); }
.badge-role-doctor { background: var(--warning-soft); color: var(--warning); }
.badge-role-client { background: var(--primary-soft); color: var(--primary-dark); }

.dash-sync { padding: 18px 20px; line-height: 1.6; }
.dash-sync .row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 5px 0; border-bottom: 1px dashed var(--border);
}
.dash-sync .row:last-child { border-bottom: none; }
.dash-sync .row span:first-child { color: var(--muted); }

/* ===== Модальные окна ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  overflow: hidden;
}
.modal {
  width: 520px; max-width: 100%;
  /* скролл только внутри тела модалки — полоса скролла не выходит за её пределы */
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal.wide { width: 640px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-close {
  border: none; background: none; font-size: 16px; cursor: pointer;
  color: var(--muted); width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.modal-close:hover { background: #f1f4f9; color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-body .field { margin-bottom: 14px; }
.modal-body .field input, .modal-body .field select, .modal-body .field textarea { width: 100%; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: #fafbfd; border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  flex-shrink: 0;
}
.slots-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.slot-btn {
  padding: 7px 14px; border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--panel); cursor: pointer; font-size: 13px;
  font-family: inherit; color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.slot-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-soft); }
.slot-btn.selected {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35);
}

/* ===== Тосты ===== */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  min-width: 260px; max-width: 420px; padding: 12px 16px;
  border-radius: 12px; color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28);
  animation: toast-in 0.2s ease-out;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: #1f2a3d; }
@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== Загрузка ===== */
.loading { padding: 34px; text-align: center; color: var(--muted); }
.spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2.5px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Скроллбары ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #c8d2e0; border-radius: 6px;
  border: 2px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #aebbcf; border: 2px solid transparent;
  border-radius: 6px; background-clip: content-box;
}

/* ===== Дейтпикер фильтра «Записи» ===== */
.datepick { position: relative; }
.datepick-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: var(--control-h); padding: 0 12px; min-width: 172px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--panel); color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; user-select: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.datepick-btn:hover { border-color: #c2cddb; }
.datepick-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.datepick-btn .icon { width: 16px; height: 16px; color: var(--muted); }
.datepick-btn .dp-chevron { margin-left: auto; }
.datepick-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 296px; padding: 14px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  animation: modal-in 0.15s ease-out;
}
.dp-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dp-title { font-size: 13px; font-weight: 700; }
.dp-nav {
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: none; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.dp-nav:hover { background: #f1f4f9; color: var(--text); }
.dp-nav .icon { width: 16px; height: 16px; }
.dp-prev .icon { transform: rotate(90deg); }
.dp-next .icon { transform: rotate(-90deg); }
/* gap совпадает с .dp-grid — иначе колонки заголовков дней недели
   были бы шире колонок дат (там 6 промежутков по 2px) и сетка «съезжала». */
.dp-wd { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 2px; }
.dp-wd span {
  text-align: center; font-size: 11px; font-weight: 600;
  color: var(--muted); padding: 4px 0; text-transform: uppercase;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-cell {
  position: relative; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; cursor: pointer; user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.dp-cell:hover { background: #f1f4f9; }
/* Пустые клетки до начала месяца. Класс dp-empty (а не empty!) —
   глобальный .empty даёт padding: 34px и ломал сетку календаря. */
.dp-cell.dp-empty { cursor: default; }
.dp-cell.dp-empty:hover { background: none; }
.dp-cell.today { box-shadow: inset 0 0 0 1px var(--border-strong); font-weight: 700; }
.dp-cell.selected {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35);
}
.dp-cell.selected:hover { background: var(--primary-dark); }
.dp-dot {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--primary); display: none;
}
.dp-cell.has-dots .dp-dot { display: block; }
.dp-cell.selected .dp-dot { background: #fff; }
.dp-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
}

/* ===== Вкладки (раздел «Синхронизация Ident») ===== */
.tabs {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: #e9edf4; border: 1px solid var(--border);
  border-radius: 10px; align-self: center;
}
.tab {
  height: 32px; padding: 0 16px; border: none; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.tab.active {
  background: var(--panel); color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== Пагинация ===== */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 16px; border-top: 1px solid var(--border);
}
.pg-info { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pg-controls { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pg-btn:hover:not(:disabled):not(.active) { background: #f1f4f9; }
.pg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.pg-btn.active {
  background: var(--primary); color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.35);
}
.pg-btn:disabled { color: #b6c0cf; cursor: default; }
.pg-nav { font-size: 14px; }
.pg-gap { color: var(--muted); padding: 0 2px; user-select: none; }

/* ===== Предпросмотр рассылки ===== */
.bc-preview {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: #f8fafc; font-size: 13px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 240px; overflow-y: auto;
}



