/* ScopeGuard — neon crypto-AI design system (v2).
   Palette: deep navy base, neon cyan/violet/pink, glass cards, glow orbs. */
:root {
  --bg: #05070f;
  --bg2: #0a0f1f;
  --panel: rgba(13, 19, 38, 0.66);
  --panel-solid: #0d1326;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.3);
  --text: #eef2ff;
  --muted: #93a3c4;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --lime: #a3e635;
  --amber: #fbbf24;
  --ok: #34d399;
  --err: #fb7185;
  --radius: 16px;
  --font: "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --grad: linear-gradient(120deg, var(--cyan), var(--violet) 45%, var(--pink));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: none; transition: color .15s ease, filter .15s ease; }
a:hover { color: #67e8f9; }
.mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }

/* ---------- ambient background ---------- */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora::before {
  content: ""; position: absolute; inset: -25%;
  background:
    radial-gradient(34% 30% at 18% 14%, rgba(34, 211, 238, .14), transparent 70%),
    radial-gradient(30% 28% at 82% 10%, rgba(139, 92, 246, .16), transparent 70%),
    radial-gradient(36% 30% at 70% 88%, rgba(236, 72, 153, .13), transparent 70%),
    radial-gradient(26% 24% at 12% 82%, rgba(163, 230, 53, .07), transparent 70%);
  filter: blur(46px);
  animation: auroraDrift 18s ease-in-out infinite alternate;
}
.aurora::after {
  content: ""; position: absolute; inset: 0;
  background: conic-gradient(from 180deg at 50% 50%,
    transparent 0deg, rgba(34,211,238,.05) 90deg, transparent 180deg,
    rgba(236,72,153,.05) 270deg, transparent 360deg);
  animation: spinSlow 40s linear infinite;
}
@keyframes auroraDrift { 0% { transform: translate3d(-2%,-1%,0) scale(1); } 100% { transform: translate3d(3%,2%,0) scale(1.1); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }
.grid-overlay {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(148,163,184,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 95% 75% at 50% 0%, black 25%, transparent 80%);
}

/* ---------- topbar (guests) ---------- */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .85rem 2rem;
  background: rgba(5, 7, 15, .72); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 800; font-size: 1.08rem; color: var(--text); letter-spacing: -.02em; display: flex; gap: .5rem; align-items: center; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 9px;
  background: var(--grad); display: inline-grid; place-items: center;
  font-size: .78rem; color: #05070f; font-weight: 800;
  box-shadow: 0 0 22px rgba(139, 92, 246, .55);
}
.topbar nav { display: flex; gap: 1.4rem; align-items: center; }
.topbar nav a { color: var(--muted); font-size: .92rem; }
.topbar nav a:hover { color: var(--text); }
.topbar .who { color: var(--muted); font-size: .85rem; }
.inline { display: inline; }
.linklike { background: none; border: none; color: var(--cyan); cursor: pointer; font: inherit; padding: 0; }
.linklike.danger { color: var(--err); }

/* ---------- app shell (authenticated) ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.4rem;
  padding: 1.4rem 1rem;
  background: linear-gradient(180deg, rgba(10, 15, 31, .9), rgba(5, 7, 15, .9));
  border-right: 1px solid var(--border); backdrop-filter: blur(14px);
}
.side-nav { display: flex; flex-direction: column; gap: .35rem; margin-top: 1.2rem; }
.side-nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .9rem; border-radius: 12px;
  color: var(--muted); font-size: .94rem; font-weight: 550;
  border: 1px solid transparent; transition: all .15s ease;
}
.side-nav a:hover { color: var(--text); background: rgba(34, 211, 238, .06); }
.side-nav a.active {
  color: #fff; background: linear-gradient(90deg, rgba(34,211,238,.14), rgba(139,92,246,.16));
  border-color: rgba(139, 92, 246, .35);
  box-shadow: 0 0 18px rgba(139, 92, 246, .18);
}
.side-user { margin-top: auto; display: flex; flex-direction: column; gap: .4rem; padding: .8rem; border-top: 1px solid var(--border); font-size: .84rem; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { max-width: 1120px; width: 100%; margin: 0 auto; padding: 1.6rem 2rem; }

/* ---------- layout ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 1.4rem; gap: 1rem; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.02em; background: linear-gradient(90deg, #fff, #b8c6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subnav { display: flex; gap: 1.1rem; }

/* ---------- glass cards with neon borders ---------- */
.card {
  position: relative; border-radius: var(--radius); padding: 1.35rem; margin-bottom: 1.25rem;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--panel), var(--panel)) padding-box,
    linear-gradient(135deg, rgba(34,211,238,.35), rgba(139,92,246,.35), rgba(236,72,153,.35)) border-box;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 44px rgba(2, 5, 14, .5);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card.hover:hover { transform: translateY(-3px); box-shadow: 0 18px 54px rgba(2, 5, 14, .6), 0 0 26px rgba(139, 92, 246, .14); }
.card h3 { margin: 0 0 .6rem; font-size: 1.04rem; letter-spacing: -.01em; }

.grid { display: grid; gap: 1.05rem; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 1.4rem; }
.grid.features { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.steps { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* stat cards with chips + sparklines */
.stat-card { overflow: hidden; }
.stat-head { display: flex; align-items: center; gap: .55rem; margin-bottom: .7rem; }
.chip {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); color: #05070f; font-size: 1rem;
  box-shadow: 0 0 16px rgba(139, 92, 246, .4);
}
.stat-num {
  font-size: 1.95rem; font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(90deg, #fff, #9db4f0); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .09em; }
.spark { width: 100%; height: 34px; margin-top: .6rem; display: block; }
.spark polyline { stroke-dasharray: 300; stroke-dashoffset: 300; animation: drawLine 1.6s ease forwards .2s; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; position: relative;
  background: var(--grad); background-size: 180% 100%;
  color: #04060f; font-weight: 700; border: none; border-radius: 11px;
  padding: .62rem 1.4rem; cursor: pointer;
  transition: background-position .4s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 4px 24px rgba(139, 92, 246, .35);
}
.btn:hover { background-position: 100% 0; transform: translateY(-1px); box-shadow: 0 8px 30px rgba(236, 72, 153, .4); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--cyan); border: 1px solid var(--border-strong); box-shadow: none; }
.btn.ghost:hover { border-color: var(--cyan); box-shadow: 0 0 18px rgba(34, 211, 238, .25); }
.btn.small { padding: .34rem .85rem; font-size: .85rem; border-radius: 9px; }
.btn.big { width: 100%; margin-top: 1.1rem; padding: .95rem; font-size: 1.02rem; border-radius: 13px; }

/* ---------- hero (guests) ---------- */
.hero { text-align: center; padding: 4.6rem 1rem 3rem; position: relative; }
.hero .kicker {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: .3rem .95rem; font-size: .82rem; color: var(--muted);
  background: rgba(13, 19, 38, .7); margin-bottom: 1.4rem; animation: fadeUp .8s ease both;
}
.hero .kicker .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: pulse 2s ease infinite; }
.hero h1 { font-size: clamp(2.3rem, 5.2vw, 3.8rem); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 1.2rem; animation: fadeUp .8s .08s ease both; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { max-width: 620px; margin: 0 auto 2rem; color: var(--muted); font-size: 1.08rem; animation: fadeUp .8s .16s ease both; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; animation: fadeUp .8s .24s ease both; }

.mockup {
  max-width: 880px; margin: 3.2rem auto 0;
  border: 1px solid transparent; border-radius: 18px;
  background:
    linear-gradient(180deg, #0b1324, #070d1a) padding-box,
    linear-gradient(135deg, rgba(34,211,238,.4), rgba(139,92,246,.4), rgba(236,72,153,.4)) border-box;
  box-shadow: 0 30px 90px rgba(2, 6, 16, .7); overflow: hidden; animation: fadeUp 1s .3s ease both;
}
.mockup .bar { display: flex; gap: .45rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); }
.mockup .bar i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.mockup .bar i:nth-child(1){ background:#fb7185; } .mockup .bar i:nth-child(2){ background:#fbbf24; } .mockup .bar i:nth-child(3){ background:#34d399; }
.mockup .body { display: grid; grid-template-columns: 1.25fr 1fr; min-height: 300px; }
.mockup .scanlines { position: relative; overflow: hidden; border-right: 1px solid var(--border); padding: 1.2rem; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.mockup .scanlines .line { display: flex; gap: .6rem; margin-bottom: .55rem; opacity: 0; animation: lineIn .5s ease forwards; }
.mockup .scanlines .ok { color: var(--lime); } .mockup .scanlines .warn { color: var(--amber); } .mockup .scanlines .err { color: var(--err); }
.mockup .sweep { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent, rgba(34,211,238,.1), transparent); height: 60px; animation: sweep 3.4s ease-in-out infinite; }
.mockup .graph-pane { display: grid; place-items: center; padding: 1rem; }
.mockup .graph-pane svg { width: 100%; height: 240px; }

@keyframes sweep { 0% { top: -15%; } 100% { top: 105%; } }
@keyframes lineIn { to { opacity: 1; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- forms ---------- */
form label { display: block; margin-bottom: .95rem; font-size: .9rem; color: var(--muted); }
form label > span { display: block; margin-bottom: .3rem; }
form input, form select, form textarea {
  width: 100%; padding: .6rem .75rem;
  background: rgba(8, 13, 27, .85); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 11px;
  font: inherit; font-size: .95rem; transition: border-color .15s ease, box-shadow .15s ease;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15);
}
form .check { display: flex; gap: .6rem; align-items: flex-start; color: var(--text); }
form .check input { width: auto; margin-top: .25rem; }
.formgrid fieldset { border: 1px solid var(--border); border-radius: 13px; margin-bottom: 1.2rem; padding: 1.1rem; }
.formgrid legend { color: var(--cyan); font-weight: 650; padding: 0 .4rem; font-size: .9rem; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.auth { display: flex; justify-content: center; padding-top: 4rem; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card h2 { margin-top: 0; letter-spacing: -.02em; }
.auth-card.center { text-align: center; }
.big-num { font-size: 3.2rem; font-weight: 800; }

/* ---------- impact presets ---------- */
.presets { display: flex; gap: .7rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.preset {
  flex: 1; min-width: 120px; text-align: left;
  background: rgba(8, 13, 27, .85); border: 1px solid var(--border-strong);
  border-radius: 13px; padding: .8rem 1rem; cursor: pointer; color: var(--text);
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.preset:hover { transform: translateY(-2px); }
.preset.active { border-color: var(--cyan); background: rgba(34, 211, 238, .09); box-shadow: 0 0 22px rgba(34, 211, 238, .2); }
.preset b { display: block; font-size: .95rem; }
.preset span { color: var(--muted); font-size: .78rem; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .62rem .65rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--muted); font-weight: 650; text-transform: uppercase; font-size: .74rem; letter-spacing: .07em; }
tr { transition: background .12s ease; }
tr:hover td { background: rgba(34, 211, 238, .04); }
td.actions { display: flex; gap: .9rem; }

/* ---------- badges ---------- */
.badge { padding: .17rem .62rem; border-radius: 999px; font-size: .74rem; background: var(--panel-solid); border: 1px solid var(--border-strong); }
.badge.st-completed { color: var(--ok); border-color: rgba(52, 211, 153, .5); }
.badge.st-running, .badge.st-queued { color: var(--cyan); border-color: rgba(34, 211, 238, .5); animation: pulse 2.2s ease infinite; }
.badge.st-refused, .badge.st-error, .badge.st-aborted,
.badge.st-target_unhealthy, .badge.st-session_lost, .badge.st-mfa_required,
.badge.st-auth_failed, .badge.st-guardian_unavailable { color: var(--err); border-color: rgba(251, 113, 133, .5); }
.badge.role-admin { color: var(--amber); border-color: rgba(251, 191, 36, .5); }
.badge.role-superadmin {
  color: #fff; border: none;
  background: var(--grad);
  box-shadow: 0 0 14px rgba(139, 92, 246, .45);
  font-weight: 700;
}

/* ---------- flash / footer ---------- */
.flash { margin: 1rem auto 0; max-width: 1120px; padding: .7rem 1.1rem; border-radius: 11px; animation: fadeUp .3s ease both; }
.flash.ok { background: rgba(52, 211, 153, .1); color: var(--ok); border: 1px solid rgba(52, 211, 153, .4); }
.flash.error { background: rgba(251, 113, 133, .1); color: var(--err); border: 1px solid rgba(251, 113, 133, .4); }
.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 2.2rem 1rem 3.2rem; }

/* ---------- findings ---------- */
.finding { border: 1px solid var(--border); border-radius: 13px; margin-bottom: .8rem; padding: 1rem; background: rgba(8, 13, 27, .6); }
.finding.sev-critical { border-left: 4px solid #f43f5e; }
.finding.sev-high { border-left: 4px solid #fb7185; }
.finding.sev-medium { border-left: 4px solid var(--amber); }
.finding.sev-low { border-left: 4px solid var(--lime); }
.finding.sev-info { border-left: 4px solid #64748b; }
.finding summary { cursor: pointer; font-weight: 650; display: flex; gap: .6rem; align-items: center; }
.finding .meta { color: var(--muted); font-size: .84rem; margin-top: .35rem; }
.finding pre { background: rgba(2, 6, 16, .65); padding: .6rem; border-radius: 11px; overflow-x: auto; font-size: .8rem; }
.sev { font-size: .72rem; padding: .12rem .55rem; border-radius: 999px; color: #05070f; font-weight: 800; }
.sev-critical { background: #f43f5e; } .sev-high { background: #fb7185; }
.sev-medium { background: var(--amber); } .sev-low { background: var(--lime); } .sev-info { background: #64748b; }

/* ---------- attack graph ---------- */
.graph {
  width: 100%; height: 470px; border-radius: 13px; overflow: hidden;
  background: radial-gradient(ellipse at center, #0e1731, #060a16);
  border: 1px solid var(--border);
}
.graph svg { width: 100%; height: 100%; }
.graph line { stroke-dasharray: 6 5; animation: dashMove 1.2s linear infinite; }
@keyframes dashMove { to { stroke-dashoffset: -22; } }

/* ---------- live terminal ---------- */
.stages { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: .7rem; }
.stage {
  padding: .22rem .7rem; border-radius: 999px; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); border: 1px solid var(--border-strong); background: rgba(8,13,27,.8);
  transition: all .3s ease;
}
.stage.done {
  color: #051018; background: var(--grad); border-color: transparent;
  font-weight: 700; box-shadow: 0 0 12px rgba(139,92,246,.4);
}
.console {
  height: 320px; overflow-y: auto;
  background: #04060d; border: 1px solid var(--border);
  border-radius: 12px; padding: .8rem .9rem;
  font-family: var(--mono); font-size: .76rem; line-height: 1.7;
}
.console::-webkit-scrollbar { width: 8px; }
.console::-webkit-scrollbar-thumb { background: rgba(148,163,184,.25); border-radius: 4px; }
.clog { white-space: pre-wrap; word-break: break-all; color: #b9c6e2; animation: lineIn .25s ease; }
.clog .cts { color: #47536e; margin-right: .5rem; }
.l-run_start, .l-run_end { color: #fff; font-weight: 700; }
.l-scope_decision { color: #7dd3fc; }
.l-guardian_verdict { color: #c4b5fd; }
.l-request_blocked, .l-run_refused, .l-run_aborted, .l-step_blocked { color: #fb7185; }
.l-request { color: #8ba3d0; }
.l-candidate { color: #fcd34d; }
.l-validation { color: #86efac; }
.l-triage { color: #f0abfc; }
.l-auth_login, .l-auth_relogin { color: #fdba74; }
.l-session_lost_handled { color: #fbbf24; }
.l-plan, .l-recon { color: #67e8f9; }
.l-wave { color: #5eead4; font-weight: 700; }
.l-chain_round { color: #e9d5ff; font-weight: 700; }

/* ---------- dashboard output ---------- */
.sev-bars { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem; }
.sev-bar { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: .7rem; }
.bar-track { height: 10px; border-radius: 999px; background: rgba(148,163,184,.14); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.ai-summary {
  display: flex; gap: .8rem; align-items: flex-start;
  background: rgba(34, 211, 238, .06); border: 1px solid rgba(34, 211, 238, .25);
  border-radius: 13px; padding: .9rem 1rem; margin-bottom: 1rem;
}
.ai-summary p { margin: 0; color: #cfe8f7; font-size: .92rem; }
.findings-feed { display: flex; flex-direction: column; gap: .55rem; }
.finding-head { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; font-size: .9rem; }

/* reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .mockup .body { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  main { padding: 1.1rem .9rem; }
}
