/* BigTure Console — design system (see docs/BigTure-Console-UI-UX.md) */

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff; --surface: #ffffff; --surface-2: #eff8ff;
  --ink: #0c2a3f; --ink-2: #47627a; --muted: #6c8aa1;
  --line: #dcebf5; --grid: #e6f1f8; --axis: #c4d9e8;
  --sms: #0ea5e9; --sms-ink: #0369a1; --voice: #f0a31a;
  --btn-bg: #0278b8; --btn-fg: #ffffff;
  --panel: #0b3550; --panel-ink: #eaf0f7;
  --good: #0ca30c; --good-text: #006300; --good-bg: #e6f5e6;
  --warn: #fab219; --warn-text: #8a5a00; --warn-bg: #fdf1d6;
  --bad: #d03b3b; --bad-text: #b02a2a; --bad-bg: #fbe7e7;
  --info-bg: #e0f2fe;
  --font-display: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #06131d; --surface: #0b1f2e; --surface-2: #11293b;
  --ink: #eaf6ff; --ink-2: #b5cfe2; --muted: #86a5bb;
  --line: #1d3a50; --grid: #173044; --axis: #2c4d66;
  --sms: #38bdf8; --sms-ink: #7dd3fc; --voice: #f5b942;
  --btn-bg: #0a86c9; --panel: #04101a;
  --good: #3cc23c; --good-text: #3cc23c; --good-bg: #12301a;
  --warn-text: #fab219; --warn-bg: #362b0f;
  --bad-text: #ef6b6b; --bad-bg: #3a1717;
  --info-bg: #0b2d44;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #06131d; --surface: #0b1f2e; --surface-2: #11293b;
    --ink: #eaf6ff; --ink-2: #b5cfe2; --muted: #86a5bb;
    --line: #1d3a50; --grid: #173044; --axis: #2c4d66;
    --sms: #38bdf8; --sms-ink: #7dd3fc; --voice: #f5b942;
    --btn-bg: #0a86c9; --panel: #04101a;
    --good: #3cc23c; --good-text: #3cc23c; --good-bg: #12301a;
    --warn-text: #fab219; --warn-bg: #362b0f;
    --bad-text: #ef6b6b; --bad-bg: #3a1717;
    --info-bg: #0b2d44;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; margin: 0; }
a { color: var(--sms-ink); }
.mono { font-family: var(--font-mono); }
.label {
  font: 500 10.5px/1.2 var(--font-mono); text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--sms); outline-offset: 2px; }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Shell ---------- */
.safe-top { position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); background: var(--bg); z-index: 60; }
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.sidebar {
  position: sticky; top: env(safe-area-inset-top); height: calc(100vh - env(safe-area-inset-top)); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: var(--sms); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font: 700 17px/1 var(--font-display); letter-spacing: -.02em; }
.brand-sub { font: 500 9.5px/1 var(--font-mono); letter-spacing: .14em; color: var(--muted); margin-top: 3px; display: block; }
.nav-group { margin: 14px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--sms); }
.sidebar-foot { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 12.5px; }
.sidebar-foot a, .sidebar-foot button { color: var(--ink-2); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.sidebar-foot a:hover, .sidebar-foot button:hover { color: var(--ink); }

.main { min-width: 0; }
.topbar {
  position: sticky; top: env(safe-area-inset-top); z-index: 40; height: 62px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding: 0 24px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.wallet {
  display: flex; align-items: center; gap: 12px; background: var(--panel); color: var(--panel-ink);
  border-radius: 999px; padding: 5px 6px 5px 16px;
}
.wallet .label { color: #8fb8d6; }
.wallet-amt { font: 600 15px/1.15 var(--font-mono); }
.wallet-hold { font: 500 11px/1.2 var(--font-mono); color: var(--warn); }
.icon-btn {
  height: 36px; min-width: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font: 500 11px/1 var(--font-mono); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font: 600 12px var(--font-mono); color: var(--sms-ink); }
.view { padding: 24px clamp(16px, 2.2vw, 40px); width: 100%; max-width: none; display: grid; gap: 20px; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 14px 18px 18px; }
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 20px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi-value { font: 700 28px/1.2 var(--font-display); margin-top: 6px; letter-spacing: -.02em; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi-note.up { color: var(--good-text); }

.alert { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 12px; padding: 14px 16px; }
.alert strong { display: block; }
.alert p { margin: 2px 0 0; color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 600 13.5px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-bg); filter: brightness(1.08); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font: 500 12px/1 var(--font-body); white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good-text); }
.pill-warn { background: var(--warn-bg); color: var(--warn-text); }
.pill-bad  { background: var(--bad-bg);  color: var(--bad-text); }
.pill-info { background: var(--info-bg); color: var(--sms-ink); }
.chan { display: inline-flex; align-items: center; gap: 7px; }
.chan i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.chan-sms i { background: var(--sms); } .chan-voice i { background: var(--voice); }
.chan small { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
.table th { background: var(--surface-2); font: 500 10.5px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: left; padding: 10px 14px; white-space: nowrap; }
.table td { padding: 10px 14px; border-top: 1px solid var(--line); white-space: nowrap; }
.table .num { text-align: right; font-family: var(--font-mono); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font: 600 12.5px/1 var(--font-body); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--panel); color: var(--panel-ink); padding: 8px 10px;
  border-radius: 8px; font: 500 12px/1.5 var(--font-mono); box-shadow: 0 6px 18px rgba(0,0,0,.25); opacity: 0; transition: opacity .1s; white-space: nowrap; z-index: 2;
}

.field { display: grid; gap: 6px; }
.field input, .field select, .field textarea {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
  padding: 0 12px; font: 14px var(--font-body); width: 100%;
}
.field textarea { height: auto; padding: 10px 12px; }
.hint { font-size: 12px; color: var(--muted); } .err { font-size: 12px; color: var(--bad-text); }

.summary { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 10px 14px; display: grid; gap: 6px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; }
.summary b { font-family: var(--font-mono); font-weight: 500; }
.summary .total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }
.json { background: var(--panel); color: var(--panel-ink); font: 12px/1.6 var(--font-mono); border-radius: 10px; padding: 14px; overflow-x: auto; }

.toast-host { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast { background: var(--panel); color: var(--panel-ink); padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.28); font-size: 13.5px; animation: toast-in .18s ease-out; }
.toast.bad { box-shadow: inset 4px 0 0 var(--bad), 0 6px 18px rgba(0,0,0,.28); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog.modal { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 0; width: min(420px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(4, 16, 26, .55); }
.modal-body { padding: 18px; display: grid; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 13px var(--font-mono); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--sms); box-shadow: inset 0 0 0 1px var(--sms); background: var(--info-bg); }

/* ---------- Responsive ---------- */
@media (max-width: 1060px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi:nth-child(odd) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: env(safe-area-inset-top); z-index: 50; height: auto; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0 8px; gap: 2px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand, .nav-group, .sidebar-foot, .nav-item .nav-text { display: none; }
  .nav-item { padding: 12px 14px; border-radius: 0; flex: none; }
  .nav-item[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--sms); background: none; }
  .topbar { top: 0; position: static; padding: 0 16px; }
  .view { padding: 16px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .kpi { border-left: 0 !important; }
  .kpi:nth-child(n+2) { border-top: 1px solid var(--line); }
  .topbar h1 { font-size: 17px; }
  .wallet .label, .avatar { display: none; }
  .kpi-value { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Send / logs ---------- */
.grid-send { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; }
.form { display: grid; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.handset { background: var(--panel); color: var(--panel-ink); border-radius: 14px; padding: 18px; min-height: 180px; display: grid; gap: 10px; align-content: start; }
.bubble { background: #12456a; border-radius: 14px 14px 14px 4px; padding: 10px 14px; white-space: pre-wrap; word-break: break-word; max-width: 92%; }
.bubble small { display: block; font: 500 10.5px var(--font-mono); color: #8fb8d6; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .06em; }
.handset .to { font: 500 11px var(--font-mono); color: #8fb8d6; }
.form-err { min-height: 18px; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; padding: 14px 18px 0; }
.card-foot { display: flex; justify-content: space-between; align-items: center; padding: 0 18px 16px; color: var(--muted); font-size: 12.5px; }
@media (max-width: 1060px) { .grid-send { grid-template-columns: 1fr; } .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) { .field-row { grid-template-columns: 1fr; } }

/* ---------- Forms, key rows, pagination, misc ---------- */
.seg button:disabled { cursor: default; }
.seg button:disabled[aria-pressed="false"] { opacity: .45; }
form.seg { margin: 0; }
.stack { display: grid; gap: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.key-row { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.key-row:first-child { border-top: 0; padding-top: 0; }
.key-val { font: 13px var(--font-mono); word-break: break-all; color: var(--ink); }
.key-meta { font-size: 12px; color: var(--muted); }
.key-actions { display: flex; gap: 8px; }
.code { font: 12.5px var(--font-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--sms); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px 16px; color: var(--muted); font-size: 12.5px; }
.pager .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.credit { color: var(--good-text); } .debit { color: var(--ink); }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 1060px) { .cols-2 { grid-template-columns: 1fr; } }
.page-note { color: var(--ink-2); max-width: 70ch; margin: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 12px 14px; }
.stat b { display: block; font: 600 20px var(--font-display); margin-top: 4px; }
.alert.alert-good { border-left-color: var(--good); }
.alert.alert-bad { border-left-color: var(--bad); }
.alert.alert-info { border-left-color: var(--sms); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }
textarea.mono, input.mono, select.mono { font-family: var(--font-mono); }
.d-none { display: none !important; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tpl { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.tpl-thumb { position: relative; height: 160px; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; }
.tpl-thumb iframe { position: absolute; top: 0; left: 0; width: 600px; height: 600px; border: 0; pointer-events: none; transform-origin: top left; background: #fff; }
.tpl-thumb-click { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: rgba(11, 53, 80, 0); color: #fff; font-weight: 600; opacity: 0; transition: .15s; text-decoration: none; }
.tpl-thumb-click:hover { background: rgba(11, 53, 80, .6); opacity: 1; }
.tpl-badge { position: absolute; top: 8px; right: 8px; z-index: 3; }
.tpl-body { padding: 12px 14px; flex: 1; }
.tpl-body h3 { font: 600 14px var(--font-body); margin: 0 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-foot { padding: 10px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-foot form { margin: 0; }
#unlayer-editor { height: 640px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
details.disclose summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.section-label { margin: 6px 0 -4px; }

/* ---------- Campaign wizard ---------- */
.step { display: flex; gap: 12px; align-items: center; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--btn-bg); color: #fff; display: grid; place-items: center; font: 600 13px var(--font-mono); flex: none; }
.subj-counter { font: 500 11px var(--font-mono); color: var(--muted); } .subj-counter.warn { color: var(--warn-text); }
.bcc-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--surface); cursor: text; }
.bcc-box:focus-within { outline: 2px solid var(--sms); outline-offset: 2px; }
.bcc-pill { display: inline-flex; gap: 6px; align-items: center; background: var(--info-bg); color: var(--sms-ink); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 12.5px; }
.bcc-pill button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.bcc-input-raw { border: 0 !important; outline: 0 !important; flex: 1; min-width: 160px; height: 26px !important; padding: 0 !important; background: transparent !important; }
.r-card { display: block; cursor: pointer; }
.r-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.r-card-inner { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.r-card input[type="radio"]:checked + .r-card-inner { border-color: var(--sms); box-shadow: inset 0 0 0 1px var(--sms); background: var(--info-bg); }
.r-card input:focus-visible + .r-card-inner { outline: 2px solid var(--sms); outline-offset: 2px; }
.src-tabs { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.src-tab { border: 0; background: none; padding: 7px 14px; border-radius: 7px; font: 600 12.5px var(--font-body); color: var(--ink-2); cursor: pointer; }
.src-tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.tpl-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.tpl-pick { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); }
.tpl-pick:hover:not(.active) { background: var(--surface-2); }
.tpl-pick.active { border-color: var(--sms); box-shadow: 0 0 0 2px var(--sms); }
.tpl-pick .tpl-thumb { height: 120px; }
.tpl-pick .tpl-thumb iframe { width: 600px; }
.tpl-check { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--sms); color: #fff; display: none; place-items: center; z-index: 3; }
.tpl-label { padding: 8px 10px; } .tpl-label .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .tpl-label .cat { font-size: 12px; color: var(--muted); }
#htmlPreviewFrame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.var-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.var-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 860px) { .var-grid { grid-template-columns: 1fr; } }

/* ---------- Auth (sign in, register, verify) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 6fr; }
.auth-side { background: var(--panel); color: var(--panel-ink); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side .brand { color: #fff; padding: 0; }
.auth-side .brand-sub { color: #8fb8d6; }
.auth-side h2 { font: 700 30px/1.15 var(--font-display); letter-spacing: -.02em; margin: 0 0 12px; }
.auth-side p { color: #b9d2e6; max-width: 38ch; margin: 0; }
.auth-points { display: grid; gap: 10px; margin-top: 22px; padding: 0; list-style: none; color: #cfe3f2; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points i { width: 8px; height: 8px; border-radius: 2px; background: var(--sms); flex: none; }
.auth-points i.v { background: var(--voice); }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); position: relative; }
.auth-card { width: min(440px, 100%); display: grid; gap: 18px; }
.auth-card h1 { font-size: 24px; font-weight: 600; }
.auth-card .sub-line { color: var(--ink-2); margin: -10px 0 0; }
.auth-top { position: absolute; top: 16px; right: 16px; }
.auth .btn-block { width: 100%; height: 42px; }
.auth-foot { text-align: center; color: var(--ink-2); font-size: 13.5px; }
.pw-wrap { position: relative; } .pw-wrap input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 5px; height: 28px; border: 0; background: none; color: var(--sms-ink); font: 600 12px var(--font-body); cursor: pointer; }
.code-boxes { display: flex; gap: 10px; justify-content: center; }
.code-boxes input { width: 56px; height: 64px; text-align: center; font: 600 26px var(--font-mono); border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); }
.code-boxes input:focus { outline: 2px solid var(--sms); outline-offset: 2px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-side { padding: 22px 20px; } .auth-side h2, .auth-side p, .auth-points { display: none; } }

/* ---------- Admin ---------- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--warn-bg); color: var(--warn-text); font: 600 11px/20px var(--font-mono); text-align: center; }
.topbar-search { position: relative; flex: 1 1 260px; max-width: 420px; margin: 0 16px; }
.topbar-search input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink); padding: 0 12px 0 34px; font: 14px var(--font-body); }
.topbar-search .icon { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topbar-search input:focus { background: var(--surface); outline: 2px solid var(--sms); outline-offset: 0; }
.attn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.attn { display: block; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 16px; color: inherit; text-decoration: none; }
.attn:hover { background: var(--surface-2); }
.attn.on { border-left-color: var(--warn); }
.attn.ok { border-left-color: var(--good); }
.attn b { display: block; font: 700 26px/1.2 var(--font-display); }
.attn span { color: var(--ink-2); font-size: 13px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--sms); }
.dl { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 0; margin: 0; }
.dl dt, .dl dd { padding: 11px 0; border-top: 1px solid var(--line); margin: 0; }
.dl dt:first-of-type, .dl dd:first-of-type { border-top: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { word-break: break-word; }
@media (max-width: 560px) { .dl { grid-template-columns: 1fr; } .dl dt { border-top: 1px solid var(--line); padding-bottom: 0; } .dl dd { border-top: 0; padding-top: 2px; } }
.cust-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.cust-id { display: flex; gap: 14px; align-items: center; min-width: 0; }
.cust-id h2 { font-size: 20px; margin: 0; }
.cust-id p { margin: 2px 0 0; color: var(--ink-2); word-break: break-all; }
.avatar-lg { width: 48px; height: 48px; font-size: 15px; flex: none; }
.cell-main { display: grid; line-height: 1.35; } .cell-main small { color: var(--muted); font-size: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px 0; }
.toolbar .field { min-width: 150px; flex: 1 1 150px; }
.toolbar .grow { flex: 3 1 240px; }
.toolbar .tools { align-self: flex-end; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: var(--bad); filter: brightness(1.08); }
.btn-ghost-danger { color: var(--bad-text); }
.zone { border: 1px solid var(--bad); border-radius: 12px; padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }
.inline-form input, .inline-form select { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 0 10px; font: 13px var(--font-body); }
.inline-form input[type=number] { width: 110px; }
.seg-link { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-link a { padding: 6px 12px; border-radius: 7px; font: 600 12.5px/1 var(--font-body); color: var(--ink-2); text-decoration: none; }
.seg-link a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
dialog.modal.wide { width: min(560px, calc(100vw - 32px)); }
.tip-list { margin: 0; padding-left: 18px; color: var(--ink-2); }
.editor-box { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.editor-box .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.editor-box .ql-container.ql-snow { border: 0; font: 14px var(--font-body); }
.editor-box .ql-editor { min-height: 220px; color: var(--ink); }
[hidden] { display: none !important; }
@media (max-width: 700px) {
  .topbar h1 { display: none; }
  .topbar-search { margin: 0; max-width: none; }
  .toolbar .field { flex-basis: 100%; }
  .cust-head .tools { width: 100%; }
}

/* ---------- Logo ---------- */
.logo { display: block; height: 32px; width: auto; max-width: 100%; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .logo-light { display: none; }
  :root:not([data-theme]) .logo-dark { display: block; }
}
.brand .brand-sub { margin-top: 5px; }
