/* ==========================================================================
   CRUCIBLE DESIGN SYSTEM  ·  v1.0  ·  drop-in stylesheet
   --------------------------------------------------------------------------
   A single self-contained stylesheet. Import it once, globally, then apply
   the documented classes (or just the tokens) across your app.

   FONTS — add these two <link>s to your <head> (or keep the @import below):
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
     <link href="https://api.fontshare.com/v2/css?f[]=satoshi@400,500,600,700,900&display=swap" rel="stylesheet">
   ========================================================================== */

/* Fonts self-hosted via /css/fonts.css (@font-face, CSP 'self') — external @import removed. */

/* ========================================================================== */
/*  1. DESIGN TOKENS                                                           */
/* ========================================================================== */
:root {
  /* — Type families — */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif; /* headings, numerals, brand */
  --font-body:    'Satoshi', system-ui, -apple-system, sans-serif;       /* body, UI, labels */
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', monospace;  /* code, IDs, metrics, tags */

  /* — Type scale — */
  --t-hero:    clamp(40px, 5.2vw, 66px);
  --t-h1:      36px;
  --t-h2:      clamp(26px, 3.2vw, 34px);
  --t-h3:      22px;
  --t-h4:      17px;
  --t-lead:    19px;
  --t-body:    16px;
  --t-sm:      14px;
  --t-xs:      12.5px;
  --t-eyebrow: 12.5px;

  /* — Ink (text) — */
  --text:   #1C2030;  /* primary text & headings */
  --text-2: #494E60;  /* secondary / body copy (darkened for legibility) */
  --text-3: #656A7D;  /* tertiary / meta (darkened — was near-invisible at #8C90A2) */
  --text-4: #868B9C;  /* faint / table headers, disabled (darkened from #AFB2C0) */

  /* — Surfaces — */
  --bg:        #F6F7FB;  /* app canvas / page background */
  --bg-2:      #FBFBFD;  /* subtle raised row hover */
  --surface:   #FFFFFF;  /* cards, panels, bars */
  --surface-2: #F2F3F8;  /* inset wells, chips, hover fills */
  --line:      #E7E8F0;  /* primary borders */
  --line-2:    #EEEFF5;  /* hairline dividers inside cards */

  /* — Brand — */
  --accent: #3E63DD;  /* primary blue — actions, links, focus */
  --violet: #8A5CF5;  /* secondary — webhooks, accents */
  --teal:   #0FB8A6;  /* tertiary — success-ish brand pop */
  --grad:      linear-gradient(105deg, #3E63DD, #8A5CF5 58%, #0FB8A6);
  --grad-soft: linear-gradient(105deg, rgba(62,99,221,.12), rgba(138,92,245,.12) 58%, rgba(15,184,166,.12));

  /* — Status (fg + tint pairs) — */
  --ok:   #18A368;  --ok-bg:   #E4F6EE;  /* pass / healthy */
  --fail: #E5484D;  --fail-bg: #FCEAEA;  /* fail / error */
  --warn: #E0930A;  --warn-bg: #FBF1DD;  /* warning / degraded */
  --run:  #3E63DD;  --run-bg:  #E8ECFB;  /* running / in-progress */
  --idle: #9499AD;  --idle-bg: #EEEFF4;  /* idle / queued / neutral */

  /* — Radii — */
  --r-lg: 16px;  /* cards, large panels */
  --r-md: 12px;  /* inner cards, wells */
  --r-sm: 9px;   /* buttons, inputs, nav items */
  --r-xs: 6px;   /* tags, tiny chips */
  --r-pill: 20px;

  /* — Elevation — */
  --shadow-sm:  0 1px 2px rgba(28,32,48,.04), 0 1px 3px rgba(28,32,48,.06);
  --shadow-md:  0 4px 16px rgba(28,32,48,.06), 0 1px 4px rgba(28,32,48,.05);
  --shadow-lg:  0 18px 50px -12px rgba(28,32,48,.22), 0 6px 18px rgba(28,32,48,.08);
  --shadow-pop: 0 12px 40px -8px rgba(28,32,48,.20);

  /* — Spacing rhythm (use multiples of 4) — */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;

  /* — Layout — */
  --rail-w: 240px;
  --maxw: 1400px;

  /* — Marketing aliases (so landing-page components read naturally) — */
  --ink:   var(--text);
  --ink-2: var(--text-2);
  --ink-3: var(--text-3);
  --paper:   var(--surface);
  --paper-2: var(--bg);
  --paper-3: var(--surface-2);
}

/* ========================================================================== */
/*  2. RESET + BASE                                                            */
/* ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1,h2,h3,h4,h5 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; color: var(--text); }
h1 { font-size: var(--t-h1); font-weight: 700; letter-spacing: -0.03em; }
h2 { font-size: var(--t-h2); }
h3 { font-size: var(--t-h3); }
h4 { font-size: var(--t-h4); }
p  { color: var(--text-2); }
a  { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: rgba(138,92,245,.20); }
/* Responsive safety: media never overflows its container on narrow viewports. */
img, video, canvas { max-width: 100%; }

/* scrollbars — slim, neutral */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #D7D9E4; border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #C2C5D4; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ========================================================================== */
/*  3. TYPOGRAPHY UTILITIES                                                    */
/* ========================================================================== */
.display   { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.035em; line-height: 0.98; }
.hero-type { font-size: var(--t-hero); font-family: var(--font-display); font-weight: 700; letter-spacing: -0.04em; line-height: 0.98; }
/* .mono = machine strings only (codes, refs, PAN/GSTIN/IFSC, file names, URLs). Dates, money
   and counts keep the body face and get .tnum for column alignment. Full rationale in
   crucible-v2.css, which is where the app screens read this from. */
.mono      { font-family: var(--font-mono); }
.tnum      { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
/* A quantity is never set in the mono face (its zero carries a mark and reads as an 8): a .tag that
   holds a count takes the body face — see crucible-v2.css, same rule. */
.tag.tnum  { font-family: var(--font-body); letter-spacing: 0; }
.lead      { font-size: var(--t-lead); line-height: 1.5; color: var(--text-2); }
.small     { font-size: var(--t-sm); color: var(--text-2); }
.meta      { font-size: var(--t-xs); color: var(--text-3); }
.eyebrow   { font-family: var(--font-body); font-size: var(--t-eyebrow); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ========================================================================== */
/*  4. BUTTONS                                                                 */
/* ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  transition: background .12s, border-color .12s, box-shadow .12s, transform .04s;
  white-space: nowrap;
}
.btn:hover  { background: var(--surface-2); border-color: #DBDDE8; }
.btn:active { transform: translateY(.5px); }
.btn svg    { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 2px 8px -2px rgba(62,99,221,.5); }
.btn.primary:hover { background: #3556c8; }
.btn.grad    { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 14px -3px rgba(62,99,221,.5); }
.btn.grad:hover { filter: brightness(1.05); }
.btn.ghost   { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger  { color: var(--fail); }
.btn.danger:hover { background: var(--fail-bg); border-color: rgba(229,72,77,.3); }
.btn.sm   { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg   { height: 48px; padding: 0 22px; font-size: 15.5px; border-radius: 11px; }
.btn.icon { width: 38px; padding: 0; }
.btn.icon.sm { width: 32px; }

/* ========================================================================== */
/*  5. CARDS / SURFACES                                                        */
/* ========================================================================== */
.card     { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card.hover, .card-hover { transition: box-shadow .14s, transform .14s, border-color .14s; }
.card.hover:hover, .card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #DCDEEA; }
.divider  { height: 1px; background: var(--line); margin: 16px 0; border: none; }

/* ========================================================================== */
/*  6. CHIPS · TAGS · STATUS DOTS · BADGES                                     */
/* ========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: 12px; font-weight: 600; font-family: var(--font-body);
  background: var(--surface-2); color: var(--text-2); border: 1px solid transparent; white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip.ok   { background: var(--ok-bg);   color: var(--ok); }
.chip.fail { background: var(--fail-bg); color: var(--fail); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.run  { background: var(--run-bg);  color: var(--run); }
.chip.idle { background: var(--idle-bg); color: var(--idle); }
.chip.line { background: var(--surface); border-color: var(--line); color: var(--text-2); }

.dot-ok { background: var(--ok); } .dot-fail { background: var(--fail); }
.dot-warn { background: var(--warn); } .dot-run { background: var(--run); } .dot-idle { background: var(--idle); }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 11.5px; font-weight: 600; font-family: var(--font-mono);
  background: var(--surface-2); color: var(--text-3); letter-spacing: -.01em;
}
/* HTTP method badge — color set inline per method (GET #18A368, POST #3E63DD, PUT #8A5CF5, PATCH #E0930A, DELETE #E5484D) */
.method-badge { font-family: var(--font-mono); font-weight: 700; letter-spacing: .02em; padding: 2px 7px; border-radius: 5px; font-size: 11px; }

.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ========================================================================== */
/*  7. FORM CONTROLS                                                           */
/* ========================================================================== */
.input, .field-input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-2);
  font-size: 14px; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; }
.input:focus, .field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(62,99,221,.12); background: var(--surface); }
.input.mono { font-family: var(--font-mono); font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* search field */
.search {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text-3);
}
.search input { border: none; background: none; outline: none; width: 100%; font-size: 14px; color: var(--text); }
.kbd { font-family: var(--font-mono); font-size: 11px; background: var(--surface); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; color: var(--text-3); }

/* ========================================================================== */
/*  8. TABLE                                                                   */
/* ========================================================================== */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-4); padding: 13px 16px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .1s; cursor: pointer; }
.tbl tbody tr:hover { background: var(--bg-2); }

/* ========================================================================== */
/*  9. METRIC / STAT CARD                                                      */
/* ========================================================================== */
.metric { padding: 18px; }
.metric .m-top { display: flex; align-items: center; justify-content: space-between; }
.metric .m-label { font-size: 13px; color: var(--text-3); font-weight: 600; }
.metric .m-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; } /* set bg/color inline w/ a status tint */
.metric .m-val { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 12px; }
.metric .m-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 5px; }
/* A count of zero is a statement, not a destination — see crucible-v2.css, same rule: the tile is
   not a link, and it is the same card a little calmer, not a dimmed one. */
.metric.metric-zero { cursor: default; }
.metric.metric-zero .m-val { color: var(--text) !important; }
.metric.metric-zero .m-ico { opacity: .62; }
.trend-up { color: var(--ok); font-weight: 700; } .trend-down { color: var(--fail); font-weight: 700; }

/* progress bar */
.bar { height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: var(--grad); }

/* mini sparkbars */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.spark > i { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; background: var(--surface-2); }

/* ========================================================================== */
/*  10. APP SHELL — sidebar rail + topbar                                      */
/* ========================================================================== */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100vh; }

.rail { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; gap: 4px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--grad); display: grid; place-items: center; box-shadow: 0 4px 14px -3px rgba(62,99,221,.5); }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.03em; }
.brand-sub { font-size: 10.5px; color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; font-weight: 600; margin-top: -2px; }

.nav-group-label { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-4); padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: 14px; font-weight: 500; width: 100%; text-align: left; transition: background .12s, color .12s; position: relative; white-space: nowrap; }
.nav-item > span { flex: 1; min-width: 0; }
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--grad-soft); color: var(--accent); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before { content: ''; position: absolute; left: -14px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav-badge { margin-left: auto; flex: none; font-family: var(--font-body); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 700; background: var(--surface-2); color: var(--text-3); padding: 1px 7px; border-radius: var(--r-pill); }
.nav-item.active .nav-badge { background: rgba(62,99,221,.14); color: var(--accent); }
/* `.nav-item > span { flex: 1 }` outranks `.nav-badge { flex: none }` — keep the count compact */
.nav-item > .nav-badge { flex: none; }

.avatar { border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; color: #fff; font-family: var(--font-display); } /* set width/height/background inline */

.topbar { height: 62px; flex: none; border-bottom: 1px solid var(--line); background: rgba(251,251,253,.85); backdrop-filter: blur(10px); display: flex; align-items: center; gap: 16px; padding: 0 26px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-3); }
.crumbs .cur { color: var(--text); font-weight: 600; }

.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { padding: 24px 28px 48px; max-width: none; margin: 0; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
/* A flex item defaults to min-width:auto, so the nowrap <h1> below set a hard floor on the whole
   page: on /app/consult at 320px the heading's 326px min-content stretched .page to 354px and
   every block inside it — including the body copy — was rendered 34px wider than the viewport and
   clipped by the shell's overflow:hidden. crucible-v2.css has carried this line for its own shell
   all along; the legacy shell never got it. */
.page-head > *:first-child { min-width: 0; }
.page-head h1 { white-space: nowrap; }
.page-head p { margin-top: 6px; font-size: 15px; max-width: 560px; }

/* layout helpers */
.kbar { display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 16px; }
.metric-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1180px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } }
.two-col { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ========================================================================== */
/*  11. CODE BLOCK (dark)                                                      */
/* ========================================================================== */
.code-block { background: #0E0E18; color: #C8CBE0; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.75; padding: 18px 20px; border-radius: var(--r-md); overflow: auto; }
.code-block .c-key { color: #A9BEFF; }   /* keys */
.code-block .c-ok  { color: #6DD7B8; }   /* values / pass */
.code-block .c-dim { color: #686C88; }   /* comments */
.code-block .c-err { color: #F0888C; }   /* errors */

/* ========================================================================== */
/*  12. ENTRANCE ANIMATION (transform-only — safe for print/reduced-motion)    */
/* ========================================================================== */
.fade-in { animation: fadeIn .4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes fadeIn { from { transform: translateY(9px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }

/* ========================================================================== */
/*  13. MARKETING / LANDING COMPONENTS                                         */
/*  (Use these on marketing pages; the app uses sections 4–11.)                */
/* ========================================================================== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; }

/* sticky translucent nav */
.m-nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.m-nav-inner { display: flex; align-items: center; gap: 28px; height: 70px; }
.m-nav-links { display: flex; align-items: center; gap: 26px; }
.m-nav-links a { font-size: 15px; font-weight: 500; color: var(--text-2); white-space: nowrap; transition: color .12s; }
.m-nav-links a:hover { color: var(--text); }
/* icon button + dark-mode toggle (sun in dark → switch to light; moon in light → switch to dark) */
.btn.icon { padding: 0; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: inline; }
html[data-theme="dark"] .theme-toggle .i-sun { display: inline; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }
.m-nav-burger { display: none !important; }   /* beat .btn.icon at desktop */
.m-nav-links .m-only { display: none; }
/* Mobile: hide the inline links, reveal them (plus Log in) from the hamburger. */
@media (max-width: 860px) {
  .m-nav-links { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
                 align-items: flex-start; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line);
                 padding: 18px 22px; box-shadow: var(--shadow-md); z-index: 60; }
  .m-nav-links.open { display: flex; }
  .m-nav-links .m-only { display: block; }
  .m-nav-desktop { display: none !important; }
  .m-nav-burger { display: inline-flex !important; }
}

/* ── Mobile header fit ──────────────────────────────────────────────────────
   The right-hand action group (search + theme + Start Filing + burger) is
   fixed-width and was laid out after a 28px .wrap gutter and a 28px flex gap,
   so below ~430px it pushed past the viewport: at 390px the page scrolled 40px
   sideways and the BURGER — the only navigation a phone has — sat off-screen at
   x=392..430, unreachable. Nothing here changes the desktop header.            */
@media (max-width: 860px) {
  .m-nav .wrap { padding-left: 16px; padding-right: 16px; }
  .m-nav-inner { gap: 12px; }
  .m-nav-inner > * { min-width: 0; }              /* let flex items actually shrink */
  .m-nav .btn.icon { width: 36px; height: 36px; flex: none; }
  .m-nav .btn.grad { padding: 0 14px; font-size: 13.5px; white-space: nowrap; }
}
@media (max-width: 600px) {
  .m-nav .wrap { padding-left: 12px; padding-right: 12px; }
  .m-nav-inner { gap: 8px; }
  .m-nav .brand-mark { width: 30px; height: 30px; }
  .m-nav .brand-mark svg { width: 17px; height: 17px; }
  .m-nav .brand-name { font-size: 16px; }
  /* Search yields its header slot first — it is the one control with a second
     home (the "Search" item inside the burger menu, plus ⌘K). Navigation and
     the primary CTA both stay. */
  .m-nav #siteSearchBtn { display: none !important; }
  .m-nav .btn.grad { padding: 0 12px; font-size: 13px; }
}
@media (max-width: 360px) {
  .m-nav .brand-name { display: none; }           /* the mark alone still links home */
  .m-nav .btn.icon { width: 34px; height: 34px; }
}

/* hero */
.m-hero { position: relative; padding: 88px 0 70px; overflow: hidden; }
.m-hero::before { content: ''; position: absolute; top: -180px; left: 50%; transform: translateX(-50%); width: 1100px; height: 620px; background: radial-gradient(ellipse at center, rgba(138,92,245,.16), rgba(62,99,221,.10) 40%, transparent 68%); z-index: -1; }
.m-hero h1 { font-size: clamp(42px, 6vw, 76px); font-weight: 700; letter-spacing: -0.04em; line-height: 0.98; max-width: 920px; }
.m-hero .sub { font-size: clamp(18px, 2.1vw, 21px); color: var(--text-2); max-width: 620px; margin-top: 24px; line-height: 1.5; }
.hero-badge { display: inline-flex; align-items: center; gap: 9px; height: 34px; padding: 0 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-sm); }
.hero-badge .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }

/* section scaffolding */
.section { padding: 96px 0; }
.section-head { max-width: 680px; margin-bottom: 54px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head h2 { font-size: clamp(32px, 4vw, 48px); font-weight: 700; letter-spacing: -0.035em; margin-top: 14px; }
.section-head p { font-size: 19px; color: var(--text-2); margin-top: 18px; line-height: 1.5; }

/* split feature row */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.split.flip .split-media { order: -1; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 36px; } .split.flip .split-media { order: 0; } }
.split h3 { font-size: 30px; letter-spacing: -0.03em; margin: 16px 0; }
.feat-list { margin-top: 26px; display: flex; flex-direction: column; gap: 16px; }
.feat-item { display: flex; gap: 13px; align-items: flex-start; }
.feat-item span { color: var(--text-2); }
.feat-check { width: 24px; height: 24px; border-radius: 7px; background: var(--grad-soft); color: var(--accent); display: grid; place-items: center; flex: none; margin-top: 1px; }
.feat-check svg { width: 14px; height: 14px; }

/* feature grid card */
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 900px) { .fgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .fgrid { grid-template-columns: 1fr; } }
.fcard { padding: 26px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); transition: box-shadow .16s, transform .16s; }
.fcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.fcard .fi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 18px; } /* set a status tint bg/color inline */
.fcard h4 { font-size: 18.5px; margin-bottom: 9px; }
.fcard p { font-size: 15px; color: var(--text-2); }

/* dark stats band */
.stats-band { background: var(--text); color: #fff; border-radius: 22px; padding: 52px; display: grid; grid-template-columns: repeat(4,1fr); gap: 30px; position: relative; overflow: hidden; }
.stats-band::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 85% 10%, rgba(138,92,245,.35), transparent 50%), radial-gradient(circle at 10% 90%, rgba(15,184,166,.22), transparent 45%); }
.stat { position: relative; }
.stat .v { font-family: var(--font-display); font-weight: 700; font-size: 46px; letter-spacing: -0.03em; background: linear-gradient(120deg,#fff,#C7D0FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .l { font-size: 15px; color: #A8ACC4; margin-top: 6px; }
@media (max-width: 820px) { .stats-band { grid-template-columns: 1fr 1fr; gap: 28px; padding: 36px; } }

/* comparison table */
.cmp { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.cmp table { width: 100%; border-collapse: collapse; }
.cmp th, .cmp td { padding: 16px 20px; text-align: left; font-size: 15px; border-bottom: 1px solid var(--line); }
.cmp thead th { background: var(--bg); font-family: var(--font-display); font-weight: 600; }
.cmp thead th.us { background: var(--grad-soft); color: var(--accent); }
.cmp td.col-us { background: rgba(62,99,221,.04); }
.cmp .yes { color: var(--ok); font-weight: 700; } .cmp .no { color: #C4C8D6; } .cmp .partial { color: var(--warn); font-weight: 600; }
.cmp tbody tr:last-child td { border-bottom: none; }
/* marketing comparison tables: scroll sideways on small screens (the .cmp box is
   overflow:hidden by default, which CLIPS a wide table and makes its right columns
   unreachable on a phone; switch it to horizontal scroll and give the table a
   min-width so the columns keep their shape while the box scrolls). */
@media (max-width: 900px) {
  .cmp { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cmp table { min-width: 560px; }
}

/* pricing tiers */
.tiers { display: grid; grid-template-columns: repeat(3,1fr); gap: 22px; align-items: stretch; }
@media (max-width: 900px) { .tiers { grid-template-columns: 1fr; max-width: 440px; margin: 0 auto; } }
.tier { padding: 32px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; }
.tier.featured { position: relative; box-shadow: var(--shadow-lg); background: linear-gradient(var(--surface),var(--surface)) padding-box, var(--grad) border-box; border: 2px solid transparent; }
.tier .badge { position: absolute; top: -13px; left: 32px; height: 26px; padding: 0 13px; border-radius: var(--r-pill); background: var(--grad); color: #fff; font-size: 12.5px; font-weight: 700; display: grid; place-items: center; }
.tier .price { font-family: var(--font-display); font-weight: 700; font-size: 46px; letter-spacing: -0.03em; margin: 16px 0 4px; white-space: nowrap; }
.tier .price span { font-size: 16px; color: var(--text-3); font-weight: 500; }
.tier ul { list-style: none; margin: 22px 0; display: flex; flex-direction: column; gap: 12px; }
.tier li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--text-2); }
.tier li svg { width: 18px; height: 18px; color: var(--accent); flex: none; margin-top: 2px; }
.tier .btn { margin-top: auto; width: 100%; }

/* dark CTA band */
.cta-band { text-align: center; padding: 84px 40px; border-radius: 24px; background: var(--text); color: #fff; position: relative; overflow: hidden; }
.cta-band::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 0%, rgba(138,92,245,.4), transparent 55%); }
.cta-band > * { position: relative; }
.cta-band h2 { color: #fff; font-size: clamp(32px, 4.5vw, 52px); letter-spacing: -0.035em; }
.cta-band p { color: #B6BAD0; font-size: 19px; margin: 18px auto 32px; max-width: 540px; }

/* footer */
.footer { border-top: 1px solid var(--line); padding: 60px 0 40px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px; } }
.footer-col h5 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 16px; }
.footer-col a { display: block; font-size: 15px; color: var(--text-2); margin-bottom: 11px; transition: color .12s; }
.footer-col a:hover { color: var(--text); }

/* reveal-on-scroll (pair with an IntersectionObserver that adds .in) */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }


/* ---- responsive additions ---- */
@media (max-width: 1020px) {
  .tiers { grid-template-columns: repeat(2, 1fr) !important; }
  .fgrid { grid-template-columns: repeat(2, 1fr) !important; }
  .metric-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .two-col { grid-template-columns: 1fr !important; }
  .split { grid-template-columns: 1fr !important; }
}
@media (max-width: 640px) {
  .tiers, .fgrid { grid-template-columns: 1fr !important; }
  .m-nav-inner { height: 60px; gap: 14px; }
  .section { padding: 44px 0 !important; }
  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 26px !important; }
  .cta-band { padding: 52px 22px !important; }
  .page { padding: 18px 14px !important; }
  .page-head { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
  /* Mirrors crucible-v2.css: a one-line-only page title cannot survive a 320px phone. */
  .page-head h1 { white-space: normal; font-size: 26px; }
  .metric-grid { grid-template-columns: 1fr 1fr !important; }
  /* Wide tables scroll INSIDE their card — the page must not.
     This used to be `.tbl { display:block; overflow-x:auto }`, which never worked: every one of
     these tables carries an inline `min-width:900px` (the CA queue) or 640–720px, and an inline
     min-width beats a stylesheet width, so the "scroller" was itself 900px wide and simply pushed
     the page out. crucible-v2.css already solved this by making the CARD the scroller and leaving
     the table its width; this is that same pair, ported to the legacy shell. */
  .card:has(> table.tbl), .card:has(> div > table.tbl) { overflow-x: auto !important; }
  table.tbl { min-width: 640px; }
  .kbar { flex-wrap: wrap; }
  .m-hero { padding: 48px 0 20px !important; }
}


/* ========================================================================== */
/*  MOBILE APP-SHELL DRAWER — CA / Admin / Customer portals                    */
/* ========================================================================== */
.rail-toggle { display: none; }
.rail-backdrop { display: none; }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr !important; }
  .main { grid-column: 1 / -1 !important; }
  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; width: 270px; max-width: 82vw;
    z-index: 130; transform: translateX(-100%);
    transition: transform .24s cubic-bezier(.2,.7,.2,1);
    box-shadow: 0 24px 60px -12px rgba(10,12,24,.5);
  }
  .app.rail-open .rail { transform: none; }
  @media (prefers-reduced-motion: reduce) { .rail { transition: none !important; } }
  .rail-backdrop { position: fixed; inset: 0; z-index: 120; background: rgba(12,14,26,.46); }
  .app.rail-open .rail-backdrop { display: block; }
  .rail-toggle {
    display: grid; place-items: center; width: 38px; height: 38px; flex: none;
    border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
    color: var(--text-2); cursor: pointer;
  }
  .rail-toggle:hover { color: var(--text); border-color: var(--line-2); }
  .topbar { padding: 0 12px !important; gap: 10px !important; }
  .topbar .search { width: 168px !important; }
  .crumbs { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .page { padding: 18px 14px 40px !important; }
}
@media (max-width: 560px) {
  .topbar .search { display: none !important; }
  .tb-hide-xs { display: none !important; }
  .crumbs { font-size: 12.5px; }
}

/* ========================================================================== */
/*  DARK MODE — html[data-theme="dark"] flips the token layer                  */
/* ========================================================================== */
html[data-theme="dark"] {
  color-scheme: dark;
  /* the same neutral charcoal palette as crucible-v2.css (owner review, Oct 2026) — see the
     note on section 15 there for the reasoning and the measured contrast */
  --text:   #DFE1E5;
  --text-2: #BCBEC4;
  --text-3: #A8ABB2;
  --text-4: #9DA0A8;
  --bg:        #1E1F22;
  --bg-2:      #26282B;
  --surface:   #2B2D30;
  --surface-2: #35373B;
  --line:      #3E4045;
  --line-2:    #35373B;
  --accent: #80A8F8;
  --grad-soft: linear-gradient(105deg, rgba(110,150,245,.15), rgba(150,125,235,.15) 58%, rgba(70,190,175,.15));
  --ok:   #73BD79;  --ok-bg:   #25362A;
  --fail: #F28B8E;  --fail-bg: #432A2C;
  --warn: #E2B85C;  --warn-bg: #3D3424;
  --run:  #86ABF8;  --run-bg:  #2A3550;
  --idle: #A8ABB2;  --idle-bg: #35373B;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.22), 0 1px 3px rgba(0,0,0,.18);
  --shadow-md:  0 4px 16px rgba(0,0,0,.30), 0 1px 4px rgba(0,0,0,.20);
  --shadow-lg:  0 18px 50px -12px rgba(0,0,0,.55), 0 6px 18px rgba(0,0,0,.28);
  --shadow-pop: 0 12px 40px -8px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04);
}
html[data-theme="dark"] .topbar { background: rgba(43,45,48,.94); }
html[data-theme="dark"] .m-nav { background: rgba(30,31,34,.86); }
html[data-theme="dark"] .cta-band,
html[data-theme="dark"] .stats-band { background: #2B2D30; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
html[data-theme="dark"] .btn.primary { background: #3364D6; }
html[data-theme="dark"] .btn.primary:hover { background: #3B6FE3; }
html[data-theme="dark"] .cmp table thead th.us,
html[data-theme="dark"] .cmp .col-us { background: rgba(110,150,245,.10); }
html[data-theme="dark"] img { filter: brightness(.92); }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea { color-scheme: dark; }
/* Gradient hero text was the light blue→teal ramp on a dark bg → unreadable. Use a bright ramp. */
html[data-theme="dark"] .grad-text {
  background: linear-gradient(120deg, #93B0FA, #B7A6F2 52%, #6FD4C6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Required fields (owner #20) — same rule as crucible-v2.css: a red asterisk after the label of any
   field whose control carries `required`. Decorative (empty alt text): `required` already says it. */
form:has(:is(input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="submit"], [type="button"], [type="reset"], [type="image"], [type="file"], [readonly], [disabled]), select:not([disabled]), textarea:not([readonly], [disabled])):not([required], [data-req])) :is(
  .field:not(:has(.field)):has(:is(input, select, textarea):is([required], [data-req]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"])) > .field-label,
  :is(.field-label, label):has(+ :is(input, select, textarea):is([required], [data-req]):not([type="hidden"]):not([type="checkbox"]):not([type="radio"]))
)::after {
  content: "\00a0*"; content: "\00a0*" / "";
  color: var(--fail); font-weight: 700; letter-spacing: 0;
}
/* The tab you are on is not a link (owner #3, #11b) — clicking it only reloaded the page. */
.seg a.on, .seg a.active, .seg a[aria-current="page"],
a[role="tab"][aria-selected="true"],
a.btn.pg-on, a.btn[aria-current="page"] { pointer-events: none; cursor: default; }
