/*
 * GrapeBeaver Intelligence — design system.
 *
 * Built from the brand guide and the landing mockup. Two rules govern
 * everything here:
 *
 *   1. Calm by default, loud only where severity earns it. Chrome is Ink Navy /
 *      Slate / Paper. Grape marks actions and identity, never status.
 *   2. Amber and Red appear ONLY in severity badges. If you find either
 *      hex outside the .sev-* rules, it is a bug — the whole credibility of the
 *      product rests on urgency having somewhere to go.
 */

/*
 * Themes.
 *
 * Three, chosen per user and stamped on <html data-theme>. Everything below is
 * token-level: a component reads --surface, never a hex, so a new theme is a
 * block of variables rather than a second stylesheet to keep in step.
 *
 * Rule 2 above survives every theme. The severity ramp is the only place amber
 * and red appear, and it is redefined per theme only to stay legible on that
 * theme's ground — never to make anything else louder. "Colorful" saturates the
 * grape/teal/bark family precisely because those are the colours that are *not*
 * spoken for.
 */

:root, [data-theme="light"] {
  --ink: #0C2A42;             /* body text */
  --deep: #0C2A42;            /* brand navy used as a *fill*; fixed in every theme */
  --on-deep: #FFFFFF;         /* text on that fill */
  --grape: #5B2C6F;
  --grape-dark: #48225A;
  --bark: #6B4226;
  --teal: #0F6E56;
  --slate: #5F6B76;
  --hairline: #DCE2E8;

  --ground: #F5F7FA;          /* the page behind everything */
  --surface: #FFFFFF;         /* cards, inputs, tables */
  --surface-2: #EEF2F6;       /* inset chrome: toolbars, shot frames */
  --surface-hover: #FCFDFE;
  --hairline-2: #C9D2DB;
  --on-accent: #FFFFFF;       /* text on grape — fixed, not a surface */
  --bark-tint: #F4EFEA;
  --bark-line: #E4D8CB;
  --grape-wash: rgba(91, 44, 111, 0.05);

  /* Severity only. Never use these for anything else. */
  --sev-low: #0F6E56;
  --sev-low-bg: #E6F2EE;
  --sev-medium: #8A560F;      /* darkened from #BA7517 for AA on tint */
  --sev-medium-bg: #FBF2E3;
  --sev-high: #A32D2D;
  --sev-high-bg: #FAEBEB;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-focus: 0 0 0 3px rgba(91, 44, 111, 0.18);

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/*
 * Dark. Ink Navy taken all the way down rather than to neutral grey, so it
 * still reads as the same product. Grape and Teal are lifted, because the
 * light-theme values fail contrast on a dark ground — the same hue, not a
 * different identity.
 */
[data-theme="dark"] {
  --ink: #E4ECF2;             /* text, not chrome: the name is the role */
  --deep: #061019;            /* deepened so it still reads as a panel on a dark ground */
  --on-deep: #FFFFFF;
  --grape: #C0A0D2;
  --grape-dark: #D3BBE0;
  --bark: #D2A87F;
  --teal: #58C5A5;
  --slate: #9DAFBD;
  --hairline: #27394A;

  --ground: #0A141D;
  --surface: #111F2B;
  --surface-2: #182838;
  --surface-hover: #162734;
  --hairline-2: #31465A;
  --on-accent: #14202B;       /* dark text on a light-grape button */
  --bark-tint: #241C14;
  --bark-line: #3C2E20;
  --grape-wash: rgba(192, 160, 210, 0.12);

  --sev-low: #6BD6B4;
  --sev-low-bg: #0E2A23;
  --sev-medium: #E6B45C;
  --sev-medium-bg: #2C2413;
  --sev-high: #F2908F;
  --sev-high-bg: #33191B;

  --shadow-focus: 0 0 0 3px rgba(192, 160, 210, 0.28);
}

/*
 * Colorful. A light theme that spends its saturation on the brand family —
 * a grape-washed ground, deeper plum text, stronger teal and bark. Severity is
 * left exactly where it is: making the chrome louder is only safe as long as
 * the one thing that must shout still shouts louder.
 */
[data-theme="colorful"] {
  --ink: #241033;
  --deep: #1E0C2C;
  --on-deep: #FFFFFF;
  --grape: #7A2E9E;
  --grape-dark: #5E2079;
  --bark: #9A5B2A;
  --teal: #0C8467;
  --slate: #6A5476;
  --hairline: #E0D2EC;

  --ground: #F7F1FB;
  --surface: #FFFFFF;
  --surface-2: #F0E5F8;
  --surface-hover: #FBF6FE;
  --hairline-2: #CDB6E0;
  --on-accent: #FFFFFF;
  --bark-tint: #FBEFE3;
  --bark-line: #EBD6BF;
  --grape-wash: rgba(122, 46, 158, 0.07);

  --sev-low: #0F6E56;
  --sev-low-bg: #E1F3ED;
  --sev-medium: #8A560F;
  --sev-medium-bg: #FBF0DE;
  --sev-high: #A32D2D;
  --sev-high-bg: #FBE7E7;

  --shadow-focus: 0 0 0 3px rgba(122, 46, 158, 0.22);
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--ground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

a { color: var(--grape); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }

/* Visible focus everywhere — this audience includes teams with their own
   accessibility requirements as part of vendor review. */
:focus-visible {
  outline: 2px solid var(--grape);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--slate); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--deep); color: var(--on-deep); padding: 10px 16px;
}
.skip-link:focus { left: 8px; top: 8px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 32px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 32px; }

/* ---------------------------------------------------------------- Buttons */

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  border: 0.5px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.btn:hover { text-decoration: none; border-color: var(--slate); }
.btn-primary { background: var(--grape); color: var(--on-accent); border-color: var(--grape); }
.btn-primary:hover { background: var(--grape-dark); border-color: var(--grape-dark); }
.btn-secondary { background: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--slate); padding: 6px 10px; }
.btn-quiet:hover { color: var(--ink); border-color: var(--hairline); }
.btn-danger { color: var(--sev-high); border-color: var(--hairline); }
.btn-danger:hover { border-color: var(--sev-high); }
.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

/* ----------------------------------------------------------------- Forms */

label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--grape);
  box-shadow: var(--shadow-focus);
}
textarea { resize: vertical; min-height: 80px; }
.field { margin-bottom: 18px; }
.field .helptext { display: block; font-size: 13px; color: var(--slate); margin-top: 6px; }
.field .errorlist { list-style: none; color: var(--sev-high); font-size: 13px; margin-top: 6px; }
.field-inline { display: flex; gap: 10px; align-items: center; }
.field-inline label { margin: 0; font-weight: 400; }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 20px;
}
.checkbox-grid li, .checkbox-row { display: flex; gap: 8px; align-items: flex-start; }
.checkbox-grid input, .checkbox-row input { margin-top: 4px; flex-shrink: 0; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 24px; }

/* ----------------------------------------------------------------- Cards */

.card {
  background: var(--surface);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-header {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; margin-bottom: 16px;
}
.card-title { font-size: 17px; }
.card-tight { padding: 18px 20px; }

.panel-grid { display: grid; gap: 16px; }
.panel-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.panel-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.panel-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat { background: var(--surface); border: 0.5px solid var(--hairline); border-radius: var(--radius); padding: 18px 20px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--slate); margin-top: 4px; }

/* -------------------------------------------------------- Severity badges */
/*
 * Text on a light tint, never a solid fill with white text — a solid badge is
 * too loud for a product whose default state is calm. Every badge carries a
 * text label, never colour alone, for colourblind readers.
 */

.sev {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  white-space: nowrap;
}
.sev::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sev-low { color: var(--sev-low); background: var(--sev-low-bg); }
.sev-medium { color: var(--sev-medium); background: var(--sev-medium-bg); }
.sev-high, .sev-critical { color: var(--sev-high); background: var(--sev-high-bg); }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--slate); background: var(--ground); border: 0.5px solid var(--hairline);
}
.tag-grape { color: var(--grape); border-color: rgba(91, 44, 111, 0.25); background: var(--grape-wash); }
/* State tags reuse the severity ramp: an operator already reads that palette as
   fine / worth a look / act now, and a live-key warning wants exactly that. */
.tag-green { color: var(--sev-low); background: var(--sev-low-bg); border-color: rgba(15, 110, 86, 0.25); }
.tag-amber { color: var(--sev-medium); background: var(--sev-medium-bg); border-color: rgba(138, 86, 15, 0.25); }
.tag-red { color: var(--sev-high); background: var(--sev-high-bg); border-color: rgba(163, 45, 45, 0.3); }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------------ Nav */

.app-nav {
  background: var(--surface);
  border-bottom: 0.5px solid var(--hairline);
  position: sticky; top: 0; z-index: 20;
}
.app-nav-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px; height: 60px;
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-links a {
  padding: 8px 12px; border-radius: 8px;
  font-size: 14px; color: var(--slate);
}
.nav-links a:hover { color: var(--ink); background: var(--ground); text-decoration: none; }
.nav-links a.active { color: var(--grape); font-weight: 500; background: var(--grape-wash); }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 13px; color: var(--slate); }

.page { max-width: 1280px; margin: 0 auto; padding: 32px 24px 80px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 28px; margin-bottom: 6px; }
.page-header p { color: var(--slate); font-size: 15px; }
.page-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Banners */

.banner {
  padding: 12px 20px; font-size: 14px;
  border-bottom: 0.5px solid var(--hairline);
  display: flex; gap: 12px; align-items: center; justify-content: center;
  flex-wrap: wrap;
}
/* Simulation banner uses Bark, not Amber — amber is reserved for severity. */
.banner-simulation { background: var(--bark-tint); color: var(--bark); }
.banner-simulation .mono { font-size: 12px; }

.messages { margin-bottom: 24px; display: grid; gap: 10px; }
.message {
  padding: 12px 16px; border-radius: var(--radius); font-size: 14px;
  background: var(--surface); border: 0.5px solid var(--hairline);
  border-left: 3px solid var(--slate);
}
.message-success { border-left-color: var(--teal); }
.message-error { border-left-color: var(--sev-high); }
.message-warning { border-left-color: var(--bark); }
.message-info { border-left-color: var(--grape); }

/* ------------------------------------------------------------------ Feed */

.feed-list { display: grid; gap: 1px; background: var(--hairline); border: 0.5px solid var(--hairline); border-radius: var(--radius-lg); overflow: hidden; }
.feed-item { background: var(--surface); padding: 20px 24px; display: block; color: inherit; }
.feed-item:hover { background: var(--surface-hover); text-decoration: none; }
.feed-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.feed-source { font-family: var(--font-mono); font-size: 11px; color: var(--slate); text-transform: uppercase; letter-spacing: 0.04em; }
.feed-title { font-family: var(--font-display); font-size: 16px; font-weight: 500; margin-bottom: 6px; line-height: 1.35; }
.feed-summary { font-size: 14px; color: var(--slate); }
.feed-matches { margin-top: 10px; font-size: 13px; color: var(--teal); }

/* The three layers a Business digest adds beneath an item, on /sample-digest/.
   Colour carries meaning here and stays inside the rule: teal for the portfolio
   match, because rule-based matching is the deterministic half of the pipeline;
   grape for the document findings, because that is the brand accent and these
   are advisory prose; slate for the retrieval note. Amber and red are severity
   badges and appear nowhere else — tests/test_themes.py checks by hue. */
.sample-line {
  margin-top: 10px; padding-left: 12px; font-size: 13px; line-height: 1.6;
  border-left: 2px solid var(--hairline);
}
.sample-line-match { color: var(--teal); border-left-color: var(--teal); }
.sample-line-docs { color: var(--grape); border-left-color: var(--grape); }
.sample-line-source { color: var(--slate); }

.filters {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end;
  padding: 16px 20px; background: var(--surface);
  border: 0.5px solid var(--hairline); border-radius: var(--radius);
  margin-bottom: 20px;
}
.filters .field { margin: 0; min-width: 150px; }
.filters label { font-size: 12px; color: var(--slate); }

.empty {
  padding: 56px 32px; text-align: center;
  background: var(--surface); border: 0.5px dashed var(--hairline); border-radius: var(--radius-lg);
}
.empty h3 { font-size: 17px; margin-bottom: 8px; }
.empty p { color: var(--slate); font-size: 14px; max-width: 460px; margin: 0 auto 20px; }

.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 28px; font-size: 14px; }

/* ---------------------------------------------------------------- Tables */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px; font-size: 12px; font-weight: 500;
  color: var(--slate); text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--hairline);
}
.table td { padding: 12px; border-bottom: 0.5px solid var(--hairline); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.definition-list { display: grid; grid-template-columns: 180px 1fr; gap: 10px 20px; font-size: 14px; }
.definition-list dt { color: var(--slate); }
.definition-list dd { margin: 0; }

/* --------------------------------------------------------------- Sidebar */

.split { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.split-reverse { grid-template-columns: 300px 1fr; }

/* ------------------------------------------------------------- Marketing */

.marketing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 32px; border-bottom: 0.5px solid var(--hairline); background: var(--surface);
}
.marketing-nav .nav-links { flex: 0; gap: 32px; }
.marketing-nav .nav-links a { padding: 0; font-size: 14px; }

.hero { padding: 96px 32px 0; text-align: center; }
.eyebrow {
  font-family: var(--font-mono); font-size: 13px; color: var(--grape);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 20px;
}
.headline { font-size: 56px; line-height: 1.08; max-width: 760px; margin: 0 auto 24px; }
.subhead { font-size: 18px; color: var(--slate); max-width: 560px; margin: 0 auto 36px; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; margin-bottom: 72px; flex-wrap: wrap; }

/* The signature signal cluster strip — a monitoring readout, not decoration. */
.signal-strip { background: var(--deep); padding: 36px 0 24px; overflow: hidden; }
.signal-strip svg { display: block; width: 100%; height: auto; }
.strip-caption { text-align: center; margin-top: 6px; }
.strip-caption span { font-family: var(--font-mono); font-size: 11px; color: #C9A8D6; }

.section { padding: 96px 0; }
.section-label { font-family: var(--font-mono); font-size: 13px; color: var(--slate); text-align: center; margin-bottom: 12px; }
.section-title { font-size: 32px; text-align: center; margin-bottom: 64px; }

.feature-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline); border: 0.5px solid var(--hairline);
  border-radius: 12px; overflow: hidden;
}
.feature-card { background: var(--surface); padding: 36px 32px; }
.feature-tag { font-family: var(--font-mono); font-size: 12px; color: var(--grape); margin-bottom: 16px; }
.feature-card h3 { font-size: 20px; margin-bottom: 10px; }
.feature-card p { font-size: 14.5px; color: var(--slate); }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan {
  background: var(--surface); border: 0.5px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 32px 28px; display: flex; flex-direction: column; position: relative;
}
.plan.featured { border: 2px solid var(--grape); }
.plan-badge {
  position: absolute; top: -12px; left: 28px; background: var(--grape); color: var(--on-accent);
  font-size: 11px; font-weight: 500; padding: 4px 12px; border-radius: 6px;
}
.plan-name { font-size: 15px; font-weight: 500; color: var(--slate); margin-bottom: 8px; }
.plan-price { font-family: var(--font-display); font-size: 34px; font-weight: 600; margin-bottom: 4px; }
.plan-price sup { font-size: 14px; font-weight: 400; color: var(--slate); }
.plan-desc { font-size: 13.5px; color: var(--slate); margin-bottom: 24px; min-height: 40px; }
.plan ul { margin-bottom: 28px; flex-grow: 1; }
.plan li {
  font-size: 14px; padding: 9px 0; border-top: 0.5px solid var(--hairline);
  display: flex; gap: 10px; align-items: flex-start;
}
.plan li:first-child { border-top: none; }
.check { color: var(--teal); flex-shrink: 0; }
.plan .btn { width: 100%; padding: 11px; }

.site-footer { border-top: 0.5px solid var(--hairline); padding: 40px 32px; text-align: center; background: var(--surface); }
.site-footer p { font-size: 13px; color: var(--slate); }
.site-footer .tag-line { font-size: 12px; color: var(--slate); margin-top: 6px; font-style: italic; }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 14px; font-size: 13px; }

/* --------------------------------------------------------- Review queue */

.review-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.source-text {
  font-size: 14px; line-height: 1.7; white-space: pre-wrap;
  max-height: 640px; overflow-y: auto;
  padding: 16px; background: var(--ground); border-radius: var(--radius);
  border: 0.5px solid var(--hairline);
}
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- Utility */

.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.divider { height: 1px; background: var(--hairline); border: 0; margin: 24px 0; }
.inline-form { display: inline; }

@media (max-width: 980px) {
  .split, .split-reverse, .review-layout { grid-template-columns: 1fr; }
  .panel-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .headline { font-size: 38px; }
  .feature-grid, .pricing-grid, .panel-grid.cols-2, .panel-grid.cols-3 { grid-template-columns: 1fr; }
  .marketing-nav .nav-links { display: none; }
  .app-nav-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .nav-links { overflow-x: auto; width: 100%; }
  .page { padding: 24px 16px 60px; }
  .definition-list { grid-template-columns: 1fr; gap: 4px 0; }
  .definition-list dt { margin-top: 12px; }
}

@media print {
  .app-nav, .site-footer, .btn, .filters, .banner { display: none; }
  body { background: var(--surface); }
}

/* ==========================================================================
   Error pages
   ========================================================================== */

.error-page { display: flex; align-items: center; justify-content: center;
              min-height: 100vh; padding: 48px 24px; }
.error-card {
  max-width: 560px; width: 100%; background: var(--surface);
  border: 0.5px solid var(--hairline); border-radius: var(--radius-lg);
  padding: 40px 36px; text-align: center;
}
.error-code {
  font-size: 13px; letter-spacing: 0.1em; color: var(--slate);
  text-transform: uppercase; margin-bottom: 10px;
}
.error-card h1 { font-size: 23px; margin-bottom: 14px; }
.error-body p { color: var(--slate); font-size: 15px; margin-bottom: 12px; }
.error-body p.small { font-size: 13.5px; }
.error-actions { display: flex; gap: 12px; justify-content: center;
                 margin-top: 28px; flex-wrap: wrap; }
.error-path {
  margin-top: 24px; padding-top: 18px; border-top: 0.5px solid var(--hairline);
  font-size: 12px; color: var(--slate); word-break: break-all;
}

/* ==========================================================================
   Operations console
   --------------------------------------------------------------------------
   A distinct surface from the subscriber app: denser, sidebar-driven, and
   built around "what is the platform doing" rather than "what is my feed".
   Still bound by the same colour rule — amber and red mean severity, so the
   console uses Bark for simulation state and Ink for its own chrome.
   ========================================================================== */

.ops-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.ops-sidebar {
  background: var(--deep); color: #C6D2DC; padding: 20px 0 40px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.ops-brand {
  display: flex; align-items: center; gap: 10px; padding: 0 20px 18px;
  font-family: var(--font-display); font-weight: 600; font-size: 16px; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 14px;
}
.ops-brand:hover { text-decoration: none; }
.ops-brand svg circle { fill: #B98FC9; }
.ops-nav-group { padding: 12px 0 4px; }
.ops-nav-label {
  padding: 0 20px 6px; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.09em; text-transform: uppercase; color: #6E8091;
}
.ops-nav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 20px; font-size: 14px; color: #C6D2DC;
}
.ops-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; text-decoration: none; }
.ops-nav a.active { background: rgba(185,143,201,0.18); color: #fff; font-weight: 500;
                    box-shadow: inset 3px 0 0 #B98FC9; }
.ops-nav .count {
  font-family: var(--font-mono); font-size: 11px; padding: 1px 7px;
  border-radius: 10px; background: rgba(255,255,255,0.12); color: #fff;
}
.ops-nav .count-alert { background: #C9A8D6; color: #0C2A42; font-weight: 600; }
.ops-footer-link { padding: 16px 20px 0; margin-top: 14px;
                   border-top: 1px solid rgba(255,255,255,0.08); }
.ops-footer-link a { font-size: 13px; color: #8FA2B2; display: block; padding: 5px 0; }
.ops-footer-link a:hover { color: #fff; }

.ops-main { padding: 28px 32px 72px; max-width: 1400px; }
.ops-header { display: flex; justify-content: space-between; align-items: flex-start;
              gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.ops-header h1 { font-size: 24px; margin-bottom: 4px; }
.ops-header p { color: var(--slate); font-size: 14px; max-width: 62ch; }

.ops-grid { display: grid; gap: 16px; }
.ops-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ops-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.mode-card {
  background: var(--surface); border: 0.5px solid var(--hairline);
  border-radius: var(--radius); padding: 16px 18px;
}
.mode-card .mode-label { font-size: 13px; color: var(--slate); margin-bottom: 6px; }
.mode-state { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.mode-live { color: var(--teal); }
.mode-sim { color: var(--bark); }
.mode-card .mode-detail { font-size: 12.5px; color: var(--slate); margin-top: 6px; }
.mode-locked { font-size: 11px; color: var(--slate); font-style: italic; margin-top: 4px; }

.ops-alert {
  border-radius: var(--radius); padding: 14px 18px; font-size: 14px;
  background: var(--bark-tint); color: var(--bark); border: 0.5px solid var(--bark-line);
  margin-bottom: 16px;
}
.ops-alert ul { margin-top: 8px; }
.ops-alert li { padding: 3px 0; }
.ops-alert-quiet { background: var(--surface); color: var(--slate); border-color: var(--hairline); }

.ops-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ops-table th {
  text-align: left; padding: 9px 12px; font-size: 11px; font-weight: 500;
  color: var(--slate); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
.ops-table td { padding: 10px 12px; border-bottom: 0.5px solid var(--hairline);
                vertical-align: top; }
.ops-table tr:last-child td { border-bottom: none; }
.ops-table tbody tr:hover { background: var(--surface-hover); }
.ops-table .num { font-family: var(--font-mono); text-align: right; }

.state-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.state-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%;
                     background: currentColor; flex-shrink: 0; }
.state-ok { color: var(--teal); }
.state-warn { color: var(--bark); }
.state-bad { color: var(--sev-high); }
.state-idle { color: var(--slate); }

.ops-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ops-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* A wide table scrolls inside its own box. Without this the whole console body
   scrolls sideways and the sidebar leaves the screen with it. */
.table-wrap { overflow-x: auto; }
.table-wrap .ops-table { min-width: 640px; }
.ops-json {
  font-family: var(--font-mono); font-size: 12px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  background: var(--ground); border: 0.5px solid var(--hairline);
  border-radius: var(--radius); padding: 14px; max-height: 460px; overflow: auto;
}
.ops-switch {
  display: grid; grid-template-columns: auto 1fr; gap: 12px;
  padding: 16px 0; border-top: 0.5px solid var(--hairline);
}
.ops-switch:first-of-type { border-top: none; }
.ops-switch input { margin-top: 4px; width: 16px; height: 16px; }
.ops-switch label { font-weight: 500; margin-bottom: 4px; }
.ops-switch .switch-help { font-size: 13px; color: var(--slate); }
.ops-switch-locked { opacity: 0.6; }

@media (max-width: 1000px) {
  .ops-shell { grid-template-columns: 1fr; }
  .ops-sidebar { position: static; height: auto; }
  .ops-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px; }
  .ops-nav-group { padding: 6px 0; }
  .ops-nav-label { display: none; }
  .ops-grid.cols-3, .ops-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-main { padding: 20px 16px 48px; }
}
@media (max-width: 640px) {
  .ops-grid.cols-2, .ops-grid.cols-3, .ops-grid.cols-4 { grid-template-columns: 1fr; }
}

/* Sticky action bar for long settings forms. A submit button placed after a
   two-column grid sits off-screen whenever one column is much taller than the
   other, which reads to the user as "there is no save button". */
.ops-sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 24px;
  padding: 14px 20px;
  background: var(--surface);
  border: 0.5px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: 0 -6px 18px -12px rgba(12, 42, 66, 0.45);
}

/* ==========================================================================
   Landing page — product previews and the single-plan pricing card
   ========================================================================== */

.hero-price { font-size: 14px; color: var(--slate); margin-top: -48px; margin-bottom: 72px; }
.section-tight { padding-top: 0; }
.section-intro {
  max-width: 62ch; margin: -44px auto 44px; text-align: center;
  font-size: 16px; color: var(--slate);
}

/* A framed shot of the real app, built from live data rather than an image. */
.app-shot {
  border: 0.5px solid var(--hairline); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
}
.app-shot-chrome {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 0.5px solid var(--hairline);
}
.app-shot-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--hairline-2); }
.app-shot-title { font-size: 11.5px; color: var(--slate); margin-left: 10px; }
.app-shot-body { display: grid; gap: 1px; background: var(--hairline); }
.shot-item { background: var(--surface); padding: 20px 24px; }
.shot-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.shot-title {
  font-family: var(--font-display); font-size: 16px; font-weight: 500;
  line-height: 1.35; margin-bottom: 7px;
}
.shot-summary { font-size: 14px; color: var(--slate); margin-bottom: 10px; }

.proof-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline); border: 0.5px solid var(--hairline);
  border-radius: var(--radius-lg); overflow: hidden; margin-top: 24px;
}
.proof { background: var(--surface); padding: 22px 24px; text-align: center; }
.proof-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; }
.proof-label { font-size: 13px; color: var(--slate); margin-top: 7px; }

.split-showcase { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
.showcase-title { font-size: 30px; margin-bottom: 16px; }
.showcase-copy { font-size: 16px; color: var(--slate); margin-bottom: 20px; }
.plain-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.plain-list li { position: relative; padding-left: 20px; font-size: 14.5px; color: var(--slate); }
.plain-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.6em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--grape);
}

.mail-shot {
  border: 0.5px solid var(--hairline); border-radius: var(--radius-lg);
  background: var(--surface); overflow: hidden;
}
.mail-shot-head { padding: 20px 22px; border-bottom: 0.5px solid var(--hairline); }
.mail-shot-subject {
  font-family: var(--font-display); font-size: 17px; font-weight: 600; margin-top: 8px;
}
.mail-shot-item { padding: 16px 22px; border-bottom: 0.5px solid var(--hairline); }
.mail-shot-item:last-child { border-bottom: none; }
.mail-shot-title { font-size: 14.5px; font-weight: 500; margin: 8px 0 4px; line-height: 1.4; }

/* -------------------------------------------------------------- pricing */
/*
 * One card or several, from the same markup. A grid of one looks wrong, so a
 * single plan gets a narrower centred card instead of a full-width one.
 */

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  align-items: start;
}
.plan-grid-single { grid-template-columns: minmax(0, 620px); justify-content: center; }

.plan-card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 32px;
  display: flex; flex-direction: column; height: 100%;
}
/* The grape border marks where a visitor is meant to start, not "better". */
.plan-card-featured { border: 2px solid var(--grape); }
.plan-card .plan-features { flex: 1 1 auto; }

.plan-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 20px; flex-wrap: wrap; margin-bottom: 24px;
}
.plan-card .plan-desc { min-height: 0; margin-bottom: 0; max-width: 44ch; }

/* Bark, not amber: amber belongs to severity badges alone. */
.offer-flag {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  padding: 9px 14px; border-radius: var(--radius);
  background: var(--bark-tint); border: 0.5px solid var(--bark-line);
}
.offer-flag-save { font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--bark); }
.offer-flag-text { font-size: 12px; color: var(--bark); }

.price-options { display: grid; gap: 12px; margin-bottom: 26px; }
.price-option {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; border: 1px solid var(--hairline);
  border-radius: var(--radius); cursor: pointer; margin: 0; font-weight: 400;
}
.price-option:hover { border-color: var(--slate); }
.price-option input { margin-top: 5px; flex: 0 0 auto; }
.price-option:has(input:checked) { border-color: var(--grape); background: var(--grape-wash); }
.price-option-body { display: flex; flex-direction: column; gap: 3px; }
.price-amount { font-family: var(--font-display); font-size: 27px; font-weight: 600; line-height: 1.1; }
.price-unit { font-size: 14px; font-weight: 400; color: var(--slate); }
.price-note { font-size: 13.5px; color: var(--slate); }

.plan-features { display: flex; flex-direction: column; margin-bottom: 26px; }
.plan-features li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 14.5px; padding: 10px 0; border-top: 0.5px solid var(--hairline);
}
.plan-features li:first-child { border-top: none; }
.plan-actions { display: flex; flex-direction: column; gap: 10px; }
.plan-finequiet { font-size: 13px; color: var(--slate); text-align: center; margin-top: 6px; }

@media (max-width: 900px) {
  .split-showcase { grid-template-columns: 1fr; gap: 32px; }
  .proof-row { grid-template-columns: 1fr; }
  .hero-price { margin-top: -32px; margin-bottom: 56px; }
  .section-intro { margin-top: -28px; }
}

/* ------------------------------------------------- Source documents */
/* A stored file is a snapshot of something that changes at its source, so the
   staleness note is part of the component rather than an afterthought. */
.doc-list { list-style: none; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.doc { padding: 12px; border: 0.5px solid var(--hairline); border-radius: 8px; background: var(--ground); }
.doc-stale { border-color: rgba(138, 86, 15, 0.35); background: var(--sev-medium-bg); }
.doc-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.doc-name { font-size: 12.5px; margin-top: 8px; word-break: break-all; }
.doc-warn { color: var(--sev-medium); }
.doc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.doc-actions .btn { flex: 1 1 auto; }

/* --------------------------------------------- Grouped category pickers */
/* Forty categories in one alphabetical grid is a wall. Grouped, a subscriber
   scans to their own area and reads six. */
.category-group + .category-group { margin-top: 20px; }
.category-group-title {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate);
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 0.5px solid var(--hairline);
}

/* ------------------------------------------------------- Theme chooser */
/*
 * Each option previews itself rather than describing itself: the swatch is
 * painted from that theme's own tokens, so "Colorful" shows what colorful
 * actually looks like instead of asking the reader to imagine it.
 */
.theme-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.theme-choice {
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  padding: 14px; margin: 0; font-weight: 400; cursor: pointer;
  border: 1px solid var(--hairline); border-radius: var(--radius);
  background: var(--surface);
}
.theme-choice:hover { border-color: var(--slate); }
.theme-choice:has(input:checked) { border-color: var(--grape); background: var(--grape-wash); }
.theme-choice input { margin: 0; }
.theme-choice-name { font-size: 14px; font-weight: 500; }

.theme-swatch {
  width: 100%; border-radius: 8px; overflow: hidden;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
}
.theme-swatch-bar { display: block; height: 14px; }
.theme-swatch-body { display: block; padding: 9px; }
.theme-swatch-line { display: block; height: 4px; border-radius: 2px; margin-bottom: 5px; }
.theme-swatch-line.short { width: 55%; }
.theme-swatch-chip { display: block; height: 8px; width: 34%; border-radius: 4px; }

/* Painted from each theme's own values, not from the tokens in effect — a
   preview that changed with the current theme would preview nothing. */
.theme-choice-light .theme-swatch { background: #FFFFFF; }
.theme-choice-light .theme-swatch-bar { background: #0C2A42; }
.theme-choice-light .theme-swatch-line { background: #DCE2E8; }
.theme-choice-light .theme-swatch-chip { background: #5B2C6F; }

.theme-choice-dark .theme-swatch { background: #111F2B; }
.theme-choice-dark .theme-swatch-bar { background: #061019; }
.theme-choice-dark .theme-swatch-line { background: #27394A; }
.theme-choice-dark .theme-swatch-chip { background: #C0A0D2; }

.theme-choice-colorful .theme-swatch { background: #FFFFFF; }
.theme-choice-colorful .theme-swatch-bar { background: #1E0C2C; }
.theme-choice-colorful .theme-swatch-line { background: #E0D2EC; }
.theme-choice-colorful .theme-swatch-chip { background: #7A2E9E; }

/* ----------------------------------------------------- Rendered prose */
/*
 * Agent output arrives as light Markdown and is rendered by |richtext into a
 * fixed set of tags. Styled here so a bold run or a bullet list sits inside a
 * card without inheriting page-level heading spacing.
 */
.richtext p { margin-bottom: 10px; }
.richtext p:last-child { margin-bottom: 0; }
.richtext ul, .richtext ol { margin: 0 0 10px 18px; }
.richtext ul { list-style: disc; }
.richtext ol { list-style: decimal; }
.richtext li { padding: 2px 0; }
.richtext li:last-child { padding-bottom: 0; }
.richtext strong { font-weight: 600; }
.richtext code {
  font-family: var(--font-mono); font-size: 0.92em;
  background: var(--surface-2); padding: 1px 5px; border-radius: 4px;
}
