:root {
  color-scheme: light dark;
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --surface-2: #ebe7dc;
  --ink: #17241f;
  --muted: #647069;
  --line: #c8c7bc;
  --green: #174f3c;
  --green-2: #216b51;
  --gold: #b98929;
  --red: #9e382d;
  --blue: #1f5870;
  --shadow: 0 12px 34px rgba(31, 43, 37, .09);
  --radius: 5px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
p, h1, h2, h3 { margin-top: 0; }

.site-header {
  min-height: 76px;
  padding: 14px max(24px, calc((100vw - 1440px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  color: #f9fbf6;
  background: var(--green);
  border-bottom: 4px solid var(--gold);
}

.wordmark { display: flex; align-items: center; gap: 12px; }
.wordmark div { display: grid; gap: 2px; }
.wordmark strong { font-family: Georgia, serif; font-size: 1.08rem; letter-spacing: .02em; }
.wordmark span { font-size: .76rem; opacity: .78; }
.crest { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.65); border-radius: 50%; font: 700 1.35rem Georgia, serif; }
.header-meta { display: flex; align-items: center; gap: 12px; font-size: .78rem; }
.demo-badge { padding: 6px 9px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; }

#app { width: min(1440px, calc(100% - 48px)); margin: 0 auto; padding-bottom: 96px; }
.intro { padding: 48px 0 30px; display: flex; justify-content: space-between; align-items: end; gap: 56px; }
.intro > div { max-width: 810px; }
.eyebrow { margin-bottom: 8px; color: var(--green-2); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { max-width: 760px; margin-bottom: 14px; font: 600 clamp(2rem, 4vw, 3.5rem)/1.04 Georgia, serif; letter-spacing: -.025em; }
.intro p:last-child { max-width: 740px; margin-bottom: 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }

.button { min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: var(--radius); font-weight: 750; }
.button.primary { color: white; background: var(--green); }
.button.secondary { flex: 0 0 auto; color: white; background: var(--green); box-shadow: var(--shadow); }
.button.ghost { border-color: var(--line); background: transparent; }
.button:hover { filter: brightness(1.08); }
.button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue), transparent 50%); outline-offset: 2px; }

.phase-banner { margin-bottom: 22px; padding: 13px 16px; border-left: 4px solid var(--gold); background: color-mix(in srgb, var(--gold), transparent 88%); font-size: .88rem; }
.phase-banner.ready-phase { border-color: var(--green-2); background: color-mix(in srgb, var(--green-2), transparent 90%); }
.phase-banner.sandbox-phase { border-color: #d99d23; background: color-mix(in srgb, #d99d23, transparent 84%); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, .75fr); gap: 26px; align-items: start; }
.form-column, .sticky-panel { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.form-column { min-width: 0; }
.sticky-panel { position: sticky; top: 18px; }
.column-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.column-heading h2 { margin: 0; font: 600 1.65rem Georgia, serif; }
.column-heading .eyebrow { margin: 0 0 4px; }
.completion-meter { padding: 5px 9px; border-radius: 999px; color: var(--green-2); background: color-mix(in srgb, var(--green-2), transparent 88%); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.toggle input { width: 32px; height: 18px; accent-color: var(--green-2); }

.form-section { padding: 26px 24px 30px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.section-heading { display: flex; gap: 14px; margin-bottom: 23px; }
.section-heading > span { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid var(--green-2); border-radius: 50%; color: var(--green-2); font: 700 .78rem Georgia, serif; }
.section-heading h3 { margin: 0 0 4px; font: 600 1.3rem Georgia, serif; }
.section-heading p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.section-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 18px; }
.form-field { position: relative; min-width: 0; padding: 3px; border-radius: var(--radius); transition: background .2s; }
.form-field.heat-active, .member-row.heat-active { background: color-mix(in srgb, #d64a31 calc(var(--risk) * 34%), #efc54c calc(var(--risk) * 12%), transparent); }
.field-label-row { display: flex; justify-content: space-between; align-items: start; gap: 8px; min-height: 21px; }
.field-label-row label { display: block; margin-bottom: 7px; font-size: .79rem; font-weight: 760; line-height: 1.35; }
.form-field input:not([type="radio"]):not([type="checkbox"]), .form-field select, .member-row input, .member-row select {
  width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); box-shadow: inset 0 1px 2px rgba(0,0,0,.025);
}
.form-field small { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; }
.risk-score { display: inline-block; padding: 2px 6px; border-radius: 999px; color: var(--red); background: var(--surface); font: 800 .66rem ui-monospace, monospace; }
.provenance-chip { display: inline-flex; margin-top: 7px; padding: 3px 7px; border-radius: 999px; color: var(--blue); background: color-mix(in srgb, var(--blue), transparent 88%); font-size: .65rem; font-weight: 800; }

.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: grid; place-items: center; min-height: 43px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); font-size: .8rem; }
.segmented input:checked + span { color: white; border-color: var(--green); background: var(--green); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue), transparent 50%); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.check-grid label { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); font-size: .76rem; font-weight: 650; }
.check-grid input { accent-color: var(--green); }

.member-list { grid-column: 1 / -1; padding: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.member-head { display: grid; grid-template-columns: 1.2fr .5fr 1fr; gap: 10px; padding: 0 10px 6px; color: var(--muted); font-size: .66rem; font-weight: 800; text-transform: uppercase; }
.member-row { position: relative; display: grid; grid-template-columns: 1.2fr .5fr 1fr; gap: 10px; margin: 0 0 8px; padding: 13px 10px 10px; border: 0; border-radius: 3px; background: var(--surface); }
.member-row:last-child { margin-bottom: 0; }
.member-row legend { position: absolute; left: 10px; top: -6px; padding: 0 4px; color: var(--muted); background: var(--surface); font-size: .62rem; }
.member-row .risk-score { position: absolute; right: 3px; top: -8px; }

#consequence-panel { padding: 18px; }
.track-card { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px; border-left: 4px solid var(--green-2); background: var(--surface-2); }
.track-card span { color: var(--muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; }
.track-card strong { text-transform: capitalize; }
.track-enhanced { border-color: var(--gold); }
.track-manual-review { border-color: var(--red); }
.track-fraud-referral { color: white; border-color: #ffb3aa; background: var(--red); }
.consequence-group { margin-top: 22px; }
.consequence-group h3 { display: flex; justify-content: space-between; margin-bottom: 8px; padding-bottom: 7px; border-bottom: 1px solid var(--line); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
.consequence-group h3 span { color: var(--muted); }
.consequence-card, .eligibility-row { width: 100%; margin: 0 0 6px; padding: 9px; border: 1px solid transparent; border-radius: 3px; text-align: left; background: transparent; }
.consequence-card { display: grid; grid-template-columns: 24px 1fr; gap: 8px; }
.consequence-card:hover, .eligibility-row:hover { border-color: var(--line); background: var(--surface-2); }
.consequence-icon { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: white; background: var(--green-2); font: 800 .65rem Georgia, serif; }
.consequence-card strong, .eligibility-row strong { display: block; font-size: .76rem; line-height: 1.35; }
.consequence-card small, .eligibility-row small { display: block; margin-top: 2px; color: var(--muted); font-size: .67rem; line-height: 1.35; }
.eligibility-row span { float: right; color: var(--green-2); font-size: .63rem; font-weight: 800; text-transform: uppercase; }
.eligibility-row.ineligible span { color: var(--red); }
.empty-copy { margin: 10px 0; color: var(--muted); font-size: .77rem; line-height: 1.45; }

.sandbox-strip { position: relative; margin-bottom: 22px; overflow: hidden; border: 1px solid #c69325; background: color-mix(in srgb, #e9ad2e, var(--surface) 88%); box-shadow: var(--shadow); }
.hazard { height: 9px; background: repeating-linear-gradient(135deg, #332c1e 0 12px, #e8ab2c 12px 24px); }
.sandbox-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 22px 10px; }
.sandbox-heading h2 { margin: 0 0 3px; font: 600 1.55rem Georgia, serif; }
.sandbox-heading p:last-child { margin: 0; color: var(--muted); font: .7rem ui-monospace, monospace; }
.fork-stale-banner { margin: 0 22px 10px; padding: 10px 12px; border: 1px solid var(--red); color: var(--red); background: color-mix(in srgb, var(--red), transparent 92%); font-size: .75rem; }
.sandbox-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 8px 22px 22px; }
.diff-card { padding: 14px; border: 1px solid color-mix(in srgb, var(--gold), var(--line)); background: var(--surface); }
.diff-card h3 { margin: 4px 0 8px; font: 600 1rem ui-monospace, monospace; }
.diff-card p { margin-bottom: 7px; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.diff-card > strong { display: block; font-size: .75rem; }
.diff-card button { margin: 5px 5px 0 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: 3px; background: transparent; font-size: .65rem; }
.diff-kicker, .ratification-kicker { color: #8a6010; font-size: .63rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.value-change { display: flex; align-items: center; gap: 8px; }
.value-change ins { color: var(--green-2); text-decoration: none; font-weight: 800; }
.causal-chain { margin: 0 22px 22px; padding: 18px; border: 1px solid var(--line); background: var(--surface); }
.chain-heading { display: flex; justify-content: space-between; color: var(--muted); font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.chain-heading button { border: 0; background: none; font-size: 1.3rem; }
.causal-chain h3 { margin: 7px 0; font-family: Georgia, serif; }
.causal-chain > p, .causal-chain li p { color: var(--muted); font-size: .75rem; }
.causal-chain code { font-size: .68rem; white-space: normal; }

.ratification-list:not(:empty) { padding: 18px 24px 0; }
.ratification-card { padding: 16px; border: 2px solid var(--blue); background: color-mix(in srgb, var(--blue), var(--surface) 94%); }
.ratification-card + .ratification-card { margin-top: 12px; }
.ratification-card h3 { margin: 3px 0 10px; font-family: Georgia, serif; }
.ratification-card p { margin: 0 0 8px; font-size: .82rem; }
.ratification-card blockquote { margin: 8px 0; padding-left: 11px; border-left: 2px solid var(--blue); color: var(--muted); font-size: .76rem; }
.ratification-actions { display: flex; gap: 8px; margin-top: 12px; }
.ratification-card > small { display: block; margin-top: 9px; color: var(--muted); font-size: .65rem; }

.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 24px max(24px, calc((100vw - 1440px) / 2)); border-top: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.site-footer strong { color: var(--green-2); }

.agent-console { position: fixed; z-index: 20; left: 16px; right: 16px; bottom: 12px; max-height: min(63vh, 630px); overflow: auto; border: 1px solid #3f4a46; border-radius: 7px; color: #eef4f0; background: #16201d; box-shadow: 0 15px 55px rgba(0,0,0,.35); }
.agent-console > summary { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; list-style: none; cursor: pointer; background: #16201d; }
.agent-console > summary::-webkit-details-marker { display: none; }
.agent-console > summary span:first-child { display: flex; align-items: baseline; gap: 9px; }
.agent-console summary small { color: #8ea29a; font-size: .66rem; }
.tool-count { padding: 4px 8px; border-radius: 999px; color: #9ee3bd; background: #24342e; font-size: .67rem; }
.console-body { display: grid; grid-template-columns: 1.05fr 1fr .85fr; gap: 18px; padding: 5px 16px 16px; border-top: 1px solid #35423d; }
.console-body section { min-width: 0; }
.console-body h3 { margin: 11px 0 9px; color: #8ea29a; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; }
.console-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; max-height: 240px; overflow: auto; }
.console-tool { position: relative; padding: 8px; border: 1px solid #35423d; border-radius: 3px; background: #1d2a26; transition: opacity .25s, transform .25s; }
.console-tool.tool-entering { opacity: 0; transform: translateY(6px); }
.console-tool.tool-leaving { opacity: 0; transform: translateX(-12px); }
.console-tool code { color: #a6e7c3; font-size: .69rem; }
.console-tool p { margin: 3px 0 0; color: #a8b6b0; font-size: .61rem; line-height: 1.35; }
.console-tool > span { position: absolute; top: 5px; right: 5px; color: #80b99a; font-size: .5rem; text-transform: uppercase; }
.invoke-section label { display: grid; gap: 4px; margin-bottom: 7px; color: #a8b6b0; font-size: .62rem; }
.invoke-section select, .invoke-section textarea { width: 100%; padding: 7px; border: 1px solid #42534c; border-radius: 3px; color: #eef4f0; background: #101714; font: .68rem ui-monospace, monospace; }
.console-button { width: 100%; min-height: 34px; color: #102018; background: #92d9b1; font-size: .7rem; }
.console-result { max-height: 125px; margin: 8px 0 0; padding: 8px; overflow: auto; white-space: pre-wrap; color: #b8c9c1; background: #101714; font-size: .61rem; }
.console-log { max-height: 245px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.console-log li { display: grid; grid-template-columns: 58px 1fr auto; gap: 5px; padding: 7px 0; border-bottom: 1px solid #303d38; font-size: .6rem; }
.console-log li > span, .console-log li > small { color: #83968d; }
.console-log details { grid-column: 2 / -1; }
.console-log pre { white-space: pre-wrap; }
.console-empty { color: #8ea29a; font-size: .7rem; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; }
  .sticky-panel { position: static; }
  .sandbox-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .console-body { grid-template-columns: 1fr 1fr; }
  .console-body section:last-child { grid-column: 1 / -1; }
}

@media (max-width: 650px) {
  #app { width: min(100% - 24px, 1440px); }
  .site-header, .intro, .column-heading, .sandbox-heading, .site-footer { align-items: flex-start; flex-direction: column; }
  .header-meta { flex-wrap: wrap; }
  .intro { padding-top: 30px; gap: 20px; }
  .section-fields, .check-grid, .sandbox-results { grid-template-columns: 1fr; }
  .form-section, .column-heading { padding-left: 16px; padding-right: 16px; }
  .member-head { display: none; }
  .member-row { grid-template-columns: 1fr; padding-top: 18px; }
  .console-body { grid-template-columns: 1fr; }
  .console-body section:last-child { grid-column: auto; }
  .agent-console { left: 6px; right: 6px; bottom: 5px; }
  .console-tools { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131815;
    --surface: #1c231f;
    --surface-2: #252d29;
    --ink: #e9eee8;
    --muted: #a1aca5;
    --line: #3c4942;
    --green: #174f3c;
    --green-2: #68bd94;
    --gold: #d5a441;
    --red: #ed8176;
    --blue: #74b9d4;
    --shadow: 0 12px 34px rgba(0,0,0,.22);
  }
  .button.primary, .button.secondary { color: white; background: #22664f; }
  .segmented input:checked + span { color: white; background: #22664f; }
  .demo-badge { color: white; }
}
