/* Final accessibility and interaction layer. Preserve the Nous visual identity. */
:root{--danger-bg:#feeceb;--danger-text:#ad231b}
.state.rejected,.state.declined,.state-strip .rejected{background:var(--red-bg,var(--danger-bg));color:var(--red,var(--danger-text))}
.state{font-size:12px}.type,.page-kicker,.inspector-label{font-size:12px}
:is(button,a,input,textarea,select):focus-visible,#surface:focus-visible{outline:3px solid #295b44;outline-offset:3px}
.skip-link{position:fixed;top:8px;left:16px;z-index:100;background:var(--raised,white);color:var(--accent,#295b44);padding:14px;border-radius:12px;transform:translateY(-150%)}.skip-link:focus{transform:none}
.map-tools{position:absolute;right:18px;bottom:18px;z-index:5;display:flex;align-items:center;gap:4px;padding:5px;background:#fff;border:1px solid #dfe6e1;border-radius:17px;box-shadow:0 3px 15px #15182312}
.map-tools[hidden]{display:none}.map-tools button{min-width:44px;height:44px;border-radius:11px;color:#295b44;font-size:23px}.map-tools button:hover{background:#edf4ef}.map-tools button:disabled{opacity:.35;cursor:default}
.map-tools #map-fit{min-width:58px;font-size:12px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}.map-tools #map-fit small{font-size:12px;color:#64666e}
.map-tools #map-fullscreen{position:static;width:44px;height:44px;box-shadow:none;border:0;border-left:1px solid var(--line);border-radius:0 11px 11px 0}
.is-map #surface{overflow:hidden}.is-map .map-viewport{position:relative;width:100%;height:100%;overflow:hidden;touch-action:pan-y pinch-zoom}
.is-map .map-content{position:absolute;left:0;top:0;width:1100px;height:auto;transform-origin:top left}
.is-map .map-wrap{width:1100px;min-width:0;height:580px;min-height:580px}.is-map .map-space{margin-top:25px}
.is-map .map-legend{left:26px;right:26px;bottom:16px;font-size:12px}.is-map .extra-list{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));padding:0 26px 20px}.is-map .extra-object{width:100%;overflow-wrap:anywhere}
.provider-controls{gap:8px}.provider-controls select{min-height:40px}#refresh-models,#help{min-width:44px;min-height:44px}#connections,#audio-tools,#cancel-ask{min-height:40px;font-size:12px;color:#28563f}#audio-tools{padding:6px 12px;border:1px solid #d7e3da;border-radius:18px;background:#fff}
.source-note,.branch-meta,.row-meta,.context-footer{font-size:12px;color:#606570}.inspector-body,.doc-section p,.decision-row p,.branch-card p,.context-group li{font-size:14px;line-height:1.65}
.state-strip{flex-wrap:wrap}.state-strip span{font-size:12px}.view-page{overflow-wrap:anywhere}.doc-live{gap:12px;flex-wrap:wrap}
.audio-layout{display:grid;grid-template-columns:1fr 1fr;gap:16px}.audio-layout label{margin:0}.audio-wide{grid-column:1/-1}.audio-layout select,.audio-layout textarea,.audio-layout input{width:100%;min-width:0;font-size:14px}.audio-layout textarea{min-height:120px;resize:vertical}
.audio-description{font-size:14px;line-height:1.6;color:#565e58}.audio-feedback{min-height:24px;font-size:14px;line-height:1.5}.audio-feedback[data-error=true]{color:var(--red,var(--danger-text))}.audio-result{border-top:1px solid #dfe6e1;margin-top:18px;padding-top:18px}.audio-result pre{font-family:inherit;white-space:pre-wrap;max-height:200px;overflow:auto;font-size:14px;line-height:1.6}.audio-result audio,.audio-artifact audio{width:100%}.audio-result a,.audio-artifact a{display:inline-block;margin-top:12px;text-decoration:underline;color:#28563f}.audio-toolbar{display:flex;gap:10px;flex-wrap:wrap}.audio-toolbar button{min-height:44px;padding:10px 16px;border:1px solid #d7e3da;border-radius:12px}.audio-status-line{display:flex;gap:10px;align-items:center}.audio-note{font-size:12px;line-height:1.6;color:#606570}.audio-artifact{margin:18px 0}.audio-artifact p{font-size:12px}.audio-result[hidden],[data-audio-field][hidden]{display:none}
dialog:has(#audio-form){width:min(660px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto}dialog :is(button,input,select){min-height:44px}
@media(max-width:850px){
 .viewbar{height:auto;flex-wrap:wrap}.views{width:100%;justify-content:space-between;overflow:visible}.views button{min-width:0;min-height:44px;flex:1;padding:0 5px;font-size:12px}.views button span{display:none}.view-right{margin-left:auto}
 .provider-controls{display:grid;grid-template-columns:1fr 1fr 44px;align-items:center;width:100%}.provider-controls select{width:100%;min-width:0!important;max-width:none!important;font-size:13px}#connection-status{grid-column:1/-1}#connections,#audio-tools,#cancel-ask{min-height:44px}#connection-orb{grid-column:3;grid-row:2}#connection-status{padding-right:30px}#audio-tools{grid-column:1}#connections{grid-column:2}#cancel-ask{grid-column:3}
 #command{font-size:16px;min-width:0}#command-form button{min-width:44px;min-height:44px}.command-context b{font-size:12px}.suggestions{flex-wrap:wrap}.suggestions button{min-height:44px;font-size:12px}.command-dock{padding-bottom:calc(14px + env(safe-area-inset-bottom))}
 .topbar #save-status{font-size:12px;max-width:95px}.source-note,.context-footer{font-size:12px}.inspector-body,.doc-section p,.branch-card p,.decision-row p{font-size:16px}
 .map-tools{right:12px;bottom:12px}.audio-layout{grid-template-columns:1fr}.audio-wide{grid-column:auto}dialog{padding:24px}dialog input,dialog select,dialog textarea{font-size:16px!important}.decision-row{grid-template-columns:1fr}.decision-row .row-meta{grid-column:1}.action-footer button,.branch-tools button,.inspector-controls button{min-height:44px}.surface-frame{min-height:420px}
}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}
.map-pan-hint{position:absolute;left:22px;bottom:34px;color:#64666e;font-size:12px;pointer-events:none}.map-pan-hint[hidden]{display:none}@media(max-width:1100px){.map-pan-hint{bottom:78px;font-size:12px;background:var(--raised,#f8f9fbd9);padding:4px 8px;border-radius:6px}}

[hidden]{display:none!important}
@media(max-width:850px){
 .command-dock{position:static;backdrop-filter:none}
 .surface-frame:not(.is-map){height:auto;min-height:0}
 .surface-frame:not(.is-map) #surface{height:auto;min-height:0;overflow:visible}
 body:not(.map-fullscreen) #inspector{max-height:none;overflow:visible}
 .suggestions{display:grid;grid-template-columns:1fr 1fr}.suggestions button{white-space:normal;text-align:left}
}
.map-fullscreen .map-viewport{touch-action:pinch-zoom}
.context-group li button{text-align:left;padding:0;color:inherit;font-size:inherit;line-height:inherit;white-space:normal}.context-group li button:hover{color:var(--accent,#295b44);text-decoration:underline}dialog select#audio-model,dialog select#audio-model option{text-transform:none}
@media(max-width:850px){.context-group li button{min-height:44px}}
/* Map navigation occupies its own row, outside the clipped object viewport. */
.is-map #surface{flex:1;height:auto;min-height:0;border-bottom-left-radius:0;border-bottom-right-radius:0}
.map-navigation{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;flex:none;padding:12px 16px;background:var(--surface,#f4f6f5);border:1px solid #e0e6e2;border-top:0;border-radius:0 0 24px 24px}
.map-navigation .map-pan-hint{position:static;pointer-events:auto;margin:0;padding:9px 12px;border:1px solid #e0e6e2;border-radius:10px;background:#fff;color:#525c56;font-size:12px;line-height:1.5}
.map-navigation .map-tools{position:static;margin-left:auto;flex:none;box-shadow:none}
.is-map .map-viewport{cursor:grab}.is-map .map-viewport button,.is-map .map-viewport select{cursor:pointer}
#surface.map-is-dragging,#surface.map-is-dragging *{cursor:grabbing!important;user-select:none}
#surface.map-pointer-focused:focus,#surface.map-is-dragging:focus{outline:none}
#command-form #ask-microphone{display:grid;place-items:center;flex:none;width:44px;height:44px;border:1px solid #d7e3da;background:var(--accent-bg,#edf4ef);color:var(--accent,#295b44);box-shadow:none}
#command-form #ask-microphone:hover{background:var(--raised-2,#e1ece5)}#command-form #ask-microphone[aria-pressed=true]{color:var(--red,#ad231b);background:var(--red-bg,#feeceb);border-color:#e6b4b1}
#command-form #ask-microphone:disabled{cursor:wait;opacity:.55}
#dictation-feedback{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:8px 0;font-size:12px;color:#295b44}#dictation-feedback[data-error=true]{color:var(--red,#ad231b)}#dictation-feedback button{min-height:40px;padding:6px 12px;border:1px solid #d7e3da;border-radius:12px;background:#fff;font-size:12px}#dictation-overflow{width:100%;min-height:90px;border:1px solid #d7e3da;border-radius:12px;padding:12px;font:inherit;background:#fff}
@media(max-width:850px){.map-navigation{padding:10px}.map-navigation .map-pan-hint{font-size:12px;padding:7px 9px}.map-navigation .map-tools{padding:3px}#command-form{gap:7px}#dictation-feedback button{min-height:44px}}

/* Keep the native file picker accessible while matching Nous controls. */
#audio-file{padding:6px;color:#606570;background:#fff;cursor:pointer}
#audio-file::file-selector-button{min-height:44px;margin-right:12px;padding:10px 18px;border:1px solid #d7e3da;border-radius:12px;background:var(--accent-bg,#edf4ef);color:var(--accent,#295b44);font:inherit;font-weight:600;cursor:pointer;transition:background .15s ease}
#audio-file:hover::file-selector-button{background:var(--raised-2,#e1ece5)}
#audio-file:active::file-selector-button{background:#d5e5da}
#audio-file:focus-visible{outline:2px solid #295b44;outline-offset:3px}
#audio-file:disabled{cursor:not-allowed;opacity:.55}
#audio-file:disabled::file-selector-button{cursor:not-allowed}
#dictation-elapsed{flex:none;padding:4px 8px;border:1px solid #e6b4b1;border-radius:8px;background:var(--red-bg,#feeceb);color:var(--red,#ad231b);font-variant-numeric:tabular-nums}

h2{font-size:16px!important}

.inspector-body{font-size:12px}

h3{font-size:14px!important}
/* Compact Ask while retaining 44px microphone and send targets. */
#command-form{height:49.5px;padding-top:0;padding-bottom:0}
.command-dock{height:auto;padding-bottom:25px}
@media(max-width:850px){#command-form{height:48px}}

/* Keep scrolling inside the padded, rounded inspector shell. */
#inspector{overflow:hidden}
.inspector-scroll{height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;margin-right:-12px;padding-right:12px;scrollbar-width:thin;scrollbar-color:#c4c8d3 transparent}
.inspector-scroll:focus-visible{outline:2px solid #295b44;outline-offset:2px;border-radius:8px}
#command-form button[type=submit]{width:28.5px;height:28.5px;min-width:28.5px;min-height:28.5px;flex:none;display:grid;place-items:center;padding:0;font-size:17.25px}
#command-form #ask-microphone{width:33px;height:33px;min-width:33px;min-height:33px;padding:0}
#ask-microphone svg{width:15px;height:15px}
@media(max-width:850px){
 #command-form button[type=submit]{width:33px;height:33px;min-width:33px;min-height:33px}
 body:not(.map-fullscreen) .inspector-scroll{height:auto;overflow:visible}
}
/* Desktop: the workspace fills spare viewport height but never shrinks below a
   usable map; on shorter screens the page scrolls, so no view hides its buttons
   inside a clipped inner scroller. */
@media(min-width:851px){
 body:not(.map-fullscreen){min-height:100dvh;display:flex;flex-direction:column}
 body:not(.map-fullscreen)>:is(.topbar,.goal-header,.viewbar,.command-dock){flex-shrink:0}
 body:not(.map-fullscreen) #main{flex:1 0 auto;min-height:560px;height:auto}
 body:not(.map-fullscreen) .is-map #surface{min-height:440px}
 body:not(.map-fullscreen) .surface-frame:not(.is-map) #surface{height:auto;overflow:visible}
 body:not(.map-fullscreen) #inspector{height:auto}
 body:not(.map-fullscreen) .inspector-scroll{height:auto;overflow:visible}
 /* Only the Ask input stays in reach while the page scrolls; context and suggestions scroll with the page. */
 body:not(.map-fullscreen) #command-form{position:fixed;left:32px;right:32px;bottom:16px;z-index:5;background:#fffffff2;border-color:#e0e6e2;box-shadow:0 8px 28px #1518231f}
 body:not(.map-fullscreen){padding-bottom:82px}
 body:not(.map-fullscreen)::after{content:'';position:fixed;left:0;right:0;bottom:0;height:82px;z-index:4;background:#f3f4f6eb;backdrop-filter:blur(18px);pointer-events:none}
}
@media(min-width:851px) and (max-width:1200px){body:not(.map-fullscreen) #command-form{left:24px;right:24px}}
/* Muted text meets the 4.5:1 contrast minimum on the page and panel backgrounds. */
.brand-note,.views button:not([aria-selected=true]):not(:hover),.inspector-eyebrow,.page-kicker,.page-intro,.branch-note,.suggestions>span{color:#5f6573}
kbd{color:#5d6558}
/* Map: connectors keep their drawn scale when placed objects deepen the canvas. */
.map-space>.connectors{height:434px;bottom:auto}
/* Selection: unrelated objects recede, the selected object's relationships come forward. */
.has-selection .node.dimmed{opacity:.38;filter:saturate(.4)}
.has-selection .node.related:not(.selected){border-color:var(--accent-line,#8fb3a1)}
.has-selection .connectors g{opacity:.25}
.has-selection .connectors g.active{opacity:1}
.connectors g.active path{stroke:var(--accent,#2f6b52);stroke-width:2.5}
.connectors g.active text{fill:var(--accent-strong,#24543f);font-weight:600}
.node,.connectors g{transition:opacity .18s ease,filter .18s ease}
@media(prefers-reduced-motion:reduce){.node,.connectors g{transition:none}}
/* Zoomed out, titles carry the map; body text and footers would be unreadable. */
.map-zoomed-out .node p,.map-zoomed-out .node-foot{display:none}
.map-zoomed-out .node h3{font-size:22px!important;line-height:1.2}
.map-zoomed-out .node{min-height:0}
/* Unplaced objects wait in a tray until they are positioned on the map. */
.map-tray{position:absolute;top:12px;right:12px;z-index:3;width:260px;max-height:calc(100% - 24px);display:flex;flex-direction:column;background:#fff;border:1px solid #e0e6e2;border-radius:14px;box-shadow:0 10px 25px #1518230f;cursor:default}
.map-tray summary{padding:10px 14px;font-size:12px;font-weight:600;color:#295b44;cursor:pointer;list-style-position:inside}
.map-tray summary:focus-visible{outline:2px solid #295b44;outline-offset:-2px;border-radius:12px}
.map-tray>p{margin:0;padding:0 14px 8px;font-size:12px;color:#5b6168}
.map-tray ul{margin:0;padding:0 8px 8px;list-style:none;overflow-y:auto;min-height:0}
.map-tray li{display:flex;align-items:center;gap:6px;padding:4px;border-radius:10px;cursor:grab}
.map-tray li:hover{background:#f4f6f5}
.tray-object{flex:1;min-width:0;display:grid;gap:3px;justify-items:start;padding:6px;border:0;background:none;text-align:left;font:inherit}
.tray-object .type{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:#5b6168}
.tray-object strong{font-size:13px;font-weight:500;line-height:1.3;overflow-wrap:anywhere}
.tray-place{flex:none;min-height:32px;padding:4px 10px;border:1px solid #d7e3da;border-radius:8px;background:#edf4ef;color:var(--accent,#295b44);font-size:12px;font-weight:600}
.tray-place:hover{background:#e1ece5}

/* P1 #4: proposal review as a slide-over, reachable on every width */
.review-chip{display:none;align-items:center;gap:6px;border:1px solid var(--line);border-radius:999px;padding:7px 12px;background:#fff;font-size:12px;color:var(--ink)}
.review-chip.has-proposal{border-color:var(--accent-line,#8fb3a1);background:var(--accent-bg,#e9f1ed);color:var(--accent-strong,#1f4a36);font-weight:600}
@media(max-width:850px){.review-chip{display:inline-flex}}
.review-scrim{position:fixed;inset:0;z-index:60;background:#151823;opacity:.32}
.review-panel{position:fixed;top:0;right:0;bottom:0;z-index:61;width:min(720px,100vw);overflow:auto;background:var(--bg,var(--paper));box-shadow:-24px 0 60px #15182333;padding:20px 24px 40px;animation:review-in .22s ease-out}
.review-panel:focus{outline:none}
.review-panel .view-page{padding:12px 0 0;max-width:none}
.review-back{border:1px solid var(--line);background:#fff;border-radius:999px;padding:9px 14px;font-size:13px;color:var(--ink);cursor:pointer}
.review-back:hover{background:var(--accent-bg,var(--green-light))}
body.review-open{overflow:hidden}
@keyframes review-in{from{transform:translateX(40px);opacity:0}to{transform:none;opacity:1}}
@media(prefers-reduced-motion:reduce){.review-panel{animation:none}}
@media(max-width:850px){.review-panel{padding:14px 16px 32px}}

/* P1 #6: provider and model picker behind a chip */
.model-chip{display:inline-flex;align-items:center;gap:6px;min-height:40px;max-width:260px;padding:0 14px;border:1px solid #d8dcd4;border-radius:999px;background:var(--raised,#fff);color:#22302a;font:inherit;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.model-chip::after{content:"▾";font-size:12px;color:#56605a}
.model-chip[aria-expanded="true"]{background:var(--accent-bg,#e9f1ed);border-color:var(--accent-line,#9fbfae);color:var(--accent-strong,#1f4a36)}
.model-chip:empty{display:none}
.provider-controls:not(.picker-open) :is(#ai-provider,#ai-model,#refresh-models){display:none}
@media(max-width:850px){.model-chip{max-width:calc(100vw - 150px)}}

/* P1 #7: Rejected is an exit from Candidate, not a step after Superseded */
.state-strip{display:grid;grid-template-columns:repeat(7,auto);justify-content:start;align-items:center;column-gap:6px;row-gap:6px}
.state-strip .state-arrow{font-style:normal;color:var(--muted)}
.state-strip .state-exit{grid-column:3;display:flex;align-items:center;gap:6px;padding:0!important;background:none!important;color:var(--muted)}
@media(max-width:500px){.state-strip{column-gap:3px}.state-strip span{padding:7px 8px}}
/* P1 #7: status chips to WCAG AA (4.5:1) at their 11px size; hues kept, text darkened */
.state.candidate,.state.idea,.state.proposed{color:var(--amber,#845a0f)}
.state.decided,.state.completed{color:#1c7243}
.state.superseded{background:var(--gray-bg,#f1f2f4);color:#5d636e}
.state-strip span:not(.current):not(.rejected):not(.state-exit){color:#5d636e}
/* P1 #8: Map/List switch, object list, Ask row pinned on small screens. */
.map-mode{display:inline-flex;gap:2px;padding:3px;background:#fff;border:1px solid #e0e6e2;border-radius:999px;box-shadow:0 4px 14px #15182314}
.map-viewport>.map-mode{position:absolute;top:12px;left:12px;z-index:3}
.map-mode button{min-height:32px;padding:0 14px;border:0;border-radius:999px;background:none;color:#5d636e;font-size:12px;font-weight:600;cursor:pointer}
.map-mode button[aria-pressed=true]{background:var(--accent,#295b44);color:#fff}
.map-mode button:focus-visible{outline:2px solid #295b44;outline-offset:2px}
.object-list .map-mode{margin-bottom:20px}
.object-list section{margin-bottom:22px}
.object-list h3{margin:0 0 8px;font:600 12px/1.4 var(--sans);letter-spacing:.08em;text-transform:uppercase;color:#5d636e}
.object-list h3 span{color:var(--accent,#295b44)}
.object-list ul{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.object-row{width:100%;min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;text-align:left;background:var(--raised,#fff);border:1px solid #e0e6e2;border-radius:12px;color:inherit;cursor:pointer}
.object-row b{font-weight:600}
.object-row .state{flex-shrink:0}
.object-row:hover{border-color:var(--accent-line,#9fb8aa)}
.object-row.selected{border-color:var(--accent,#295b44);box-shadow:0 0 0 1px var(--accent,#295b44)}
@media(max-width:850px){
 .map-mode button{min-height:44px}
 .map-viewport>.map-mode~.map-tray{width:auto;max-width:calc(100% - 150px)}
 body:not(.map-fullscreen) #command-form{position:fixed;left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom));z-index:20;background:#fffffff2;border-color:#e0e6e2;box-shadow:0 8px 28px #15182326}
 body:not(.map-fullscreen){padding-bottom:calc(70px + env(safe-area-inset-bottom))}
}
/* Small text links still get a 24px click target. */
:is(#edit-context,#last-ask-result,#clear-selection):not([hidden]){min-height:24px;display:inline-flex;align-items:center}
.object-links button,.context-group li>button{min-height:24px}
dialog .field-hint{display:block;margin-top:6px;font-size:12px;font-weight:400;letter-spacing:0;text-transform:none;line-height:1.5;color:#5f656e}
/* Map heading sits outside the scaled .map-content so the branch picker keeps its real size. */
.map-viewport>.surface-heading{position:absolute;top:12px;left:140px;z-index:3;display:flex;align-items:center;gap:10px;max-width:calc(100% - 152px);padding:3px 3px 3px 14px;background:#fff;border:1px solid #e0e6e2;border-radius:999px;box-shadow:0 4px 14px #15182314;cursor:default}
.map-viewport>.surface-heading>span{white-space:nowrap}
.map-viewport>.surface-heading .branch-switch{display:flex;align-items:center;gap:4px;min-width:0}
.map-viewport>.surface-heading select{min-height:32px;min-width:0;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.map-viewport>.surface-heading:has(~.map-tray){max-width:calc(100% - 424px)}
@media(max-width:850px){
 .map-viewport>.surface-heading,.map-viewport>.surface-heading:has(~.map-tray){top:76px;left:12px;max-width:calc(100% - 24px)}
 .map-viewport>.surface-heading select{min-height:44px;max-width:none;flex:1}
 .map-viewport>.surface-heading{padding-left:12px;right:12px}
 .map-viewport>.surface-heading .branch-switch{flex:1}
 .map-viewport>.surface-heading>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
}
/* "Review decision" links meet the 24px minimum target (WCAG 2.5.8). */
.decision-row .row-meta button{min-height:24px;display:inline-flex;align-items:center}
.branch-root{color:var(--muted)}
.branch-card button{min-height:24px;display:inline-flex;align-items:center}
.doc-section .ref{min-height:24px;display:flex;align-items:center;width:fit-content}
