:root {
  --navy: #0B1F3A;
  --blue: #1565D8;
  --blue-dark: #0f52b8;
  --teal: #0AAFB0;
  --white: #FFFFFF;
  --gray-text: #5A6880;
  --border: #DDE5F0;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --green: #22c55e;
  --red: #ef4444;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }

/* ── Nav ── */
nav.portal-nav {
  position: sticky; top: 0; z-index: 100;
  height: 68px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 28px);
  flex-shrink: 0;
}
nav.portal-nav .logo {
  display: inline-flex; align-items: center; gap: 11px;
  letter-spacing: -.02em;
}
nav.portal-nav .logo-mark {
  width: 48px; height: 48px; flex-shrink: 0;
  border-radius: 10px;
}
nav.portal-nav .nav-actions {
  display: flex; align-items: center; gap: 12px;
}
.nav-link {
  font-size: .88rem; font-weight: 600; color: var(--gray-text);
  padding: 8px 14px; border-radius: 8px;
  transition: color .15s, background .15s;
}
.nav-link:hover { color: var(--navy); background: rgba(11,31,58,.05); }
.nav-link--muted { opacity: .85; }

/* ── Main shell ── */
.portal-main {
  flex: 1;
  background: linear-gradient(165deg, #0B1F3A 0%, #08182e 42%, #051020 100%);
  color: rgba(255, 255, 255, 0.92);
  padding: clamp(36px, 7vw, 64px) clamp(18px, 4vw, 28px) clamp(48px, 8vw, 80px);
  position: relative;
  overflow: hidden;
}
.portal-main::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 15% 20%, rgba(21,101,216,0.18), transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 75%, rgba(10,175,176,0.12), transparent 50%);
}
.portal-inner {
  position: relative; z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}
.portal-inner--wide { max-width: 820px; }

.portal-eyebrow {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em;
  color: rgba(255,255,255,.45);
  margin-bottom: 10px;
  text-align: center;
}
.portal-title {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  font-weight: 400; line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--white);
  margin-bottom: 10px;
  text-align: center;
}
.portal-lead {
  font-size: 1rem; line-height: 1.65;
  color: rgba(255,255,255,.76);
  margin-bottom: 28px;
  text-align: center;
}

/* ── Cards ── */
.portal-card {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 22px 24px;
  margin-bottom: 16px;
  backdrop-filter: blur(8px);
}
.portal-card h2 {
  font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  color: rgba(255,255,255,.48);
  margin-bottom: 14px;
}
.portal-card p.hint {
  font-size: .88rem;
  color: rgba(255,255,255,.62);
  margin-top: 8px;
  line-height: 1.55;
}

/* ── Forms ── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: .82rem; font-weight: 600;
  color: rgba(255,255,255,.72);
  margin-bottom: 7px;
}
.field input {
  width: 100%;
  padding: 13px 15px;
  border-radius: 11px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.28);
  color: var(--white);
  font-family: inherit;
  font-size: .96rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: rgba(255,255,255,.35); }
.field input:focus {
  border-color: rgba(21,101,216,.65);
  box-shadow: 0 0 0 3px rgba(21,101,216,.22);
}

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%;
  padding: 14px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--blue) 0%, #0a4fb8 100%);
  color: var(--white);
  font-weight: 700; font-size: .98rem;
  border: none; cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 10px 32px rgba(21,101,216,.4);
  font-family: inherit;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(21,101,216,.48);
}
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.16);
  color: rgba(255,255,255,.9);
  font-weight: 600; font-size: .9rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.btn-secondary:hover { background: rgba(255,255,255,.14); }

.btn-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-top: 8px;
}
.btn-row .btn-primary { width: auto; flex: 1; min-width: 140px; }

.status-msg {
  font-size: .9rem; font-weight: 600;
  margin-top: 12px;
  min-height: 1.4em;
}
.status-msg.ok { color: var(--green); }
.status-msg.err { color: #fca5a5; }

/* ── Code box ── */
.code-box {
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  font-size: .86rem; line-height: 1.55;
  color: rgba(255,255,255,.92);
  word-break: break-all;
  white-space: pre-wrap;
}

/* ── Status badge ── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
}
.badge--active {
  background: rgba(34,197,94,.16);
  color: #86efac;
  border: 1px solid rgba(34,197,94,.28);
}
.badge--paused {
  background: rgba(239,68,68,.12);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,.25);
}
.badge--pending {
  background: rgba(251,191,36,.12);
  color: #fde68a;
  border: 1px solid rgba(251,191,36,.25);
}

.dashboard-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.dashboard-header .portal-title { text-align: left; margin: 0; }
.dashboard-header .portal-lead { text-align: left; margin: 0; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}
.meta-item {
  padding: 12px 14px;
  background: rgba(0,0,0,.22);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
}
.meta-item span {
  display: block;
  font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  color: rgba(255,255,255,.42);
  margin-bottom: 4px;
}
.meta-item strong {
  font-size: .92rem; font-weight: 600;
  color: rgba(255,255,255,.9);
  word-break: break-all;
}

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.toggle-row p { font-size: .92rem; color: rgba(255,255,255,.78); max-width: 420px; }

footer.portal-footer {
  flex-shrink: 0;
  background: var(--navy);
  color: rgba(255,255,255,.7);
  padding: 28px;
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center;
  font-size: .78rem;
}
footer.portal-footer a { color: rgba(255,255,255,.72); }
footer.portal-footer a:hover { color: var(--white); }

.hidden { display: none !important; }

@media (max-width: 720px) {
  nav.portal-nav { height: 60px; }
  nav.portal-nav .logo { font-size: 1.12rem; }
  nav.portal-nav .logo-mark { width: 34px; height: 34px; }
  .dashboard-header { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary { transition: none; }
}
