/* One document scroll owner. Legacy overflow-x:hidden made the whole shell a
   scroll container, breaking sticky navigation and clipping mobile disclosures. */
.shell { overflow: visible; align-items: start; }
.main { min-height: 100dvh; }
.header-context, .user-menu { min-width: 0; }
.contour-page { --ct-line: var(--st-line, #35433d); --ct-accent: var(--st-accent, #cbb7f5); color: var(--st-text, #e4ebe5); }
#contour-root { scroll-margin-top: 90px; }
.contour-markdown :is(h2,h3,h4) { scroll-margin-top: 95px; }
.contour-page button, .contour-page input, .contour-page textarea, .contour-page select { font: inherit; }
.contour-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 6px 0 25px; }
.contour-heading h2 { margin: 15px 0; font-size: clamp(34px, 4vw, 56px); font-weight: 500; line-height: 1.08; letter-spacing: -.055em; }
.contour-heading h2 em { color: var(--ct-accent); font-family: Georgia, serif; font-weight: 400; }
.contour-heading p { color: #a2b2aa; font-size: 13px; line-height: 1.8; }
.contour-is-context .contour-heading h2 { font-size: 31px; line-height: 1.2; margin: 10px 0; }
.contour-is-context .contour-heading p { font-size: 12px; }
.contour-is-editing .contour-header-actions { display: none; }
.contour-header-actions, .contour-inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.contour-header-actions { justify-content: flex-end; max-width: 280px; }
.contour-scope { display: flex; flex-wrap: wrap; gap: 20px; padding: 13px 0; color: #91a59a; font-size: 10px; border-top: 1px solid var(--ct-line); }
.contour-tabs { display: flex; gap: 5px; flex-wrap: wrap; padding: 9px 0 18px; border-bottom: 1px solid var(--ct-line); }
.contour-tabs button { padding: 11px 16px; min-height: 42px; border: 1px solid transparent; border-radius: 9px; color: #a6b6ab; background: transparent; cursor: pointer; }
.contour-tabs [aria-pressed="true"] { color: var(--st-ink, #142218); background: var(--ct-accent); border-color: var(--ct-accent); }
#contour-status { min-height: 20px; font-size: 12px; color: var(--ct-accent); line-height: 1.8; }
#contour-status.is-error { color: #efafbd; }
.contour-page h3 { font-size: 23px; font-weight: 500; letter-spacing: -.035em; margin: 12px 0 15px; line-height: 1.35; }
.contour-page h4 { font-size: 14px; font-weight: 600; line-height: 1.6; }
.contour-muted, .contour-empty p { color: #a3b2a9; font-size: 12px; line-height: 1.85; }
.contour-launch-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin: 6px 0 24px; }
.contour-launch { text-align: left; border: 1px solid var(--ct-line); border-radius: 18px; padding: 24px; color: #deebe1; background: radial-gradient(ellipse at 0 0, var(--st-halo), transparent 70%), #151d19; display: flex; flex-direction: column; cursor: pointer; min-width: 0; }
.contour-launch > span { color: var(--ct-accent); font-size: 35px; margin-bottom: 27px; }
.contour-launch > strong { font-size: 22px; font-weight: 500; letter-spacing: -.04em; }
.contour-launch p { color: #9dad9f; line-height: 1.8; font-size: 12px; margin: 12px 0 24px; }
.contour-launch small { margin-top: auto; display: flex; justify-content: space-between; color: #b2c5b7; }
.contour-launch b { color: var(--ct-accent); font-weight: 400; }
.contour-launch:hover, .contour-node:hover, .contour-connectors button:hover { border-color: var(--ct-accent); }
.contour-two { display: grid; grid-template-columns: 1.3fr 1fr; align-items: start; gap: 20px; }
.contour-panel, .contour-document, .contour-editor { min-width: 0; border: 1px solid var(--ct-line); border-radius: 18px; background: #141b18; padding: 25px; }
.contour-panel > small, .contour-section-head small, .contour-document-head small { color: #91a49a; letter-spacing: .09em; font-size: 9px; line-height: 1.8; }
.contour-section-head { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.contour-section-head > span { color: var(--ct-accent); font: 11px ui-monospace, monospace; white-space: nowrap; }
.contour-starters { display: grid; gap: 13px; margin-top: 25px; }
.contour-starters article { padding: 17px; border: 1px solid #344138; border-radius: 12px; background: #1b241e; }
.contour-starters strong { font-weight: 500; font-size: 15px; }
.contour-starters p { color: #a2b4a7; font-size: 12px; line-height: 1.75; }
.contour-starters .button { font-size: 11px; }
.contour-recent { display: grid; grid-template-columns: 22px 1fr; gap: 6px 9px; width: 100%; padding: 15px 0; border: 0; border-bottom: 1px solid var(--ct-line); background: none; color: #d5e4d8; text-align: left; cursor: pointer; }
.contour-recent strong { font-size: 13px; line-height: 1.6; font-weight: 500; }
.contour-recent small { grid-column: 2; color: #8b9e91; font-size: 10px; }
.contour-recent > span { color: var(--ct-accent); }
.contour-library { display: grid; grid-template-columns: minmax(200px, .7fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.contour-index { min-width: 0; }
.contour-page label { display: grid; gap: 9px; font-size: 12px; color: #b9c9bf; }
.contour-index > label { margin-bottom: 17px; }
.contour-page select, .contour-page textarea, .contour-page input:not([type="checkbox"]) { width: 100%; padding: 11px 12px; border: 1px solid var(--ct-line); min-height: 44px; }
.contour-page textarea { resize: vertical; font: 13px/1.8 ui-monospace, Consolas, monospace; }
.contour-page select[multiple] { min-height: 115px; }
.contour-page .contour-check { display: flex; align-items: center; gap: 8px; min-height: 35px; }
.contour-page input[type="checkbox"] { width: 18px; height: 18px; min-width: 18px; margin: 0; }
.contour-record-list { display: grid; gap: 8px; max-height: 65vh; overflow-y: auto; padding: 3px; scrollbar-width: thin; }
.contour-list-row { display: grid; gap: 7px; width: 100%; text-align: left; border: 1px solid var(--ct-line); border-radius: 11px; padding: 16px; color: #bcd0c1; background: #151f18; cursor: pointer; }
.contour-list-row.is-selected { border-color: var(--ct-accent); background: var(--st-soft); }
.contour-list-row small { font-size: 9px; color: #97ad9e; }
.contour-list-row strong { font-size: 14px; line-height: 1.6; font-weight: 500; }
.contour-list-row > span { font-size: 11px; color: #9eafa4; line-height: 1.7; }
.contour-document-head { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 23px; border-bottom: 1px solid var(--ct-line); }
.contour-document-head > div { min-width: 0; }
.contour-document-head h3 { font-size: 28px; margin-bottom: 10px; }
.contour-document-head p { font-size: 13px; line-height: 1.8; color: #aabbb0; }
.contour-document-head .contour-inline-actions { align-items: flex-start; justify-content: flex-end; min-width: 130px; }
.contour-tags { display: flex; flex-wrap: wrap; gap: 9px; color: var(--ct-accent); font-size: 10px; }
.contour-markdown { color: #c0d1c4; font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.contour-markdown h2 { color: #e7efe8; font-size: 25px; font-weight: 500; margin: 27px 0 12px; line-height: 1.35; }
.contour-markdown h3 { font-size: 20px; margin-top: 24px; }
.contour-markdown h4 { font-size: 16px; margin-top: 20px; }
.contour-markdown p { margin: 12px 0; white-space: pre-wrap; }
.contour-markdown .contour-bullet { padding-left: 19px; position: relative; }
.contour-bullet::before { content: '•'; position: absolute; left: 2px; color: var(--ct-accent); }
.contour-markdown pre { background: #0d1510; padding: 16px; border: 1px solid var(--ct-line); border-radius: 10px; white-space: pre-wrap; }
.contour-markdown code { color: var(--ct-accent); background: #a4cdb00a; font: 12px/1.7 ui-monospace, monospace; }
.contour-toc { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 18px 0; border-bottom: 1px solid var(--ct-line); }
.contour-toc a { color: var(--ct-accent); text-decoration: none; font-size: 11px; }
.contour-relations { display: grid; gap: 8px; margin-top: 25px; padding: 18px; border: 1px dashed var(--ct-line); border-radius: 12px; background: #a3bfaf04; }
.contour-relations h4 { margin: 5px 0; }
.contour-relations button, .contour-dependencies button { border: 0; padding: 8px 0; background: transparent; color: var(--ct-accent); font-size: 12px; text-align: left; cursor: pointer; }
.contour-relations p { font-size: 11px; color: #98ac9d; line-height: 1.7; margin: 3px 0; }
.contour-document-footer { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--ct-line); color: #94a79a; font-size: 10px; }
.contour-document-footer > div { display: flex; flex-wrap: wrap; gap: 6px; }
.contour-document-footer .button { font-size: 10px; }
.contour-integration { padding: 20px; border: 1px solid #4d4962; border-radius: 13px; margin: 23px 0; background: #29253845; }
.contour-label { display: block; color: var(--ct-accent); font-size: 10px; letter-spacing: .05em; margin: 17px 0; }
.contour-integration p { font-size: 12px; line-height: 1.8; color: #adbbaF; }
.contour-dependencies { display: grid; gap: 7px; font-size: 11px; }
.contour-map-tools { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 0 0 22px; }
.contour-map-tools p { font-size: 12px; color: #a5b5a9; line-height: 1.8; }
.contour-map-tools label { min-width: 235px; max-width: 100%; }
.contour-graph { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 16px; padding: 7px 2px 26px; overflow-x: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.contour-layer { min-width: 0; display: flex; flex-direction: column; gap: 13px; }
.contour-layer > span { font-size: 9px; color: #99b4a1; margin-bottom: 7px; letter-spacing: .07em; }
.contour-node { display: grid; gap: 14px; width: 100%; text-align: left; padding: 23px; border: 1px solid var(--ct-line); border-radius: 15px; color: #d9e8dc; background: #19241d; cursor: pointer; }
.contour-node > small { color: #adbbc1; font-size: 10px; line-height: 1.6; }
.contour-node strong { font-size: 19px; font-weight: 500; letter-spacing: -.025em; }
.contour-node p { margin: 0; color: #a0b5a6; font-size: 12px; line-height: 1.8; }
.contour-node > span { color: #bdb0d9; font-size: 11px; line-height: 1.6; }
.contour-node b { color: #94b59e; font-size: 9px; font-weight: 500; }
.contour-node.is-affected { border-color: #ac7f94; background: #312329; }
.contour-node.is-affected b { color: #ecb2c4; }
.contour-simulation { padding: 15px; border: 1px solid #79556a; background: #b68c9e09; border-radius: 10px; color: #ddbdc9; font-size: 12px; line-height: 1.8; }
.contour-connectors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 23px; }
.contour-connectors button { display: grid; text-align: left; gap: 11px; padding: 20px; color: #d7e9da; background: #1b251e; border: 1px solid var(--ct-line); border-radius: 12px; cursor: pointer; }
.contour-connectors strong { font-size: 15px; font-weight: 500; }
.contour-connectors span { font-size: 11px; line-height: 1.7; color: #a6b8ac; }
.contour-connectors small { color: var(--ct-accent); font-size: 10px; }
.contour-empty { padding: 38px 25px; text-align: center; min-width: 0; }
.contour-empty-mark { font-size: 40px; color: var(--ct-accent); }
.contour-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 25px 0; }
.contour-wide { grid-column: 1/-1; }
.contour-writing { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.contour-writing > section { border: 1px solid var(--ct-line); border-radius: 12px; padding: 20px; min-height: 350px; min-width: 0; background: #101813; }
.contour-writing > section > small { color: #93a99a; letter-spacing: .08em; font-size: 9px; }
.contour-editor label > small, .contour-steps-field > small { font-size: 11px; color: #99ad9f; line-height: 1.8; }
.contour-steps-field { margin: 23px 0; }
.contour-editor > .contour-inline-actions { margin-top: 22px; }
.contour-history { margin-top: 20px; }
.contour-history details { padding: 14px 0; border-bottom: 1px solid var(--ct-line); }
.contour-history summary { font-size: 12px; cursor: pointer; line-height: 1.8; color: #c1cfcd; }
.contour-step-preview { padding-left: 26px; }
.contour-step-preview li { padding: 15px 10px; border-bottom: 1px solid var(--ct-line); line-height: 1.8; }
.contour-step-preview li strong { font-size: 14px; font-weight: 500; }
.contour-step-preview p { font-size: 12px; color: #9eb4a4; margin: 6px 0; }
.contour-step-preview small { display: inline-block; padding: 2px 8px; color: #c7b5e8; font-size: 9px; margin-left: 9px; }
.contour-runs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.contour-run-card { width: 100%; display: grid; text-align: left; padding: 20px; margin: 12px 0; gap: 11px; color: #d5e6d9; border: 1px solid var(--ct-line); border-radius: 13px; background: #1a251d; cursor: pointer; }
.contour-run-card span, .contour-run-card small { font-size: 10px; color: #9fb2a4; line-height: 1.7; }
.contour-run-card strong { font-weight: 500; font-size: 15px; }
.contour-page progress { display: block; width: 100%; height: 6px; accent-color: var(--ct-accent); border: 0; border-radius: 4px; overflow: hidden; }
.contour-page progress::-webkit-progress-bar { background: #33483a; }
.contour-page progress::-webkit-progress-value { background: var(--ct-accent); }
.contour-run-detail { max-width: 850px; margin: auto; }
.contour-run-detail > p:not(.contour-muted) { font-size: 12px; color: #bdd5c5; }
.contour-run-steps { display: grid; gap: 12px; margin: 28px 0; }
.contour-run-steps > label { display: flex; align-items: flex-start; padding: 21px; border: 1px solid var(--ct-line); border-radius: 13px; gap: 16px; cursor: pointer; }
.contour-run-steps input { margin-top: 3px!important; }
.contour-run-steps small { display: block; color: #9cb1a2; font-size: 9px; margin-bottom: 10px; line-height: 1.7; }
.contour-run-steps strong { display: block; color: #d1e1d7; font-size: 16px; line-height: 1.7; font-weight: 500; }
.contour-run-steps p { font-size: 12px; line-height: 1.85; color: #9cb4a4; margin-bottom: 0; }
.contour-run-steps .is-done { background: var(--st-soft); }
.contour-run-steps .is-done strong { color: var(--ct-accent); }
.contour-foot { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--ct-line); color: #8ba091; font-size: 11px; line-height: 1.9; }
.contour-template-dialog { width: min(600px, calc(100% - 32px)); padding: 25px; }
.contour-template-dialog p, .contour-template-dialog li { font-size: 13px; line-height: 1.9; color: #b4c5b8; }
.contour-template-dialog label { display: grid; gap: 9px; font-size: 12px; line-height: 1.8; color: #b4c5b8; }
#contour-project-error { color: #efafbd; font-size: 12px; }
#contour-template-error { color: #efafbd; }
.contour-entry { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 27px; margin-top: 25px; border: 1px solid #505063; border-radius: 19px; background: radial-gradient(ellipse at 90% 0, #bca6f411, transparent 70%), #181c1b; }
.contour-entry h3 { color: #e2e6e7; margin: 9px 0; font-size: 25px; font-weight: 500; letter-spacing: -.035em; }
.contour-entry p { color: #a8b6b0; font-size: 12px; line-height: 1.8; }
.contour-entry .button { flex-shrink: 0; }
.contour-page :is(strong,p,h2,h3,h4,span,small,button,label) { overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .contour-two { grid-template-columns: 1fr; }
  .contour-library { grid-template-columns: minmax(170px, .65fr) minmax(0, 1.8fr); gap: 14px; }
  .contour-document-head { flex-direction: column; }
  .contour-document-head .contour-inline-actions { justify-content: flex-start; }
  .contour-writing { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .contour-launch-grid { grid-template-columns: 1fr; }
  .contour-launch { padding: 22px; }
  .contour-launch > span { margin-bottom: 15px; }
  .contour-library { grid-template-columns: 1fr; }
  .contour-record-list { max-height: 280px; }
  .contour-heading, .contour-map-tools { align-items: stretch; flex-direction: column; gap: 12px; }
  .contour-header-actions { justify-content: flex-start; max-width: none; }
  .contour-connectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .contour-runs-grid { grid-template-columns: 1fr; }
  .contour-entry { align-items: flex-start; flex-direction: column; gap: 10px; }
}
@media (max-width: 620px) {
  .shell, .main, .page { overflow: visible; }
  .sidebar { height: auto; max-height: none; position: relative; top: auto; overflow: visible; }
  .sidebar #nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: visible; gap: 4px; }
  .sidebar #nav > .nav-button, .sidebar #nav > .nav-more > .nav-more-toggle { min-width: 0; min-height: 46px; padding: 8px 3px; white-space: normal; line-height: 1.25; overflow-wrap: anywhere; font-size: 10px; }
  .main > header { gap: 10px; flex-wrap: wrap; }
  .header-context { flex: 1; min-width: 100px; }
  .user-menu { max-width: 100%; }
  .studio-hero-actions { margin-right: 0; }
  .studio-hero { grid-template-columns: 1fr; }
  .studio-sculpture { display: none; }
  .studio-hero-copy { padding: 25px; }
  .studio-hero h3 { font-size: 43px; }
  .studio-hero-caption { font-size: 9px; }
  .contour-heading h2 { font-size: 35px; }
  .contour-is-context .contour-heading { margin-top: 0; margin-bottom: 16px; }
  .contour-is-context .contour-heading h2 { font-size: 27px; }
  .contour-is-context .contour-heading p { margin-bottom: 0; }
  .contour-page .button { font-size: 12px; min-height: 44px; }
  .contour-panel, .contour-document, .contour-editor { padding: 19px; border-radius: 14px; }
  .contour-section-head { flex-wrap: wrap; align-items: flex-start; }
  .contour-form-grid { grid-template-columns: 1fr; }
  .contour-page :is(input:not([type="checkbox"]),textarea,select) { font-size: 16px; }
  .contour-tabs { gap: 4px; }
  .contour-tabs button { font-size: 11px; padding: 10px 11px; min-height: 44px; }
  .contour-graph { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .contour-layer { padding-bottom: 13px; }
  .contour-connectors { grid-template-columns: 1fr; }
  .contour-run-steps > label { padding: 16px; gap: 12px; }
  .contour-document-head h3 { font-size: 25px; }
  .contour-scope { gap: 10px 16px; }
}
