:root {
  --bg: #090d16;
  --surface: #111827;
  --surface-2: #1a2335;
  --border: #263248;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.14);
  --green: #10b981;
  --green-dim: rgba(16, 185, 129, 0.14);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.14);
  --tron: #38bdf8;
  --canvas-deep: #05080f;
  --radius: 10px;
  --radius-sm: 7px;
  /* Self-hosted type (public/assets/fonts/fonts.css) — no CDN, no Google Fonts. */
  --font-display: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: var(--font-body);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; }
a { color: var(--amber); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* Ticker */
.ticker-bar {
  background: #05080f;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  padding: 7px 0;
  overflow: hidden;
  white-space: nowrap;
}
.ticker-inner { display: inline-flex; gap: 28px; padding-left: 20px; animation: ticker 35s linear infinite; }
.ticker-inner:hover { animation-play-state: paused; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.tick-item { color: var(--muted); }
.tick-item b { color: var(--green); }

/* Header */
header {
  border-bottom: 1px solid var(--border);
  background: rgba(9, 13, 22, 0.92);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; gap: 16px; flex-wrap: wrap; }
.nav-links { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: 0.15s ease;
}
.btn:hover { border-color: var(--amber); text-decoration: none; }
.btn-primary { background: var(--amber); color: #090d16; border-color: var(--amber); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-green { background: var(--green); color: #052e16; border-color: var(--green); }
.btn-danger { background: var(--red-dim); color: #fca5a5; border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-transform: uppercase;
}
.badge-green { background: var(--green-dim); color: #34d399; border-color: rgba(16,185,129,0.4); }
.badge-amber { background: var(--amber-dim); color: #fbbf24; border-color: rgba(245,158,11,0.4); }
.badge-red { background: var(--red-dim); color: #fca5a5; border-color: rgba(239,68,68,0.4); }

/* THE BOX — ReferStash-Style Hero Card */
.the-box {
  border: 2px solid var(--amber);
  background: linear-gradient(135deg, #111827 0%, #161f33 100%);
  border-radius: 12px;
  padding: 22px;
  position: relative;
  margin: 22px 0;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), 0 14px 36px rgba(0, 0, 0, 0.45);
}
.box-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.box-body { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: center; }
@media (max-width: 780px) { .box-body { grid-template-columns: 1fr; } }
.box-title { margin: 6px 0; font-size: 24px; line-height: 1.25; }
.box-meta { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 12px; }
.box-chart-wrap {
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.box-stats { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; margin-bottom: 6px; }

/* Inputs & Tables */
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #0b1120;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber); }
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-row { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; }

/* Tabs & Modals */
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
.tab-btn.admin-tab { color: #34d399; }
.tab-btn.admin-tab.active { color: #34d399; border-bottom-color: #10b981; }
.hidden { display: none !important; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  max-width: 560px; width: 100%; max-height: 92vh; overflow-y: auto; padding: 24px;
}
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  background: var(--surface-2); border: 1px solid var(--amber); padding: 12px 18px;
  border-radius: 8px; font-size: 14px; max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.progress-bar { height: 8px; background: #0b1120; border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress-fill { height: 100%; background: var(--green); transition: width 0.3s ease; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.pill { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 600; }
.pill.active { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
footer { border-top: 1px solid var(--border); margin-top: 56px; padding: 24px 0; color: var(--muted); font-size: 13px; }


/* v1.4 Brand Hero Banner, Dividers & Trust Strip */
.hero-banner {
  position: relative;
  margin-top: 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #070b14 url('/assets/brand/hero-banner.svg') right center / cover no-repeat;
  padding: 36px 32px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.hero-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 11, 20, 0.94) 0%, rgba(7, 11, 20, 0.80) 48%, rgba(7, 11, 20, 0.12) 100%);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 620px;
}
.hero-title {
  margin: 10px 0 8px;
  font-size: clamp(26px, 3.6vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.hero-badges {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
  align-items: center;
}
.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(17, 24, 39, 0.82);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 7px;
}
.divider-art {
  margin: 26px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.divider-art img {
  width: 100%;
  max-height: 32px;
  display: block;
}
.the-box {
  background-image: url('/assets/brand/bg-grid-pattern.svg'), linear-gradient(135deg, #111827 0%, #161f33 100%);
}
.chain-icon {
  width: 24px;
  height: 24px;
  vertical-align: middle;
  border-radius: 6px;
}


/* ==========================================================================
   Nightdesk layout studies (dark / graphite operations dashboard), rethemed
   through this package's own tokens: brass amber, emerald drip, tron cyan.
   Structure follows ~/projects/kituwa/design-kituwa/static/layouts/nightdesk.
   ========================================================================== */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.16); }

.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5.2vw, 62px);
  line-height: 1.0;
  letter-spacing: -.045em;
}
.display em, .serif-em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -.01em;
}
.lede { margin: 0; max-width: 62ch; font-size: 16.5px; line-height: 1.6; color: var(--muted); }

/* Hero split — nightdesk .hero-split, collapsing to one column on mobile */
.hero-split {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 44px;
  align-items: center;
  padding: 44px 0 8px;
}
.hero-split > div:last-child img { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--canvas-deep); }
@media (max-width: 860px) {
  .hero-split { grid-template-columns: 1fr; gap: 24px; padding: 28px 0 4px; }
  .hero-split > div:last-child { order: -1; }
}

/* KPI strip — nightdesk .nd-kpi-row */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 22px 0 6px; }
.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: linear-gradient(180deg, #131b2a, #0d1420);
}
.kpi span { display: block; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi b { display: block; font-family: var(--font-display); font-size: 26px; letter-spacing: -.035em; margin-top: 8px; }
.kpi i { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--green); }
@media (max-width: 780px) { .kpi-row { grid-template-columns: 1fr 1fr; } }

/* Wide app shell panel — nightdesk .nd-app */
.panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, #101827, #0b1220);
  padding: 18px;
  margin: 18px 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.panel-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .panel-grid { grid-template-columns: 1fr; } }

/* Signals */
.signal { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.signal::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,.16); }
.signal.amber::before { background: var(--amber); box-shadow: 0 0 0 3px rgba(245,158,11,.16); }
.signal.tron::before { background: var(--tron); box-shadow: 0 0 0 3px rgba(56,189,248,.16); }

/* Demo notice — the instance is an unfunded demo. Always visible, never dismissed. */
.demo-note {
  border: 1px solid rgba(245,158,11,.45);
  background: rgba(245,158,11,.08);
  color: #fbbf24;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 14px 0;
}
.demo-note b { color: #fde68a; }
.demo-note .mono { color: #fca5a5; }

/* Element · button — uiverse-astronaut/black-octopus-6, rethemed to brass amber.
   Underline gradient uses the three brand accents instead of the vendor rainbow. */
.aether-prism-btn {
  --aether-ink: #f8fafc;
  --aether-void: #06080c;
  --aether-grad: linear-gradient(90deg, var(--amber) 0%, var(--green) 52%, var(--tron) 100%);
  --aether-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 13px 26px 15px;
  margin: 0;
  background: var(--aether-ink);
  color: var(--aether-void);
  border: 1px solid var(--aether-ink);
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 120ms var(--aether-ease);
}
.aether-prism-btn::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--aether-grad);
  transition: height 120ms var(--aether-ease);
}
.aether-prism-btn:hover { transform: translateY(-1px); text-decoration: none; }
.aether-prism-btn:hover::after { height: 4px; }
.aether-prism-btn:active { transform: translateY(0); }
.aether-prism-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--aether-void), 0 0 0 3px var(--amber); }
.aether-prism-btn__icon { stroke-width: 1.5; transition: transform 220ms var(--aether-ease); }
.aether-prism-btn:hover .aether-prism-btn__icon { transform: translateX(3px); }
.aether-prism-btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.aether-prism-btn--ghost:hover { border-color: var(--amber); }

/* Element · card — uiverse-astronaut/nervous-earwig-97, rethemed to terminal slate.
   Carries The Box, KPI briefs and the admin summary. */
.aether-brief {
  --aether-stratum: #111827;
  --aether-strata: #1a2335;
  --aether-vapor: #94a3b8;
  --aether-hairline: #263248;
  --aether-hairline-strong: #33415c;
  --aether-positive: #10b981;
  --aether-grad: linear-gradient(90deg, var(--amber) 0%, var(--green) 52%, var(--tron) 100%);
  --aether-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 26px 26px 22px;
  background: var(--aether-stratum);
  border: 1px solid var(--aether-hairline);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  transition: border-color 220ms var(--aether-ease), transform 220ms var(--aether-ease);
}
.aether-brief:hover { border-color: var(--aether-hairline-strong); transform: translateY(-1px); }
.aether-brief--flat:hover { transform: none; }
.aether-brief__ribbon { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--aether-grad); }
.aether-brief__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.aether-brief__index { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--aether-vapor); }
.aether-brief__sym { margin-right: 0.4em; color: var(--amber); font-style: normal; }
.aether-brief__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 4px;
  background: var(--aether-strata);
  border: 1px solid var(--aether-hairline);
  border-radius: 999px;
  font-family: var(--mono); font-weight: 500; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text);
}
.aether-brief__dot { width: 6px; height: 6px; border-radius: 999px; background: var(--aether-positive); box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.aether-brief__title { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.015em; }
.aether-brief__title em { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 1.08em; }
.aether-brief__body { margin: 0; color: var(--aether-vapor); font-size: 14px; line-height: 1.6; }
.aether-brief__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--aether-hairline); }
.aether-brief__meta { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--aether-vapor); }
.aether-brief__link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0; background: transparent; border: none;
  color: var(--text);
  font-family: var(--mono); font-weight: 500; font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  cursor: pointer; position: relative;
}
.aether-brief__link::after {
  content: ""; position: absolute; left: 0; right: 22px; bottom: -3px; height: 1px;
  background: var(--aether-grad); transform: scaleX(0); transform-origin: left;
  transition: transform 220ms var(--aether-ease);
}
.aether-brief__link:hover { text-decoration: none; }
.aether-brief__link:hover::after { transform: scaleX(1); }
.aether-brief__link svg { stroke-width: 1.5; transition: transform 220ms var(--aether-ease); }
.aether-brief__link:hover svg { transform: translateX(3px); }

/* Dense table — nightdesk .nd-table */
.nd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.nd-table th { text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.nd-table td { padding: 11px 10px; border-bottom: 1px solid rgba(38,50,72,.7); color: var(--muted); }
.nd-table td:first-child { color: var(--text); font-weight: 500; }
.nd-table tr:last-child td { border-bottom: 0; }

/* Network bar sits above everything, including the ticker. */
kituwa-network { display: block; }
