:root {
  --navy-900: #070b18;
  --navy-850: #0a1022;
  --panel: #111a33;
  --panel-2: #0f1730;
  --border: #20305c;
  --border-soft: #1a2648;
  --text: #eaf0ff;
  --muted: #93a2c9;
  --muted-2: #6b7aa3;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --blue-soft: #93c5fd;
  --emerald: #34d399;
  --rose: #f87171;
  --amber: #fbbf24;
  --cyan: #22d3ee;
  --font: "Sora", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 14px;
  --sider: 240px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 40% -10%, #101a3a 0%, transparent 55%),
    radial-gradient(700px 400px at 100% 0%, rgba(59,130,246,.12) 0%, transparent 45%),
    var(--navy-900);
  line-height: 1.5;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { color: var(--blue-soft); }
.muted { color: var(--muted); }
.tiny { font-size: .72rem; }
.lead { color: var(--muted); max-width: 40rem; font-size: 1.02rem; }
.eyebrow {
  color: var(--muted-2); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 600; margin-bottom: .35rem;
}

.gate {
  position: relative; min-height: 100vh; overflow: hidden;
  display: grid; place-items: center; padding: 2.5rem 1.25rem;
}
.gate-aurora {
  position: absolute; inset: -20% -10% auto -10%; height: 70%;
  background:
    radial-gradient(45% 55% at 30% 40%, rgba(59,130,246,.28), transparent 70%),
    radial-gradient(40% 50% at 70% 30%, rgba(34,211,238,.14), transparent 65%),
    radial-gradient(50% 60% at 50% 80%, rgba(99,102,241,.12), transparent 70%);
  filter: blur(8px); pointer-events: none;
  animation: gate-drift 12s ease-in-out infinite alternate;
}
.gate-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image:
    linear-gradient(rgba(147,162,201,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(147,162,201,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}
.gate-stage {
  position: relative; z-index: 1; width: min(28rem, 100%);
  text-align: center; padding: 1rem 0 2rem;
}
.gate-brand {
  margin: 1.1rem 0 0; font-size: clamp(2.4rem, 6vw, 3.4rem); font-weight: 700;
  letter-spacing: -.04em; line-height: 1.05;
  background: linear-gradient(180deg, #f4f7ff 10%, #93c5fd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-tag {
  margin: .35rem 0 0; color: var(--muted-2); font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase; font-weight: 600;
}
.gate-msg {
  margin: 1.35rem 0 0; color: var(--muted); font-size: .98rem; min-height: 1.5em;
}
.gate-detail {
  margin: .65rem auto 0; max-width: 26rem; color: var(--rose);
  font-size: .85rem; line-height: 1.45;
}
.gate-actions {
  margin-top: 1.35rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap;
}
.gate-shield {
  width: 88px; height: 88px; margin: 0 auto; position: relative;
  display: grid; place-items: center;
}
.gate-shield-ring {
  position: absolute; inset: 0; border-radius: 28px;
  border: 1px solid rgba(96,165,250,.45);
  background: linear-gradient(160deg, rgba(59,130,246,.22), rgba(7,11,24,.2));
  box-shadow: 0 0 0 1px rgba(15,23,48,.6), 0 20px 50px rgba(0,0,0,.35);
}
.gate.is-busy .gate-shield-ring {
  animation: gate-pulse 2.2s ease-in-out infinite;
}
.gate-shield-core {
  position: relative; z-index: 1;
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #60a5fa, #2563eb);
  color: #070b18; font-weight: 700; font-size: 1.45rem;
  letter-spacing: -.03em;
}
.gate-scan {
  height: 2px; width: min(220px, 55%); margin: 1.4rem auto 0;
  border-radius: 999px; overflow: hidden;
  background: rgba(59,130,246,.12);
}
.gate.is-busy .gate-scan::after {
  content: ""; display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, transparent, var(--blue-2), transparent);
  animation: gate-scan 1.4s ease-in-out infinite;
}
.gate.is-error .gate-scan { display: none; }
.gate.is-error .gate-shield-ring {
  border-color: rgba(248,113,113,.45);
  background: linear-gradient(160deg, rgba(248,113,113,.16), rgba(7,11,24,.2));
  animation: none;
}
@keyframes gate-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: .85; }
}
@keyframes gate-scan {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}
@keyframes gate-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.04); }
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 11px; background: var(--blue);
  color: #070b18; font-weight: 700; font-size: 1.25rem;
  display: grid; place-items: center;
}

.shell { display: none; min-height: 100vh; }
html[data-ready="1"] .shell { display: grid; grid-template-columns: var(--sider) 1fr; }
html[data-ready="1"] #sso-gate { display: none !important; }

.sider {
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border-soft);
  background: rgba(7,11,24,.88); backdrop-filter: blur(12px);
  display: flex; flex-direction: column; padding: 1.1rem .85rem;
}
.sider-brand { display: flex; gap: .7rem; align-items: center; padding: .4rem .5rem 1.1rem; }
.sider-brand strong { display: block; font-size: 1rem; }
.sider-brand small { color: var(--muted-2); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.sider-nav { display: grid; gap: .2rem; }
.sider-nav button {
  appearance: none; border: 0; background: transparent; text-align: left;
  color: var(--muted); font: inherit; font-size: .9rem; font-weight: 500;
  padding: .55rem .75rem; border-radius: 9px; cursor: pointer;
}
.sider-nav button:hover { color: var(--text); background: rgba(59,130,246,.08); }
.sider-nav button.active { color: var(--text); background: rgba(59,130,246,.16); }
.sider-foot { margin-top: auto; padding: .8rem .5rem; }
.plan-pill {
  display: inline-block; background: rgba(59,130,246,.18); color: var(--blue-soft);
  border: 1px solid rgba(59,130,246,.35); border-radius: 999px;
  padding: .2rem .65rem; font-size: .75rem; font-weight: 600; margin-bottom: .4rem;
}

.maincol { min-width: 0; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border-soft);
  background: rgba(7,11,24,.55); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.top-actions { display: flex; align-items: center; gap: .6rem; }
.acct { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .85rem; }
.acct-av {
  width: 28px; height: 28px; border-radius: 999px; background: #1e3a6e;
  color: var(--blue-soft); display: grid; place-items: center; font-size: .72rem; font-weight: 600;
}

main { padding: 1.25rem 1.5rem 3rem; max-width: 1180px; }
.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font: inherit; font-size: .85rem; font-weight: 600;
  padding: .5rem .9rem; border-radius: 9px; cursor: pointer;
}
.btn:hover { border-color: var(--blue); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #070b18; }
.btn.primary:hover { background: var(--blue-2); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: .3rem .6rem; font-size: .78rem; }
.btn.danger { border-color: rgba(248,113,113,.4); color: var(--rose); }

.hero-panel {
  background: linear-gradient(135deg, rgba(17,26,51,.98), rgba(15,23,48,.9));
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px);
  padding: 1.5rem 1.6rem; margin-bottom: 1rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.hero-panel.compact { padding: 1.2rem 1.4rem; }
.hero-panel h2 {
  margin: 0 0 .5rem; font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 650; letter-spacing: -.03em; line-height: 1.15;
}
.hero-panel h2 em { font-style: normal; color: var(--blue-soft); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }

.panel {
  background: linear-gradient(180deg, rgba(17,26,51,.95), rgba(15,23,48,.92));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.panel h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 600; }
.panel .sub, .sub { color: var(--muted); font-size: .88rem; margin: .25rem 0 1rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.panel-head h3 { margin: 0; }
.panel-head.spread, .spread { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.section-title { margin: 0; font-size: 1.25rem; font-weight: 650; }
.narrative { font-size: 1.02rem; line-height: 1.55; color: var(--blue-soft); }

.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem; margin-bottom: 1rem;
}
.stat {
  background: var(--panel-2); border: 1px solid var(--border-soft);
  border-radius: 12px; padding: .9rem 1rem;
}
.stat .label { color: var(--muted-2); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.stat .value { font-family: var(--mono); font-size: 1.5rem; font-weight: 500; margin-top: .15rem; }
.stat.allow .value { color: var(--emerald); }
.stat.block .value { color: var(--rose); }
.stat.mask .value { color: var(--cyan); }

.grid-2 { display: grid; grid-template-columns: 1.05fr .95fr; gap: 1rem; }
.status-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  border: 1px solid var(--border-soft); background: rgba(15,23,48,.7);
  border-radius: 999px; padding: .25rem .65rem; font-size: .76rem; color: var(--muted);
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.chip.ok i { background: var(--emerald); box-shadow: 0 0 0 3px rgba(52,211,153,.15); }
.chip.bad i { background: var(--rose); }
.chip.warn i { background: var(--amber); }

.steps { margin: 0; padding-left: 1.1rem; color: var(--muted); }
.steps li { margin-bottom: .65rem; }
.steps strong { color: var(--text); display: block; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li {
  padding: .45rem 0 .45rem 1.4rem; position: relative; color: var(--muted); font-size: .92rem;
}
.checks li::before {
  content: ""; position: absolute; left: 0; top: .7rem;
  width: .55rem; height: .55rem; border-radius: 2px; background: var(--blue);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { color: var(--muted-2); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }
.mono { font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.pill {
  display: inline-block; font-family: var(--mono); font-size: .68rem;
  padding: .15rem .45rem; border-radius: 6px; text-transform: uppercase;
}
.pill.block { background: rgba(248,113,113,.12); color: var(--rose); }
.pill.mask { background: rgba(34,211,238,.12); color: var(--cyan); }
.pill.allow { background: rgba(52,211,153,.12); color: var(--emerald); }
.empty { color: var(--muted-2); padding: 1.2rem .25rem; }

.policy-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .85rem; margin-bottom: 1rem;
}
.policy-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); padding: 1rem 1.05rem;
  display: flex; flex-direction: column; gap: .45rem; min-height: 160px;
}
.policy-card.active { border-color: var(--blue); box-shadow: 0 0 0 1px rgba(59,130,246,.35); }
.policy-card h4 { margin: 0; font-size: 1rem; }
.policy-card p { margin: 0; color: var(--muted); font-size: .84rem; flex: 1; }
.tag {
  display: inline-block; font-size: .68rem; color: var(--muted-2);
  border: 1px solid var(--border-soft); border-radius: 999px; padding: .1rem .45rem; margin-right: .25rem;
}
.card-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }

.field { margin-bottom: .85rem; }
.field label {
  display: block; color: var(--muted-2); font-size: .7rem; letter-spacing: .06em;
  text-transform: uppercase; font-weight: 600; margin-bottom: .35rem;
}
.field input, .field select, .field textarea, .select {
  width: 100%; background: var(--navy-900); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: .6rem .75rem; font: inherit; font-size: .9rem;
}
.field textarea { min-height: 72px; resize: vertical; font-family: var(--mono); font-size: .8rem; }
.select { width: auto; }
.field input:focus, .field select:focus, .field textarea:focus, .select:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.18);
}
.toggle-list { display: grid; gap: .5rem; }
.toggle {
  display: flex; gap: .7rem; align-items: flex-start;
  padding: .7rem .8rem; border-radius: 10px;
  border: 1px solid var(--border-soft); background: rgba(7,11,24,.35);
}
.toggle strong { display: block; font-size: .9rem; }
.toggle span { color: var(--muted); font-size: .78rem; }
.toggle input { margin-top: .25rem; accent-color: var(--blue); }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; }
.stack { display: grid; gap: .55rem; }
.stack .row {
  display: flex; justify-content: space-between; gap: .75rem;
  padding: .65rem .75rem; border: 1px solid var(--border-soft); border-radius: 10px;
  background: rgba(7,11,24,.3); font-size: .88rem;
}
.event-list { display: grid; gap: .45rem; max-height: 420px; overflow: auto; }
.event-item {
  border: 1px solid var(--border-soft); border-radius: 10px; padding: .65rem .75rem;
  background: rgba(7,11,24,.3); font-size: .85rem;
}
.event-item strong { display: block; margin-bottom: .15rem; }

.bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: .5rem; align-items: center; font-size: .8rem; }
.bar-track { height: 8px; background: #0a1228; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-soft)); border-radius: 999px; }
.bar-row span:last-child { font-family: var(--mono); color: var(--muted); text-align: right; }

.meter {
  height: 10px; background: #0a1228; border-radius: 999px; overflow: hidden; margin: .6rem 0;
}
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--emerald)); transition: width .4s ease; }

.plan-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .85rem; margin-bottom: 1rem;
}
.plan-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); padding: 1.1rem; display: flex; flex-direction: column; gap: .4rem;
}
.plan-card.popular { border-color: var(--blue); position: relative; }
.plan-card .price { font-size: 1.6rem; font-weight: 700; letter-spacing: -.03em; }
.plan-card .price small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.plan-card ul { margin: .4rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: .82rem; flex: 1; }
.plan-card.current { outline: 1px solid rgba(52,211,153,.5); }

.codeblk {
  background: #050914; border: 1px solid var(--border-soft); border-radius: 10px;
  padding: .9rem 1rem; font-family: var(--mono); font-size: .78rem; color: var(--blue-soft);
  overflow-x: auto; white-space: pre; line-height: 1.55;
}
.copy-row { display: flex; gap: .5rem; align-items: center; margin-top: .55rem; }
.copy-row input {
  flex: 1; background: #050914; border: 1px solid var(--border-soft); color: var(--text);
  border-radius: 8px; padding: .55rem .7rem; font-family: var(--mono); font-size: .8rem;
}

.toast {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 50;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.4);
  font-size: .88rem; transform: translateY(120%); opacity: 0; transition: .25s ease;
}
.toast.show { transform: none; opacity: 1; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(5,8,18,.72);
  display: grid; place-items: center; padding: 1rem;
}
.modal {
  width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; padding: 1.5rem; text-align: center;
}

@media (max-width: 960px) {
  html[data-ready="1"] .shell { grid-template-columns: 1fr; }
  .sider { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .sider-nav { grid-template-columns: repeat(3, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
