/* Revenue HQ: server-rendered pages (sign-in, enrollment, account, approvals). System fonts only; no external assets. */
:root {
  --bg-0: #03060f;
  --bg-1: #060d1f;
  --bg-2: #0a1530;
  --panel: rgba(12, 22, 44, 0.66);
  --panel-solid: #0d1830;
  --line: rgba(125, 190, 255, 0.16);
  --line-strong: rgba(125, 211, 252, 0.38);
  --ink: #e8f1ff;
  --ink-soft: #a9b8d6;
  --ink-faint: #6f7f9f;
  --cyan: #38bdf8;
  --cyan-bright: #7dd3fc;
  --blue: #2563eb;
  --electric: #3b82f6;
  --danger: #fb7185;
  --danger-bg: rgba(244, 63, 94, 0.12);
  --ok: #34d399;
  --ok-bg: rgba(16, 185, 129, 0.12);
  --radius: 18px;
  --focus: 0 0 0 3px rgba(56, 189, 248, 0.45), 0 0 0 1px #7dd3fc;
  --sans: "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body.ui {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-0);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--cyan-bright); text-underline-offset: 3px; }
a:hover { color: #bae6fd; }
code { font: 0.88em var(--mono); background: rgba(56, 189, 248, 0.1); border: 1px solid var(--line); border-radius: 6px; padding: 0.08em 0.4em; color: var(--cyan-bright); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* --- backdrop: deep navy fields, a faint grid and a slow glow ---------------------------------------------------------- */
.backdrop {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 50% -10%, rgba(37, 99, 235, 0.28), transparent 60%),
    radial-gradient(40rem 30rem at 85% 110%, rgba(14, 165, 233, 0.16), transparent 60%),
    radial-gradient(36rem 28rem at 10% 90%, rgba(30, 64, 175, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0) 70%);
}
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(125, 190, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(125, 190, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 35%, #000 20%, transparent 75%);
}
.backdrop::after {
  content: ""; position: absolute; left: 50%; top: 18%; width: 46rem; height: 46rem; margin-left: -23rem;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 62%);
  filter: blur(10px);
  animation: breathe 9s ease-in-out infinite;
}

/* --- brand and AI core ------------------------------------------------------------------------------------------------------ */
.brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.wordmark {
  margin: 0.2rem 0 0; font-weight: 700; font-size: clamp(1.55rem, 1.2rem + 1.4vw, 2.1rem); letter-spacing: 0.32em; text-indent: 0.32em;
  background: linear-gradient(180deg, #f2f8ff 10%, #9cc8ff 95%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark span { background: linear-gradient(90deg, #38bdf8, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.95rem; letter-spacing: 0.08em; }

.core { display: block; overflow: visible; }
.core-large { width: clamp(132px, 22vw, 176px); height: auto; }
.core-small { width: 34px; height: 34px; }
.core .ring { transform-box: view-box; transform-origin: 100px 100px; }
.core .ring-a { animation: spin 18s linear infinite; }
.core .ring-b { animation: spin 26s linear infinite reverse; }
.core .ring-c { animation: spin 60s linear infinite; }
.core .core-halo { transform-box: view-box; transform-origin: 100px 100px; animation: pulse 4.8s ease-in-out infinite; }
.core .core-nucleus { filter: drop-shadow(0 0 10px rgba(125, 211, 252, 0.9)); }
.core-large { filter: drop-shadow(0 0 28px rgba(56, 189, 248, 0.28)); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.82; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spinner { to { transform: rotate(360deg); } }

/* --- sign-in / enrollment layout -------------------------------------------------------------------------------------------- */
.auth-shell {
  position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem;
  padding: max(2rem, env(safe-area-inset-top)) 16px max(1.5rem, env(safe-area-inset-bottom));
}
.panel {
  width: 100%; max-width: 420px; padding: 1.9rem 1.9rem 1.6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.02) inset, 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  animation: rise 0.5s ease-out both;
}
.panel h1 { margin: 0 0 0.35rem; font-size: 1.2rem; font-weight: 650; letter-spacing: 0.01em; }
.panel .lead { margin: 0 0 1.2rem; color: var(--ink-soft); font-size: 0.93rem; }
.panel p { color: var(--ink-soft); }
.fineprint { margin: 0; color: var(--ink-faint); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; text-wrap: balance; }

/* --- form controls ------------------------------------------------------------------------------------------------------------ */
form { margin: 0; }
.field { margin: 0 0 1.1rem; }
.field label { display: block; margin: 0 0 0.45rem; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.input-wrap { position: relative; }
input[type="password"], input[type="text"] {
  width: 100%; height: 52px; padding: 0 3.2rem 0 1rem;
  font: 1.02rem/1 var(--sans); color: var(--ink); letter-spacing: 0.02em;
  background: rgba(3, 8, 20, 0.7); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input::placeholder { color: var(--ink-faint); }
input:hover { border-color: var(--line-strong); }
input:focus, input:focus-visible { outline: none; border-color: var(--cyan); background: rgba(3, 10, 26, 0.85); box-shadow: var(--focus); border-radius: 12px; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field-code input { font-family: var(--mono); letter-spacing: 0.08em; padding-right: 1rem; }
.reveal {
  position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 9px; color: var(--ink-soft); cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.reveal:hover { color: var(--cyan-bright); background: rgba(56, 189, 248, 0.1); }
.reveal svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reveal .eye-closed { display: none; }
.reveal[aria-pressed="true"] .eye-open { display: none; }
.reveal[aria-pressed="true"] .eye-closed { display: block; }
.hint { margin: 0.45rem 0 0; font-size: 0.82rem; color: var(--ink-faint); }
.caps-warning { margin: 0.45rem 0 0; font-size: 0.82rem; color: #fbbf24; }

.btn-primary {
  position: relative; width: 100%; height: 56px; margin-top: 0.4rem; border: 0; border-radius: 14px; cursor: pointer;
  font: 650 1.04rem/1 var(--sans); letter-spacing: 0.04em; color: #fff;
  background: linear-gradient(100deg, #0ea5e9 0%, #2563eb 55%, #4f46e5 100%);
  box-shadow: 0 10px 30px -10px rgba(37, 99, 235, 0.75), 0 0 0 1px rgba(125, 211, 252, 0.25) inset;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 16px 40px -12px rgba(56, 189, 248, 0.7), 0 0 0 1px rgba(186, 230, 253, 0.4) inset; }
.btn-primary:active { transform: translateY(0); filter: brightness(0.98); }
.btn-primary:focus-visible { box-shadow: var(--focus), 0 10px 30px -10px rgba(37, 99, 235, 0.75); border-radius: 14px; }
.btn-primary[aria-busy="true"] { color: transparent; pointer-events: none; }
.btn-primary[aria-busy="true"]::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff; border-radius: 50%; animation: spinner 0.8s linear infinite;
}
.btn-secondary {
  height: 44px; padding: 0 1.1rem; border-radius: 11px; cursor: pointer; font: 600 0.92rem/1 var(--sans); color: var(--ink);
  background: rgba(56, 189, 248, 0.08); border: 1px solid var(--line-strong); transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-secondary:hover { background: rgba(56, 189, 248, 0.16); border-color: var(--cyan); }
.btn-danger { color: #fecdd3; background: rgba(244, 63, 94, 0.1); border-color: rgba(251, 113, 133, 0.45); }
.btn-danger:hover { background: rgba(244, 63, 94, 0.18); border-color: var(--danger); }

/* --- messages ------------------------------------------------------------------------------------------------------------------- */
.notice { margin: 0 0 1.1rem; padding: 0.75rem 0.9rem 0.75rem 2.6rem; border-radius: 12px; position: relative; font-size: 0.92rem; animation: rise 0.25s ease-out both; }
.notice p { margin: 0; color: inherit; }
.notice ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.notice::before { content: ""; position: absolute; left: 0.9rem; top: 0.95rem; width: 0.95rem; height: 0.95rem; border-radius: 50%; }
.notice-error { color: #fecdd3; background: var(--danger-bg); border: 1px solid rgba(251, 113, 133, 0.4); }
.notice-error::before { background: radial-gradient(circle, #fb7185 35%, rgba(251, 113, 133, 0.25) 40%); }
.notice-success { color: #a7f3d0; background: var(--ok-bg); border: 1px solid rgba(52, 211, 153, 0.4); }
.notice-success::before { background: radial-gradient(circle, #34d399 35%, rgba(52, 211, 153, 0.25) 40%); }
.notice-info { color: #bae6fd; background: rgba(56, 189, 248, 0.1); border: 1px solid var(--line-strong); }
.notice-info::before { background: radial-gradient(circle, #38bdf8 35%, rgba(56, 189, 248, 0.25) 40%); }

/* --- signed-in pages -------------------------------------------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.7rem max(16px, env(safe-area-inset-left)); background: rgba(5, 10, 22, 0.72); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand-small { flex-direction: row; gap: 0.6rem; }
.brand-small .wordmark { font-size: 0.95rem; letter-spacing: 0.26em; margin: 0; }
.topnav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.topnav a { padding: 0.45rem 0.8rem; border-radius: 9px; color: var(--ink-soft); text-decoration: none; font-size: 0.92rem; font-weight: 550; }
.topnav a:hover { color: var(--ink); background: rgba(56, 189, 248, 0.1); }
.app-shell { position: relative; z-index: 1; max-width: 52rem; margin: 0 auto; padding: 2rem 16px 4rem; }
.page-title { margin: 0 0 1.4rem; font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.9rem); font-weight: 680; letter-spacing: 0.01em; }
.card {
  margin: 0 0 1.2rem; padding: 1.4rem 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: rise 0.35s ease-out both;
}
.card h2 { margin: 0 0 0.9rem; font-size: 1.02rem; font-weight: 650; letter-spacing: 0.02em; }
.card p, .card li, .card dd { color: var(--ink-soft); }
.card .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }
.card form.inline { display: inline; }
.meta { color: var(--ink-faint); font-size: 0.85rem; }
.pill { display: inline-block; padding: 0.12rem 0.55rem; border-radius: 99px; font-size: 0.75rem; font-weight: 650; letter-spacing: 0.04em; background: rgba(56, 189, 248, 0.12); color: var(--cyan-bright); border: 1px solid var(--line-strong); }
.session-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.session-list li { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(3, 8, 20, 0.45); }
.session-list .when { font-size: 0.86rem; color: var(--ink-faint); }
.approvals { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.approvals li { padding: 0.8rem 1rem; border: 1px solid var(--line); border-radius: 12px; background: rgba(3, 8, 20, 0.45); }
.card dl { margin: 0 0 1rem; display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; }
.card dt { color: var(--ink-faint); font-size: 0.86rem; }
.card dd { margin: 0; word-break: break-word; }
.card pre { white-space: pre-wrap; background: rgba(3, 8, 20, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; color: var(--ink); font: 0.88rem/1.5 var(--mono); }
textarea { width: 100%; min-height: 5.5rem; padding: 0.7rem 0.9rem; font: 0.95rem/1.4 var(--sans); color: var(--ink); background: rgba(3, 8, 20, 0.7); border: 1px solid var(--line); border-radius: 12px; }
textarea:focus { outline: none; border-color: var(--cyan); box-shadow: var(--focus); }

/* --- small screens (iPhone) ---------------------------------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .auth-shell { justify-content: flex-start; gap: 1.2rem; padding-top: max(1.6rem, env(safe-area-inset-top)); }
  .panel { padding: 1.5rem 1.2rem 1.3rem; border-radius: 16px; }
  .wordmark { letter-spacing: 0.26em; text-indent: 0.26em; }
  .card { padding: 1.1rem 1rem; }
  .card dl { grid-template-columns: 1fr; }
  .topbar { gap: 0.4rem; }
}
@media (min-width: 1100px) and (min-height: 760px) {
  .panel { max-width: 440px; padding: 2.2rem 2.2rem 1.9rem; }
}

/* --- reduced motion: no orbiting, pulsing, rising or spinning ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .btn-primary[aria-busy="true"] { color: #fff; }
  .btn-primary[aria-busy="true"]::after { display: none; }
}
@media (forced-colors: active) {
  .backdrop { display: none; }
  .panel, .card, input { border: 1px solid CanvasText; }
}

/* --- links styled as buttons, legacy form, plain buttons inside cards ---------------------------------------------- */
.actions { margin: 1rem 0 0; }
a.btn-primary, a.btn-secondary { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.btn-primary.btn-link { display: flex; width: 100%; }
a.btn-secondary { height: 44px; }
.legacy { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.9rem; }
.legacy summary { cursor: pointer; margin-bottom: 0.8rem; }
.card button:not([class]) { height: 42px; padding: 0 1rem; margin: 0.2rem 0.4rem 0.2rem 0; border-radius: 10px; cursor: pointer; font: 600 0.92rem/1 var(--sans); color: var(--ink); background: rgba(56, 189, 248, 0.1); border: 1px solid var(--line-strong); }
.card button:not([class]):hover { background: rgba(56, 189, 248, 0.18); border-color: var(--cyan); }
.card label { color: var(--ink-soft); font-size: 0.9rem; }
