:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #5d6964;
  --line: #d5ddd9;
  --line-strong: #a9b7b0;
  --paper: #f7f9f8;
  --surface: #ffffff;
  --surface-alt: #edf2ef;
  --green: #155d48;
  --green-dark: #0c4434;
  --green-soft: #dcece5;
  --amber: #a95712;
  --amber-soft: #fff0df;
  --red: #a13c35;
  --red-soft: #fbe9e7;
  --blue: #245e8a;
  --shadow: 0 10px 30px rgba(25, 42, 35, 0.08);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

button, input, textarea, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(36, 94, 138, 0.28);
  outline-offset: 1px;
}

.app-header {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto 0;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  color: #f7fbf9;
  background: #14251f;
  border-bottom: 1px solid #31453d;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 270px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid #7b9e90;
  color: #d8eee5;
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; }
.brand small { margin-top: 2px; color: #aabdb5; font-size: 11px; }

.project-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #b9cbc4;
  font-size: 12px;
}

.save-dot { width: 7px; height: 7px; background: #67c69f; border-radius: 50%; }
.save-dot.saving { background: #e1a65d; }

.header-actions { display: flex; align-items: center; gap: 7px; }
.button {
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 650;
  font-size: 12px;
}
.button:hover { border-color: var(--green); color: var(--green-dark); }
.button.primary { border-color: var(--green); color: #fff; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.app-header .button.quiet { border-color: #496159; color: #e9f3ef; background: transparent; }
.app-header .button.quiet:hover { border-color: #98b7aa; background: #20362e; }
.button.danger { border-color: #d5aaa6; color: var(--red); background: #fff; }
.button.small { min-height: 30px; padding: 5px 9px; }

.menu-wrap { position: relative; }
.export-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  width: 170px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.export-menu button { width: 100%; padding: 9px; border: 0; text-align: left; color: var(--ink); background: transparent; }
.export-menu button:hover { background: var(--surface-alt); }

.workflow-nav {
  position: fixed;
  z-index: 10;
  inset: 72px auto 0 0;
  width: 252px;
  overflow-y: auto;
  background: #edf2ef;
  border-right: 1px solid var(--line);
}
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 10px; }
.nav-heading p { margin: 0; color: var(--muted); font-weight: 750; font-size: 11px; text-transform: uppercase; }
.nav-heading button { display: none; border: 0; background: transparent; }
.workflow-nav nav { padding: 0 10px; }
.workflow-step {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  width: 100%;
  min-height: 62px;
  padding: 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  color: var(--muted);
  text-align: left;
  background: transparent;
}
.workflow-step:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.workflow-step.active { border-left-color: var(--green); color: var(--ink); background: #fff; }
.workflow-step.complete span { color: #fff; background: var(--green); }
.workflow-step span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  align-self: start;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 750;
}
.workflow-step b { font-size: 13px; }
.workflow-step small { margin-top: 3px; font-size: 11px; }
.review-step { margin-top: 7px; border-top: 1px solid var(--line); }
.privacy-note { margin: 22px 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.privacy-note strong { font-size: 11px; text-transform: uppercase; }
.privacy-note p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.workspace {
  min-height: 100vh;
  margin-left: 252px;
  margin-right: 294px;
  padding: 104px 34px 90px;
}
.workspace-topline { display: flex; justify-content: space-between; gap: 30px; max-width: 980px; margin: 0 auto 24px; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 10px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; font: 650 28px/1.2 Georgia, "Times New Roman", serif; }
h2 { margin: 0; font: 650 20px/1.25 Georgia, "Times New Roman", serif; }
h3 { margin: 0; font-size: 14px; }
.completion { min-width: 150px; padding-top: 4px; color: var(--muted); font-size: 11px; text-align: right; }
.completion div { width: 150px; height: 5px; margin-top: 7px; overflow: hidden; background: var(--line); }
.completion i { display: block; width: 0; height: 100%; background: var(--green); transition: width .2s ease; }

.stage-content { max-width: 980px; margin: 0 auto; }
.intro-copy { max-width: 740px; margin: -6px 0 24px; color: var(--muted); line-height: 1.6; }
.section-band { padding: 22px 0; border-top: 1px solid var(--line); }
.section-band:first-of-type { border-top: 0; padding-top: 0; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading p { max-width: 620px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { color: #39453f; font-size: 11px; font-weight: 750; }
.field em { color: var(--red); font-style: normal; }
.field small { color: var(--muted); font-size: 10px; line-height: 1.4; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: #fff;
}
input, select { min-height: 39px; padding: 8px 10px; }
textarea { min-height: 92px; padding: 10px; resize: vertical; line-height: 1.5; }
input:hover, textarea:hover, select:hover { border-color: #7b9087; }
input[type="range"] { min-height: auto; padding: 0; accent-color: var(--green); }

.callout { padding: 14px 16px; border-left: 3px solid var(--green); color: #314139; background: var(--green-soft); font-size: 12px; line-height: 1.55; }
.callout.warning { border-left-color: var(--amber); background: var(--amber-soft); }
.empty-state { padding: 28px; border: 1px dashed var(--line-strong); color: var(--muted); text-align: center; background: rgba(255,255,255,.5); }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); }

.item-list { display: grid; gap: 9px; margin-top: 17px; }
.data-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1.5fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--line);
}
.data-row strong, .data-row small { display: block; }
.data-row small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.row-actions { display: flex; gap: 5px; }
.icon-button { width: 31px; height: 31px; padding: 0; border: 1px solid var(--line); color: var(--muted); background: #fff; }
.icon-button:hover { color: var(--red); border-color: #d5aaa6; }
.status-chip { display: inline-block; margin-right: 5px; padding: 3px 6px; color: var(--green-dark); background: var(--green-soft); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.status-chip.inferred { color: var(--amber); background: var(--amber-soft); }
.status-chip.asserted { color: var(--red); background: var(--red-soft); }
.score { font: 700 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--green); }

.enclosure-map { display: grid; gap: 7px; margin-top: 18px; }
.enclosure-node { position: relative; padding: 12px 14px; background: #fff; border: 1px solid var(--line); }
.enclosure-node::before { content: ""; position: absolute; top: -8px; bottom: 50%; left: -15px; width: 12px; border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.enclosure-node.depth-0::before { display: none; }
.enclosure-node-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.enclosure-node p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

.ranked-support { grid-template-columns: 42px minmax(150px, 1fr) minmax(180px, 1.4fr) 70px auto; }
.rank-number { display: grid; place-items: center; width: 28px; height: 28px; color: var(--green-dark); background: var(--green-soft); font-weight: 800; }
.meter-set { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.meter-set span { color: var(--muted); font-size: 9px; }
.meter-set i { display: block; height: 3px; margin-top: 3px; background: var(--line); }
.meter-set b { display: block; height: 100%; background: var(--blue); }

.review-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.review-score { padding: 22px; color: #fff; background: #173e31; }
.review-score strong { display: block; font: 650 46px/1 Georgia, serif; }
.review-score span { display: block; margin-top: 8px; color: #bcd2c9; font-size: 11px; }
.review-list { display: grid; gap: 7px; }
.review-item { display: grid; grid-template-columns: 22px 1fr; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); background: #fff; }
.review-item i { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: #fff; background: var(--green); font-size: 10px; font-style: normal; }
.review-item.fail i { background: var(--amber); }
.review-item strong, .review-item small { display: block; }
.review-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.model-output { margin-top: 20px; }
.model-output pre { max-height: 300px; overflow: auto; padding: 16px; color: #d9e8e2; background: #17231f; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }

.stage-footer {
  position: fixed;
  z-index: 8;
  right: 294px;
  bottom: 0;
  left: 252px;
  min-height: 66px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  padding: 12px 34px;
  background: rgba(247,249,248,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.stage-footer p { margin: 0; color: var(--muted); font-size: 11px; text-align: center; }

.context-panel {
  position: fixed;
  inset: 72px 0 0 auto;
  width: 294px;
  overflow-y: auto;
  padding: 27px 22px;
  background: #fff;
  border-left: 1px solid var(--line);
}
.context-panel section { padding: 0 0 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.context-panel section:last-child { border-bottom: 0; }
.context-panel h2 { overflow-wrap: anywhere; font-size: 17px; }
.model-summary { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin: 18px 0 0; font-size: 11px; }
.model-summary dt { color: var(--muted); }
.model-summary dd { margin: 0; font-weight: 750; }
.method-check { display: grid; gap: 8px; }
.check-line { display: grid; grid-template-columns: 17px 1fr; gap: 7px; color: var(--muted); font-size: 11px; }
.check-line span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 8px; }
.check-line.pass { color: var(--ink); }
.check-line.pass span { color: #fff; border-color: var(--green); background: var(--green); }
.guidance p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; padding: 11px 15px; color: #fff; background: #183b2f; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .context-panel { display: none; }
  .workspace { margin-right: 0; }
  .stage-footer { right: 0; }
}

@media (max-width: 820px) {
  .app-header { height: auto; min-height: 66px; padding: 10px 14px; flex-wrap: wrap; gap: 9px; }
  .brand { min-width: 0; margin-right: auto; }
  .brand small { display: none; }
  .project-state { display: none; }
  .header-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .workflow-nav { inset: 116px 0 auto 0; width: 100%; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-heading { height: 42px; padding: 0 14px; }
  .nav-heading button { display: block; }
  .workflow-nav nav, .privacy-note { display: none; }
  .workflow-nav.open nav { display: block; max-height: calc(100vh - 158px); overflow-y: auto; padding-bottom: 10px; }
  .workflow-nav.open .privacy-note { display: block; }
  .workspace { margin: 0; padding: 182px 18px 95px; }
  .stage-footer { left: 0; padding: 10px 16px; }
  .stage-footer p { display: none; }
  .stage-footer { grid-template-columns: auto 1fr; }
  .stage-footer .primary { justify-self: end; }
}

@media (max-width: 620px) {
  .brand strong { font-size: 12px; }
  .brand-mark { width: 32px; height: 32px; }
  .workspace-topline { display: block; }
  .completion { margin-top: 16px; text-align: left; }
  .field-grid, .field-grid.three, .review-grid { grid-template-columns: 1fr; }
  .data-row, .ranked-support { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-end; }
  .meter-set { max-width: 300px; }
  .section-heading { display: block; }
  .section-heading .button { margin-top: 10px; }
  h1 { font-size: 24px; }
  .header-actions .button { white-space: nowrap; }
}
