@layer reset, base, components, utilities;

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html { color-scheme: light; text-size-adjust: 100%; scroll-behavior: smooth; }
  body, h1, h2, h3, h4, p, ul, ol, dl, dd, fieldset, pre { margin: 0; }
  ul, ol { padding: 0; }
  button, input, textarea, select { font: inherit; }
  button, a { -webkit-tap-highlight-color: transparent; }
  img, svg { display: block; max-width: 100%; }
}

@layer base {
  :root {
    --paper: #f2efe8;
    --paper-deep: #e7e1d5;
    --surface: #fbfaf7;
    --surface-strong: #ffffff;
    --ink: #15201f;
    --ink-soft: #3f4b49;
    --muted: #687270;
    --line: #cfc8bb;
    --line-strong: #9f998e;
    --accent: #0d655d;
    --accent-dark: #084b46;
    --accent-soft: #dcece8;
    --warning: #8a5a17;
    --warning-soft: #f3e7cf;
    --danger: #923e31;
    --danger-soft: #f4ded9;
    --success: #2c6644;
    --success-soft: #deecdf;
    --shadow: 0 18px 52px rgba(29, 36, 34, 0.08);
    --radius-sm: 7px;
    --radius: 12px;
    --radius-lg: 18px;
    --content: 1180px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  body {
    min-width: 320px;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
  }

  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
  a:hover { color: var(--accent-dark); }
  button { color: inherit; }
  code, pre { font-family: var(--mono); }
  code { overflow-wrap: anywhere; }
  pre { white-space: pre-wrap; overflow-wrap: anywhere; }

  :focus-visible {
    outline: 3px solid rgba(13, 101, 93, 0.32);
    outline-offset: 3px;
  }

  ::selection { background: var(--accent-soft); color: var(--ink); }
}

@layer components {
  .skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
    transform: translateY(-180%);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: white;
  }
  .skip-link:focus { transform: translateY(0); }

  .site-header {
    width: min(calc(100% - 40px), var(--content));
    min-height: 64px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    text-decoration: none;
  }
  .brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--ink);
    border-radius: 50%;
    color: var(--accent);
    background: var(--surface);
  }
  .brand strong, .brand small { display: block; }
  .brand strong { font-size: 15px; letter-spacing: 0.015em; }
  .brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }

  .site-header nav, .site-footer nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px 22px;
  }
  .site-header nav a, .site-footer nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--ink-soft);
    font-size: 14px;
    text-decoration: none;
  }
  .site-header nav a:hover, .site-footer nav a:hover { color: var(--accent-dark); }

  .page-shell, .content-shell {
    width: min(calc(100% - 40px), var(--content));
    margin: 0 auto;
  }

  .diagnostic-intro {
    max-width: 900px;
    padding: clamp(26px, 4vw, 46px) 0 18px;
  }
  .eyebrow {
    color: var(--accent-dark);
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  h1 {
    max-width: 15ch;
    margin-top: 7px;
    font-size: clamp(38px, 5.2vw, 60px);
    font-weight: 660;
    letter-spacing: -0.048em;
    line-height: 0.99;
    text-wrap: balance;
  }
  .lede {
    max-width: 760px;
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: clamp(16px, 1.8vw, 19px);
    line-height: 1.42;
  }
  .trust-line {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 18px;
    margin-top: 12px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 12px;
  }

  .workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.32fr);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: clip;
  }
  .workbench form { min-width: 0; padding: clamp(20px, 2.5vw, 30px); }
  .workbench-guide {
    min-width: 0;
    padding: clamp(22px, 3vw, 34px);
    border-left: 1px solid var(--line);
    background: #e9e5dc;
  }

  .field-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
  }
  .field-head label, fieldset legend {
    font-size: 18px;
    font-weight: 680;
    letter-spacing: -0.012em;
  }
  .field-head p { max-width: 680px; margin-top: 5px; color: var(--muted); font-size: 14px; }
  .text-action, .file-action {
    min-height: 44px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 680;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
  }

  textarea, input, select {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-strong);
    color: var(--ink);
  }
  textarea { resize: vertical; }
  #evidence {
    min-height: 148px;
    margin-top: 10px;
    padding: 14px 15px;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.55;
    tab-size: 2;
  }
  textarea::placeholder, input::placeholder { color: #7d8582; opacity: 1; }
  textarea:focus, input:focus, select:focus { border-color: var(--accent); outline: 3px solid rgba(13, 101, 93, 0.14); }
  .field-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
  }

  .category-group {
    margin-top: 14px;
    padding: 0;
    border: 0;
  }
  .category-group legend { margin-bottom: 6px; }
  .choices { display: flex; flex-wrap: wrap; gap: 6px; }
  .choice { position: relative; }
  .choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
  .choice span {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-strong);
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 620;
    cursor: pointer;
  }
  .choice input:checked + span {
    border-color: var(--accent-dark);
    background: var(--accent-soft);
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px var(--accent-dark);
  }
  .choice input:focus-visible + span { outline: 3px solid rgba(13, 101, 93, 0.32); outline-offset: 3px; }

  .context-panel {
    margin-top: 14px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }
  .context-panel summary {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 680;
    cursor: pointer;
  }
  .context-panel summary span { color: var(--muted); font-size: 12px; font-weight: 500; }
  .context-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    padding: 4px 0 20px;
  }
  .context-grid label, .block-label, .outcome-panel label { display: grid; gap: 7px; min-width: 0; }
  .context-grid label > span, .block-label > span, .outcome-panel label > span {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 680;
  }
  .context-grid input, .context-grid select {
    min-height: 44px;
    padding: 9px 11px;
    font-size: 14px;
  }
  .span-two { grid-column: 1 / -1; }

  .inline-error {
    margin-top: 18px;
    padding: 12px 14px;
    border-left: 3px solid var(--danger);
    background: var(--danger-soft);
    color: #672a22;
    font-size: 14px;
  }
  .primary-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 14px;
  }
  .primary-button, .secondary-button, .danger-button, .copy-button, .outcome-button {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 11px 17px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
  }
  .primary-button {
    border: 1px solid var(--accent-dark);
    background: var(--accent);
    color: white;
  }
  .primary-button:hover { background: var(--accent-dark); color: white; }
  .primary-button:disabled, .secondary-button:disabled, .danger-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
  }
  .secondary-button, .copy-button {
    border: 1px solid var(--line-strong);
    background: var(--surface-strong);
    color: var(--ink);
  }
  .secondary-button:hover, .copy-button:hover { border-color: var(--accent); color: var(--accent-dark); }
  .danger-button {
    border: 1px solid var(--danger);
    background: transparent;
    color: var(--danger);
  }
  .danger-button:hover { background: var(--danger); color: white; }
  .privacy-note { margin-top: 12px; color: var(--muted); font-size: 12px; }

  .guide-label { color: var(--accent-dark); font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
  .workbench-guide ol { display: grid; gap: 0; margin-top: 16px; list-style: none; }
  .workbench-guide li { padding: 17px 0; border-top: 1px solid var(--line); }
  .workbench-guide li:last-child { border-bottom: 1px solid var(--line); }
  .workbench-guide span, .workbench-guide small { display: block; }
  .workbench-guide span { font-size: 14px; font-weight: 700; }
  .workbench-guide small { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
  .guide-stop { margin-top: 18px; color: var(--ink-soft); font-size: 12px; }

  .result-region { scroll-margin-top: 20px; }
  .result-empty {
    min-height: 275px;
    margin-top: 26px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(251, 250, 247, 0.55);
  }
  .result-placeholder { max-width: 720px; padding: 42px 24px; text-align: center; }
  .result-placeholder h2 { margin-top: 8px; font-size: clamp(25px, 3vw, 36px); letter-spacing: -0.032em; line-height: 1.12; }
  .result-placeholder p:not(.eyebrow) { margin-top: 12px; color: var(--muted); }
  .empty-chain { margin-top: 25px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
  .empty-chain i { width: 34px; border-top: 1px solid var(--line-strong); }

  .diagnosis-card {
    margin-top: 26px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: clip;
  }
  .diagnosis-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    padding: clamp(24px, 3.5vw, 40px);
    border-bottom: 1px solid var(--line);
  }
  .diagnosis-header h2 { margin-top: 7px; font-size: clamp(31px, 4.4vw, 54px); letter-spacing: -0.045em; line-height: 1; }
  .result-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .checkpoint-code, .confidence {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .checkpoint-code { border: 1px solid var(--line-strong); background: var(--paper); }
  .confidence-high { background: var(--success-soft); color: var(--success); }
  .confidence-medium { background: var(--warning-soft); color: var(--warning); }
  .confidence-low { background: var(--danger-soft); color: var(--danger); }
  .result-summary { padding: 24px clamp(24px, 3.5vw, 40px); color: var(--ink); font-size: clamp(18px, 2.4vw, 23px); line-height: 1.45; }

  .why-block, .chain-block, .fix-block, .verify-block, .evidence-block, .save-block, .cause-grid {
    border-top: 1px solid var(--line);
  }
  .why-block, .chain-block, .fix-block, .evidence-block { padding: 26px clamp(24px, 3.5vw, 40px); }
  .why-block { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 22px; }
  .why-block h3, .section-heading h3, .cause-grid h3, .fix-block h3, .verify-block h3, .save-block h3, .evidence-block h4 { font-size: 15px; letter-spacing: -0.01em; }
  .why-block p { color: var(--ink-soft); }
  .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
  .section-heading span { color: var(--muted); font-family: var(--mono); font-size: 10px; text-transform: uppercase; }

  .chain-list { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); list-style: none; border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
  .chain-item { min-width: 0; padding: 15px; border-right: 1px solid var(--line); background: var(--surface-strong); }
  .chain-item:last-child { border-right: 0; }
  .chain-item strong, .chain-item code, .chain-item p, .chain-status { display: block; }
  .chain-status { color: var(--muted); font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
  .chain-item strong { margin-top: 7px; font-size: 13px; }
  .chain-item code { margin-top: 2px; color: var(--muted); font-size: 9px; }
  .chain-item p { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.4; }
  .status-pass { box-shadow: inset 0 3px 0 var(--success); }
  .status-fail { box-shadow: inset 0 3px 0 var(--danger); }
  .status-partial { box-shadow: inset 0 3px 0 var(--warning); }
  .status-not_reached, .status-unknown { box-shadow: inset 0 3px 0 var(--line-strong); }

  .cause-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cause-grid section { min-width: 0; padding: 26px clamp(24px, 3.5vw, 40px); }
  .cause-grid section + section { border-left: 1px solid var(--line); }
  .cause-grid ul, .evidence-grid ul { margin: 13px 0 0 18px; }
  .cause-grid li, .evidence-grid li { margin-top: 7px; color: var(--ink-soft); }
  .muted { color: var(--muted); }

  .action-list { margin-top: 18px; display: grid; gap: 1px; list-style: none; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
  .action-list li { display: grid; grid-template-columns: 35px minmax(0, 1fr); gap: 14px; padding: 17px; background: var(--surface-strong); }
  .step-number { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent-dark); font-family: var(--mono); font-size: 11px; font-weight: 700; }
  .action-list h4 { font-size: 14px; }
  .action-list p { margin-top: 4px; color: var(--ink-soft); font-size: 14px; }
  .copy-button { min-height: 44px; margin-top: 14px; padding: 8px 12px; font-size: 12px; }

  .verify-block, .save-block, .delete-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    padding: 26px clamp(24px, 3.5vw, 40px);
    background: #e8eee9;
  }
  .verify-block p, .save-block p, .delete-panel p { margin-top: 5px; color: var(--ink-soft); font-size: 13px; }

  .evidence-block summary { min-height: 44px; font-weight: 700; cursor: pointer; }
  .evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 18px; }
  .evidence-grid section { min-width: 0; }
  .matched-snippets { margin-top: 23px; }
  .matched-snippets code { display: block; margin-top: 7px; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink-soft); font-size: 11px; white-space: pre-wrap; }
  .evidence-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-top: 23px; border: 1px solid var(--line); background: var(--line); }
  .evidence-meta div { min-width: 0; padding: 10px 12px; background: var(--surface-strong); }
  .evidence-meta dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
  .evidence-meta dd { margin-top: 3px; font-size: 12px; overflow-wrap: anywhere; }
  .turnstile-mount { min-width: 0; }
  .save-status { margin-top: 8px; color: var(--ink-soft); font-size: 13px; overflow-wrap: anywhere; }

  .method-section, .related-section {
    display: grid;
    grid-template-columns: minmax(220px, 0.35fr) minmax(0, 1fr);
    gap: clamp(30px, 6vw, 90px);
    padding: clamp(62px, 9vw, 112px) 0;
  }
  .method-section h2, .related-section h2, .content-hero h1 {
    margin-top: 9px;
    font-size: clamp(31px, 4.6vw, 54px);
    letter-spacing: -0.045em;
    line-height: 1.05;
  }
  .method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
  .method-grid article { min-width: 0; padding: 23px; background: rgba(251, 250, 247, 0.82); }
  .method-grid h3 { font-size: 15px; }
  .method-grid p { margin-top: 8px; color: var(--ink-soft); font-size: 13px; }
  .related-section { border-top: 1px solid var(--line); }
  .related-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
  .related-links a { min-width: 0; padding: 20px; background: var(--surface); text-decoration: none; }
  .related-links a:hover { background: var(--accent-soft); }
  .related-links strong, .related-links span { display: block; }
  .related-links strong { font-size: 14px; }
  .related-links span { margin-top: 4px; color: var(--muted); font-size: 12px; }

  .site-footer {
    width: min(calc(100% - 40px), var(--content));
    min-height: 160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    border-top: 1px solid var(--line);
  }
  .site-footer strong { font-size: 14px; }
  .site-footer p { margin-top: 4px; color: var(--muted); font-size: 12px; }

  .content-shell { padding-bottom: 80px; }
  .content-hero { max-width: 900px; padding: clamp(58px, 9vw, 110px) 0 clamp(38px, 6vw, 70px); }
  .content-hero h1 { max-width: 18ch; }
  .content-hero > p:not(.eyebrow) { max-width: 760px; margin-top: 20px; color: var(--ink-soft); font-size: clamp(17px, 2.2vw, 21px); }
  .inline-button { width: fit-content; margin-top: 24px; }
  .content-section { padding: clamp(30px, 5vw, 60px) 0; border-top: 1px solid var(--line); }
  .content-section h2 { font-size: clamp(25px, 3.3vw, 38px); letter-spacing: -0.035em; }
  .content-section h3 { margin-top: 24px; font-size: 18px; }
  .content-section p { max-width: 820px; margin-top: 14px; color: var(--ink-soft); }
  .content-section ul { margin: 16px 0 0 21px; }
  .content-section li { margin-top: 8px; }
  .split-content { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 7vw, 90px); }
  .large-steps { margin-top: 24px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); list-style: none; }
  .large-steps li { min-width: 0; margin: 0; padding: 18px; border-right: 1px solid var(--line); font-size: 13px; font-weight: 680; }
  .large-steps li:last-child { border-right: 0; }
  .notice { padding: 15px 17px; border-left: 3px solid var(--warning); background: var(--warning-soft); }
  .legal-page .content-section p { max-width: 900px; }
  .empty-state-page { min-height: 62vh; display: grid; align-content: center; justify-items: start; max-width: 760px; }
  .empty-state-page h1 { margin-top: 8px; }
  .empty-state-page > p:not(.eyebrow) { margin-top: 18px; color: var(--ink-soft); font-size: 18px; }

  .collector-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.38fr);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: clip;
  }
  .collector-form, .collector-checklist { padding: clamp(22px, 3.5vw, 40px); }
  .collector-checklist { border-left: 1px solid var(--line); background: #e9e5dc; }
  .collector-form h2, .collector-checklist h2 { font-size: 24px; letter-spacing: -0.025em; }
  .collector-form > p { margin-top: 7px; color: var(--muted); }
  .collector-form .context-grid { margin-top: 20px; }
  .block-label { margin-top: 16px; }
  .block-label textarea, .outcome-panel textarea { padding: 12px; font-family: var(--mono); font-size: 13px; }
  .collector-checklist ol { margin: 17px 0 0 20px; }
  .collector-checklist li { margin-top: 12px; color: var(--ink-soft); }
  .collector-checklist h3 { margin-top: 28px; }
  .collector-checklist p { margin-top: 8px; color: var(--ink-soft); font-size: 13px; }

  .report-page { padding-bottom: 80px; }
  .report-banner { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: clamp(44px, 7vw, 82px) 0 24px; }
  .report-banner h1 { max-width: 12ch; font-size: clamp(35px, 5.5vw, 66px); }
  .report-banner dl { display: grid; gap: 8px; min-width: 250px; }
  .report-banner dl div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 9px; }
  .report-banner dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
  .report-banner dd { font-family: var(--mono); font-size: 10px; overflow-wrap: anywhere; }
  .private-notice { padding: 14px 16px; border: 1px solid var(--line); background: var(--warning-soft); color: var(--ink-soft); font-size: 13px; }
  .report-evidence { margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .report-evidence summary { min-height: 44px; font-weight: 700; cursor: pointer; }
  .report-evidence pre { max-height: 360px; overflow: auto; padding: 15px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; }
  .outcome-panel, .delete-panel { margin-top: 18px; padding: clamp(22px, 3.2vw, 34px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
  .outcome-panel h2, .delete-panel h2 { margin-top: 6px; font-size: 26px; letter-spacing: -0.03em; }
  .outcome-panel > div > p:not(.eyebrow), .delete-panel p { margin-top: 7px; color: var(--muted); }
  .outcome-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
  .outcome-button { border: 1px solid var(--line-strong); background: var(--surface-strong); }
  .outcome-button.is-selected { border-color: var(--accent-dark); background: var(--accent-soft); color: var(--accent-dark); }
  .outcome-panel label { margin-top: 18px; }
  .outcome-panel .primary-button { margin-top: 18px; }
  .delete-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .delete-panel .save-status { grid-column: 1 / -1; }

  .redaction-dialog {
    width: min(760px, calc(100% - 28px));
    max-height: min(86vh, 760px);
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 26px 90px rgba(20, 29, 28, 0.24);
    overflow: hidden;
  }
  .redaction-dialog::backdrop { background: rgba(18, 25, 24, 0.52); }
  .dialog-body { max-height: min(86vh, 760px); display: grid; grid-template-rows: auto auto minmax(120px, 1fr) auto; }
  .dialog-head, .dialog-actions, .redaction-counts, .redaction-preview { padding: 20px clamp(18px, 3vw, 28px); }
  .dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
  .dialog-head h2 { font-size: 25px; letter-spacing: -0.03em; }
  .dialog-head p { margin-top: 5px; color: var(--muted); font-size: 13px; }
  .dialog-close { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-strong); cursor: pointer; }
  .redaction-counts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; border-bottom: 1px solid var(--line); }
  .redaction-counts div { padding: 9px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); }
  .redaction-counts strong, .redaction-counts span { display: block; }
  .redaction-counts strong { font-family: var(--mono); font-size: 16px; }
  .redaction-counts span { margin-top: 2px; color: var(--muted); font-size: 10px; }
  .redaction-preview { overflow: auto; }
  .redaction-preview pre { min-height: 140px; padding: 13px; border: 1px solid var(--line); background: var(--paper); font-size: 12px; }
  .redaction-warning { margin-bottom: 12px; padding: 10px 12px; border-left: 3px solid var(--warning); background: var(--warning-soft); font-size: 12px; }
  .dialog-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }

  .loading-state { min-height: 250px; margin-top: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
  .loading-state strong { display: block; margin-top: 15px; font-size: 20px; }
  .loading-state p { margin-top: 6px; color: var(--muted); }
  .loading-mark { width: 46px; height: 46px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

@layer utilities {
  [hidden] { display: none !important; }
}

@media (max-width: 900px) {
  .site-header { min-height: 60px; }
  .site-header nav { display: none; }
  .workbench, .collector-workbench { grid-template-columns: 1fr; }
  .workbench-guide, .collector-checklist { border-top: 1px solid var(--line); border-left: 0; }
  .method-section, .related-section { grid-template-columns: 1fr; gap: 28px; }
  .large-steps { grid-template-columns: 1fr; }
  .large-steps li { border-right: 0; border-bottom: 1px solid var(--line); }
  .large-steps li:last-child { border-bottom: 0; }
  .report-banner { align-items: start; flex-direction: column; }
  .report-banner dl { width: 100%; }
}

@media (max-width: 680px) {
  .site-header, .page-shell, .content-shell, .site-footer { width: min(calc(100% - 24px), var(--content)); }
  .site-header { min-height: 56px; }
  .brand small { display: none; }
  .diagnostic-intro { padding: 14px 0 10px; }
  .diagnostic-intro .eyebrow { font-size: 10px; }
  h1 { max-width: none; margin-top: 4px; font-size: clamp(31px, 9.2vw, 38px); line-height: 1.02; }
  .lede { margin-top: 7px; font-size: 15px; line-height: 1.35; }
  .trust-line { display: none; }
  .workbench { border-radius: 13px; }
  .workbench form { padding: 12px; }
  .workbench-guide, .collector-form, .collector-checklist { padding: 20px 16px; }
  .field-head { display: flex; align-items: center; gap: 10px; }
  .field-head p {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .text-action { flex: 0 0 auto; margin-top: 0; }
  #evidence { min-height: 110px; margin-top: 7px; padding: 11px 12px; font-size: 12px; line-height: 1.45; }
  .field-meta { align-items: center; }
  .category-group { margin-top: 8px; }
  .category-group legend { margin-bottom: 4px; font-size: 15px; }
  .choices {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 1px 1px 4px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  .choice { flex: 0 0 auto; }
  .choice span { width: auto; justify-content: center; padding: 8px 11px; white-space: nowrap; }
  .choice:last-child { grid-column: auto; }
  .context-panel summary { align-items: flex-start; flex-direction: column; justify-content: center; gap: 2px; }
  .context-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .primary-actions { margin-top: 9px; flex-direction: column; }
  .primary-button, .secondary-button { width: 100%; }
  .result-empty { min-height: 240px; }
  .empty-chain { flex-wrap: wrap; }
  .diagnosis-header { flex-direction: column; }
  .result-badges { justify-content: flex-start; }
  .why-block { grid-template-columns: 1fr; gap: 7px; }
  .chain-list { grid-template-columns: 1fr; }
  .chain-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .chain-item:last-child { border-bottom: 0; }
  .cause-grid { grid-template-columns: 1fr; }
  .cause-grid section + section { border-top: 1px solid var(--line); border-left: 0; }
  .verify-block, .save-block, .delete-panel { align-items: stretch; flex-direction: column; }
  .verify-block .copy-button, .save-block .secondary-button, .delete-panel .danger-button { width: 100%; }
  .evidence-grid, .evidence-meta { grid-template-columns: 1fr; }
  .method-grid, .related-links, .split-content { grid-template-columns: 1fr; }
  .site-footer { min-height: 220px; align-items: flex-start; flex-direction: column; justify-content: center; }
  .site-footer nav { justify-content: flex-start; }
  .content-hero { padding-top: 46px; }
  .collector-form .context-grid { grid-template-columns: 1fr; }
  .report-banner dl div { grid-template-columns: 60px minmax(0, 1fr); }
  .delete-panel { display: flex; }
  .redaction-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
}

@media (max-width: 390px) {
  .field-meta { align-items: center; flex-direction: row; gap: 8px; }
  .redaction-counts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
  body { background: white; color: black; }
  body::before, .site-header, .site-footer, .skip-link, .outcome-panel, .delete-panel, .copy-button, .save-block { display: none !important; }
  .page-shell { width: 100%; }
  .diagnosis-card { margin: 0; border: 0; box-shadow: none; }
  .private-notice { border: 1px solid #777; background: white; }
  .chain-list { break-inside: avoid; }
  .diagnosis-card section { break-inside: avoid; }
}
