:root {
  --ink: #18211d;
  --muted: #67736c;
  --paper: #f5f3ed;
  --card: #fffef9;
  --line: #d8ddd7;
  --green: #235d46;
  --green-2: #dbe9df;
  --gold: #d6a73d;
  --gold-2: #f5e8bf;
  --red: #a8473a;
  --blue: #3e6b8d;
  --shadow: 0 18px 48px rgba(25, 45, 36, .10);
  font-family: "Raleway", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; color: var(--ink); background: var(--paper); }
html.pilot-checking body > header, html.pilot-checking body > main,
html.pilot-locked body > header, html.pilot-locked body > main { display: none; }
.pilot-gate { min-height: 100vh; padding: 32px 18px; display: grid; place-items: center; background: #f4f4f2; }
.pilot-auth-card { width: min(100%,460px); padding: 36px; border: 1px solid #d9d9d9; border-radius: 10px; background: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.08); }
.pilot-auth-card > img { display: block; width: 210px; max-width: 70%; margin-bottom: 32px; }
.pilot-auth-card h1 { margin: 0 0 12px; color: #000; font: 700 34px/1.08 Arial,sans-serif; letter-spacing: -.03em; }
.pilot-auth-card > p { color: #666; line-height: 1.5; }
.pilot-auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 26px 0 18px; border-bottom: 1px solid #d9d9d9; }
.pilot-auth-tabs button { padding: 11px 7px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: #777; font-size: 12px; font-weight: 700; }
.pilot-auth-tabs button.active { border-color: #000; color: #000; }
.pilot-auth-form { display: grid; gap: 14px; }
.pilot-auth-form label { display: grid; gap: 6px; color: #333; font-size: 12px; font-weight: 700; }
.pilot-auth-form input { width: 100%; padding: 12px; border: 1px solid #bbb; border-radius: 6px; background: #fff; }
.pilot-auth-form .primary { margin-top: 5px; padding: 13px 18px; }
.pilot-auth-message { min-height: 22px; margin: 16px 0 0; font-size: 12px; }
.pilot-auth-message.error { color: var(--red); }
.pilot-user { display: flex; align-items: center; gap: 8px; color: #555; font-size: 12px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(214,167,61,.45); outline-offset: 2px; }
.topbar { position: sticky; top: 0; z-index: 20; height: 74px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; background: rgba(255,254,249,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 148px; height: 42px; display: grid; place-items: center; }
.brand-mark img { display: block; width: 148px; max-height: 42px; object-fit: contain; }
.brand span:last-child { display: none; }
.brand small { color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.ghost, .small-button, .help-actions button { border: 1px solid var(--line); border-radius: 9px; background: var(--card); padding: 9px 13px; color: var(--ink); }
.ghost:hover, .small-button:hover, .help-actions button:hover { border-color: var(--green); color: var(--green); }
.export-menu { position: absolute; right: 34px; top: 62px; display: grid; padding: 8px; min-width: 210px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.export-menu button, .export-menu a { border: 0; background: transparent; color: inherit; text-align: left; text-decoration: none; padding: 10px; border-radius: 7px; }
.export-menu button:hover, .export-menu a:hover { background: var(--green-2); }
.welcome { min-height: calc(100vh - 74px); padding: 64px clamp(24px, 6vw, 96px) 80px; background: #fff; color: #000; font-family: "Halo", "Raleway", Arial, sans-serif; }
.welcome-hero { display: grid; grid-template-columns: minmax(0,1.04fr) minmax(360px,.96fr); gap: clamp(44px,7vw,108px); align-items: center; max-width: 1280px; margin: 0 auto 76px; }
.welcome-copy { max-width: 650px; }
.welcome-logo { display: block; width: min(260px,66vw); max-height: 86px; margin-bottom: 44px; object-fit: contain; object-position: left center; }
.welcome-kicker { display: block; margin-bottom: 15px; color: #777; font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.welcome h1 { margin: 0 0 24px; max-width: 630px; color: #000; font-family: inherit; font-size: clamp(40px,5vw,68px); font-weight: 700; line-height: 1.02; letter-spacing: -.045em; }
.welcome-copy p { max-width: 600px; margin: 0; color: #5d5d5d; font-size: clamp(17px,1.5vw,20px); line-height: 1.62; }
.welcome-primary { display: inline-flex; align-items: center; gap: 20px; margin-top: 34px; padding: 16px 22px; border: 2px solid #000; border-radius: 4px; background: #000; color: #fff; font-weight: 700; transition: background .18s ease,color .18s ease,transform .18s ease; }
.welcome-primary:hover { background: #fff; color: #000; transform: translateY(-2px); }
.fishbone-intro { color: #000; }
.fishbone-intro svg { display: block; width: 100%; height: auto; }
.fishbone-labels { fill: #000; font-size: 17px; font-weight: 700; }
.fishbone-problem { fill: #fff; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.welcome-modes { max-width: 1280px; margin: 0 auto; padding-top: 56px; border-top: 1px solid #d9d9d9; }
.welcome-section-title { margin-bottom: 24px; }
.welcome-section-title h2,.saved-heading h2 { margin: 0; color: #000; font-family: inherit; font-size: 30px; font-weight: 700; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.mode-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.mode-card { min-height: 210px; padding: 24px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid #d9d9d9; border-radius: 6px; background: #fff; color: #000; text-align: left; }
.mode-card.featured { background: #000; color: #fff; border-color: #000; }
.mode-number { color: #777; font-size: 12px; font-weight: 800; }
.mode-card.featured .mode-number { color: #d9d9d9; }
.mode-card strong { margin: 26px 0 10px; font-size: 22px; font-weight: 700; line-height: 1.15; }
.mode-card > span:nth-child(3) { color: #707070; line-height: 1.5; }
.mode-card.featured > span:nth-child(3) { color: #d9d9d9; }
.mode-card em { margin-top: auto; padding-top: 24px; color: #777; font-style: normal; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.mode-card.featured em { color: #fff; }
.saved-analyses { max-width: 1280px; margin: 42px auto 0; padding: 24px; border: 1px solid #d9d9d9; border-radius: 6px; background: #f7f7f7; }
.saved-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.local-only { color: #777; font-size: 11px; }
.saved-list { display: grid; gap: 9px; }
.saved-analysis { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid #d9d9d9; border-radius: 4px; background: white; }
.saved-analysis strong,.saved-analysis span { display: block; }
.saved-analysis strong { color: #171714; }
.saved-analysis span { margin-top: 4px; color: #74716a; font-size: 11px; }
.saved-analysis button { border: 1px solid #000; border-radius: 4px; background: #000; color: #fff; padding: 9px 13px; font-weight: 800; }
.saved-empty { padding: 20px; border: 1px dashed #cbc9c0; border-radius: 10px; color: #77736b; text-align: center; font-size: 13px; }
.workspace { display: grid; grid-template-columns: 265px minmax(0, 1fr); min-height: calc(100vh - 74px); }
.steps-panel { position: sticky; top: 74px; height: calc(100vh - 74px); padding: 30px 22px; background: #eef0eb; border-right: 1px solid var(--line); overflow-y: auto; }
.back-link { margin-bottom: 28px; padding: 0; border: 0; background: none; color: var(--green); font-weight: 700; }
.panel-label { margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#stepsNav { display: grid; gap: 5px; }
.step-button { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; width: 100%; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); text-align: left; font-size: 12px; line-height: 1.3; }
.step-button span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid #bac2bc; border-radius: 50%; font-size: 10px; }
.step-button.active { background: var(--card); color: var(--ink); box-shadow: 0 5px 14px rgba(34,58,46,.08); }
.step-button.active span { background: var(--green); border-color: var(--green); color: white; }
.save-state { margin-top: 28px; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }
.save-dot { width: 8px; height: 8px; border-radius: 50%; background: #9aa69f; }
.save-dot.saved { background: #3c8f62; }
.analysis-panel { padding: 42px clamp(22px, 4vw, 62px) 56px; min-width: 0; }
.step-counter { margin: 0 0 5px; color: var(--gold); font-size: 12px; font-weight: 800; }
.stage-guide-heading { margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.stage-guide-heading h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -.025em; }
.stage-guide-heading p:last-child { max-width: 780px; margin-bottom: 0; color: var(--muted); line-height: 1.55; }
.help-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.help-actions button { font-size: 12px; white-space: nowrap; }
.source-warning { max-width: 1280px; margin: 0 auto 20px; padding: 15px 18px; display: grid; gap: 3px; border: 1px solid #e1c879; border-radius: 12px; background: #fff8db; color: #6c551d; font-size: 13px; }
.context-card, .diagram-card, .editor-card, .why-card, .selected-panel { max-width: 1280px; margin: 0 auto 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 10px 30px rgba(31,53,42,.05); }
.context-card { padding: 20px; }
.step-help { margin-top: 18px; padding-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--line); }
.step-help > span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.context-card label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.context-card input, .context-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 12px; color: var(--ink); }
.context-card textarea { min-height: 86px; resize: vertical; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.field-block + .field-block { margin-top: 14px; }
.participant-setup { margin-top: 14px; }
.instruction-only { max-width: 840px; padding: 14px 16px; border-left: 4px solid var(--gold); background: #fffaf0; }
.instruction-only p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
.diagram-card { padding: 20px; overflow: hidden; }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.section-heading h3 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.diagram-tools { display: grid; justify-items: end; gap: 7px; }
.view-switch { display: flex; gap: 3px; padding: 3px; border-radius: 10px; background: #e9eeea; }
.view-switch button { border: 0; border-radius: 7px; background: transparent; padding: 7px 10px; color: var(--muted); font-size: 11px; font-weight: 700; }
.view-switch button.active { background: white; color: var(--green); box-shadow: 0 1px 4px #1f3d2d1c; }
.zoom-controls { display: flex; align-items: center; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8f5; }
.zoom-controls button { min-width: 31px; height: 29px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font-weight: 800; }
.zoom-controls button:disabled { opacity: .4; cursor: default; }
.zoom-controls #zoomFit, .zoom-controls #zoomOverview { min-width: auto; padding: 0 9px; font-size: 10px; }
.zoom-controls span { min-width: 42px; color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; }
.zoom-note { color: var(--muted); font-size: 10px; }
.diagram-scroll { width: 100%; overflow-x: auto; margin-top: 8px; }
#fishbone { display: block; width: 100%; min-width: 0; max-width: none; height: auto; transform-origin: top left; }
.cause-register { margin-top: 18px; padding: 4px 0 8px; }
.register-empty { padding: 30px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); text-align: center; }
.register-category { margin: 0 0 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfa; }
.register-category h4 { margin: 0 0 12px; color: var(--green); font-family: Georgia, serif; font-size: 20px; }
.register-list { margin: 0; padding: 0; list-style: none; }
.register-item { position: relative; margin: 7px 0; padding-left: calc(var(--depth, 0) * 22px); }
.register-row { display: flex; gap: 9px; align-items: flex-start; min-width: 0; }
.register-number { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 800; line-height: 1.65; }
.register-text { min-width: 0; color: var(--ink); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.register-item.disregarded .register-text { color: #777d79; text-decoration: line-through 2px #a8473a; }
.register-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; vertical-align: middle; }
.register-badge { border-radius: 999px; padding: 2px 6px; font-size: 9px; font-weight: 800; text-decoration: none; }
.register-badge.disregarded { background: #eceeed; color: #666d69; }
.register-badge.likely { background: #e4eef4; color: #365e77; }
.register-badge.fundamental { background: #fff0ba; color: #765816; }
.diagram-step-note { min-height: 30px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.5; }
.selected-panel { padding: 20px; }
.selected-panel h3 { margin: 0; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.selected-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 10px; }
.selected-card { padding: 14px; border: 1px solid #b9cbd4; border-radius: 11px; background: #f5f9fb; }
.selected-card.fundamental { border-color: #d6a73d; background: #fff8df; }
.selected-card strong { display: block; margin-bottom: 6px; }
.selected-card p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.selected-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.selected-card-actions button { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: 8px 10px; font-size: 11px; }
.selected-card-actions button.on { background: var(--gold-2); border-color: #d6a73d; color: #5f4714; font-weight: 800; }
.editor-grid { width: 100%; min-width: 0; max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: minmax(280px, .78fr) minmax(360px, 1.22fr); gap: 20px; }
.editor-card { min-width: 0; max-width: 100%; margin: 0; padding: 20px; }
.small-button { padding: 8px 10px; font-size: 12px; }
.category-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.category-unit { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: white; overflow: hidden; }
.category-chip { border: 1px solid var(--line); border-radius: 999px; background: white; padding: 7px 11px; color: var(--muted); font-size: 12px; }
.category-unit .category-chip { border: 0; border-radius: 0; }
.category-chip.active { background: var(--green); color: white; border-color: var(--green); }
.category-tools { display: flex; border-left: 1px solid var(--line); }
.category-tools button { width: 28px; height: 30px; border: 0; background: #f6f7f3; color: var(--muted); font-size: 11px; }
.category-tools button:hover { background: var(--gold-2); color: var(--ink); }
.inline-form label { display: block; margin-bottom: 7px; font-size: 12px; color: var(--muted); }
.inline-form > div { display: flex; gap: 7px; }
.inline-form input, dialog input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 11px; }
.inline-form button, .primary { border: 0; border-radius: 9px; background: var(--green); color: white; padding: 11px 16px; font-weight: 800; }
.causes-list { display: grid; gap: 10px; margin-top: 15px; max-height: 420px; overflow-y: auto; }
.empty-state { padding: 28px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 13px; }
.cause-item { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: white; }
.cause-item.disregarded { opacity: .72; background: #f2eeea; }
.cause-item.disregarded .cause-text, .subcause-node.disregarded > .subcause-head > span:first-child { text-decoration: line-through 2px var(--red); }
.cause-item.selected-likely { border-color: #7ea3bc; background: #f4f8fb; }
.cause-line { display: flex; gap: 9px; justify-content: space-between; align-items: flex-start; }
.cause-text { font-weight: 700; font-size: 13px; }
.cause-meta { margin-top: 4px; color: var(--muted); font-size: 10px; }
.cause-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.cause-actions button, .cause-actions select { border: 1px solid var(--line); border-radius: 7px; background: #fafaf7; padding: 6px 7px; color: var(--muted); font-size: 10px; }
.cause-actions button.on { background: var(--green-2); border-color: #9ebca9; color: var(--green); font-weight: 800; }
.cause-actions button.action-on { background: var(--gold-2); border-color: #dfc267; color: #6c5116; }
.cause-actions button.disregard-on { background: #f2ded9; border-color: #cc8e82; color: #7e3026; font-weight: 800; }
.cause-actions button.likely-on { background: #dceaf3; border-color: #7ea3bc; color: #315c78; font-weight: 800; }
.subcauses { margin: 10px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--green-2); color: var(--muted); font-size: 11px; }
.subcause-node { margin: 8px 0; }
.subcause-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.subcause-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.subcause-actions button { border: 0; border-radius: 5px; background: #f0f2ed; color: var(--muted); padding: 4px 6px; font-size: 9px; }
.inline-child-editor { margin-top: 10px; padding: 10px; display: grid; gap: 8px; border: 1px solid #b7ccbe; border-radius: 9px; background: #f2f8f4; }
.inline-child-editor label { font-size: 10px; font-weight: 800; color: var(--green); }
.inline-child-editor input { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 9px; }
.inline-child-editor div { display: flex; gap: 6px; justify-content: flex-end; }
.inline-child-editor button { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: white; font-size: 10px; }
.inline-child-editor button.save-child { background: var(--green); border-color: var(--green); color: white; }
.why-card { padding: 20px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: white; font-size: 20px; }
.why-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; margin-top: 11px; }
.why-number { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--green-2); color: var(--green); font-weight: 800; font-size: 12px; }
.why-row input { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 10px; }
.why-row label { display: flex; gap: 6px; align-items: center; font-size: 10px; color: var(--muted); }
.why-row.needs-review { border-radius: 10px; outline: 1px solid #d6a73d; background: #fffaf0; }
.why-row label em { display: inline-block; margin-left: 6px; border-radius: 999px; background: #fff0ba; padding: 2px 6px; color: #765816; font-size: 9px; font-style: normal; font-weight: 800; }
.why-sequence-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.why-stop { margin-top: 14px; }
.workspace-footer { max-width: 1280px; margin: 24px auto 0; display: flex; justify-content: space-between; }
.application-intro { max-width: 920px; margin: 0 auto 22px; padding: clamp(22px,3vw,34px); border: 1px solid #c7d5cb; border-radius: 17px; background: linear-gradient(145deg,#fff 0%,#f1f6f1 100%); box-shadow: var(--shadow); }
.application-intro h2 { margin: 6px 0 14px; font-family: Georgia,serif; font-size: clamp(27px,3.5vw,40px); font-weight: 500; line-height: 1.12; }
.application-intro p { max-width: 760px; margin: 8px 0; color: var(--muted); line-height: 1.65; }
.application-intro strong { display: block; margin-top: 16px; color: var(--green); line-height: 1.5; }
.application-intro-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
.simulation-guide { max-width: 1080px; margin: 0 auto 22px; padding: clamp(22px,3vw,34px); border: 1px solid #c8d5cc; border-radius: 17px; background: linear-gradient(145deg,#fff 0%,#eef5ef 100%); box-shadow: var(--shadow); }
.simulation-guide h2 { margin: 6px 0 14px; font-family: Georgia,serif; font-size: clamp(28px,3.4vw,40px); font-weight: 500; }
.simulation-guide h3 { margin: 22px 0 8px; color: var(--green); }
.simulation-guide p { max-width: 900px; color: var(--muted); line-height: 1.65; }
.simulation-concepts { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.simulation-concepts div,.simulation-map article { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.simulation-concepts strong,.simulation-map strong { display: block; margin-bottom: 5px; color: var(--green); }
.simulation-rule { padding: 14px 16px; border-left: 4px solid #b98b27; background: #fff8df; color: #5f4818; font-weight: 800; }
.simulation-map { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin: 16px 0; }
.simulation-map article.active { border-color: var(--green); background: var(--green-2); }
.simulation-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.simulation-guide.compact { padding: 17px 20px; }
.simulation-guide.compact h2 { font-size: 23px; }
body.simulation-active .brainstorm-form,body.simulation-active .brainstorm-actions,body.simulation-active .organize-actions,body.simulation-active .cause-actions,body.simulation-active .selected-card-actions,body.simulation-active .why-stop,body.simulation-active #addCategoryBtn { display: none !important; }
.secondary { border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--ink); padding: 11px 16px; font-weight: 700; }
dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100vh - 30px); overflow: auto; border: 0; border-radius: 17px; padding: 0; box-shadow: 0 28px 80px rgba(20,39,30,.28); }
dialog::backdrop { background: rgba(15,29,23,.55); backdrop-filter: blur(3px); }
.dialog-shell { padding: 24px; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.dialog-header h3 { margin: 0; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.dialog-shell > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.dialog-shell > input { width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.field-help, #dialogContent { color: var(--muted); font-size: 13px; line-height: 1.65; }
.dialog-shell select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px; background: white; }
.danger { border: 0; border-radius: 9px; background: var(--red); color: white; padding: 11px 16px; font-weight: 800; }
.ai-sim { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f7f8f5; }
.ai-sim strong { color: var(--green); }
.ai-status { margin-bottom: 12px; padding: 10px 12px; border-radius: 9px; background: #fff8db; color: #6c551d; font-size: 12px; }
.ai-question { display: grid; gap: 8px; }
.ai-question textarea { width: 100%; min-height: 90px; border: 1px solid var(--line); border-radius: 9px; padding: 10px; resize: vertical; }
.ai-question button { justify-self: end; }
.ai-answer { margin-top: 12px; padding: 12px; border-radius: 9px; background: var(--green-2); color: var(--ink); white-space: pre-wrap; }
.evaluation-dialog-shell { max-width: 720px; }
.evaluation-status { margin-bottom: 12px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.evaluation-answer { padding: 16px; border: 1px solid var(--line); border-radius: 11px; background: #f7f8f5; color: var(--ink); line-height: 1.65; white-space: pre-wrap; }
.evaluation-answer.is-empty { color: var(--muted); }
.final-review-dialog-shell { max-width: 760px; }
.final-review-sections { display: grid; gap: 12px; }
.final-review-sections[hidden] { display: none; }
.final-review-sections section { padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: #f7f8f5; }
.final-review-sections section:nth-child(2) { background: #fffaf0; border-color: #e5d5aa; }
.final-review-sections h4 { margin: 0 0 8px; color: var(--green); font-family: Georgia,serif; font-size: 20px; font-weight: 500; }
.final-review-sections section:nth-child(2) h4 { color: #765816; }
.final-review-sections section div { color: var(--ink); line-height: 1.65; white-space: pre-wrap; }
#finalReviewMessage[hidden] { display: none; }
.ai-chat { display: grid; gap: 9px; max-height: 300px; margin: 12px 0; padding-right: 4px; overflow-y: auto; }
.ai-message { max-width: 88%; padding: 10px 12px; border-radius: 11px; color: var(--ink); white-space: pre-wrap; line-height: 1.5; }
.ai-message.user { justify-self: end; background: #e5edf3; }
.ai-message.assistant { justify-self: start; background: var(--green-2); }
.ai-message small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.ai-empty { padding: 18px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); text-align: center; font-size: 12px; }
.ai-note { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.lesson-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.lesson-tabs button { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 8px 10px; color: var(--ink); font-size: 11px; }
.lesson-tabs button.active { border-color: var(--green); background: var(--green-2); color: var(--green); font-weight: 800; }
.lesson-dialog { width: min(860px,calc(100vw - 30px)); }
.lesson-dialog .dialog-header { position: sticky; top: -24px; z-index: 2; margin-inline: -24px; padding: 20px 24px 14px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.lesson-dialog .dialog-header .icon-button { flex: 0 0 auto; border-color: var(--green); color: var(--green); font-weight: 800; }
.lesson-return-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #142018; }
.video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tutor-answer, .tutor-transcript { white-space: pre-wrap; overflow-wrap: anywhere; }
.tutor-transcript { font: inherit; max-height: 16rem; overflow: auto; }
.tutor-source-title { margin-top: .5rem; font-weight: 600; }
.tutor-source-detail { margin-top: .4rem; }
.video-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; color: var(--muted); font-size: 11px; }
.video-meta a { color: var(--green); font-weight: 700; }
.mode-card.unavailable { cursor: default; opacity: .68; filter: saturate(.55); }
.mode-card.unavailable:hover { transform: none; box-shadow: none; }
.brainstorm-card,.organize-toolbar,.removed-panel { max-width: 1280px; margin: 18px auto 0; padding: 22px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 8px 25px rgba(32,63,49,.05); }
.brainstorm-heading h3,.organize-toolbar h3,.removed-panel h3 { margin: 4px 0 8px; font-family: Georgia,serif; font-size: 25px; font-weight: 500; }
.brainstorm-heading p { margin: 0; color: var(--muted); line-height: 1.6; }
.brainstorm-form { margin-top: 18px; padding: 16px; border-radius: 12px; background: #f4f7f2; }
.brainstorm-form label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 800; }
.brainstorm-form > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: stretch; }
.brainstorm-form textarea,.dialog-shell textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px; resize: vertical; font: inherit; }
.brainstorm-list { display: grid; gap: 8px; margin-top: 16px; }
.brainstorm-item { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.brainstorm-number { color: var(--green); font-weight: 900; }
.brainstorm-text { white-space: pre-wrap; line-height: 1.45; }
.brainstorm-item button,.organize-row button,.removed-item button { border: 1px solid var(--line); border-radius: 7px; background: #fafaf7; padding: 7px 9px; color: var(--muted); font-size: 11px; }
.brainstorm-actions { display: flex; gap: 6px; align-items: center; }
.brainstorm-actions .exclude { color: var(--red); }
.brainstorm-edit { grid-column: 2 / -1; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 7px; }
.brainstorm-edit textarea { width: 100%; min-height: 60px; border: 1px solid var(--line); border-radius: 8px; padding: 9px; resize: vertical; }
.brainstorm-footer { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-top: 18px; color: var(--muted); font-size: 11px; }
.organize-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.organize-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.organize-row { display: grid; grid-template-columns: auto minmax(180px,1fr) minmax(140px,.55fr) minmax(170px,.7fr) auto; gap: 8px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.organize-row .cause-text { min-width: 0; overflow-wrap: anywhere; }
.organize-row select { min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 8px; background: #fafaf7; }
.organize-row .row-actions { display: flex; gap: 5px; }
.organize-row .row-actions .retire { color: var(--red); }
.organize-note { grid-column: 2 / -1; color: var(--muted); font-size: 10px; }
.removed-panel { border-color: #d6c9b8; background: #fffdf8; }
.removed-list { display: grid; gap: 8px; }
.removed-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px; border: 1px solid #e3d8c9; border-radius: 9px; background: white; }
.removed-item small { display: block; margin-top: 4px; color: var(--muted); }
.ai-usage { margin-top: 6px; font-size: 10px; }
.tutor-home { min-height: calc(100vh - 74px); padding: 0; background: #f3f4f0; color: var(--ink); font-family: "Raleway", Arial, sans-serif; }
.tutor-shell { min-height: calc(100vh - 74px); display: grid; grid-template-columns: 290px minmax(0,1fr); }
.tutor-rail { min-width: 0; padding: 28px 20px; display: flex; flex-direction: column; gap: 22px; background: #e9ece6; border-right: 1px solid #d2d8d1; }
.tutor-brand-block img { display: block; width: 180px; max-width: 100%; }
.tutor-brand-block span { display: block; margin-top: 10px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tutor-new { width: 100%; padding: 12px 14px; border: 1px solid var(--green); border-radius: 9px; background: var(--green); color: white; font-weight: 800; text-align: left; }
.tutor-rail-section { min-height: 0; }
.tutor-rail-section h2 { margin: 0 0 9px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.tutor-history { display: grid; gap: 6px; max-height: 38vh; overflow-y: auto; }
.tutor-history button { min-width: 0; padding: 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; }
.tutor-history button:hover,.tutor-history button.active { border-color: #c6d2c9; background: #fff; }
.tutor-history strong,.tutor-history span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tutor-history strong { font-size: 12px; }
.tutor-history span,.tutor-history-empty { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.tutor-analyses { margin-top: auto; border-top: 1px solid #ccd3cc; padding-top: 16px; }
.tutor-analyses summary { cursor: pointer; color: var(--green); font-size: 12px; font-weight: 800; }
.tutor-analyses .local-only { display: block; margin: 8px 0; }
.tutor-analyses .saved-analysis { grid-template-columns: 1fr; padding: 10px; gap: 8px; }
.tutor-analyses .saved-analysis button { width: 100%; }
.tutor-analyses .saved-heading { display: none; }
.tutor-main { width: min(100%,980px); min-width: 0; min-height: calc(100vh - 74px); margin: 0 auto; padding: 34px clamp(20px,4vw,56px) 24px; display: grid; grid-template-rows: auto minmax(280px,1fr) auto auto auto; gap: 15px; }
.tutor-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.tutor-heading .welcome-kicker { margin-bottom: 7px; color: var(--green); }
.tutor-heading h1 { margin: 0; font-family: "Raleway",Arial,sans-serif; font-size: clamp(30px,4vw,48px); line-height: 1; letter-spacing: -.035em; }
.tutor-messages { min-height: 300px; max-height: calc(100vh - 390px); padding: 8px 5px 18px; display: flex; flex-direction: column; gap: 13px; overflow-y: auto; scroll-behavior: smooth; }
.tutor-message { width: fit-content; max-width: min(78%,720px); padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 5px 16px rgba(26,48,38,.05); white-space: pre-wrap; line-height: 1.62; font-size: 14px; }
.tutor-message.user { align-self: flex-end; border-color: #cbd9e0; border-bottom-right-radius: 5px; background: #eaf1f4; }
.tutor-message.assistant { align-self: flex-start; border-bottom-left-radius: 5px; }
.tutor-speaker { display: block; margin-bottom: 5px; color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.tutor-message.user .tutor-speaker { color: #456b7d; }
.tutor-message-action { margin-top: 12px; padding: 9px 12px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: white; font-size: 12px; font-weight: 800; }
.tutor-sources { margin-top: 10px; color: var(--muted); font-size: 10px; white-space: normal; }
.tutor-sources summary { cursor: pointer; font-weight: 800; }
.tutor-sources div { margin-top: 5px; }
.tutor-lesson { padding: 17px; border: 1px solid #c9d5cd; border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.tutor-lesson-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.tutor-lesson-heading h2 { margin: 0; font-size: 20px; }
.tutor-starters { display: flex; gap: 8px; flex-wrap: wrap; }
.tutor-starters button,.tutor-print-form { padding: 9px 12px; border: 1px solid #cbd3cd; border-radius: 999px; background: #fff; color: var(--green); font-size: 12px; font-weight: 700; text-decoration: none; }
.tutor-starters button:hover,.tutor-print-form:hover { border-color: var(--green); background: var(--green-2); }
.lesson-choice { display: grid; gap: 10px; margin-top: 12px; }
.lesson-choice > strong { color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.lesson-topic-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.lesson-topic-list button { padding: 10px; border: 1px solid #cbd3cd; border-radius: 9px; background: #fff; color: var(--green); text-align: left; font-weight: 700; }
.lesson-topic-list small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }
.secondary-action { background: #fff !important; color: var(--green) !important; }
.tutor-composer { position: sticky; bottom: 0; padding: 12px; border: 1px solid #c7d0ca; border-radius: 14px; background: rgba(255,255,255,.97); box-shadow: 0 12px 35px rgba(27,50,40,.12); backdrop-filter: blur(10px); }
.tutor-composer label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tutor-composer > div { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 9px; align-items: end; }
.tutor-composer textarea { width: 100%; min-height: 58px; max-height: 160px; padding: 11px; border: 0; border-radius: 9px; background: #f4f6f2; color: var(--ink); resize: vertical; }
.tutor-composer p { margin: 7px 3px 0; color: var(--muted); font-size: 10px; }
.tutor-composer p.error { color: var(--red); }
body.tutor-active .analysis-only { display: none; }
body.analysis-active .tutor-only { display: none; }
@media (max-width: 980px) {
  .welcome-hero { grid-template-columns: 1fr; align-items: start; }
  .fishbone-intro { width: min(680px,100%); }
  .mode-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mode-card { min-height: 190px; }
  .workspace { grid-template-columns: 1fr; }
  .steps-panel { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  #stepsNav { display: flex; overflow-x: auto; }
  .step-button { min-width: 170px; }
  .save-state { margin-top: 12px; }
  .editor-grid { grid-template-columns: 1fr; }
  .organize-row { grid-template-columns: auto minmax(0,1fr); }
  .organize-row select,.organize-row .row-actions,.organize-note { grid-column: 2; }
  .tutor-shell { grid-template-columns: 230px minmax(0,1fr); }
  .tutor-main { padding-inline: 24px; }
}
@media (max-width: 700px) {
  .pilot-auth-card { padding: 26px 22px; }
  .pilot-auth-card h1 { font-size: 29px; }
  .pilot-auth-tabs { grid-template-columns: 1fr; }
  .pilot-user > span { display: none; }
  .topbar { height: auto; min-height: 68px; padding: 10px 12px; }
  .brand-mark,.brand-mark img { width: 112px; }
  .top-actions { gap: 4px; }
  .top-actions .ghost { padding: 8px 10px; }
  .welcome { padding: 42px 20px; }
  .tutor-home { padding: 0; }
  .welcome-hero { margin-bottom: 48px; gap: 36px; }
  .welcome-logo { margin-bottom: 24px; }
  .welcome h1 { font-size: clamp(38px,12vw,52px); }
  .mode-grid { grid-template-columns: 1fr; }
  .saved-heading,.saved-analysis { display: grid; grid-template-columns: 1fr; }
  .saved-analysis button { width: 100%; }
  .analysis-panel { padding: 28px 15px 44px; }
  .application-intro { margin-bottom: 16px; padding: 21px 18px; }
  .simulation-guide { padding: 20px 17px; }
  .simulation-concepts,.simulation-map { grid-template-columns: 1fr; }
  .simulation-actions,.simulation-actions button { width: 100%; }
  .application-intro-actions,.application-intro-actions button,.lesson-return-actions,.lesson-return-actions button { width: 100%; }
  .lesson-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); }
  .lesson-dialog .dialog-shell { padding: 16px; }
  .lesson-dialog .dialog-header { top: -16px; margin-inline: -16px; padding: 15px 16px 12px; }
  .lesson-dialog .dialog-header h3 { font-size: 23px; }
  .lesson-dialog .video-meta { display: grid; gap: 6px; }
  .help-actions { justify-content: flex-start; margin-top: 18px; }
  .step-help { display: block; }
  .step-help .help-actions { margin-top: 10px; }
  .field-grid, .field-grid.three { grid-template-columns: 1fr; }
  .diagram-tools { justify-items: start; margin-top: 12px; }
  .zoom-controls, .view-switch { max-width: 100%; flex-wrap: wrap; }
  .section-heading { display: block; }
  .section-heading .small-button { margin-top: 12px; }
  .inline-form > div { display: grid; }
  .brainstorm-form > div { grid-template-columns: 1fr; }
  .brainstorm-footer,.organize-toolbar { display: grid; }
  .organize-actions { justify-content: stretch; }
  .organize-actions button { width: 100%; }
  .why-row { grid-template-columns: 34px 1fr; }
  .why-row label { grid-column: 2; }
  .workspace-footer { gap: 8px; }
  .workspace-footer button { flex: 1; }
  .tutor-shell { min-height: calc(100vh - 68px); display: block; }
  .tutor-rail { padding: 13px 14px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .tutor-brand-block img { width: 135px; }
  .tutor-brand-block span { margin-top: 5px; font-size: 9px; }
  .tutor-new { width: auto; align-self: center; }
  .tutor-rail-section,.tutor-analyses { display: none; }
  .tutor-main { min-height: calc(100vh - 156px); padding: 20px 12px 14px; grid-template-rows: auto minmax(280px,1fr) auto auto auto; gap: 11px; }
  .tutor-heading h1 { font-size: 30px; }
  .tutor-heading .welcome-kicker { font-size: 9px; }
  .tutor-heading .secondary { padding: 8px 10px; font-size: 10px; }
  .tutor-messages { min-height: 310px; max-height: none; padding-inline: 2px; }
  .tutor-message { max-width: 91%; padding: 12px 13px; font-size: 13px; }
  .tutor-starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .tutor-starters button,.tutor-print-form { min-width: 0; padding: 8px 7px; font-size: 10px; white-space: normal; text-align: center; }
  .lesson-topic-list { grid-template-columns: 1fr; }
  .tutor-composer { padding: 9px; bottom: 6px; }
  .tutor-composer > div { grid-template-columns: 1fr; }
  .tutor-composer button { width: 100%; }
  .tutor-lesson { padding: 12px; }
}
@media print {
  .topbar, .steps-panel, .context-card, .editor-grid, .why-card, .workspace-footer, .source-warning { display: none !important; }
  .workspace { display: block !important; }
  .analysis-panel { padding: 0; }
  .diagram-card { box-shadow: none; border: 0; }
  body { background: white; }
}
