/* ==========================================================================
   BIND Control — дизайн-система
   Концепция: «студия управления сигналом» (master control room broadcast-
   инженерии). Обоснование: панель управляет DNS-инфраструктурой, которая
   буквально маршрутизирует IPTV-сигнал (iptv1..iptvN) для абонентов —
   тёмная студийная палитра, статусные цвета в духе индикаторов вещательной
   аппаратуры (tally lights), моноширинный шрифт для DNS-данных (имена,
   IP, TTL, серийные номера) — там, где в файле зоны и так моноширинный
   текст, что подчёркивает связь панели с исходным zone-файлом.
   ========================================================================== */

:root {
  /* ---- Цвета ---- */
  --bg-void: #0b1420;
  --bg-panel: #121d2b;
  --bg-panel-raised: #17263a;
  --bg-panel-hover: #1c2e44;
  --line: #223349;
  --line-soft: #1a2738;
  --text-primary: #e8eef5;
  --text-muted: #7c93ad;
  --text-faint: #4d6076;

  --signal-cyan: #3fc6d9;
  --signal-cyan-soft: rgba(63, 198, 217, 0.12);
  --tally-green: #34d399;
  --tally-green-soft: rgba(52, 211, 153, 0.12);
  --tally-amber: #f5a623;
  --tally-amber-soft: rgba(245, 166, 35, 0.12);
  --tally-red: #f0554c;
  --tally-red-soft: rgba(240, 85, 76, 0.12);

  /* ---- Типографика ---- */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;

  /* ---- Прочее ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-drawer: -24px 0 48px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.45);
  --sidebar-w: 252px;
  --topbar-h: 64px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------------------------- Reset / base ---------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
code, .mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: 2px;
  border-radius: 3px;
}

::selection { background: var(--signal-cyan-soft); color: var(--text-primary); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 2px solid var(--bg-void); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
/* Firefox использует отдельный API стилизации скролла, не псевдоэлементы
   ::-webkit-*. Без этого в Firefox скролл всё равно РАБОТАЕТ (просто со
   стандартным системным видом), но добавляем для единообразия с остальными
   браузерами и чтобы скроллбар был визуально гарантированно заметен. */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ------------------------------ App shell ------------------------------ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  color: var(--signal-cyan);
  display: flex; align-items: center; justify-content: center;
  background: var(--signal-cyan-soft);
  border-radius: 9px;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 14.5px; letter-spacing: -0.01em; }
.brand-text span { font-size: 11.5px; color: var(--text-muted); }

.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--text-muted); font-size: 13.5px; font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-panel-raised); color: var(--text-primary); }
.nav-item.is-active { background: var(--signal-cyan-soft); color: var(--signal-cyan); }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 10px; }
.current-user { display: flex; align-items: center; gap: 10px; padding: 6px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px; background: var(--bg-panel-raised);
  color: var(--signal-cyan); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.user-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11px; color: var(--text-muted); }

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

.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(11, 20, 32, 0.7);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { display: flex; flex-direction: column; gap: 2px; }
.topbar-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; }
.topbar h1 { font-size: 17px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.mobile-menu-btn { display: none; }

.content { padding: 26px 28px 56px; flex: 1; max-width: 1320px; width: 100%; margin: 0 auto; }

/* ------------------------------ Typography ------------------------------ */

.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); font-weight: 600; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-sm { font-size: 12.5px; }
.text-danger { color: var(--tally-red); }
.text-ok { color: var(--tally-green); }
.text-warn { color: var(--tally-amber); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h2 { font-size: 21px; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 13.5px; max-width: 60ch; }

/* -------------------------------- Layout -------------------------------- */

.grid { display: grid; gap: 16px; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .grid-cols-3, .grid-cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .gap-3 { gap: 16px; }
.mt-1{margin-top:6px;} .mt-2{margin-top:12px;} .mt-3{margin-top:20px;}
.mb-1{margin-bottom:6px;} .mb-2{margin-bottom:12px;} .mb-3{margin-bottom:20px;}

/* -------------------------------- Cards -------------------------------- */

.card { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; margin-bottom: 8px; }
.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.stat-sub { font-size: 12px; color: var(--text-muted); }

.section-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

/* -------------------------------- Buttons -------------------------------- */

.btn {
  font-family: var(--font-sans); font-weight: 600; font-size: 13.5px;
  padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--signal-cyan); color: #04262b; border-color: var(--signal-cyan); }
.btn-primary:hover:not(:disabled) { background: #57d3e3; }

.btn-secondary { background: var(--bg-panel-raised); color: var(--text-primary); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--signal-cyan); color: var(--signal-cyan); }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-panel-raised); }

.btn-danger { background: transparent; color: var(--tally-red); border-color: rgba(240, 85, 76, 0.35); }
.btn-danger:hover:not(:disabled) { background: var(--tally-red-soft); }

.btn-danger-solid { background: var(--tally-red); color: #2a0908; border-color: var(--tally-red); }
.btn-danger-solid:hover:not(:disabled) { background: #f37972; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-icon { padding: 7px; }
.btn-block { width: 100%; }

/* -------------------------------- Forms -------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; margin-bottom: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.field .hint { font-size: 12px; color: var(--text-faint); }
.field .error-text { font-size: 12.5px; color: var(--tally-red); }

.input, select.input, textarea.input {
  background: var(--bg-void); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--text-primary); font-family: var(--font-sans); font-size: 13.5px;
  width: 100%;
}
.input.mono { font-family: var(--font-mono); }
.input:focus { outline: 2px solid var(--signal-cyan); outline-offset: 0; border-color: var(--signal-cyan); }
.input:disabled { opacity: 0.55; cursor: not-allowed; }
textarea.input { resize: vertical; min-height: 90px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237C93AD' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.field.invalid .input { border-color: var(--tally-red); }

.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.checkbox-row input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--signal-cyan); }

.radio-tabs { display: inline-flex; background: var(--bg-void); border: 1px solid var(--line); border-radius: 8px; padding: 3px; gap: 2px; }
.radio-tabs label { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.radio-tabs input { position: absolute; opacity: 0; pointer-events: none; }
.radio-tabs label:has(input:checked) { background: var(--bg-panel-raised); color: var(--text-primary); }
.radio-tabs label:has(input:checked) svg { color: var(--signal-cyan); }

fieldset { border: none; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 10px; font-size: 13px; font-weight: 600; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* -------------------------------- Tables -------------------------------- */

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-panel); }
.data-table { font-size: 13px; }
.data-table thead th {
  text-align: left; padding: 11px 14px; background: var(--bg-panel-raised);
  color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.data-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-panel-hover); }
.data-table .col-name { font-family: var(--font-mono); font-weight: 600; }
.data-table .col-value { font-family: var(--font-mono); color: var(--text-primary); }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table tr.is-disabled-record { opacity: 0.55; }
.data-table tr.is-disabled-record .col-value, .data-table tr.is-disabled-record .col-name { text-decoration: line-through; text-decoration-color: var(--text-faint); }
.data-table .row-group-header td { background: var(--bg-void); color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 14px; font-weight: 600; }

.empty-state { padding: 60px 24px; text-align: center; color: var(--text-muted); }
.empty-state svg { width: 40px; height: 40px; color: var(--text-faint); margin-bottom: 12px; }
.empty-state h3 { color: var(--text-primary); font-size: 15px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 42ch; margin: 0 auto; }

/* -------------------------------- Badges -------------------------------- */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.badge-type { font-family: var(--font-mono); background: var(--bg-panel-raised); color: var(--text-primary); border: 1px solid var(--line); }
.badge-type--A, .badge-type--AAAA { color: var(--signal-cyan); border-color: rgba(63,198,217,.35); background: var(--signal-cyan-soft); }
.badge-type--MX { color: #c9a8f5; border-color: rgba(201,168,245,.35); background: rgba(201,168,245,.1); }
.badge-type--TXT { color: #f5d97a; border-color: rgba(245,217,122,.35); background: rgba(245,217,122,.08); }
.badge-type--CNAME { color: #8fd6ff; border-color: rgba(143,214,255,.35); background: rgba(143,214,255,.08); }
.badge-type--NS { color: #9fd8b8; border-color: rgba(159,216,184,.35); background: rgba(159,216,184,.08); }

.ttl-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; }
.ttl-badge--custom { border: 1px solid var(--tally-amber); color: var(--tally-amber); background: var(--tally-amber-soft); }
.ttl-badge--inherit { border: 1px solid var(--line); color: var(--text-muted); background: transparent; }
.ttl-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot--ok { background: var(--tally-green); box-shadow: 0 0 0 3px var(--tally-green-soft); }
.status-dot--warn { background: var(--tally-amber); box-shadow: 0 0 0 3px var(--tally-amber-soft); }
.status-dot--error { background: var(--tally-red); box-shadow: 0 0 0 3px var(--tally-red-soft); }
.status-dot--unknown { background: var(--text-faint); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); color: var(--text-muted); }
.pill--ok { color: var(--tally-green); border-color: rgba(52,211,153,.35); background: var(--tally-green-soft); }
.pill--warn { color: var(--tally-amber); border-color: rgba(245,166,35,.35); background: var(--tally-amber-soft); }
.pill--error { color: var(--tally-red); border-color: rgba(240,85,76,.35); background: var(--tally-red-soft); }

/* ---------------------- Signal meter (сигнатурный элемент) ---------------------- */
/* Живой индикатор доступности сервера в виде аудио-эквалайзера — реальная
   статусная информация (не декорация): пульсирует при доступности сервера,
   статичен при недоступности. */

.signal-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; width: 18px; flex-shrink: 0; }
.signal-meter .bar { width: 3px; border-radius: 1px; background: var(--tally-green); animation: signal-bounce 1.15s ease-in-out infinite; transform-origin: bottom; }
.signal-meter .bar:nth-child(1) { height: 45%; animation-delay: 0s; }
.signal-meter .bar:nth-child(2) { height: 100%; animation-delay: 0.12s; }
.signal-meter .bar:nth-child(3) { height: 65%; animation-delay: 0.24s; }
.signal-meter .bar:nth-child(4) { height: 85%; animation-delay: 0.36s; }
@keyframes signal-bounce { 0%, 100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
.signal-meter[data-state="offline"] .bar { animation: none; height: 22% !important; background: var(--line); }
.signal-meter[data-state="warn"] .bar { background: var(--tally-amber); }
.signal-meter[data-state="unknown"] .bar { animation: none; height: 32% !important; background: var(--text-faint); }

/* -------------------------------- Drawer -------------------------------- */

.overlay {
  position: fixed; inset: 0; background: rgba(5, 10, 16, 0.62); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 50;
}
.overlay.is-open { opacity: 1; pointer-events: auto; }
body.panel-open { overflow: hidden; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(480px, 100vw);
  background: var(--bg-panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform 0.24s cubic-bezier(0.2, 0.7, 0.3, 1);
  z-index: 51; display: flex; flex-direction: column; box-shadow: var(--shadow-drawer);
}
.drawer.is-open { transform: translateX(0); }
.drawer-header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-shrink: 0; }
.drawer-header h3 { font-size: 16px; }
.drawer-header p { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.drawer-close { color: var(--text-muted); padding: 6px; border-radius: 7px; flex-shrink: 0; }
.drawer-close:hover { background: var(--bg-panel-raised); color: var(--text-primary); }
.drawer-body { padding: 22px 24px; overflow-y: auto; overflow-x: hidden; flex: 1; min-height: 0; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }
/* Во многих drawer'ах <form> оборачивает drawer-body и drawer-footer вместе
   (нужно, чтобы Enter/submit работали на всё содержимое). Чтобы прокрутка
   длинного контента работала надёжно во ВСЕХ браузерах, сама форма тоже
   должна быть flex-контейнером той же ориентации, что и .drawer — тогда
   drawer-body корректно получает "flex:1; min-height:0" от СВОЕГО прямого
   родителя и сжимается/скроллится, а не выталкивает футер за экран.
   (Раньше здесь стоял display:contents — технически тоже решает задачу,
   но имеет историю несовместимостей в некоторых браузерах; обычный
   вложенный flexbox поддерживается стабильно везде.) */
.drawer > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* -------------------------------- Modal -------------------------------- */

.modal {
  position: fixed; top: 50%; left: 50%; width: min(440px, 92vw);
  max-height: 88vh; display: flex; flex-direction: column;
  background: var(--bg-panel-raised); border: 1px solid var(--line); border-radius: var(--radius-lg);
  z-index: 61; opacity: 0; pointer-events: none; box-shadow: var(--shadow-modal);
  transform: translate(-50%, -46%); transition: opacity 0.16s ease, transform 0.16s ease;
}
.modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.modal-body { padding: 22px 24px; overflow-y: auto; overflow-x: hidden; min-height: 0; flex: 1; }
.modal-body h3 { font-size: 15.5px; margin-bottom: 8px; }
.modal-body p { font-size: 13px; color: var(--text-muted); line-height: 1.55; }
.modal-footer { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0; }
.modal-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.modal-icon svg { width: 20px; height: 20px; }
.modal-icon--danger { background: var(--tally-red-soft); color: var(--tally-red); }
.modal-icon--info { background: var(--signal-cyan-soft); color: var(--signal-cyan); }

/* -------------------------------- Toasts -------------------------------- */

.toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; width: min(360px, calc(100vw - 40px)); }
.toast {
  background: var(--bg-panel-raised); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 15px; display: flex; align-items: flex-start; gap: 10px; font-size: 13px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35); animation: toast-in 0.2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast-icon { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.toast--success .toast-icon { color: var(--tally-green); }
.toast--error .toast-icon { color: var(--tally-red); }
.toast--info .toast-icon { color: var(--signal-cyan); }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close { color: var(--text-muted); flex-shrink: 0; }

/* -------------------------------- Auth pages -------------------------------- */

.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(63,198,217,0.08), transparent), var(--bg-void);
  padding: 24px;
}
.auth-card { width: 100%; max-width: 400px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 40px; height: 40px; }
.auth-brand .brand-mark svg { width: 24px; height: 24px; }
.auth-brand strong { font-size: 16px; display: block; }
.auth-brand span { font-size: 12px; color: var(--text-muted); }
.auth-error { background: var(--tally-red-soft); border: 1px solid rgba(240,85,76,.35); color: #ffb4af; padding: 11px 13px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.auth-footnote { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-faint); }

/* -------------------------------- Zone editor -------------------------------- */

.zone-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--bg-panel); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.zone-toolbar .search-field { position: relative; flex: 1; min-width: 220px; }
.zone-toolbar .search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.zone-toolbar .search-field input { padding-left: 36px; }
.server-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.server-tab { padding: 7px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); color: var(--text-muted); display: flex; align-items: center; gap: 7px; cursor: pointer; background: var(--bg-void); }
.server-tab.is-active { border-color: var(--signal-cyan); color: var(--signal-cyan); background: var(--signal-cyan-soft); }
.server-sync-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.server-sync-chip { padding: 7px 10px 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); color: var(--text-primary); display: flex; align-items: center; gap: 8px; cursor: pointer; background: var(--bg-void); }
.server-sync-chip:hover { border-color: var(--line-soft); background: var(--bg-panel-raised); }
.server-sync-chip-status { font-size: 11px; }

.history-panel { background: var(--bg-void); border: 1px dashed var(--line); border-radius: var(--radius-md); padding: 12px 14px; margin-top: 8px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.history-item:last-child { border-bottom: none; }

.sync-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--line); margin-bottom: 16px; font-size: 13px; }
.sync-banner.is-ok { border-color: rgba(52,211,153,.35); background: var(--tally-green-soft); color: #a7f3d0; }
.sync-banner.is-warn { border-color: rgba(245,166,35,.35); background: var(--tally-amber-soft); color: #fcd9a0; }

.diff-list { font-family: var(--font-mono); font-size: 12px; }
.diff-list .diff-add { color: var(--tally-green); }
.diff-list .diff-remove { color: var(--tally-red); }

/* -------------------------------- Misc -------------------------------- */

.divider { height: 1px; background: var(--line); border: none; margin: 18px 0; }
.skeleton { background: linear-gradient(90deg, var(--bg-panel-raised) 25%, var(--bg-panel-hover) 37%, var(--bg-panel-raised) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 6px; }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.raw-view { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; background: var(--bg-void); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 16px; overflow-x: auto; white-space: pre; }
.raw-view .ln { color: var(--text-faint); display: inline-block; width: 3.2em; user-select: none; }

.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--bg-void); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; color: var(--text-muted); }

/* -------------------------------- Responsive -------------------------------- */

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 24px 0 48px rgba(0,0,0,.4); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .mobile-menu-btn { display: inline-flex; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
}
