/* Colour themes. Keep dark diagrams/code readable in either theme. */
.theme-toggle {
 display:inline-flex;align-items:center;justify-content:center;flex:none;
 width:40px;height:40px;padding:9px;border:1px solid var(--line);border-radius:8px;
 background:var(--paper);color:var(--ink);cursor:pointer;
}
.theme-toggle:hover{background:var(--soft);border-color:var(--blue)}
.theme-toggle svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.theme-toggle .theme-sun{display:none}
html[data-theme=dark] .theme-toggle .theme-moon{display:none}
html[data-theme=dark] .theme-toggle .theme-sun{display:block}
.theme-toggle:focus-visible{outline:3px solid var(--orange);outline-offset:3px}
html[data-theme=light]{color-scheme:light}
html[data-theme=dark]{
 color-scheme:dark;
 --paper:#0b1220;--surface:#131e30;--surface-raised:#1a2940;
 --ink:#e7eef8;--muted:#afbed2;--line:#33445d;
 --blue:#91b8ff;--blue-dark:#a5c7ff;--soft:#1a2e4d;
 --navy:#101c31;--orange:#fbbf24;--orange-dark:#ffd38a;
 --value:#d7e1f8;--logo-value:#d7e1f8;--loop-value-ink:#d7e1f8;--learning:#fbbf24;--learning-heading:var(--learning);--extra:#c4a5ff;
 background:var(--paper);color:var(--ink);
}
/* Neutral surfaces, including components that predate theme tokens. */
html[data-theme=dark] :is(
 .topbar,.skip,.workspace,.timeline,.transfer,.card,.person-card,.concept,
 .meeting,.meeting-detail,.meeting-content .agenda,.inline-disclosure,
 .prompt-surface,.prompt-picker button.active,.section-disclosure-body .meeting,
 .doc-section,.ops-flow li,.gantt-scroll,.gantt-label,.consent-panel,
 .entry-card,.core-summary,.human-ai,.practice-feature,.home-small-specs,
 .framework-support-links a,.meeting-nav a,
 .home-principles-grid article,.home-mini-example,.home-next-links a,
 .framework-short-flow li,.framework-more,.framework-principle,.coding-context,
 .audience-grid article,.docs-toc,.nav-submenu,.lw-card,
 .study-weeks button,.study-day,.study-demo,.study-legacy,.cart-journey-map a,.cart-stage,
 .scale-figure,.scale-dependency span,.scale-table,.scale-table tr,.scale-initiative>div,.scale-start,
 .tool-index a,.tool-slicing,.tool-flow li,.tool-decisions span,.tool-journey li,
 .tool-automations,.tool-questions li,.debt-metrics>div,.test-result,
 .pr-review .review-details
 ){background:var(--surface);border-color:var(--line)}
html[data-theme=dark] .framework-guide .framework-loop{background:var(--surface);border-inline-color:var(--line)}
html[data-theme=dark] .lw-card{border-top-color:var(--accent)}
html[data-theme=dark] .lw-card:hover{border-color:var(--accent)}
html[data-theme=dark] #loop-detail{background:var(--surface)}
html[data-theme=dark] :is(
 .grid-people .person-card,.role-grid .person-card,.role-grid .person-card[data-person],
 .investment-grid .card,.skill-cycle article,.meeting-content,.meeting-content .two-col,
 .prompt-config,.prompt-header,.reason-form,.case-panel,.case-panel .case-meta,
 .doc-stages article,.ops-cards article,.gantt-intro,.gantt-weeks,.gantt-days,.gantt-detail,
 .scorecard-focus,.scorecard-chain,.home-scorecard,.home-example-flow li,
 .framework-step,.study-artifact,.study-overview,.explorer-controls,
 .explorer-toolbar .perspective-control,.explorer-context,.explorer-relationships,
 .review-summary,.pr-review,.pr-review .review-boundaries,
 .section-disclosure-body .transfer,.concept:nth-child(3),.tool-flow.workflow li:nth-child(n+6)
 ){background:var(--surface-raised);border-color:var(--line)}
html[data-theme=dark] :is(
 .section-disclosure .disclosure-label h2,.pr-review>h3,.review-summary>h3,
 .home-example-flow li,.explorer-controls-title,#explorer-filter select,
 .step-list button,.perspective-control span
 ){color:var(--ink)}
html[data-theme=dark] :is(
 .nav a,.callout p,.investment-grid p,.ops-flow span,.home-scorecard>span,
 .section-disclosure .disclosure-hint,.doc-section>summary small,
 .gantt-label small,.study-day-focus,.study-day-output,.study-activities p,
 .relationship-item small,.explorer-hint,.explorer-controls .explorer-hint,
 .explorer-toolbar .perspective-control span
 ){color:var(--muted)}
html[data-theme=dark] :is(
 .lw-resources a,.pr-review .review-details>summary,.pr-review .review-boundaries dt,
 .explorer-back,.explorer-toolbar .explorer-back,.context-nav a
 ){color:var(--blue)}
/* Tints follow the three loops across cards, badges and Explorer panels. */
html[data-theme=dark] :is(.lw-build,#build,[data-tone=build]){--accent:var(--logo-build);--tone:#1a2e4d;--deep:#a5c7ff}
html[data-theme=dark] :is(.lw-value,#value,[data-tone=value]){--accent:var(--logo-value);--tone:#1a2e4d;--deep:var(--loop-value)}
html[data-theme=dark] :is(.lw-learning,#learning,[data-tone=learning]){--accent:var(--logo-learning);--tone:#392d1a;--deep:#ffd38a}
html[data-theme=dark] #loop-detail[data-tone]{
 --panel-bg:var(--tone);--panel-light:var(--surface);--panel-line:var(--line);
 --panel-text:var(--ink);--panel-muted:var(--muted);--detail-accent:var(--deep);--detail-soft:var(--tone);
}
html[data-theme=dark] :is(.step-B,.study-loop-tag.build,.cart-stage.build .cart-stage-loop,.loop-tag.build){background:#1a2e4d;color:#a5c7ff}
html[data-theme=dark] :is(.step-V,.study-loop-tag.value,.cart-stage.value .cart-stage-no,.cart-stage.value .cart-stage-loop,.pill.ink,.loop-tag.value){background:#1a2e4d;color:var(--loop-value)}
html[data-theme=dark] :is(.step-L,.study-loop-tag.learning,.cart-stage.learning .cart-stage-no,.cart-stage.learning .cart-stage-loop,.pill.orange,.loop-tag.learning){background:#392d1a;color:#ffd38a}
html[data-theme=dark] :is(.callout.orange,.demo-label,.demo-data,.study-evidence,.meeting-example,.status.error,.reliability-feedback li:nth-child(2)){background:#392d1a;color:#ffd38a;border-color:#715932}
html[data-theme=dark] :is(.callout.orange p,.feedback-debt-note,.test-result .fail){color:#ffd38a}
html[data-theme=dark] .status.info{color:var(--blue-dark)}
html[data-theme=dark] .scale-tone-value{--loop-bg:#1a2e4d}
html[data-theme=dark] .scale-tone-value{--loop-color:var(--loop-value)}
html[data-theme=dark] .scale-tone-learning{--loop-bg:#392d1a}
html[data-theme=dark] :is(.study-overview li,.home-scorecard,.debt-metrics dd,.scale-figure figcaption){color:var(--ink)}
html[data-theme=dark] .docs-nav a{background:var(--soft)}
html[data-theme=dark] .meeting-detail.tone-value>summary:after{color:var(--value)}
html[data-theme=dark] :is(.gantt-bar.build,.circle-step-key button.active){background:#284d85;color:#fff}
html[data-theme=dark] .lane.value .lane-bar{background:#1a2e4d;border-color:var(--value)}
html[data-theme=dark] .lane.learning .lane-bar{background:#392d1a}
html[data-theme=dark] .section-disclosure{
 --section-accent:#91b8ff;--section-tint:#1a2e4d;--section-wash:#131e30;--section-line:#33445d;
}
html[data-theme=dark] .section-disclosure[data-palette=violet]{--section-accent:#c4a5ff;--section-tint:#2c2346}
html[data-theme=dark] .section-disclosure[data-palette=teal]{--section-accent:#78e5d0;--section-tint:#14332f}
html[data-theme=dark] .section-disclosure[data-palette=amber]{--section-accent:#ffd38a;--section-tint:#392d1a}
html[data-theme=dark] .section-disclosure[data-palette=slate]{--section-accent:#bfcee2;--section-tint:#253249}
html[data-theme=dark] .section-disclosure>summary:after{background:var(--surface)}
html[data-theme=dark] :is(.doc-section>summary,.doc-value>summary,.meeting-detail.tone-build>summary,.meeting-detail.tone-value>summary){background:var(--soft)}
html[data-theme=dark] :is(.doc-teal>summary,.loop-detail .step-roles){background:#14332f}
html[data-theme=dark] :is(.doc-orange>summary,.meeting-detail.tone-learning>summary){background:#392d1a}
html[data-theme=dark] :is(.meeting-detail.tone-shared>summary,.loop-detail .step-appointments,.section-disclosure-body .meeting .pill){background:#2c2346;color:#d4bdff}
/* Form controls and interaction states retain clear focus and contrast. */
html[data-theme=dark] :is(
 .button.secondary,.toolbar button,.case-tabs button,.step-list button,.principle-tab,
 .input-field input,.input-field select,#explorer-filter select,
 .perspective-control span,.connections-toggle,.explorer-toolbar .explorer-back,
 .person-card details>summary,.nav-toggle,.topbar.is-compact.nav-open .topinner>.nav
 ){background:var(--surface);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(.button,.button.primary,.entry-actions .primary){background:#2563eb;border-color:#2563eb;color:#fff}
html[data-theme=dark] :is(.button,.entry-actions .button):hover{background:#1d4ed8}
html[data-theme=dark] :is(.button.secondary,.tool-actions .secondary){background:var(--surface);border-color:var(--line);color:var(--ink)}
html[data-theme=dark] .button.orange{background:#fbbf24;border-color:#fbbf24;color:#171008}
html[data-theme=dark] :is(
 .toolbar button.active,.case-tabs button.active,.step-list button.active,
 #loop-detail .step-list button.active,.principle-tab[aria-selected=true],
 .perspective-control input:checked+span,.explorer-toolbar .perspective-control input:checked+span,
 .study-weeks button[aria-selected=true]
 ){background:#284d85;border-color:#91b8ff;color:#fff}
html[data-theme=dark] :is(#loop-detail .step-list button.active>*,.principle-tab[aria-selected=true]>span){color:#fff}
html[data-theme=dark] :is(
 .nav a:hover,.nav a[aria-current=page],
 .framework-principle[open]>summary,.section-disclosure>summary:hover,.inline-disclosure>summary:hover,
 .loop-detail .step-roles>summary:hover,.loop-detail .step-appointments>summary:hover,
 .context-nav,.context-nav a:hover,.gantt-label:hover,.explorer-toolbar .perspective-control label:hover span,
 .explorer-toolbar .explorer-back:not(:disabled):hover,.button.secondary:hover
 ){background:var(--soft);color:var(--blue)}
html[data-theme=dark] .context-nav a[aria-current=page]{background:#284d85;color:#fff}
html[data-theme=dark] .explorer-toolbar .perspective-control label:has(input:checked):hover span{background:#284d85;color:#fff}
html[data-theme=dark] .explorer-toolbar .connections-toggle:has(input:checked){color:var(--blue)}
html[data-theme=dark] .explorer-toolbar .connections-toggle input:checked{background:#2563eb}
html[data-theme=dark] .explorer-toolbar .explorer-back:disabled{color:var(--muted)}
html[data-theme=dark] .gantt-task{background-image:repeating-linear-gradient(to right,transparent 0,transparent calc(5% - 1px),#33445d calc(5% - 1px),#33445d 5%)}
html[data-theme=dark] :is(.gantt-row,.gantt-label,.gantt-weeks>span,.table-wrap,th,td){border-color:var(--line)}
html[data-theme=dark] :is(th,.case-panel .spec-table th){background:var(--soft);color:var(--ink)}
html[data-theme=dark] .scale-table thead th{background:var(--navy);color:#fff}
html[data-theme=dark] .gantt-legend span{background:var(--soft);color:var(--blue)}
html[data-theme=dark] .gantt-legend .value{background:#253249;color:#bfcee2}
html[data-theme=dark] .gantt-legend .learning{background:#392d1a;color:#ffd38a}
html[data-theme=dark] .gantt-legend .ops{background:#14332f;color:#78e5d0}
html[data-theme=dark] .gantt-legend .meeting{background:#2c2346;color:#d4bdff}
/* Preview identity, editorial content and existing deep diagram surfaces. */
html[data-theme=dark] .lw-blueprint{background-color:#101e31;background-image:radial-gradient(#3d536e .8px,transparent .9px);border-color:var(--line)}
html[data-theme=dark] :is(.core-ring,.home-loop-flow strong){color:#e7eef8}
html[data-theme=dark] .home-loop-flow strong{background:var(--soft)}
html[data-theme=dark] .node-value.active{background:#1a2e4d;color:var(--ink)}
html[data-theme=dark] :is(.circle-step.active,.map-step.active,.node-build.active){background:#284d85;color:#fff}
html[data-theme=dark] .learning .map-step.active{background:#fbbf24;color:#171008}
html[data-theme=dark] :is(.scale-team:before,.scale-dependency:after,.scale-feedback-arrow){background:var(--line)}
html[data-theme=dark] .consent-panel::backdrop{background:#020617b3}
/* Keep header controls comfortable and on-screen at narrow widths. */
@media(max-width:520px){
 .topbar .topinner .guide-controls{justify-content:space-between;width:100%;gap:8px}
 .theme-toggle{width:42px;height:42px}
 .language-meta{gap:8px}
}
@media print{
 .theme-toggle{display:none}
}


/* Keep the three loop markers visible on Quickstart cards in dark mode. */
html[data-theme=dark] .card.guide-section[data-loop=build]{border-top-color:var(--blue)}
html[data-theme=dark] .card.guide-section[data-loop=value]{border-top-color:var(--loop-value)}
html[data-theme=dark] .card.guide-section[data-loop=learning]{border-top-color:var(--orange)}
