/* ============================================================================
   Simulant — Design System v3
   Premium, dark-first QA / accessibility platform UI.
   Order: tokens → themes → base → app shell → components → page-level
          → utilities → keyframes → responsive.
   Motion keyframes/utilities beyond the basics live in motion.css.
   ========================================================================== */

/* ================================================================ tokens == */
:root {
  color-scheme: dark;

  /* ---- surfaces (dark-first) ---- */
  --bg:          #06070b;
  --bg-grid:     rgba(123,108,255,.05);
  --bg-glow-a:   rgba(123,108,255,.16);
  --bg-glow-b:   rgba(62,214,230,.10);
  --surface:     #0d0f17;
  --surface-1:   #11131d;
  --surface-2:   #161926;
  --surface-3:   #1d2130;
  --elevate:     #1b2032;   /* popovers / toasts / menus */
  --overlay:     rgba(4,5,9,.66);
  --border:        rgba(255,255,255,.07);
  --border-strong: rgba(255,255,255,.13);
  --border-accent: rgba(123,108,255,.45);
  --hover:       rgba(255,255,255,.045);
  --pressed:     rgba(255,255,255,.07);

  /* ---- text ---- */
  --text:     #eceefb;
  --text-dim: #a9afc6;
  /* muted/faint are TEXT tokens: both clear WCAG 1.4.3 (4.5:1) on every
     surface they sit on, up to --surface-3/--elevate + hover.
     --muted #9097b0 >= 5.04:1, --faint #8a91aa >= 4.67:1 (worst case #242838). */
  --muted:    #9097b0;
  --faint:    #8a91aa;
  --on-accent:#ffffff;

  /* ---- brand ---- */
  --accent:      #7B6CFF;   /* iris — primary */
  --accent-600:  #6A5BF2;
  --accent-700:  #5747DE;
  --accent-text: #a9a6ff;   /* accent used as text: tuned for contrast */
  --accent-soft: rgba(123,108,255,.14);
  --accent-2:    #3ED6E6;   /* cyan — integrity */
  --accent-warm: #FFB547;   /* amber — empathy */
  --grad-a: #7B6CFF;
  --grad-b: #3ED6E6;
  --grad:        linear-gradient(135deg, #7B6CFF 0%, #5B8CFF 45%, #3ED6E6 100%);
  /* Surfaces that carry WHITE TEXT (primary buttons, avatars, numbered dots):
     every stop clears 4.5:1 against #fff (#5747DE 6.3, #3A5BD9 5.7, #0E7C8C 4.9).
     The bright --grad above stays for decoration only (bars, rules, glows);
     with it white text fell to 1.75:1 at the cyan end. */
  --grad-strong: linear-gradient(135deg, #5747DE 0%, #3A5BD9 50%, #0E7C8C 100%);
  --accent-strong: #5747DE;
  --grad-warm:   linear-gradient(135deg, #FFB547 0%, #ff7eb6 100%);
  --grad-text:   linear-gradient(120deg, #c9c6ff 0%, #8fe6f0 100%);

  /* ---- severity / status ---- */
  --sev-info:     #5b93ff;
  --sev-low:      #35d6a0;
  --sev-medium:   #f5b64e;
  --sev-high:     #ff8a5b;
  --sev-critical: #ff5d6c;
  --ok:   #35d6a0;
  --warn: #f5b64e;
  --bad:  #ff5d6c;
  --danger-text: #ffc7cd;

  /* ---- type ---- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --fs-2xs:  .75rem;    /* 12 — floor for informational text (was 11px) */
  --fs-xs:   .75rem;    /* 12 */
  --fs-sm:   .8125rem;  /* 13 */
  --fs-base: .9375rem;  /* 15 */
  --fs-md:   1.0625rem; /* 17 */
  --fs-lg:   1.25rem;   /* 20 */
  --fs-xl:   1.5rem;    /* 24 */
  --fs-2xl:  2rem;      /* 32 */
  --fs-3xl:  2.75rem;   /* 44 */
  --fs-4xl:  3.5rem;    /* 56 */
  --lh-tight: 1.12; --lh-snug: 1.35; --lh: 1.55;
  --tracking-caps: .12em;

  /* ---- spacing (4px grid) ---- */
  --sp-0: 0; --sp-px: 1px;
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.25rem;
  --sp-6: 1.5rem; --sp-7: 1.75rem; --sp-8: 2rem; --sp-10: 2.5rem; --sp-12: 3rem; --sp-16: 4rem;

  /* ---- radii ---- */
  --r-xs: 6px; --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* ---- elevation ---- */
  --elev-0: none;
  --elev-1: 0 1px 2px rgba(0,0,0,.4);
  --elev-2: 0 8px 24px -8px rgba(0,0,0,.55);
  --elev-3: 0 18px 44px -14px rgba(0,0,0,.65);
  --elev-4: 0 28px 70px -18px rgba(0,0,0,.75), 0 0 0 1px rgba(255,255,255,.04);
  --shadow-sm: var(--elev-1);
  --shadow:    var(--elev-2);
  --shadow-lg: var(--elev-3);
  --inset-hi:  inset 0 1px 0 rgba(255,255,255,.04);
  --glow:      0 0 0 1px rgba(123,108,255,.25), 0 12px 40px -12px rgba(123,108,255,.45);

  /* ---- focus ---- */
  --focus: #9d9aff;
  --ring:  0 0 0 3px rgba(123,108,255,.38);
  --ring-offset: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus);

  /* ---- motion ---- */
  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --t-fast: .13s; --t: .22s; --t-slow: .4s;

  /* ---- layout ---- */
  --sidebar-w: 252px;
  --topbar-h: 60px;
  --maxw: 1180px;
  --content-maxw: 1120px;
  --z-topbar: 20; --z-sidebar: 40; --z-scrim: 35; --z-pop: 250; --z-modal: 300; --z-toast: 400;
}

/* ---------------------------------------------------------- light theme -- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fa;
  --bg-grid: rgba(90,84,232,.06);
  --bg-glow-a: rgba(123,108,255,.14);
  --bg-glow-b: rgba(62,214,230,.10);
  --surface:  #ffffff;
  --surface-1:#ffffff;
  --surface-2:#f2f3f8;
  --surface-3:#e7e9f2;
  --elevate:  #ffffff;
  --overlay:  rgba(18,20,38,.38);
  --border:        rgba(16,20,40,.09);
  --border-strong: rgba(16,20,40,.16);
  --border-accent: rgba(90,84,232,.5);
  --hover:   rgba(16,20,40,.04);
  --pressed: rgba(16,20,40,.07);

  --text:#141829; --text-dim:#434a62; --muted:#545a71; --faint:#5b6178; /* >= 5.27 / 4.74:1 on --surface-3 */

  --accent: #6352F2; --accent-600:#5546E6; --accent-700:#4a43d4;
  --accent-text: #4f48d8;
  --accent-soft: rgba(108,102,242,.10);
  --accent-2: #065f6b;   /* also status text (running/pending chips): >= 4.85:1 */
  --accent-warm: #c26a0c;
  --grad-text: linear-gradient(120deg, #4a43d4 0%, #065f6b 100%);

  /* Severity/status hues double as chip TEXT on a 12-15% tint of themselves:
     each clears 4.5:1 on that tint over --surface-3 (worst case), >= 7:1 on white. */
  --sev-info:#1c47bf; --sev-low:#065f42; --sev-medium:#7a4c03; --sev-high:#9e360b; --sev-critical:#a8192c;
  --ok:#065f42; --warn:#7a4c03; --bad:#a8192c;
  --danger-text: #b4192d;

  --elev-1: 0 1px 2px rgba(20,24,50,.06), 0 0 0 1px rgba(20,24,50,.02);
  --elev-2: 0 10px 30px -12px rgba(30,35,70,.18);
  --elev-3: 0 22px 50px -18px rgba(30,35,70,.24);
  --elev-4: 0 30px 80px -20px rgba(30,35,70,.32), 0 0 0 1px rgba(20,24,50,.06);
  --inset-hi: inset 0 1px 0 rgba(255,255,255,.8);
  --glow: 0 0 0 1px rgba(108,102,242,.22), 0 12px 32px -14px rgba(108,102,242,.45);

  --focus: #5546E6;
  --ring: 0 0 0 3px rgba(108,102,242,.28);
}

/* ================================================================== base == */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--sp-4)); }
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11" 1, "ss01" 1;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
/* ambient background: soft glow + masked grid */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 78% -10%, var(--bg-glow-a), transparent 60%),
    radial-gradient(900px 500px at 8% 110%, var(--bg-glow-b), transparent 55%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 75%);
}

/* theme switch cross-fade (class added briefly by toggleTheme) */
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .28s var(--ease), border-color .28s var(--ease), color .28s var(--ease), fill .28s, stroke .28s !important;
}

h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 600; line-height: var(--lh-tight); letter-spacing: -.02em; color: var(--text); }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img, svg, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
:not(pre) > code { padding: .1em .38em; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
::selection { background: rgba(123,108,255,.3); }

/* universal, accessible focus */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }

/* scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

.mono, .num { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
.muted { color: var(--muted); }
.dim { color: var(--text-dim); }
.faint { color: var(--faint); }
.accent { color: var(--accent-text); }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-6); }
/* the hidden attribute always hides, even on elements whose class sets display */
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent-strong); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--r-sm); z-index: 1000; font-weight: 600; }
.skip-link:focus { left: var(--sp-4); top: var(--sp-4); }
[data-scroll-focus="1"]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* disclosure summaries are click targets: at least 24px tall (WCAG 2.5.8) */
summary { min-height: 24px; padding-block: 2px; cursor: pointer; }
/* scroll boxes contain their absolutely positioned (.sr-only) children */
.table-scroll, .pop-scroll, .scroll-x { position: relative; }
/* form controls never push their container wider than the screen */
.select, .input, .textarea { max-width: 100%; }
fieldset { min-width: 0; }
/* checkboxes / radios: 18px boxes with room around them, so each sits in its own
   24px target circle (WCAG 2.5.8) and is easy to hit */
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 3px; flex: 0 0 auto; accent-color: var(--accent); cursor: pointer; }
.skip-nav { position: absolute; top: 0; left: 0; z-index: 1000; }
/* headings that receive focus after a route change: not interactive, no ring */
h1.route-focus:focus, h1[tabindex="-1"]:focus { outline: none; }
.ic { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; line-height: 0; }
.ic svg { display: block; }

/* ============================================================ app shell == */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
body.auth-mode .app-shell { grid-template-columns: 1fr; }
body.auth-mode .sidebar, body.auth-mode .topbar { display: none; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  gap: var(--sp-1); padding: var(--sp-4) var(--sp-3);
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 55%, var(--bg)) 100%);
  border-right: 1px solid var(--border); z-index: var(--z-sidebar);
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-1) var(--sp-2) var(--sp-4); }
.sidebar .brand { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-1); border-radius: var(--r-sm); min-width: 0; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); box-shadow: var(--glow); flex: 0 0 auto; }
.brand-mark svg, .brand-mark .brand-glyph { width: 100%; height: 100%; display: block; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; line-height: 1.1; color: var(--text); }
.brand-name small { display: block; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--font-sans); font-weight: 600; margin-top: 3px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-label { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--tracking-caps);
  color: var(--faint); padding: var(--sp-5) var(--sp-3) var(--sp-2); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-label:first-child { padding-top: var(--sp-2); }
.side-link { display: flex; align-items: center; gap: var(--sp-3); padding: .55rem var(--sp-3); border-radius: var(--r-sm);
  color: var(--text-dim); font-weight: 500; font-size: var(--fs-sm); position: relative; min-height: 38px;
  transition: background var(--t-fast), color var(--t-fast); }
.side-link > span:not(.side-count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-link svg { width: 18px; height: 18px; opacity: .75; flex: 0 0 auto; transition: opacity var(--t-fast), color var(--t-fast); }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link:hover svg { opacity: 1; }
.side-link:active { background: var(--pressed); }
.side-link.active { background: var(--accent-soft); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }
.side-link.active svg { opacity: 1; color: var(--accent-text); }
.side-link.active::before { content: ""; position: absolute; left: calc(-1 * var(--sp-3)); top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.side-count { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--muted); padding: 1px 6px; border-radius: var(--r-pill); background: var(--surface-2); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--sp-2); padding-top: var(--sp-4); border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-2); border-radius: var(--r); border: 1px solid transparent;
  background: transparent; text-align: left; cursor: pointer; transition: background var(--t-fast), border-color var(--t-fast); }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--hover); border-color: var(--border); }
.user-chip .uc-text { min-width: 0; flex: 1; }
.user-chip .uc-name, .user-chip .uc-email { display: block; }
.user-chip .uc-name { font-size: var(--fs-sm); font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .uc-email { font-size: var(--fs-2xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .uc-caret { color: var(--muted); flex: 0 0 auto; }

.main-col { display: flex; flex-direction: column; min-width: 0; }

/* ----------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; height: var(--topbar-h); z-index: var(--z-topbar);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: 0 var(--sp-8); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 74%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
}
.topbar-left { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; flex: 1; }
.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--muted); min-width: 0; flex: 1; overflow: hidden; }
.crumbs ol { display: flex; align-items: center; gap: var(--sp-2); list-style: none; padding: 0; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.crumbs li:not(:last-child) { flex: 0 0 auto; }
.crumbs li:last-child { flex: 0 1 auto; }
.crumbs a { padding: 2px 6px; margin: -2px -6px; border-radius: var(--r-xs); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color var(--t-fast), background var(--t-fast); }
.crumbs a:hover { color: var(--text); background: var(--hover); }
.crumbs .sep { opacity: .45; flex: 0 0 auto; }
.crumbs .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--sp-2); flex: 0 0 auto; }
.content { padding: var(--sp-8); max-width: var(--content-maxw); width: 100%; margin-inline: auto; }
.content:focus { outline: none; }

/* mobile drawer (higher specificity than .icon-btn display) */
.icon-btn.hamburger, .icon-btn.sidebar-close { display: none; }
.nav-scrim { position: fixed; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  z-index: var(--z-scrim); opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease); border: 0; padding: 0; }
body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

/* -------------------------------------------------------------- avatar */
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto;
  background: var(--grad-strong); color: var(--on-accent); font-weight: 600; font-size: .8rem; letter-spacing: .01em;
  box-shadow: var(--elev-1), inset 0 0 0 1px rgba(255,255,255,.18); user-select: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: .75rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
button.avatar, .avatar-btn { border: 0; padding: 0; cursor: pointer; transition: box-shadow var(--t-fast), transform var(--t-fast); }
button.avatar:hover, .avatar-btn:hover { box-shadow: var(--elev-1), 0 0 0 3px var(--accent-soft); }
/* white initials on every hue clear 4.5:1 at both gradient stops */
.avatar-hue-1 { background: linear-gradient(135deg,#C2410C,#BE185D); }
.avatar-hue-2 { background: linear-gradient(135deg,#047857,#1D6FA3); }
.avatar-hue-3 { background: linear-gradient(135deg,#B45309,#C2410C); }
.avatar-hue-4 { background: linear-gradient(135deg,#3B5BDB,#5747DE); }

/* ------------------------------------------------------------- icon-btn */
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--r-sm); flex: 0 0 auto;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-dim); cursor: pointer;
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--border-accent); }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.ghost:hover { background: var(--hover); }
.icon-btn-sm { width: 28px; height: 28px; border-radius: var(--r-xs); }
.icon-btn-sm svg { width: 15px; height: 15px; }
.theme-toggle .ti { display: grid; place-items: center; transition: transform var(--t-slow) var(--ease-spring), opacity var(--t); grid-area: 1 / 1; }
.theme-toggle { display: inline-grid; }
.theme-toggle .ti svg { width: 18px; height: 18px; }
.theme-toggle .ti-moon { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root[data-theme="light"] .theme-toggle .ti-sun { opacity: 0; transform: rotate(90deg) scale(.6); }
:root[data-theme="light"] .theme-toggle .ti-moon { opacity: 1; transform: none; }

/* =========================================================== components == */
/* ------------------------------------------------------------ page head */
.page-head, .page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-8); }
.page-head > div:first-child, .page-header > div:first-child { min-width: 0; }
.page-head .eyebrow, .eyebrow { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .16em; color: var(--accent-text); font-weight: 700; margin-bottom: var(--sp-2); }
.page-head h1, .page-title { font-size: var(--fs-2xl); letter-spacing: -.025em; overflow-wrap: anywhere; }
.page-head p, .page-subtitle { color: var(--text-dim); margin-top: var(--sp-2); max-width: 62ch; font-size: var(--fs-base); }
.page { display: block; }
.lede { font-size: var(--fs-md); color: var(--text-dim); line-height: 1.6; max-width: 62ch; }
.section-title { font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; margin-bottom: var(--sp-4); display: flex; align-items: center; gap: var(--sp-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.section-head .section-title { margin-bottom: 0; }

/* breadcrumb (in-page) */
.breadcrumb { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--sp-4); min-width: 0; }
.breadcrumb a { color: var(--text-dim); transition: color var(--t-fast); }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb .sep { opacity: .45; }

/* ---------------------------------------------------------------- cards */
.card, .panel {
  background: linear-gradient(180deg, var(--surface-1), var(--surface));
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6);
  box-shadow: var(--elev-1), var(--inset-hi); position: relative; min-width: 0;
}
.panel + .panel { margin-top: var(--sp-5); }
details.panel > summary { cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); list-style: none; display: flex; align-items: center; gap: var(--sp-2); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--t-fast); margin-right: 4px; }
details.panel[open] > summary::before { transform: rotate(45deg); }
.card-pad-sm { padding: var(--sp-4); border-radius: var(--r); }
.card-flush { padding: 0; overflow: hidden; }
a.card { display: block; color: inherit; }
.card-hover { transition: transform var(--t) var(--ease), border-color var(--t), box-shadow var(--t); cursor: pointer; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--elev-2); }
.card-hover:focus-visible { outline: none; box-shadow: var(--ring), var(--elev-2); border-color: var(--border-accent); }
.card-glow::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity var(--t); pointer-events: none; }
.card-glow:hover::after { opacity: .55; }
.card-title { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--muted); font-weight: 700; margin-bottom: var(--sp-4); }

/* -------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 38px; padding: .55rem 1.05rem; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: var(--fs-sm); line-height: 1.2; cursor: pointer;
  box-shadow: var(--inset-hi);
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast), color var(--t-fast);
  white-space: nowrap; text-decoration: none; user-select: none; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }
.btn:hover { transform: translateY(-1px); background: var(--surface-3); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--grad-strong); border-color: transparent; color: var(--on-accent); box-shadow: 0 6px 20px -8px rgba(123,108,255,.7), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-primary:hover { background: var(--grad-strong); filter: brightness(1.12); box-shadow: 0 10px 28px -8px rgba(123,108,255,.8), inset 0 1px 0 rgba(255,255,255,.22); }
.btn-primary:focus-visible { box-shadow: var(--ring), 0 6px 20px -8px rgba(123,108,255,.7); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); box-shadow: none; }
.btn-ghost:hover { background: var(--hover); color: var(--text); border-color: var(--border-strong); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-dim); box-shadow: none; }
.btn-quiet:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--danger-text); box-shadow: none; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 24%, transparent); }
.btn-sm { min-height: 30px; padding: .35rem .7rem; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { min-height: 46px; padding: .75rem 1.4rem; font-size: var(--fs-base); border-radius: var(--r); }
.btn-block { width: 100%; }
.btn-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; filter: saturate(.6); }
:root[data-theme="light"] .btn-primary:disabled,
:root[data-theme="light"] .btn-primary[aria-disabled="true"] { opacity: 1; filter: none; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); box-shadow: none; }
.btn.is-loading { pointer-events: none; }
.btn-group { display: inline-flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.field label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-dim); }
.field .hint, .hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.field .error, .field-error { font-size: var(--fs-xs); color: var(--bad); font-weight: 500; }
.input, .textarea, .select {
  width: 100%; min-height: 42px; padding: .62rem .85rem; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: var(--fs-base); line-height: 1.4;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast); }
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--accent) 40%); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus, .input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: none; border-color: var(--border-accent); box-shadow: var(--ring); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.input[disabled], .textarea[disabled], .select[disabled] { opacity: .6; cursor: not-allowed; }
.textarea { resize: vertical; min-height: 92px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 2.2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .ic, .input-group > .input-ic { position: absolute; left: .8rem; color: var(--muted); pointer-events: none; }
.input-group > .ic + .input, .input-group > .input-ic + .input { padding-left: 2.4rem; }

/* --------------------------------------------------------- chips / tags */
.chip { display: inline-flex; align-items: center; gap: .38rem; padding: .2rem .6rem; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; letter-spacing: .01em; text-transform: capitalize; line-height: 1.4;
  border: 1px solid var(--border); color: var(--text-dim); background: var(--surface-2); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.chip-info, .chip.sev-info { color: var(--sev-info); background: color-mix(in srgb, var(--sev-info) 13%, transparent); border-color: color-mix(in srgb, var(--sev-info) 30%, transparent); }
.chip-low, .chip.sev-low { color: var(--sev-low); background: color-mix(in srgb, var(--sev-low) 13%, transparent); border-color: color-mix(in srgb, var(--sev-low) 30%, transparent); }
.chip-medium, .chip.sev-medium { color: var(--sev-medium); background: color-mix(in srgb, var(--sev-medium) 13%, transparent); border-color: color-mix(in srgb, var(--sev-medium) 30%, transparent); }
.chip-high, .chip.sev-high { color: var(--sev-high); background: color-mix(in srgb, var(--sev-high) 13%, transparent); border-color: color-mix(in srgb, var(--sev-high) 30%, transparent); }
.chip-critical, .chip.sev-critical { color: var(--sev-critical); background: color-mix(in srgb, var(--sev-critical) 15%, transparent); border-color: color-mix(in srgb, var(--sev-critical) 36%, transparent); }
.chip-accent { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.chip-plain::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: .16rem .5rem; border-radius: var(--r-xs); font-size: var(--fs-xs);
  font-weight: 500; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; line-height: 1.45; }

/* status pill */
.status { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .62rem; border-radius: var(--r-pill); white-space: nowrap;
  font-size: var(--fs-xs); font-weight: 600; text-transform: capitalize; line-height: 1.4; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status-completed, .status-succeeded, .status-success { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.status-running, .status-scanning, .status-reporting, .status-pending { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, transparent); border-color: color-mix(in srgb, var(--accent-2) 30%, transparent); }
.status-running::before, .status-scanning::before, .status-reporting::before { animation: pulse 1.4s var(--ease) infinite; }
.status-queued { color: var(--sev-medium); background: color-mix(in srgb, var(--sev-medium) 12%, transparent); border-color: color-mix(in srgb, var(--sev-medium) 28%, transparent); }
.status-failed, .status-error, .status-cancelled { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

/* ----------------------------------------------------------- stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: var(--sp-4); }
.stat { background: linear-gradient(180deg,var(--surface-1),var(--surface)); border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-5);
  box-shadow: var(--elev-1), var(--inset-hi); min-width: 0; }
.stat .k, .stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.stat .v, .stat-value { font-family: var(--font-mono); font-size: var(--fs-2xl); font-weight: 600; margin-top: var(--sp-2); letter-spacing: -.02em; line-height: 1.1; color: var(--text); font-feature-settings: "tnum" 1; overflow-wrap: anywhere; }
.stat .sub, .stat-sub { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); }
span.stat-label { display: inline-block; }

/* ------------------------------------------------------- dimension bars */
.dim-row { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); align-items: center; margin-bottom: var(--sp-3); }
.dim-row .lbl { font-size: var(--fs-sm); font-weight: 500; color: var(--text-dim); }
.dim-row .val { font-family: var(--font-mono); font-size: var(--fs-sm); font-weight: 600; }
.dim-track { grid-column: 1 / -1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.dim-fill { height: 100%; border-radius: 999px; background: var(--grad); width: 0; transition: width 1s var(--ease-out); }

/* ---------------------------------------------------- linear progress */
.progress { position: relative; width: 100%; height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress-sm { height: 4px; }
.progress-lg { height: 10px; }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width .8s var(--ease-out); }
.progress-bar.indeterminate { width: 38%; position: absolute; left: 0; top: 0; animation: progress-indet 1.25s var(--ease) infinite; }
.progress.tone-ok .progress-bar, .progress-bar.tone-ok { background: var(--ok); }
.progress.tone-warn .progress-bar, .progress-bar.tone-warn { background: var(--warn); }
.progress.tone-bad .progress-bar, .progress-bar.tone-bad { background: var(--bad); }
.progress-meta { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--sp-2); }

/* ---------------------------------------------------------- score gauge */
.gauge { position: relative; width: 168px; height: 168px; flex: 0 0 auto; }
.gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; overflow: visible; }
.gauge .track { stroke: var(--surface-3); }
.gauge .prog { stroke-linecap: round; transition: stroke-dashoffset 1.3s var(--ease-out); filter: drop-shadow(0 0 8px rgba(123,108,255,.45)); }
.gauge .cap { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge .num { font-family: var(--font-mono); font-size: 2.6rem; font-weight: 600; line-height: 1; letter-spacing: -.03em; color: var(--text); }
.gauge .grade { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .15em; color: var(--muted); margin-top: 6px; }
/* CSS-only conic gauge (report page: .gauge.gauge-lg with --value) */
.gauge-lg { --value: 0; --tone: var(--accent); width: 176px; height: 176px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--tone) calc(var(--value) * 1%), var(--surface-3) 0); box-shadow: 0 0 40px -12px color-mix(in srgb, var(--tone) 60%, transparent); }
.gauge-lg::before { content: ""; position: absolute; inset: 13px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.gauge-lg.score-good { --tone: var(--ok); }
.gauge-lg.score-medium { --tone: var(--sev-medium); }
.gauge-lg.score-high { --tone: var(--sev-high); }
.gauge-lg.score-critical { --tone: var(--sev-critical); }
.gauge-inner { position: relative; text-align: center; display: grid; gap: 4px; }
.gauge-value { font-family: var(--font-mono); font-size: 2.6rem; font-weight: 600; line-height: 1; letter-spacing: -.03em; color: var(--text); }
.gauge-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .15em; color: var(--muted); font-weight: 600; }
.score-good { --tone: var(--ok); } .score-medium { --tone: var(--sev-medium); } .score-high { --tone: var(--sev-high); } .score-critical { --tone: var(--sev-critical); }
.text-score-good { color: var(--ok); } .text-score-medium { color: var(--sev-medium); } .text-score-high { color: var(--sev-high); } .text-score-critical { color: var(--sev-critical); }

/* --------------------------------------------------------------- tables */
.table-wrap { position: relative; width: 100%; overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: var(--sp-5); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); white-space: nowrap; background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.table td { padding: var(--sp-4); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); vertical-align: middle; }
.table tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr.pj-row-click { cursor: pointer; }
.table tbody tr:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.table tr:last-child td { border-bottom: none; }
.table .num, .table td.mono { text-align: right; }

/* ------------------------------------------------------------- findings */
.finding { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: var(--r); padding: var(--sp-5); background: var(--surface); margin-bottom: var(--sp-3); transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast); }
.finding:hover { transform: translateX(2px); box-shadow: var(--elev-1); }
.finding.sev-critical { border-left-color: var(--sev-critical); }
.finding.sev-high { border-left-color: var(--sev-high); }
.finding.sev-medium { border-left-color: var(--sev-medium); }
.finding.sev-low { border-left-color: var(--sev-low); }
.finding.sev-info { border-left-color: var(--sev-info); }
.finding h3, .finding h4 { font-family: var(--font-sans); font-size: var(--fs-base); font-weight: 600; letter-spacing: -.005em; margin-bottom: var(--sp-2); }
.finding .meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.finding .block { margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--text-dim); }
.finding .block .k { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }

/* ------------------------------------------------- persona / selectable */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px),1fr)); gap: var(--sp-3); }
.persona { position: relative; border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: var(--surface); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.persona:hover { border-color: var(--border-strong); background: var(--surface-1); }
.persona .pfidelity { margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-dim); line-height: 1.45; }
.persona:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--border-accent); }
.persona.selected { border-color: var(--border-accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--border-accent); }
.persona.disabled { opacity: .45; pointer-events: none; }
.persona .tick { position: absolute; top: var(--sp-3); right: var(--sp-3); width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-spring); }
.persona.selected .tick { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.persona .tick svg { width: 12px; height: 12px; opacity: 0; color: var(--on-accent); transition: opacity var(--t-fast); }
.persona.selected .tick svg { opacity: 1; }
.persona .pname { font-weight: 600; font-size: var(--fs-base); margin-bottom: var(--sp-1); padding-right: 28px; }
.persona .pdesc { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; margin-bottom: var(--sp-3); }
.persona .ptags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ------------------------------------------------- engine toggle cards */
.engine-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.engine { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); cursor: pointer; background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); display: flex; gap: var(--sp-3); align-items: flex-start; }
.engine .eicon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; }
.engine-empathy .eicon { background: color-mix(in srgb, var(--accent-warm) 16%, transparent); color: var(--accent-warm); }
.engine-integrity .eicon { background: color-mix(in srgb, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.engine:hover { border-color: var(--border-strong); background: var(--surface-1); }
.engine:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--border-accent); }
.engine.on { border-color: var(--border-accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--border-accent); }
.engine .etitle { font-weight: 600; display: flex; align-items: center; gap: var(--sp-2); }
.engine .edesc { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* ------------------------------------------------ steps timeline (run) */
.timeline { position: relative; padding-left: var(--sp-6); }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: var(--sp-4); }
.tl-item::before { content: ""; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--bg); box-shadow: 0 0 0 2px var(--border); }
.tl-item.ok::before { background: var(--ok); box-shadow: 0 0 0 2px color-mix(in srgb,var(--ok) 40%,transparent); }
.tl-item.bad::before { background: var(--bad); box-shadow: 0 0 0 2px color-mix(in srgb,var(--bad) 40%,transparent); }
.tl-item .tl-head { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; font-size: var(--fs-base); }
.tl-item .tl-thought { font-size: var(--fs-sm); color: var(--text-dim); font-style: italic; margin-top: 2px; }
.tl-item .tl-shot { margin-top: var(--sp-3); border-radius: var(--r-sm); border: 1px solid var(--border); max-width: 320px; max-height: 180px; object-fit: cover; object-position: top; display: block; }

/* live step feed: ul.steps > li.step > .step-idx + .step-body */
.steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; position: relative; }
.step { position: relative; display: grid; grid-template-columns: 28px minmax(0,1fr); gap: var(--sp-3); padding: var(--sp-3) 0; }
.step:not(:last-child)::after { content: ""; position: absolute; left: 13px; top: calc(var(--sp-3) + 30px); bottom: calc(-1 * var(--sp-1)); width: 2px; background: var(--border); border-radius: 2px; }
.step-idx { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-2xs); font-weight: 600;
  color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--border); position: relative; z-index: 1; }
.step-body { min-width: 0; padding-top: 3px; }
.step-action { font-weight: 600; font-size: var(--fs-sm); color: var(--text); text-transform: capitalize; }
.step-detail { font-size: var(--fs-xs); color: var(--muted); margin-top: var(--sp-1); overflow-wrap: anywhere; line-height: 1.5; }
p.step-detail { color: var(--text-dim); font-size: var(--fs-sm); }
.shot { margin: 0; border-radius: var(--r-sm); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); box-shadow: var(--elev-1); }
.shot img { display: block; width: 100%; height: auto; max-height: 200px; object-fit: cover; object-position: top; }
.shot-caption { font-size: var(--fs-2xs); color: var(--muted); padding: 6px var(--sp-3); border-top: 1px solid var(--border); text-transform: capitalize; }

/* persona run lane */
.lane { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); margin-bottom: var(--sp-2); }
.lane .lmeta { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.lane .ldot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; font-size: .8rem; font-weight: 700; color: var(--on-accent); background: var(--grad-strong); }

/* -------------------------------------------------------- consent panel */
.consent { border: 1px solid color-mix(in srgb, var(--sev-medium) 40%, transparent); background: color-mix(in srgb, var(--sev-medium) 7%, var(--surface)); border-radius: var(--r-lg); padding: var(--sp-6); }
.consent h2, .consent h3 { font-size: var(--fs-lg); display: flex; align-items: center; gap: var(--sp-2); }
.checkbox-row { display: flex; align-items: flex-start; gap: var(--sp-3); margin: var(--sp-4) 0; cursor: pointer; }
.checkbox-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; cursor: pointer; }

/* ------------------------------------------------------------ auth split */
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-aside { --aside-bg: linear-gradient(150deg, #0a0c16 0%, #0e1020 50%, #0b1620 100%);
  position: relative; overflow: hidden; padding: var(--sp-16) var(--sp-12); display: flex; flex-direction: column; justify-content: space-between;
  background: var(--aside-bg); border-right: 1px solid var(--border); color: var(--text); }
:root[data-theme="light"] .auth-aside { --aside-bg: linear-gradient(150deg, #eeedff 0%, #f4f3ff 45%, #e6f7fa 100%); }
.auth-aside::before { content:""; position:absolute; inset:0; pointer-events: none;
  background: radial-gradient(600px 400px at 20% 20%, rgba(123,108,255,.22), transparent 60%), radial-gradient(500px 400px at 90% 90%, rgba(62,214,230,.16), transparent 60%); }
.auth-aside > * { position: relative; }
.auth-aside h2 { font-size: var(--fs-3xl); line-height: 1.05; margin: var(--sp-6) 0 var(--sp-4); letter-spacing: -.03em; }
.auth-aside .lede { font-size: var(--fs-md); color: var(--text-dim); max-width: 42ch; }
.auth-feats { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-8); }
.auth-feat { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-base); color: var(--text-dim); }
.auth-feat svg { width: 20px; height: 20px; color: var(--accent-2); flex: 0 0 auto; margin-top: 2px; }
.auth-main { display: grid; place-items: center; padding: var(--sp-8); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.auth-card .sub { color: var(--text-dim); margin-bottom: var(--sp-6); }
.auth-alt { text-align: center; margin-top: var(--sp-5); color: var(--muted); font-size: var(--fs-sm); }
.auth-alt a { color: var(--accent-text); font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------ empty / loading */
.empty-state { display: grid; place-items: center; gap: var(--sp-3); padding: var(--sp-16) var(--sp-4); text-align: center; color: var(--muted); }
.empty-state h3, .empty-state .es-title { font-size: var(--fs-lg); }
.empty-state p { max-width: 46ch; }
.empty-state > :last-child:is(.btn, a, div) { margin-top: var(--sp-2); }
.empty-state .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent-text); border: 1px solid var(--border); box-shadow: var(--inset-hi); margin-bottom: var(--sp-1); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: 0 0 auto; }
.spinner-lg { width: 46px; height: 46px; border-width: 3.5px; }
.spinner-sm, .btn .spinner { width: 15px; height: 15px; border-width: 2px; }
.btn-primary .spinner { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.loading-block { display: grid; place-items: center; gap: var(--sp-3); padding: var(--sp-12) var(--sp-4); color: var(--muted); }
.error-state { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); }

/* skeleton */
.skel { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; }

/* ----------------------------------------------------------------- toast */
.toast-region, #toasts { position: fixed; bottom: var(--sp-6); right: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-2); z-index: var(--z-toast); max-width: min(380px, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; padding: .8rem 1rem; border-radius: var(--r); background: var(--elevate); border: 1px solid var(--border-strong); box-shadow: var(--elev-4); font-size: var(--fs-sm); color: var(--text); line-height: 1.45;
  transform: translateX(120%); opacity: 0; transition: transform var(--t) var(--ease-out), opacity var(--t); border-left: 3px solid var(--accent); cursor: pointer; }
.toast-show { transform: translateX(0); opacity: 1; }
.toast-error { border-left-color: var(--bad); }
.toast-success { border-left-color: var(--ok); }
.toast-info { border-left-color: var(--accent); }

/* ----------------------------------------------------------------- modal */
.modal-overlay { position: fixed; inset: 0; background: var(--overlay); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: grid; place-items: center; z-index: var(--z-modal); padding: var(--sp-4); animation: fadeIn .2s var(--ease) both; overflow-y: auto; }
.modal { width: 100%; max-width: 480px; background: var(--elevate); border: 1px solid var(--border-strong); border-radius: var(--r-xl); padding: var(--sp-6);
  box-shadow: var(--elev-4); animation: scaleIn .24s var(--ease-out) both; position: relative; }
.modal-lg { max-width: 720px; }
.modal-sm { max-width: 380px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.modal-head h2, .modal-head h3 { font-size: var(--fs-lg); margin: 0; }
.modal-close { margin: -6px -6px 0 0; }
.modal-foot { display: flex; gap: var(--sp-2); justify-content: flex-end; margin-top: var(--sp-6); flex-wrap: wrap; }
.modal-overlay.closing { animation: fadeOut .16s var(--ease) both; }
.modal-overlay.closing .modal { animation: scaleOut .16s var(--ease) both; }

/* ------------------------------------------------------- popover / menu */
.popover { position: fixed; z-index: var(--z-pop); min-width: 200px; max-width: min(320px, calc(100vw - 16px)); background: var(--elevate);
  border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--elev-4); padding: var(--sp-1);
  transform-origin: var(--origin, top right); animation: popIn .16s var(--ease-out) both; }
.popover.closing { animation: popOut .12s var(--ease) both; }
.popover-pad { padding: var(--sp-4); }
.menu, .menu-list { display: flex; flex-direction: column; gap: 1px; }
.menu-head { padding: var(--sp-3) var(--sp-3) var(--sp-2); display: flex; gap: var(--sp-3); align-items: center; min-width: 0; }
.menu-head .mh-text { min-width: 0; }
.menu-head .mh-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head .mh-sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-label { font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--faint); font-weight: 700; padding: var(--sp-2) var(--sp-3) var(--sp-1); }
.menu-sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }
.menu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: .5rem var(--sp-3); border-radius: var(--r-xs); border: 0; background: transparent;
  color: var(--text-dim); font-size: var(--fs-sm); font-weight: 500; text-align: left; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.menu-item svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: .85; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); color: var(--text); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 1px var(--border-accent); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.menu-item .mi-hint { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); }
.menu-item[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--sp-5); }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); padding: .65rem .85rem; border: 0; background: transparent;
  color: var(--muted); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; border-radius: var(--r-xs) var(--r-xs) 0 0; transition: color var(--t-fast), background var(--t-fast); }
.tab:hover { color: var(--text); background: var(--hover); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }
.tab:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.tab .tab-count { font-family: var(--font-mono); font-size: var(--fs-2xs); padding: 1px 6px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--muted); }
.tab[aria-selected="true"] .tab-count { background: var(--accent-soft); color: var(--accent-text); }

/* --------------------------------------------------- segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; }
.seg { display: inline-flex; align-items: center; gap: 6px; padding: .35rem .8rem; border-radius: 6px; border: 0; background: transparent; color: var(--muted);
  font-size: var(--fs-xs); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast); }
.seg:hover { color: var(--text); }
.seg[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--elev-1), 0 0 0 1px var(--border-strong); }
:root[data-theme="light"] .seg[aria-checked="true"] { background: #fff; }
.seg:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus); }

/* ---------------------------------------------------- filter chip group */
.toolbar { display: flex; align-items: center; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.toolbar .spacer, .spacer { flex: 1; }
.filter-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: .3rem .72rem; border-radius: var(--r-pill); border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-dim); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; text-transform: capitalize;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.fchip:hover { background: var(--hover); color: var(--text); }
.fchip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--border-accent); color: var(--text); }
.fchip:focus-visible { outline: none; box-shadow: var(--ring); }
.fchip .fc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tone, currentColor); }
.fchip .fc-count { font-family: var(--font-mono); font-size: var(--fs-2xs); color: var(--muted); }
.fchip[data-tone="info"] { --tone: var(--sev-info); } .fchip[data-tone="low"] { --tone: var(--sev-low); } .fchip[data-tone="medium"] { --tone: var(--sev-medium); }
.fchip[data-tone="high"] { --tone: var(--sev-high); } .fchip[data-tone="critical"] { --tone: var(--sev-critical); }

/* ----------------------------------------------------------------- kbd */
kbd, .kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 1.5em; height: 1.5em; padding: 0 .4em; border-radius: 5px;
  font-family: var(--font-mono); font-size: .75rem; font-weight: 600; color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border-strong); box-shadow: inset 0 -1px 0 var(--border-strong); line-height: 1; }

/* ------------------------------------------------------------- tooltip */
[data-tip] { position: relative; }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translate(-50%, 4px); z-index: var(--z-pop);
  padding: .32rem .55rem; border-radius: var(--r-xs); background: var(--text); color: var(--bg); font-size: var(--fs-xs); font-weight: 500; line-height: 1.3;
  white-space: nowrap; max-width: 260px; pointer-events: none; opacity: 0; transition: opacity var(--t-fast), transform var(--t-fast) var(--ease-out); box-shadow: var(--elev-2); font-family: var(--font-sans); letter-spacing: 0; text-transform: none; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }
/* Escape hides a showing tooltip (WCAG 1.4.13 dismissible), until the pointer or focus moves */
body.tips-off [data-tip]::after { opacity: 0 !important; transition: none !important; }
[data-tip][data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
[data-tip][data-tip-pos="bottom"]:hover::after, [data-tip][data-tip-pos="bottom"]:focus-visible::after { transform: translate(-50%, 0); }
[data-tip][data-tip-pos="end"]::after { left: auto; right: 0; transform: translateY(4px); }
[data-tip][data-tip-pos="end"]:hover::after, [data-tip][data-tip-pos="end"]:focus-visible::after { transform: none; }
[data-tip][data-tip-pos="end"][data-tip-pos-y="bottom"]::after, [data-tip-pos="bottom-end"]::after { left: auto; right: 0; bottom: auto; top: calc(100% + 8px); transform: translateY(-4px); }
[data-tip-pos="bottom-end"]:hover::after, [data-tip-pos="bottom-end"]:focus-visible::after { transform: none; }
.chip[data-tip]::after { text-transform: none; }

/* -------------------------------------------------------- copy button */
.copy-btn { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn .ci-done { display: none; color: var(--ok); }
.copy-btn.copied .ci-copy { display: none; }
.copy-btn.copied .ci-done { display: inline-flex; }
.copy-field { display: flex; align-items: center; gap: var(--sp-2); padding: 4px 4px 4px var(--sp-3); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.copy-field code { background: none; border: 0; padding: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-xs); color: var(--text-dim); }

/* --------------------------------------------------------- report body */
.report-body { color: var(--text-dim); font-size: var(--fs-base); line-height: 1.7; overflow-wrap: anywhere; }
.report-body > * + * { margin-top: var(--sp-3); }
.report-body h1, .report-body h2, .report-body h3, .report-body h4 { color: var(--text); margin-top: var(--sp-6); margin-bottom: var(--sp-2); }
.report-body h1 { font-size: var(--fs-xl); } .report-body h2 { font-size: var(--fs-lg); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }
.report-body h3 { font-size: var(--fs-md); } .report-body h4 { font-size: var(--fs-base); }
.report-body > :first-child { margin-top: 0; }
.report-body ul, .report-body ol { padding-left: 1.3rem; }
.report-body li + li { margin-top: 4px; }
.report-body li::marker { color: var(--muted); }
.report-body strong { color: var(--text); font-weight: 600; }
.report-body a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.report-body blockquote { border-left: 3px solid var(--border-accent); padding: var(--sp-2) var(--sp-4); background: var(--accent-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text); }
.report-body pre { padding: var(--sp-4); border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; font-size: var(--fs-sm); line-height: 1.55; }
.report-body table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); display: block; overflow-x: auto; }
.report-body th, .report-body td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); text-align: left; }
.report-body th { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
.report-body hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }

/* =========================================================== utilities == */
.grid { display: grid; gap: var(--sp-4); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px),1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.split { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); gap: var(--sp-6); align-items: start; }

.row { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-width: 0; }
.flex { display: flex; } .inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; } .flex-wrap, .wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; min-width: 0; } .shrink-0 { flex-shrink: 0; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; } .items-stretch { align-items: stretch; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; }
.stack-1 > * + * { margin-top: var(--sp-1); } .stack-2 > * + * { margin-top: var(--sp-2); } .stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); } .stack-6 > * + * { margin-top: var(--sp-6); }
.gap-1{gap:var(--sp-1);} .gap-2{gap:var(--sp-2);} .gap-3{gap:var(--sp-3);} .gap-4{gap:var(--sp-4);} .gap-5{gap:var(--sp-5);} .gap-6{gap:var(--sp-6);}
.mt-0{margin-top:0 !important;} .mt-1{margin-top:var(--sp-1);} .mt-2{margin-top:var(--sp-2);} .mt-3{margin-top:var(--sp-3);} .mt-4{margin-top:var(--sp-4);} .mt-5{margin-top:var(--sp-5);} .mt-6{margin-top:var(--sp-6);} .mt-8{margin-top:var(--sp-8);}
.mb-0{margin-bottom:0 !important;} .mb-1{margin-bottom:var(--sp-1);} .mb-2{margin-bottom:var(--sp-2);} .mb-3{margin-bottom:var(--sp-3);} .mb-4{margin-bottom:var(--sp-4);} .mb-5{margin-bottom:var(--sp-5);} .mb-6{margin-bottom:var(--sp-6);} .mb-8{margin-bottom:var(--sp-8);}
.ml-auto { margin-left: auto; }
.w-full { width: 100%; } .min-w-0 { min-width: 0; }
.text-c, .text-center { text-align: center; } .text-right { text-align: right; }
.text-2xs { font-size: var(--fs-2xs); } .text-xs { font-size: var(--fs-xs); } .text-sm { font-size: var(--fs-sm); } .text-base { font-size: var(--fs-base); } .text-md { font-size: var(--fs-md); } .text-lg { font-size: var(--fs-lg); }
.strong { font-weight: 600; color: var(--text); } .medium { font-weight: 500; }
.uppercase { text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.break { overflow-wrap: anywhere; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-bad { color: var(--bad); }
hr.div, .divider { border: none; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
.hidden { display: none !important; }

/* ============================================================ keyframes == */
/* (core keyframes used by components; richer motion lives in motion.css) */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1);} 50% { opacity: .4; transform: scale(.7);} }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes scaleOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(.97); } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes popOut { from { opacity: 1; } to { opacity: 0; transform: scale(.97); } }
@keyframes progress-indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(270%); } }

.reveal { opacity: 0; }
.reveal.in { animation: fadeInUp .5s var(--ease-out) forwards; }
/* Print / full-page capture: never leave unrevealed sections blank */
@media print {
  .reveal, .reveal.in { opacity: 1 !important; animation: none !important; transform: none !important; }
}
.page-enter { animation: fadeIn .3s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; }
  .progress-bar.indeterminate { width: 100%; opacity: .55; transform: none; }
}

/* =========================================================== responsive == */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 920px) {
  .split { grid-template-columns: minmax(0,1fr); }
  .engine-row { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .app-shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(86vw, 300px); transform: translateX(-104%); visibility: hidden;
    transition: transform var(--t-slow) var(--ease-out), visibility 0s linear var(--t-slow); box-shadow: var(--elev-4); padding-top: var(--sp-3); }
  body.nav-open .sidebar { transform: translateX(0); visibility: visible; transition: transform var(--t-slow) var(--ease-out), visibility 0s; }
  body.nav-open { overflow: hidden; }
  .icon-btn.sidebar-close, .icon-btn.hamburger { display: inline-grid; }
  .content { padding: var(--sp-5) var(--sp-4) var(--sp-10); }
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .crumbs li.crumb-mid { display: none; }
  .crumbs li.crumb-ellipsis { display: flex; }
  .crumbs a { max-width: 14ch; }
  .page-head, .page-header { flex-direction: column; align-items: stretch; margin-bottom: var(--sp-6); }
  .page-head h1, .page-title { font-size: var(--fs-xl); }
  .card, .panel { padding: var(--sp-5); }
  .grid-3, .grid-4 { grid-template-columns: minmax(0,1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-3); }
  .stat { padding: var(--sp-4); }
  .stat .v, .stat-value { font-size: var(--fs-xl); }
  .toast-region, #toasts { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); max-width: none; }
  .modal { padding: var(--sp-5); border-radius: var(--r-lg); }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .auth-main { padding: var(--sp-6) var(--sp-4); }
}
@media (min-width: 761px) { .crumbs li.crumb-ellipsis { display: none; } }
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: var(--sp-2); }
  .stat { padding: var(--sp-3); }
  .stat .v, .stat-value { font-size: var(--fs-xl); }
  .stat .k, .stat-label { font-size: var(--fs-2xs); }
  .gauge-lg { width: 150px; height: 150px; }
}

/* Logo tile: same gradient, highlight and hairline as the Simulant mark */
.brand-mark { position: relative; overflow: hidden; border-radius: 27%;
  background: radial-gradient(120% 120% at 28% 12%, rgba(255,255,255,.26), rgba(255,255,255,0) 55%), var(--grad); }
.brand-mark::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); pointer-events: none; }

/* ------------------------------------------------------ custom personas */
.pj-create-row { display: flex; align-items: center; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-5); }
.persona-create { flex: 1 1 320px; display: flex; align-items: center; gap: var(--sp-4); text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: var(--sp-4); border-radius: var(--r); border: 1.5px dashed var(--border-accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast); }
.persona-create:hover { background: var(--accent-soft); border-style: solid; }
.persona-create:focus-visible { outline: none; box-shadow: var(--ring); }
.persona-create-ic { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; background: var(--grad); color: var(--on-accent); }
.persona-create-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.persona-create-title { font-weight: 600; }
.persona-create-sub { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
.persona-create-go { color: var(--accent-text); flex: 0 0 auto; }
.persona-shell { position: relative; display: flex; }
.persona-shell > .persona { flex: 1; padding-bottom: calc(var(--sp-4) + 30px); }
.persona-actions { position: absolute; right: var(--sp-2); bottom: var(--sp-2); display: flex; gap: 2px; }
.persona-shell.disabled .persona-actions { opacity: .45; }
.persona-badge { display: inline-flex; align-items: center; gap: 4px; margin-right: var(--sp-2); padding: .08rem .45rem; border-radius: var(--r-pill);
  font-size: var(--fs-2xs, .7rem); font-weight: 700; letter-spacing: .02em; text-transform: uppercase; vertical-align: 2px;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.persona-badge svg { width: 11px; height: 11px; }

/* persona studio modal */
.ps-modal { max-width: 760px; }
.ps-foot { display: contents; }
.ps-lede { color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.5; margin: 0 0 var(--sp-5); max-width: 62ch; }
.ps-field-meta { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.ps-count { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--muted); }
.ps-count.is-short { color: var(--warn); }
.ps-examples, .ps-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.ps-gen { display: grid; gap: var(--sp-4); }
.ps-gen-head { display: flex; align-items: center; gap: var(--sp-3); }
.ps-quote { margin: 0; padding: var(--sp-3) var(--sp-4); border-left: 3px solid var(--border-strong); background: var(--surface-1); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-stages { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.ps-stage { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  transition: border-color var(--t), background var(--t); }
.ps-stage-dot { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: var(--fs-xs);
  border: 1.5px solid var(--border-strong); color: var(--muted); }
.ps-stage-dot svg { width: 13px; height: 13px; }
.ps-stage-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.ps-stage-name { font-weight: 600; font-size: var(--fs-sm); }
.ps-stage-role { font-size: var(--fs-xs); color: var(--muted); }
.ps-stage-state { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.ps-stage.is-active { border-color: var(--border-accent); background: var(--accent-soft); }
.ps-stage.is-active .ps-stage-dot { border-color: var(--accent); color: var(--accent-text); animation: psPulse 1.2s ease-in-out infinite; }
.ps-stage.is-active .ps-stage-state { color: var(--accent-text); font-weight: 600; }
.ps-stage.is-done .ps-stage-dot { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
@keyframes psPulse { 0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); } 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
.ps-summary { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5); border-radius: var(--r);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); color: var(--text); font-size: var(--fs-sm); line-height: 1.5; }
.ps-summary svg { color: var(--accent-text); flex: 0 0 auto; margin-top: 2px; }
.ps-summary p { margin: 0; }
.ps-warn { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5); border-radius: var(--r);
  background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); font-size: var(--fs-sm); color: var(--text-dim); }
.ps-warn svg { color: var(--warn); flex: 0 0 auto; margin-top: 2px; }
.ps-warn ul { margin: 0; padding-left: var(--sp-4); display: grid; gap: 2px; }
.ps-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--sp-4); margin-bottom: var(--sp-5); align-items: start; }
.ps-col { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-4); background: var(--surface); min-width: 0; }
.ps-col-sys { border-color: color-mix(in srgb, var(--accent-2) 35%, transparent); background: color-mix(in srgb, var(--accent-2) 6%, var(--surface)); }
.ps-col-title { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: var(--tracking-caps, .06em); color: var(--muted); font-weight: 700; }
.ps-col-sys .ps-col-title { color: var(--accent-2); }
.ps-facts { margin: 0; display: grid; gap: var(--sp-3); }
.ps-fact dt { font-size: var(--fs-xs); font-weight: 600; color: var(--text-dim); margin-bottom: 2px; }
.ps-fact dd { margin: 0; font-size: var(--fs-sm); color: var(--text); line-height: 1.45; overflow-wrap: anywhere; }
.ps-fact ul { margin: 0; padding-left: var(--sp-4); display: grid; gap: 2px; }
.ps-wcag { display: flex; flex-wrap: wrap; gap: 4px; }
.ps-fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-5); min-width: 0; }
.ps-fieldset legend { margin-bottom: var(--sp-2); padding: 0; }
.ps-cons-group { display: grid; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.ps-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.ps-checks { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); }
.ps-check { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-dim); cursor: pointer; min-height: 32px; }
.ps-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.ps-details { border: 1px solid var(--border); border-radius: var(--r); padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.ps-details > summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.ps-details > summary:focus-visible { outline: none; box-shadow: var(--ring); }
.ps-details[open] > summary { margin-bottom: var(--sp-2); }
.ps-details .hint { margin: 0 0 var(--sp-3); }
.ps-policy { font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.55; min-height: 240px; }
.ps-trace { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.ps-trace-item { font-size: var(--fs-xs); color: var(--muted); padding: .2rem .6rem; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface-1); }
.ps-trace-item strong { color: var(--text-dim); font-weight: 600; }
.ps-trace-item.is-llm { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
@media (max-width: 760px) {
  .ps-cols, .ps-grid2 { grid-template-columns: minmax(0, 1fr); }
  .persona-create { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ps-stage.is-active .ps-stage-dot { animation: none; }
  .persona-create, .ps-stage { transition: none; }
}
/* long custom persona names must wrap in the run review list */
.pj-review-row .tag { white-space: normal; max-width: 100%; overflow-wrap: anywhere; text-align: left; }

/* ---- Site-ownership verification panel (project page) ---- */
.vf-body { margin-top: var(--sp-3); }
.vf-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); }
.vf-status .chip .ic { margin-right: 4px; }
.vf-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
.vf-method { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.vf-method[data-ok="true"] { border-color: color-mix(in srgb, var(--sev-low) 55%, transparent); }
.vf-method-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-2); }
.vf-result { font-size: var(--fs-xs); }
.vf-where, .vf-help { font-size: var(--fs-xs); overflow-wrap: anywhere; }
.vf-method .copy-field code { overflow-wrap: anywhere; white-space: normal; }
.vf-error { display: flex; gap: var(--sp-2); align-items: flex-start; color: var(--sev-medium); font-size: var(--fs-sm); }
.vf-collapsible { border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.vf-collapsible > summary { display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-weight: 600; list-style: none; }
.vf-collapsible > summary::-webkit-details-marker { display: none; }
.vf-collapsible > summary .chip { margin-left: auto; }
.vf-collapsible[open] > summary { margin-bottom: var(--sp-2); }

/* ======================================================= project trends == */
/* "Since last run" card + inline SVG trend charts (project.js). */
.pj-trends-host { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.pj-trends-host:empty { display: none; }
.pj-trends-loading { padding: var(--sp-5); }
.pj-since, .pj-trends { padding: var(--sp-5); min-width: 0; }
.pj-since-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.pj-since-title { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); margin: 0; }
.pj-since-headline { margin: var(--sp-2) 0 0; color: var(--text); font-weight: 600; }
.pj-since-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-4); }
.pj-since-stat { border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: var(--sp-3); min-width: 0; }
.pj-since-stat b { display: block; font-size: var(--fs-lg); line-height: 1.2; color: var(--text); }
.pj-since-stat span { font-size: var(--fs-xs); color: var(--muted); }
.pj-since-stat[data-tone="good"] b { color: var(--ok); }
.pj-since-stat[data-tone="bad"] b { color: var(--sev-critical); }
.pj-since-stat[data-tone="warn"] b { color: var(--warn); }
.pj-since-regs { list-style: none; padding: 0; margin: var(--sp-4) 0 0; display: grid; gap: var(--sp-2); font-size: var(--fs-sm); }
.pj-since-regs li { border-left: 3px solid var(--sev-critical); padding: 2px 0 2px var(--sp-3); overflow-wrap: anywhere; }
.pj-trends-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.pj-trends-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-3); }
.pj-chart { margin: 0; border: 1px solid var(--border); border-radius: var(--r-md, 10px); padding: var(--sp-3) var(--sp-4); min-width: 0; background: var(--surface-1); }
.pj-chart-title { font-size: var(--fs-sm); font-weight: 600; color: var(--text); margin-bottom: var(--sp-2); }
.pj-chart-svg svg { display: block; width: 100%; height: auto; overflow: visible; }
.pj-ch-grid { stroke: var(--border-strong); stroke-width: 1; }
.pj-ch-ax { fill: var(--muted); font-size: 9px; font-family: var(--font-mono); }
.pj-ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pj-ch-dot { stroke: var(--surface-1); stroke-width: 1.5; }
.pj-legend { list-style: none; padding: 0; margin: var(--sp-2) 0 0; display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-size: var(--fs-xs); color: var(--muted); }
.pj-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pj-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.pj-chart-data { margin-top: var(--sp-2); font-size: var(--fs-xs); }
.pj-chart-data summary { cursor: pointer; color: var(--muted); }
.pj-chart-data summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.pj-chart-table { font-size: var(--fs-xs); margin-top: var(--sp-2); }
.pj-chart-table th, .pj-chart-table td { padding: 4px 8px; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .pj-ch-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pj-ch-draw .9s ease-out forwards; }
  .pj-ch-bar { transform-box: fill-box; transform-origin: bottom; animation: pj-ch-grow .5s ease-out both; }
}
@keyframes pj-ch-draw { to { stroke-dashoffset: 0; } }
@keyframes pj-ch-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (max-width: 560px) {
  .pj-since, .pj-trends { padding: var(--sp-4); }
  .pj-since-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
