:root {
  --bg: #eef3fb;
  --text: #16243d;
  --muted: #566585;
  --faint: #8695b2;
  --brand: #1f9fd6;
  --brand-2: #7c6cf0;
  --brand-ink: #ffffff;
  --ok: #10b981;
  --warn: #d99100;
  --bad: #ef5a4d;
  --crit: #e11d48;
  --review: #d99100;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-brd: rgba(255, 255, 255, 0.85);
  --glass-brd-hi: rgba(31, 159, 214, 0.5);
  --blur: saturate(140%) blur(20px);
  --shadow: 0 20px 48px -22px rgba(30, 55, 100, 0.28);
  --ring: 0 0 0 1px rgba(255,255,255,.5) inset, 0 1px 0 rgba(255,255,255,.9) inset;
  --hairline: rgba(31, 55, 100, 0.08);
  --line: rgba(31, 55, 100, 0.14);
  --bg-2: rgba(31, 55, 100, 0.08);
  --radius: 22px;
  --radius-sm: 13px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; min-height: 100dvh; color: var(--text); font-family: var(--font);
  background: var(--bg); overflow-x: hidden; -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
button { font-family: inherit; }
a { color: inherit; }
::selection { background: rgba(31,159,214,.22); }

.aurora { position: fixed; inset: -15% -10% -10% -10%; z-index: -2; filter: blur(70px); opacity: .9; pointer-events: none; }
.aurora span { position: absolute; border-radius: 50%; }
.aurora span:nth-child(1) { width: 58vw; height: 58vw; top: -16vw; right: -6vw; background: radial-gradient(circle, rgba(120,205,245,.55), transparent 65%); animation: drift1 26s ease-in-out infinite; }
.aurora span:nth-child(2) { width: 50vw; height: 50vw; bottom: -18vw; left: -10vw; background: radial-gradient(circle, rgba(165,150,250,.45), transparent 65%); animation: drift2 32s ease-in-out infinite; }
.aurora span:nth-child(3) { width: 40vw; height: 40vw; top: 34%; left: 40%; background: radial-gradient(circle, rgba(120,230,195,.4), transparent 62%); animation: drift3 38s ease-in-out infinite; }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(130% 90% at 50% -10%, rgba(255,255,255,.65), transparent 55%), linear-gradient(180deg, rgba(238,243,251,.35), rgba(238,243,251,.72)); }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1);} 50% { transform: translate(-4vw,3vw) scale(1.1);} }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1);} 50% { transform: translate(5vw,-3vw) scale(1.08);} }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1);} 50% { transform: translate(-3vw,-4vw) scale(1.12);} }
@media (prefers-reduced-motion: reduce) { .aurora span { animation: none; } }

.glass { background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-brd); box-shadow: var(--shadow), var(--ring); }

.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; }
.auth-card { width: 100%; max-width: 420px; border-radius: 26px; padding: 36px; background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-brd); box-shadow: var(--shadow), var(--ring); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.auth-brand .mark { width: 40px; height: 40px; filter: drop-shadow(0 6px 14px rgba(31,159,214,.35)); }
.auth-brand b { font-size: 20px; letter-spacing: -.02em; font-weight: 650; }
.auth-card h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.03em; font-weight: 650; }
.auth-card p.sub { color: var(--muted); font-size: 14px; margin: 0 0 24px; line-height: 1.5; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.input { width: 100%; color: var(--text); font-size: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,.7); border: 1px solid var(--hairline); outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
.input::placeholder { color: var(--faint); }
.input:focus { border-color: rgba(31,159,214,.65); box-shadow: 0 0 0 4px rgba(31,159,214,.14); background: #fff; }
select.input { appearance: none; }
textarea.input { resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-weight: 600; font-size: 14px;
  padding: 12px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; color: var(--brand-ink);
  background: linear-gradient(180deg, #38b4e6, var(--brand)); box-shadow: 0 10px 24px -12px rgba(31,159,214,.7), 0 1px 0 rgba(255,255,255,.45) inset;
  transition: transform .06s, filter .18s, box-shadow .18s; }
.btn:hover { filter: brightness(1.05); box-shadow: 0 14px 28px -12px rgba(31,159,214,.8), 0 1px 0 rgba(255,255,255,.55) inset; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
.btn.ghost { background: rgba(255,255,255,.7); color: var(--text); border: 1px solid var(--hairline); box-shadow: none; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.btn.ghost:hover { border-color: var(--glass-brd-hi); background: #fff; filter: none; }
.btn.sm { padding: 8px 13px; font-size: 12.5px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--muted); }
.auth-switch a { color: var(--brand); cursor: pointer; font-weight: 500; }
.err { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; display: flex; align-items: center; gap: 16px;
  margin: 16px 18px 0; padding: 10px 14px; border-radius: var(--radius); }
.topbar .brand { display: flex; align-items: center; gap: 10px; padding-right: 6px; }
.topbar .brand .mark { width: 28px; height: 28px; filter: drop-shadow(0 4px 10px rgba(31,159,214,.35)); }
.topbar .brand b { font-size: 16.5px; letter-spacing: -.02em; font-weight: 650; white-space: nowrap; }
.topbar .brand b span { color: var(--brand); }
.nav { display: flex; align-items: center; gap: 2px; margin: 0 auto; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.5); border: 1px solid rgba(255,255,255,.7); }
.nav-item { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; border: 1px solid transparent; background: transparent; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 999px; transition: color .15s, background .15s, box-shadow .15s; }
.nav-item svg { width: 16px; height: 16px; opacity: .8; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.75); }
.nav-item.active { color: #0b4f6c; background: linear-gradient(180deg, rgba(31,159,214,.22), rgba(31,159,214,.1)); border-color: rgba(31,159,214,.4);
  box-shadow: 0 6px 16px -8px rgba(31,159,214,.5), 0 1px 0 rgba(255,255,255,.7) inset; }
.nav-item.active svg { opacity: 1; }
.whoami { display: flex; align-items: center; gap: 12px; }
.whoami .pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(16,185,129,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,.45);} 70% { box-shadow: 0 0 0 7px rgba(16,185,129,0);} 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0);} }
.who-id { display: flex; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; color: #fff;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px -8px rgba(124,108,240,.7); }
.who-meta { line-height: 1.25; }
.who-name { font-size: 13px; font-weight: 600; }
.who-role { font-size: 11px; color: var(--faint); text-transform: capitalize; }

.main { padding: 26px 30px 70px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; margin: 0; letter-spacing: -.03em; font-weight: 650;
  background: linear-gradient(120deg, #16243d, #1f7fb0 70%, #6a5cf0); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.page-head p { color: var(--muted); margin: 6px 0 0; font-size: 14px; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card { border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; background: var(--glass); border: 1px solid var(--glass-brd);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow), var(--ring); }
.card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), transparent); }
.card h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
.card .chead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card .chead .ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--brand); background: rgba(31,159,214,.1); border: 1px solid rgba(31,159,214,.22); }
.card .chead .ic svg { width: 17px; height: 17px; }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--muted); font-size: 12.5px; }
.stat .big { font-size: 32px; font-weight: 650; letter-spacing: -.035em; font-variant-numeric: tabular-nums; color: var(--text); }
.stat .sub { font-size: 12px; color: var(--faint); }
.posture { padding: 28px; }
.posture .ring { display: flex; align-items: center; gap: 30px; }
.gauge { width: 148px; height: 148px; flex: none; position: relative; filter: drop-shadow(0 10px 18px rgba(31,159,214,.22)); }
.gauge .score { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .score b { font-size: 38px; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.gauge .score span { font-size: 11px; color: var(--muted); display: block; letter-spacing: .08em; text-transform: uppercase; }
.posture .ptext h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.02em; font-weight: 650; }
.posture .ptext p { margin: 0; color: var(--muted); font-size: 14px; max-width: 54ch; line-height: 1.55; }
.posture .pmeta { display: flex; gap: 26px; margin-top: 20px; flex-wrap: wrap; }
.posture .pmeta div span { display: block; color: var(--faint); font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; }
.posture .pmeta div b { font-size: 18px; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-ok { color: #0a7d57; background: rgba(16,185,129,.12); border-color: rgba(16,185,129,.3); }
.b-warn { color: #a56e00; background: rgba(217,145,0,.14); border-color: rgba(217,145,0,.32); }
.b-bad { color: #c23a2e; background: rgba(239,90,77,.12); border-color: rgba(239,90,77,.3); }
.b-crit { color: #b00c36; background: rgba(225,29,72,.12); border-color: rgba(225,29,72,.32); }
.b-muted { color: var(--muted); background: rgba(86,101,133,.1); border-color: rgba(86,101,133,.2); }
.b-brand { color: #0e6f98; background: rgba(31,159,214,.12); border-color: rgba(31,159,214,.3); }
.pill { font-family: var(--mono); font-size: 11.5px; background: rgba(255,255,255,.7); border: 1px solid var(--hairline); padding: 3px 9px; border-radius: 8px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 500; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 9px 11px; border-bottom: 1px solid var(--hairline); }
.tbl td { padding: 11px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: rgba(255,255,255,.5); }
.tbl .mono { font-family: var(--mono); font-size: 12px; }
.empty { text-align: center; color: var(--faint); padding: 38px 10px; font-size: 13.5px; }
.mod-grid { display: grid; grid-template-columns: 390px 1fr; gap: 16px; align-items: start; }
.seg { display: inline-flex; background: rgba(255,255,255,.6); border: 1px solid var(--hairline); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { background: transparent; border: none; color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 7px 13px; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.seg button.on { background: rgba(31,159,214,.16); color: #0b4f6c; box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; }
.finding { border: 1px solid var(--hairline); border-radius: 14px; padding: 14px 15px; margin-bottom: 11px; background: rgba(255,255,255,.55); }
.finding .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.finding .title { font-weight: 600; font-size: 13.5px; }
.finding .ev { font-family: var(--mono); font-size: 12px; background: #0f1b2e; border: 1px solid rgba(0,0,0,.2); border-radius: 9px; padding: 9px 11px; color: #cfe0f5; overflow-x: auto; white-space: pre; margin: 8px 0; }
.finding .hint { font-size: 12.5px; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 15px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; }
pre.patch { font-family: var(--mono); font-size: 12px; line-height: 1.6; background: #0f1b2e; border: 1px solid rgba(0,0,0,.2); border-radius: 13px; padding: 15px; overflow-x: auto; color: #cfe0f5; max-height: 460px; }
.loader { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(31,55,100,.18); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(8px); z-index: 60; background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--glass-brd); color: var(--text); padding: 12px 20px; border-radius: 14px; font-size: 13.5px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.copybtn { cursor: pointer; }
.row-act { color: var(--brand); cursor: pointer; font-size: 12.5px; font-weight: 500; }
.row-act:hover { text-decoration: underline; }
.decision { font-weight: 650; }
.hr { height: 1px; background: var(--hairline); margin: 18px 0; }
code.inline { font-family: var(--mono); font-size: 12px; background: rgba(31,159,214,.1); padding: 2px 7px; border-radius: 6px; border: 1px solid rgba(31,159,214,.22); color: #0e6f98; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.endpoint { font-family: var(--mono); font-size: 12px; background: #0f1b2e; border: 1px solid rgba(0,0,0,.2); border-radius: 11px; padding: 10px 13px; color: #cfe0f5; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 9px; overflow-x: auto; }
.endpoint .row-act { color: #6fd0f5; }
.method { color: #4ee39b; font-weight: 700; }
@media (max-width: 920px) {
  .topbar { flex-wrap: wrap; margin: 12px 12px 0; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; margin: 4px 0 0; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .whoami { margin-left: auto; }
  .who-meta { display: none; }
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3, .cols-2 { grid-template-columns: 1fr; }
  .mod-grid { grid-template-columns: 1fr; }
  .main { padding: 20px 14px 60px; }
  .posture .ring { flex-direction: column; text-align: center; gap: 20px; }
  .posture .pmeta { justify-content: center; }
}

/* ---------- theme toggle button ---------- */
.icon-btn { padding: 8px; width: 36px; height: 36px; }
.icon-btn svg { width: 17px; height: 17px; }
.theme-float { position: fixed; top: calc(18px + env(safe-area-inset-top, 0px)); right: 18px; z-index: 40; }

/* ---------- DARK MODE ---------- */
:root[data-theme="dark"] {
  --bg: #070c16;
  --text: #eaf1fb;
  --muted: #9fb2cf;
  --faint: #677c9c;
  --brand: #45c0e6;
  --brand-2: #8b7bff;
  --brand-ink: #04121a;
  --ok: #3ddc97; --warn: #ffcf5c; --bad: #ff7a6b; --crit: #ff4d6d; --review: #ffcf5c;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.085);
  --glass-brd: rgba(255, 255, 255, 0.12);
  --glass-brd-hi: rgba(255, 255, 255, 0.28);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.75);
  --ring: 0 0 0 1px rgba(255,255,255,.06) inset, 0 1px 0 rgba(255,255,255,.18) inset;
  --hairline: rgba(255, 255, 255, 0.1);
  --line: rgba(255, 255, 255, 0.14);
  --bg-2: rgba(255, 255, 255, 0.08);
}
:root[data-theme="dark"] body::after { background: radial-gradient(120% 80% at 50% -10%, transparent 40%, rgba(4,7,13,.55) 100%), linear-gradient(180deg, rgba(7,12,22,.2), rgba(7,12,22,.72)); }
:root[data-theme="dark"] .aurora { opacity: .85; }
:root[data-theme="dark"] .aurora span { mix-blend-mode: screen; }
:root[data-theme="dark"] .aurora span:nth-child(1) { background: radial-gradient(circle, rgba(69,192,230,.5), transparent 62%); }
:root[data-theme="dark"] .aurora span:nth-child(2) { background: radial-gradient(circle, rgba(139,123,255,.46), transparent 62%); }
:root[data-theme="dark"] .aurora span:nth-child(3) { background: radial-gradient(circle, rgba(61,220,151,.26), transparent 60%); }
:root[data-theme="dark"] .input { background: rgba(255,255,255,.04); }
:root[data-theme="dark"] .input:focus { background: rgba(255,255,255,.07); }
:root[data-theme="dark"] .btn.ghost { background: rgba(255,255,255,.05); }
:root[data-theme="dark"] .btn.ghost:hover { background: rgba(255,255,255,.1); }
:root[data-theme="dark"] .nav { background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
:root[data-theme="dark"] .nav-item:hover { background: rgba(255,255,255,.06); }
:root[data-theme="dark"] .nav-item.active { color: #eafaff; background: linear-gradient(180deg, rgba(69,192,230,.32), rgba(69,192,230,.16)); border-color: rgba(69,192,230,.45); }
:root[data-theme="dark"] .page-head h1 { background: linear-gradient(120deg, #fff, #bfe7f4 60%, #c9bfff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
:root[data-theme="dark"] .stat .big { background: linear-gradient(180deg, #fff, #cfe6f2); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
:root[data-theme="dark"] .card::before { background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); }
:root[data-theme="dark"] .tbl tr:hover td { background: rgba(255,255,255,.035); }
:root[data-theme="dark"] .finding { background: rgba(255,255,255,.035); }
:root[data-theme="dark"] .seg { background: rgba(255,255,255,.04); }
:root[data-theme="dark"] .seg button.on { color: #eaffff; background: rgba(69,192,230,.18); }
:root[data-theme="dark"] .pill { background: rgba(255,255,255,.05); }
:root[data-theme="dark"] .badge::before { box-shadow: 0 0 8px currentColor; }
:root[data-theme="dark"] .b-ok { color: #3ddc97; background: rgba(61,220,151,.12); border-color: rgba(61,220,151,.3); }
:root[data-theme="dark"] .b-warn { color: #ffcf5c; background: rgba(255,207,92,.12); border-color: rgba(255,207,92,.3); }
:root[data-theme="dark"] .b-bad { color: #ff7a6b; background: rgba(255,122,107,.12); border-color: rgba(255,122,107,.3); }
:root[data-theme="dark"] .b-crit { color: #ff4d6d; background: rgba(255,77,109,.14); border-color: rgba(255,77,109,.36); }
:root[data-theme="dark"] .b-brand { color: #45c0e6; background: rgba(69,192,230,.12); border-color: rgba(69,192,230,.3); }
:root[data-theme="dark"] code.inline { color: #45c0e6; background: rgba(69,192,230,.1); border-color: rgba(69,192,230,.22); }
