/* ============================================================
   EDGE//DNS — DNS Manager design system
   Shared stylesheet for the Agency Console (admin) and the
   Client Portal (tenant). Simplified from the design reference.
   ============================================================ */

:root {
  --bg: #0c1322;
  --bg-deep: #070e1d;
  --panel: #141b2b;
  --panel-2: #191f2f;
  --panel-3: #232a3a;
  --panel-4: #2e3545;

  --border: #232a3a;
  --border-soft: #1b2231;
  --border-strong: #374151;

  --text: #dce2f7;
  --muted: #98a2b8;
  --dim: #6b7488;

  --orange: #f38020;
  --orange-hover: #fa9a4b;
  --orange-soft: rgba(243, 128, 32, 0.12);
  --on-orange: #1b0f00;

  --blue: #38bdf8;
  --blue-soft: rgba(56, 189, 248, 0.14);
  --purple: #c084fc;
  --purple-soft: rgba(192, 132, 252, 0.14);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.13);
  --amber: #fb923c;
  --amber-soft: rgba(251, 146, 60, 0.14);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.13);
  --gray: #9ca3af;
  --gray-soft: rgba(156, 163, 175, 0.12);

  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  --sidebar-w: 232px;
  --topbar-h: 56px;

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

selection { background: var(--orange-soft); }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4, p { margin: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 99px; border: 2px solid var(--bg); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Material Symbols renders as ligature text until the icon font loads, which
   flashes raw words like "dashboard". Each icon slot is a fixed 1em square, so
   the blank placeholder and the loaded glyph occupy exactly the same space (no
   layout shift). The `icons-ready` class is added by app.js / inline JS once the
   ligature font is confirmed rendering. */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  line-height: 1;
  visibility: hidden;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.icons-ready .icon { visibility: visible; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 15px; }
.strong { font-weight: 600; }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }
.nowrap { white-space: nowrap; }
.cap { text-transform: capitalize; }
.balance { text-wrap: balance; }

/* ---------- layout shell ---------- */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: rgba(20, 27, 43, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  background: var(--orange);
  color: var(--on-orange);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-mark .icon { font-size: 18px; }
.brand-name { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; font-size: 14px; }
.brand-ver {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--orange); background: var(--panel-3);
  padding: 2px 5px; border-radius: var(--radius-sm);
}

.sidebar {
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  padding: 10px 8px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  z-index: 40;
}

.nav-scroll { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.nav-group { margin-bottom: 8px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; margin-bottom: 2px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim);
}
.nav-label .tag {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  background: var(--panel-3); color: var(--muted);
  padding: 1px 5px; border-radius: var(--radius-sm);
}
.nav-label .tag.admin { color: var(--blue); }
.nav-label .tag.tenant { color: var(--orange); }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px;
  cursor: pointer; border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.nav-item .icon { font-size: 18px; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active {
  background: var(--panel-3); color: var(--orange);
  font-weight: 600; border-left-color: var(--orange);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.side-user {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px;
}
.side-user .avatar { width: 28px; height: 28px; }
.side-user .who { min-width: 0; flex: 1; }
.side-user .who b { display: block; font-family: var(--mono); font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }

.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 20px) 24px 48px;
  min-height: 100vh;
}
.main-inner { max-width: 1280px; margin: 0 auto; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
  .main { margin-left: 0; padding-left: 16px; padding-right: 16px; }
  .only-desktop { display: none !important; }
  .nav-backdrop {
    position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 39;
    background: rgba(7, 14, 29, 0.7); backdrop-filter: blur(2px);
  }
}
@media (min-width: 901px) { .only-mobile { display: none !important; } }

/* ---------- typography helpers ---------- */

.page-kicker { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.page-kicker .path { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.page-desc { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ---------- grid ---------- */

.grid { display: grid; gap: 16px; }
.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.split { grid-template-columns: 1.6fr 1fr; }
.grid.split-r { grid-template-columns: 1fr 1.6fr; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.stack-lg { margin-top: 20px; }
.stack-md { margin-top: 14px; }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.split, .grid.split-r { grid-template-columns: 1fr; }
  .grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .grid.cols-2 { grid-template-columns: 1fr; }
}

/* ---------- surfaces ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card.tight { padding: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card-head.bordered { padding-bottom: 12px; border-bottom: 1px solid var(--border); }

.well { background: var(--bg-deep); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px; }

.kpi {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden;
}
.kpi-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; display: flex; align-items: baseline; gap: 8px; }
.kpi-value .unit { font-size: 18px; font-weight: 600; color: var(--orange); }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.kpi .icon { color: var(--orange); font-size: 18px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}
.btn:hover { background: rgba(255, 255, 255, 0.05); border-color: #4b5563; }
.btn .icon { font-size: 17px; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--on-orange); font-weight: 600; }
.btn.primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn.danger { border-color: rgba(248, 113, 113, 0.5); background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: #ef4444; border-color: #ef4444; color: #fff; }
.btn.subtle { background: var(--panel-2); border-color: var(--border); color: var(--muted); }
.btn.subtle:hover { color: var(--text); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn .icon { font-size: 19px; }
.icon-btn.danger:hover { color: var(--red); }

/* segmented control */
.segment { display: inline-flex; background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.segment button {
  border: 0; background: transparent; color: var(--muted);
  height: 26px; padding: 0 10px; border-radius: 2px; cursor: pointer; font-size: 12px; font-weight: 500;
}
.segment button:hover { color: var(--text); }
.segment button.active { background: var(--panel-3); color: var(--orange); }

/* ---------- badges & pills ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 2px 6px; border-radius: var(--radius-sm);
  border: 1px solid transparent; white-space: nowrap;
}
.badge.plain { background: var(--panel-3); color: var(--muted); font-family: var(--sans); letter-spacing: 0.04em; }
.badge.orange { background: var(--orange-soft); color: var(--orange); border-color: rgba(243, 128, 32, 0.3); }
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: rgba(56, 189, 248, 0.3); }
.badge.purple { background: var(--purple-soft); color: var(--purple); border-color: rgba(192, 132, 252, 0.3); }
.badge.green { background: var(--green-soft); color: var(--green); border-color: rgba(52, 211, 153, 0.3); }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(251, 146, 60, 0.3); }
.badge.red { background: var(--red-soft); color: var(--red); border-color: rgba(248, 113, 113, 0.3); }
.badge.gray { background: var(--gray-soft); color: var(--gray); border-color: rgba(156, 163, 175, 0.3); }

.dot { width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0; display: inline-block; }
.dot.green { background: var(--green); }
.dot.orange { background: var(--orange); }
.dot.blue { background: var(--blue); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--gray); }
.dot.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* DNS record type badges */
.rectype {
  display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: var(--radius-sm); border: 1px solid transparent; text-transform: uppercase;
}
.rectype.A, .rectype.AAAA { background: rgba(2, 132, 199, 0.15); border-color: rgba(56, 189, 248, 0.3); color: var(--blue); }
.rectype.CNAME { background: var(--purple-soft); border-color: rgba(192, 132, 252, 0.3); color: var(--purple); }
.rectype.MX { background: rgba(234, 88, 12, 0.15); border-color: rgba(251, 146, 60, 0.3); color: var(--amber); }
.rectype.TXT { background: rgba(75, 85, 99, 0.2); border-color: rgba(156, 163, 175, 0.3); color: var(--gray); }
.rectype.NS, .rectype.SRV { background: rgba(5, 150, 105, 0.15); border-color: rgba(52, 211, 153, 0.3); color: var(--green); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tbody tr:hover { background: var(--panel-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td .primary-cell { display: flex; align-items: center; gap: 10px; }
table.tbl .cell-title { font-weight: 600; color: var(--text); }
table.tbl .cell-sub { font-size: 11px; color: var(--dim); }
.tbl-actions { display: flex; gap: 4px; justify-content: flex-end; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--dim); }

.copy { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; color: var(--dim); }
.copy:hover { color: var(--text); }
.copy .icon { font-size: 14px; }
.copy.copied { color: var(--green); }
/* Long values (e.g. joined DKIM TXT records) clip instead of stretching the table. */
.clip { display: inline-block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); }
.input, .select, textarea.input {
  height: 38px; width: 100%; padding: 0 10px;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--sans); font-size: 13px; outline: none;
  transition: border-color 0.12s;
}
textarea.input { height: auto; padding: 10px; resize: vertical; }

/* Input with a trailing action (e.g. show/hide password). */
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 40px; }
.input-wrap .reveal {
  position: absolute; top: 0; right: 0; height: 100%; width: 38px;
  display: grid; place-items: center; border: 0; background: transparent;
  color: var(--muted); cursor: pointer;
}
.input-wrap .reveal:hover { color: var(--text); }
.input-wrap .reveal .icon { font-size: 19px; }
.input.mono, .select.mono { font-family: var(--mono); font-size: 12px; }
.input::placeholder { color: var(--dim); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--orange); }
.select { appearance: none; background-image: none; cursor: pointer; }
.input[disabled], .select[disabled] { opacity: 0.6; cursor: not-allowed; }

.field-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 10px; height: 32px; color: var(--dim);
}
.search input { flex: 1; border: 0; background: transparent; color: var(--text); outline: none; font-size: 12px; min-width: 0; }
.search .icon { font-size: 16px; }
.search kbd { font-family: var(--mono); font-size: 10px; background: var(--panel-3); color: var(--muted); padding: 1px 5px; border-radius: 3px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px; border-radius: 99px; background: var(--panel-4); position: relative; transition: background 0.15s; flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 99px;
  background: #fff; transition: transform 0.15s;
}
.switch input:checked + .track { background: var(--orange); }
.switch input:checked + .track::after { transform: translateX(16px); }

.checkbox { width: 16px; height: 16px; accent-color: var(--orange); }

/* ---------- meters / bars ---------- */

.meter { height: 6px; border-radius: 99px; background: var(--panel-4); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--orange); }
.meter.blue > span { background: var(--blue); }
.meter.green > span { background: var(--green); }
.meter.red > span { background: var(--red); }

.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-row .bar-label { width: 130px; flex-shrink: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .bar-track { flex: 1; height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 99px; background: var(--orange); }
.bar-row .bar-val { width: 92px; text-align: right; font-family: var(--mono); font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* ---------- logs / timeline ---------- */

.log-list { display: flex; flex-direction: column; }
.log-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.log-item:last-child { border-bottom: 0; }
.log-icon {
  width: 26px; height: 26px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: grid; place-items: center; background: var(--panel-3); color: var(--muted); font-size: 15px;
}
.log-icon.green { color: var(--green); }
.log-icon.orange { color: var(--orange); }
.log-icon.red { color: var(--red); }
.log-icon.blue { color: var(--blue); }
.log-item .log-body { flex: 1; min-width: 0; }
.log-item .log-title { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.log-item .log-meta { font-size: 11px; color: var(--dim); margin-top: 2px; }
.log-item .log-time { font-family: var(--mono); font-size: 11px; color: var(--dim); white-space: nowrap; }

/* ---------- toast ---------- */

.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-3); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--green);
  color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 13px; min-width: 240px; max-width: 380px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.18s ease;
}
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast .icon { font-size: 17px; color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--blue); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- modal / drawer ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(7, 14, 29, 0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: overlay-in 0.15s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); }

/* ---------- empty / loading ---------- */

.empty { text-align: center; padding: 40px 16px; color: var(--dim); }
.empty .icon { font-size: 34px; opacity: 0.5; }
.empty p { margin-top: 8px; font-size: 13px; }

/* ---------- loading skeleton ---------- */

.skeleton {
  background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2));
  background-size: 200% 100%;
  animation: sk 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- spinner (inline, inherits the button's colour) ---------- */

.spinner {
  width: 13px; height: 13px; flex-shrink: 0; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; opacity: 0.85;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.8s; } }

/* ---------- boot loader (painted before the shell mounts) ---------- */

.boot { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: var(--bg); }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.boot-mark { width: 52px; height: 52px; border-radius: var(--radius-lg); }
.boot-mark .icon { font-size: 28px; }
.boot-name { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; font-size: 17px; }
.boot-sub { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.boot-bar { margin-top: 8px; width: 168px; height: 3px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.boot-bar > span { display: block; height: 100%; width: 40%; border-radius: 999px; background: var(--orange); animation: boot-slide 1.15s ease-in-out infinite; }
@keyframes boot-slide { 0% { transform: translateX(-105%); } 100% { transform: translateX(255%); } }
@media (prefers-reduced-motion: reduce) { .boot-bar > span { animation: none; width: 100%; opacity: 0.65; } }

/* ---------- charts ---------- */

.chart { width: 100%; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .area { fill: url(#areaGrad); opacity: 0.5; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.orange { stroke: var(--orange); }
.chart .line.blue { stroke: var(--blue); }
.chart .line-alt { fill: none; stroke: var(--blue); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0.6; }
.chart .axis { fill: var(--dim); font-family: var(--mono); font-size: 10px; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.orange { background: var(--orange); }
.legend i.blue { background: var(--blue); }
.legend i.green { background: var(--green); }

.donut { --p: 94; width: 130px; height: 130px; border-radius: 99px; display: grid; place-items: center;
  background: conic-gradient(var(--orange) calc(var(--p) * 1%), var(--panel-3) 0); }
.donut::after { content: attr(data-label); width: 92px; height: 92px; border-radius: 99px; background: var(--panel);
  display: grid; place-items: center; font-family: var(--mono); font-size: 18px; font-weight: 700; }

/* ---------- misc ---------- */

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .split-2 { grid-template-columns: 1fr; } }

.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.kv .v { font-family: var(--mono); font-size: 12px; }

.panel-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.panel-section + .panel-section { margin-top: 16px; }
.grid > .panel-section { display: flex; flex-direction: column; }
.grid > .panel-section + .panel-section { margin-top: 0; }
.grid > .panel-section > .body { flex: 1; }
.list-fill { display: flex; flex-direction: column; }
.list-fill > .list-row { flex-grow: 1; }
.panel-section > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-section > .body { padding: 16px; }

.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.list-row:last-child { border-bottom: 0; }

.tag-note { font-size: 12px; color: var(--dim); }
.divider { height: 1px; background: var(--border); margin: 14px 0; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 18px;
}
.pointer { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- avatar & login ---------- */

.avatar {
  width: 32px; height: 32px; border-radius: 99px; flex-shrink: 0;
  background: var(--panel-3); border: 1px solid var(--border-strong); color: var(--text);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; font-weight: 700;
}

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { max-width: 380px; }

.status-strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--border);
  font-size: 11px; color: var(--muted);
}
