:root {
  color-scheme: light;
  --background: #f5f8f5;
  --surface: #fbfdfb;
  --forest: #153d32;
  --forest-dark: #0c2922;
  --green: #195a46;
  --mint: #deeee5;
  --charcoal: #142d26;
  --muted: #465e54;
  --line: #d9e4dc;
  --line-strong: #acbfb3;
  --gold: #84521f;
  --high: #952f27;
  --radius: 14px;
  --gutter: clamp(18px, 3.1vw, 52px);
  --page-width: 1680px;
  --header-height: 68px;
  --display-font: Georgia, "Times New Roman", serif;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  background: var(--background);
  color: var(--charcoal);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .62; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid #2b8669;
  outline-offset: 3px;
}
a { color: var(--green); }
h1, h2, h3, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; inset: 8px auto auto 8px; transform: translateY(-200%); padding: 12px; background: white; z-index: 5; }
.skip-link:focus { transform: none; }
.masthead {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  gap: clamp(16px, 5vw, 90px);
  padding: 8px max(var(--gutter), calc((100% - var(--page-width)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--line);
  background: #fbfdfb;
}
.brand { display: flex; align-items: center; gap: clamp(10px, 1.6vw, 25px); color: var(--forest-dark); text-decoration: none; white-space: nowrap; }
.brand strong { font: 700 clamp(20px, 2.1vw, 32px)/1.15 var(--display-font); letter-spacing: -.035em; }
.brand span { border-left: 1px solid var(--line-strong); padding-left: clamp(10px, 1.6vw, 25px); font-size: clamp(13px, 1.35vw, 20px); }
.masthead nav { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(3px, .8vw, 12px); }
.nav-item { color: var(--forest-dark); padding: 9px clamp(10px, 1.1vw, 18px); border-radius: 12px; text-decoration: none; font-size: clamp(14px, 1.2vw, 18px); }
.nav-item:hover, .nav-item[aria-current="page"] { background: var(--mint); color: var(--forest-dark); }
.nav-item[aria-current="page"] { font-weight: 650; }
.reader-mode { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.masthead [hidden] { display: none; }
.masthead:has(.workspace-controls:not([hidden])) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 16px; padding-block: 12px; }
.masthead:has(.workspace-controls:not([hidden])) nav { grid-column: 1 / -1; grid-row: 2; }
.masthead:has(.workspace-controls:not([hidden])) .reader-mode { grid-column: 1; grid-row: 3; margin-left: 0; }
.workspace-controls { grid-column: 2; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 6px 12px; }
.workspace-controls select { max-width: 28ch; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--forest-dark); background: var(--surface); padding: 7px 8px; }
.auth-card { width: min(100%, 470px); align-self: flex-end; padding: clamp(24px, 4vw, 44px); margin: auto 0; background: #fbfdfbf2; }
.auth-card header p, .auth-card form > p:not(.run-error) { color: var(--muted); line-height: 1.55; margin-top: 10px; }
.auth-card form { display: grid; gap: 15px; margin-top: 24px; }
.auth-card .run-error:empty { display: none; }
.source-editors input[type="file"] { max-width: 100%; }
@media (max-width: 650px) {
  .masthead:has(.workspace-controls:not([hidden])) { grid-template-columns: minmax(0, 1fr); }
  .masthead:has(.workspace-controls:not([hidden])) .workspace-controls { grid-column: 1; grid-row: 2; justify-content: start; }
  .masthead:has(.workspace-controls:not([hidden])) nav { grid-row: 3; }
  .masthead:has(.workspace-controls:not([hidden])) .reader-mode { grid-row: 4; }
}
main { flex: 1; min-width: 0; }
.garden-home { background: var(--background) url("/glass-garden.webp") no-repeat left bottom / cover; }
.page { max-width: var(--page-width); margin: 0 auto; padding: 36px var(--gutter) 48px; }
.garden-home .page { min-height: calc(100svh - var(--header-height)); padding-top: clamp(34px, 6vh, 69px); display: flex; flex-direction: column; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 25px; }
h1 { font-family: var(--display-font); font-size: clamp(32px, 4vw, 52px); line-height: 1.02; font-weight: 500; letter-spacing: -.045em; color: var(--forest-dark); }
.page-heading p { margin-top: 10px; max-width: 62ch; color: var(--muted); font-size: 14px; line-height: 1.55; }
.workflow-heading h1 { font-size: clamp(42px, 5.15vw, 80px); }
.workflow-toolbar { margin-top: 18px; display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 15px 20px; }
.scenario-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 15px; }
.scenario-meta h2 { min-width: 0; font-size: clamp(18px, 1.85vw, 28px); font-weight: 500; overflow-wrap: anywhere; }
.scenario-meta .chip { padding: 6px 12px; font-size: clamp(13px, 1.2vw, 17px); }
#workflow-status:empty { display: none; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.workflow-toolbar .page-actions { gap: 8px clamp(8px, 1.4vw, 22px); }
.button { min-height: 40px; padding: 8px 14px; font-weight: 650; font-size: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--forest); }
.button:hover { background: var(--mint); border-color: #8fab9a; }
.button.primary { background: linear-gradient(170deg, #2c705a, #114737); border-color: #1e5645; color: white; box-shadow: 0 6px 15px #184e351a, inset 0 1px #ffffff30; }
.button.primary:hover { background: #123e32; border-color: #123e32; }
.button.text { background: transparent; border-color: transparent; color: var(--green); text-decoration: underline; text-underline-offset: .25em; }
.button.text:hover:not(:disabled) { background: #e5f1e9; }
.button.text:disabled { color: var(--muted); opacity: .8; text-decoration: none; }
.workflow-toolbar .button { font-size: clamp(14px, 1.4vw, 20px); }
.workflow-toolbar .button.primary { min-height: 52px; padding: 10px clamp(14px, 2.2vw, 34px); border-radius: 16px; }
.workflow-toolbar .button.text { padding-inline: 6px; font-weight: 500; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) clamp(218px, 20vw, 310px); gap: clamp(18px, 2.1vw, 36px); margin-top: clamp(30px, 6vh, 64px); }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; min-height: 65px; padding: 13px 18px; gap: 9px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16px; font-weight: 700; color: var(--forest); }
.panel-head p { color: var(--muted); font-size: 12px; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; color: var(--forest-dark); background: var(--mint); font-size: 12px; font-weight: 650; line-height: 1.25; }
.chip.amber { background: #f7ecd6; color: var(--gold); }
.chip.red { background: #f8e6e0; color: var(--high); }
.chip.neutral { background: #ecece4; color: #4e5b50; }
.canvas { position: relative; min-width: 0; min-height: clamp(310px, 42vh, 455px); display: grid; align-items: center; }
.workflow {
  --flow-direction: horizontal;
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.14fr) minmax(0, 1.1fr) minmax(0, .82fr);
  grid-template-rows: repeat(2, minmax(82px, auto));
  gap: clamp(36px, 7vh, 86px) clamp(18px, 3.6vw, 61px);
  align-items: center;
}
.workflow-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; }
.node {
  width: 100%;
  display: flex;
  align-items: center;
  gap: clamp(6px, .8vw, 14px);
  min-height: clamp(64px, 6vw, 78px);
  padding: 10px clamp(9px, 1.25vw, 20px);
  text-align: left;
  border-radius: 999px;
  border: 1px solid #cedfd5;
  background: linear-gradient(155deg, #fffffff7, #f2f8f4f5);
  color: var(--forest-dark);
  box-shadow: 0 12px 23px #2763471d, 0 2px 5px #305c4320, inset 0 1px #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.node:hover { border-color: #6b9b86; box-shadow: 0 13px 26px #286b482b, 0 2px 6px #305c4323, inset 0 1px #fff; }
.node[aria-pressed="true"] { border-color: #2e775b; background: linear-gradient(150deg, #fbfffc, #e0f1e6); box-shadow: 0 0 0 2px #2e775b30, 0 12px 23px #27634725; }
.node.disabled-node { background: #f3f6f3; border-style: dashed; }
.node-icon { flex: 0 0 auto; display: grid; min-width: 1.15em; place-items: center; color: var(--green); font-size: clamp(17px, 1.65vw, 27px); font-weight: 750; line-height: 1; }
.node.python .node-icon { font-size: clamp(14px, 1.45vw, 23px); font-family: Consolas, monospace; }
.node-label { min-width: 0; display: grid; gap: 3px; }
.node strong { font-size: clamp(14px, 1.33vw, 21px); font-weight: 650; line-height: 1.15; overflow-wrap: anywhere; }
.node small { font-size: clamp(11px, .91vw, 14px); color: var(--muted); line-height: 1.2; overflow-wrap: anywhere; }
.node.source { grid-row: 1 / 3; grid-column: 1; }
.node.python { grid-row: 1; grid-column: 2; }
.node.config { grid-row: 2; grid-column: 2; }
.node.explain { grid-row: 1 / 3; grid-column: 3; }
.node.deliver { grid-row: 1 / 3; grid-column: 4; }
.inspector { min-width: 0; border-left: 1px solid var(--line-strong); padding: 14px 0 20px clamp(16px, 1.8vw, 28px); }
.inspector h2 { font-size: clamp(19px, 1.8vw, 28px); line-height: 1.16; font-weight: 700; letter-spacing: -.025em; }
.inspector header p { color: var(--muted); font-size: 14px; margin-top: 7px; }
.inspector-body { border: 0; margin: 18px 0 0; min-width: 0; padding: 0; display: grid; gap: 12px; }
.inspector-body > .button { justify-self: start; padding-inline: 4px; margin-top: 7px; font-size: 15px; font-weight: 500; }
.field { display: grid; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 600; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; background: #ffffffda; padding: 7px 10px; color: var(--charcoal); font-weight: 500; font-size: 14px; }
.field textarea { resize: vertical; font: 12px/1.55 Consolas, monospace; min-height: 206px; }
.fine-print { color: var(--muted); font-size: 12px; line-height: 1.5; }
.rules { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.rules legend { color: var(--muted); font-size: 12px; margin-bottom: 7px; font-weight: 650; }
.check { padding: 8px; border-radius: 8px; border: 1px solid var(--line); display: flex; gap: 7px; align-items: flex-start; font-size: 13px; line-height: 1.35; }
.check input { accent-color: var(--green); margin-top: 2px; }
.check small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.latest { display: flex; align-items: baseline; flex-wrap: wrap; margin-top: auto; padding-top: clamp(26px, 8vh, 84px); gap: 8px 19px; font-size: clamp(14px, 1.4vw, 20px); }
.latest h2 { font-size: inherit; color: var(--forest-dark); }
.latest p { color: var(--muted); font-size: .9em; }
.latest > :not(:first-child) { border-left: 1px solid var(--line-strong); padding-left: 19px; }
.latest .link-button { font-weight: 500; text-decoration: underline; text-underline-offset: .23em; }
.finding-count { color: var(--gold); font-weight: 600; }
.result .panel-head { align-items: center; }
.summary-strip { padding: 13px 17px; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; font-size: 13px; }
.summary-strip .spacer { margin-left: auto; }
.revision { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 560px; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 11px 16px; }
th { color: var(--muted); background: #edf4ee; font-size: 12px; font-weight: 650; }
td { border-top: 1px solid var(--line); }
.link-button { background: none; padding: 0; font: inherit; font-weight: 650; color: var(--green); border: 0; text-align: left; }
.link-button:hover { text-decoration: underline; }
.result { margin-top: 14px; }
.stages { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 17px; border-bottom: 1px solid var(--line); }
.findings { display: grid; gap: 9px; padding: 14px 16px 16px; }
.finding { border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.finding summary { cursor: pointer; padding: 11px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; list-style: none; }
.finding summary::before { content: "›"; color: var(--green); font-weight: 700; }
.finding[open] summary::before { content: "⌄"; }
.finding summary strong { font-size: 14px; }
.finding summary code { color: var(--muted); font-size: 11px; margin-left: auto; }
.finding-detail { border-top: 1px solid var(--line); padding: 12px; display: grid; gap: 10px; font-size: 13px; line-height: 1.5; }
.finding-detail pre { margin: 0; background: #e9f1eb; color: #234436; padding: 10px; border-radius: 6px; overflow-x: auto; }
.finding-detail .field { max-width: 210px; }
.finding-detail .chip { justify-self: start; }
.triage-summary { display: grid; justify-items: start; gap: 5px; }
.coverage { color: var(--muted); padding: 12px 17px; font-size: 13px; border-bottom: 1px solid var(--line); }
.coverage h3 { color: var(--forest); font-size: 13px; margin-bottom: 6px; }
.coverage ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.coverage li { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.coverage code { overflow-wrap: anywhere; }
.empty { color: var(--muted); padding: 20px 17px; font-size: 14px; }
.fixed-list { padding: 13px 17px; color: var(--green); border-top: 1px solid var(--line); font-size: 13px; }
.fixed-list ul { margin: 5px 0 0; padding-left: 18px; }
.outbox { display: grid; gap: 11px; padding: 15px; }
.mail { border: 1px solid var(--line); padding: 13px; border-radius: 8px; }
.mail p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.mail-heading, .mail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.mail-actions { margin-top: 9px; font-size: 13px; }
dialog { color: var(--charcoal); background: var(--surface); width: min(700px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 13px; max-height: 91vh; overflow: auto; }
dialog::backdrop { background: #102a2399; }
.dialog-body { padding: 16px 19px; display: grid; gap: 13px; }
.source-editors { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.source-editors[hidden] { display: none; }
.decision-fields { padding: 0; margin: 0; border: 0; min-width: 0; display: grid; gap: 12px; }
.decision-fields[hidden] { display: none; }
.decision-fields textarea { min-height: 80px; font: inherit; }
.dialog-footer { border-top: 1px solid var(--line); padding: 12px 19px; display: flex; justify-content: flex-end; gap: 7px; }
#toast { position: fixed; bottom: 21px; right: 21px; padding: 10px 15px; border-radius: 9px; color: white; background: var(--forest); box-shadow: 0 3px 10px #16332826; max-width: calc(100vw - 42px); font-size: 13px; z-index: 2; }
#toast:empty { display: none; }
#toast.error { background: var(--high); }
.run-error:empty { display: none; }
.run-error { color: var(--high); font-size: 13px; }
.busy { opacity: .76; }

@media (max-width: 1050px) {
  .workspace { grid-template-columns: minmax(0, 1fr); margin-top: 26px; }
  .canvas { min-height: 260px; }
  .inspector { border: 0; border-top: 1px solid var(--line-strong); padding: 18px 0 0; }
  .inspector-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector-body .rules { grid-column: 1 / -1; }
  .garden-home { background-size: auto 100%; }
}
@media (max-width: 690px) {
  :root { --header-height: 100px; }
  .masthead { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; align-content: center; }
  .masthead nav { grid-row: 2; grid-column: 1 / -1; }
  .reader-mode { grid-row: 1; grid-column: 2; font-size: 11px; }
  .brand { width: fit-content; }
  .page, .garden-home .page { padding-top: 28px; padding-bottom: 30px; }
  .workflow-heading h1 { font-size: clamp(34px, 8vw, 54px); }
  .workflow-toolbar { margin-top: 13px; }
  .scenario-meta { gap: 7px 9px; }
  .workflow-toolbar .button.primary { min-height: 46px; border-radius: 13px; }
  .garden-home { background-size: auto min(770px, 78%); background-position: left 42%; }
  .canvas { min-height: 0; padding-block: 7px 16px; }
  .workflow { --flow-direction: vertical; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; gap: 32px 13px; }
  .node { min-height: 60px; padding: 8px 10px; }
  .node.source, .node.explain, .node.deliver { justify-self: center; max-width: 245px; }
  .node.python, .node.config { align-self: stretch; }
  .node.source { grid-row: 1; grid-column: 1 / 3; }
  .node.python { grid-row: 2; grid-column: 1; }
  .node.config { grid-row: 2; grid-column: 2; }
  .node.explain { grid-row: 3; grid-column: 1 / 3; }
  .node.deliver { grid-row: 4; grid-column: 1 / 3; }
  .source-editors, .inspector-body { grid-template-columns: minmax(0, 1fr); }
  .latest { gap: 8px 11px; padding-top: 26px; }
  .latest > :not(:first-child) { padding-left: 11px; }
}
@media (max-width: 420px) {
  .masthead { grid-template-columns: minmax(0, 1fr); }
  .reader-mode { grid-row: 3; grid-column: 1; justify-self: start; margin: 2px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .node { transition: none; }
}
@media (forced-colors: active) {
  .garden-home { background-image: none; }
  .node[aria-pressed="true"] { outline: 2px solid Highlight; }
}
