/* ============================================================
   CABINET.CSS — Административный кабинет записи на прием
   Правительство Тверской области / 2026
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400;500;600;700&display=swap');

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Core palette */
  --bg:            #eef2f7;
  --surface:       #ffffff;
  --surface-2:     #f5f8fc;
  --surface-3:     #edf1f7;
  --border:        #dce5ef;
  --border-strong: #b8cade;

  /* Text */
  --ink:           #1b2a3b;
  --ink-2:         #3d5165;
  --muted:         #6b7f96;

  /* Brand blue */
  --blue-900:      #0c2d56;
  --blue-800:      #103d70;
  --blue-700:      #1a5296;
  --blue-600:      #1e64b8;
  --blue-500:      #2979d6;
  --blue-100:      #ddeeff;
  --blue-50:       #eef6ff;

  /* Semantic */
  --success-bg:    #e6f7ed;
  --success-ink:   #166534;
  --success-dot:   #16a34a;
  --error-bg:      #fef2f2;
  --error-ink:     #991b1b;
  --warning-bg:    #fffbeb;
  --warning-ink:   #92400e;
  --warning-dot:   #d97706;

  /* Status badges */
  --badge-active-bg:    #dbeafe;
  --badge-active-ink:   #1d4ed8;
  --badge-conf-bg:      #d1fae5;
  --badge-conf-ink:     #065f46;
  --badge-cancel-bg:    #fee2e2;
  --badge-cancel-ink:   #991b1b;
  --badge-open-bg:      #ede9fe;
  --badge-open-ink:     #4c1d95;
  --badge-offline-bg:   #f0fdf4;
  --badge-offline-ink:  #15803d;
  --badge-vks-bg:       #eff6ff;
  --badge-vks-ink:      #1d4ed8;

  /* UI */
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     16px;
  --radius-xl:     20px;
  --shadow-xs:     0 1px 3px rgba(16,36,64,.06), 0 1px 2px rgba(16,36,64,.04);
  --shadow-sm:     0 2px 8px rgba(16,36,64,.07), 0 1px 3px rgba(16,36,64,.05);
  --shadow:        0 4px 16px rgba(16,36,64,.09), 0 2px 6px rgba(16,36,64,.06);
  --shadow-md:     0 8px 24px rgba(16,36,64,.11), 0 3px 8px rgba(16,36,64,.07);
  --transition:    150ms ease;
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: 'Golos Text', 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background-color: var(--bg);
}

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

img { max-width: 100%; }

/* ── SHELL LAYOUT ───────────────────────────────────────────── */
.site-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOP BAR ────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 32px;
  height: 68px;
  background: var(--blue-800);
  box-shadow: 0 2px 8px rgba(16,36,64,.25);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.topbar__emblem {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: .06em;
  color: #fff;
  flex-shrink: 0;
  transition: background var(--transition);
}
.topbar__brand:hover .topbar__emblem { background: rgba(255,255,255,.2); }

.topbar__brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topbar__region {
  font-size: 0.72rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(255,255,255,.6);
  line-height: 1;
}

.topbar__sys {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  line-height: 1;
}

.topbar__account {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__user-block {
  text-align: right;
}

.topbar__user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.topbar__authority {
  font-size: 0.78rem;
  color: rgba(255,255,255,.6);
  line-height: 1.2;
}

/* ── BODY LAYOUT ────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  flex: 1;
  min-height: 0;
}

/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  background: var(--blue-900);
  padding: 24px 0;
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar__section-label {
  padding: 4px 20px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: rgba(255,255,255,.7);
  font-size: 0.93rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  position: relative;
}

.nav__link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  text-decoration: none;
}

.nav__link--active {
  background: rgba(255,255,255,.13);
  color: #fff;
  font-weight: 600;
}

.nav__link--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: #6db5ff;
  border-radius: 0 3px 3px 0;
}

.nav__icon {
  width: 18px;
  height: 18px;
  opacity: .8;
  flex-shrink: 0;
}
.nav__link--active .nav__icon,
.nav__link:hover .nav__icon { opacity: 1; }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.content {
  padding: 28px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

/* ── PAGE HEADER ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-kicker {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--blue-600);
  margin-bottom: 6px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 680px;
}

/* ── NOTICE ─────────────────────────────────────────────────── */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.93rem;
  line-height: 1.5;
}

.notice--success {
  background: var(--success-bg);
  color: var(--success-ink);
  border: 1px solid #bbf7d0;
}

.notice--error {
  background: var(--error-bg);
  color: var(--error-ink);
  border: 1px solid #fecaca;
}

.notice__icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* ── CARD / PANEL ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card--padded { padding: 24px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.panel__hint {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.panel__body { padding: 24px; }

.panel__body--nop { padding: 0; }

/* ── STATS GRID ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-500));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.metric-card__label {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-card__value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--blue-800);
  line-height: 1;
}

/* ── TABLE ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  padding: 11px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--ink-2);
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: background var(--transition);
}

.table tbody tr:hover { background: var(--surface-2); }

.table__primary { color: var(--ink); font-weight: 600; }
.table__muted { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.table__time { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge--active    { background: var(--badge-active-bg);  color: var(--badge-active-ink); }
.badge--confirmed { background: var(--badge-conf-bg);    color: var(--badge-conf-ink); }
.badge--cancelled { background: var(--badge-cancel-bg);  color: var(--badge-cancel-ink); }
.badge--open      { background: var(--badge-open-bg);    color: var(--badge-open-ink); }
.badge--booked    { background: var(--badge-active-bg);  color: var(--badge-active-ink); }
.badge--offline   { background: var(--badge-offline-bg); color: var(--badge-offline-ink); }
.badge--vks       { background: var(--badge-vks-bg);     color: var(--badge-vks-ink); }
.badge--change    { background: #fef3c7; color: #92400e; }
.badge--cancel-day{ background: var(--badge-cancel-bg);  color: var(--badge-cancel-ink); }
.badge--dot::before {
  content: '●';
  font-size: .5rem;
}

/* Status map for Jinja rendered strings */
.status-active    { @extend .badge--active; }

/* ── FILTER TABS ────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.filter-tab:hover { color: var(--ink); text-decoration: none; background: rgba(255,255,255,.8); }

.filter-tab--active {
  background: var(--surface);
  color: var(--blue-700);
  font-weight: 600;
  box-shadow: var(--shadow-xs);
}

/* ── BUTTONS ────────────────────────────────────────────────── */
button, input, select, textarea { font: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform 80ms ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(.98); }

.btn--primary {
  background: var(--blue-700);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26,82,150,.25);
}
.btn--primary:hover { background: var(--blue-800); box-shadow: 0 4px 10px rgba(26,82,150,.3); text-decoration: none; }

.btn--secondary {
  background: var(--surface);
  color: var(--blue-700);
  border: 1px solid var(--border-strong);
}
.btn--secondary:hover { background: var(--blue-50); }

.btn--danger {
  background: #dc2626;
  color: #fff;
}
.btn--danger:hover { background: #b91c1c; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn--ghost-white {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
}
.btn--ghost-white:hover { background: rgba(255,255,255,.18); color: #fff; text-decoration: none; }

.btn--sm { min-height: 32px; padding: 0 12px; font-size: 0.83rem; }
.btn--full { width: 100%; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.form-grid--1 { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }

.field__label {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .01em;
}

.field__hint {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:hover, select:hover, textarea:hover { border-color: #9fb3c8; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(41,121,214,.12);
}

textarea { resize: vertical; min-height: 80px; }

.inline-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

/* Checkboxes & pills */
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.87rem;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}

.check-pill input[type="checkbox"] { width: auto; padding: 0; }

.check-pill:has(input:checked) {
  background: var(--blue-50);
  border-color: var(--blue-500);
  color: var(--blue-700);
}

.check-pill:hover { border-color: var(--blue-500); }

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.check-line input[type="checkbox"] { width: auto; cursor: pointer; accent-color: var(--blue-600); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 8px;
  color: var(--muted);
}

.empty-state__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  opacity: .5;
}

.empty-state__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
}

.empty-state__text {
  font-size: 0.88rem;
  max-width: 360px;
  line-height: 1.55;
}

/* ── CALENDAR ───────────────────────────────────────────────── */
.calendar-wrap { padding: 20px 24px 24px; }

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--blue-700);
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  text-decoration: none;
  transition: background var(--transition);
}
.calendar-nav__btn:hover { background: var(--blue-100); text-decoration: none; }

.calendar-nav__label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
}

.calendar-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}

.calendar-legend__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot--slot     { background: #3b82f6; }
.dot--booking  { background: #16a34a; }
.dot--change   { background: #d97706; }

.calendar-grid-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}

.calendar-grid-head__day {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-cell {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color var(--transition), box-shadow var(--transition);
  overflow: hidden;
}

.cal-cell:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }

.cal-cell--muted {
  background: var(--surface-2);
  opacity: .55;
}

.cal-cell--today {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

.cal-cell__date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.cal-cell--today .cal-cell__date {
  background: var(--blue-700);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.cal-cell__tags {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.cal-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-tag--slot    { background: #dbeafe; color: #1d4ed8; }
.cal-tag--booking { background: #d1fae5; color: #065f46; }
.cal-tag--change  { background: #fef3c7; color: #92400e; }

.cal-cell__btn {
  margin-top: auto;
  width: 100%;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--blue-700);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  display: none;
}

.cal-cell:hover .cal-cell__btn { display: block; }
.cal-cell__btn:hover { background: var(--blue-50); border-color: var(--blue-500); }

/* ── EXCEPTION FORM PANEL ───────────────────────────────────── */
.exception-panel {
  position: sticky;
  top: calc(68px + 20px);
}

.selection-banner {
  padding: 10px 14px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  color: var(--blue-700);
  font-weight: 500;
}

/* ── RULE EDITOR ────────────────────────────────────────────── */
.rule-editor-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rule-editor {
  border-bottom: 1px solid var(--border);
}

.rule-editor:last-child { border-bottom: none; }

.rule-editor__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  cursor: pointer;
  transition: background var(--transition);
}

.rule-editor__header:hover { background: var(--surface-2); }

.rule-editor__summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rule-editor__summary-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.rule-editor__summary-meta {
  font-size: 0.83rem;
  color: var(--muted);
}

.rule-editor__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.rule-editor__body {
  padding: 0 24px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.rule-editor__body-inner {
  padding-top: 20px;
}

/* ── SPLIT LAYOUT ───────────────────────────────────────────── */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}

/* ── CODE BLOCK ─────────────────────────────────────────────── */
.code-block {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  background: var(--blue-900);
}

.login-sidebar {
  width: 380px;
  flex-shrink: 0;
  background: var(--blue-800);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
}

.login-sidebar::before {
  content: '';
  position: absolute;
  bottom: -60px; right: -60px;
  width: 320px; height: 320px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}

.login-sidebar::after {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
}

.login-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.login-sidebar__emblem {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

.login-sidebar__region {
  font-size: 0.75rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1;
  margin-bottom: 4px;
}

.login-sidebar__sys {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}

.login-sidebar__tagline {
  position: relative;
  z-index: 1;
}

.login-sidebar__tagline h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 12px;
}

.login-sidebar__tagline p {
  font-size: 0.9rem;
  color: rgba(255,255,255,.6);
  line-height: 1.6;
}

.login-sidebar__footer {
  position: relative;
  z-index: 1;
  font-size: 0.78rem;
  color: rgba(255,255,255,.35);
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px;
  width: min(440px, 100%);
}

.login-card__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.login-card__sub {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.5;
}

.login-card__form { display: flex; flex-direction: column; gap: 16px; }

/* ── AUDIT PAYLOAD ──────────────────────────────────────────── */
.audit-event {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink);
}

/* ── UTILITY ────────────────────────────────────────────────── */
.is-hidden { display: none !important; }
.text-muted { color: var(--muted); }
.text-link { color: var(--blue-600); font-size: 0.87rem; font-weight: 500; }
.text-link:hover { text-decoration: underline; }
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }
.section-label { font-size: 0.72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Status badge mapping (dynamic from Jinja) */
[data-status="active"]    { background: var(--badge-active-bg);  color: var(--badge-active-ink); }
[data-status="confirmed"] { background: var(--badge-conf-bg);    color: var(--badge-conf-ink); }
[data-status="cancelled"] { background: var(--badge-cancel-bg);  color: var(--badge-cancel-ink); }
[data-status="open"]      { background: var(--badge-open-bg);    color: var(--badge-open-ink); }
[data-status="booked"]    { background: var(--badge-active-bg);  color: var(--badge-active-ink); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .split-layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 10px;
    display: flex;
    align-items: center;
  }

  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .nav__link { padding: 8px 12px; font-size: 0.85rem; }
  .nav__link--active::before { display: none; }
  .sidebar__section-label { display: none; }

  .content { padding: 16px; }

  .page-header { flex-direction: column; }

  .topbar { height: auto; padding: 14px 16px; }
}

@media (max-width: 720px) {
  .login-sidebar { display: none; }
  .login-shell { background: var(--surface-2); }
  .login-main { padding: 24px 16px; align-items: flex-start; padding-top: 40px; }
  .login-card { padding: 28px; }

  .stats-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 1fr; }

  .table th:nth-child(n+4),
  .table td:nth-child(n+4) { display: none; }

  .cal-cell { min-height: 68px; }
  .cal-cell__btn { display: none !important; }
}
