/* Runtime appearance only. Export generators retain their own document palettes.
   Semantic fallbacks in component styles preserve the existing light appearance. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1f5fb;
  --muted: #b4c2d6;
  --surface: #192334;
  --canvas: #111827;
  --paper: #111827;
  --card: #192334;
  --green-soft: #193e32;
  --focus: #ffd27d;
  --quiet: #223149;
  --line: #8194b0;
  --border: #8194b0;
  --blue: #355777;
  --blue-dark: #263e59;
  --appearance-summary-end: #304b69;
  --blue-soft: #1b3555;
  --sense-soft: #33264a;
  --success-soft: #193e32;
  --warning-soft: #493820;
  --danger-soft: #482b32;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --appearance-ink: #f1f5fb;
  --appearance-muted: #b4c2d6;
  --appearance-surface: #192334;
  --appearance-quiet: #223149;
  --appearance-line: #8194b0;
  --appearance-link: #9dc4ff;
  --appearance-blue-soft: #1b3555;
  --appearance-sense-text: #d1b3ff;
  --appearance-sense-soft: #33264a;
  --appearance-success-text: #75e0ad;
  --appearance-success-soft: #193e32;
  --appearance-warning-text: #ffd27d;
  --appearance-warning-soft: #493820;
  --appearance-danger-text: #ffaaa3;
  --appearance-danger-soft: #482b32;
  --appearance-focus: #ffd27d;
  --appearance-lifecycle-text: #f1f5fb;
  --appearance-toggle-background: #26262f;
  --appearance-toggle-ink: #b7b7c5;
  --appearance-toggle-hover: #ffffff;
  --appearance-toggle-focus: #ffd27d;
}
html[data-theme="light"] { color-scheme: light; }
/* Compact theme and zoom controls share the supplied toolbar control family. */
.pi-theme-toggle { display: inline-flex; flex: 0 0 auto; gap: 1px; padding: 2px; border-radius: 999px; background: var(--appearance-toggle-background,#f1f5fb); }
.pi-resizer .pi-theme-button { width: 26px; height: 26px; min-height: 26px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--appearance-toggle-ink,#4b5565); }
.pi-theme-button svg { width: 14px; height: 14px; stroke: currentColor; fill: none; pointer-events: none; }
.pi-resizer .pi-theme-button[aria-pressed="true"],.pi-resizer .pi-preset.is-active { background: #1e6fe0; color: #fff; }
.pi-resizer .pi-theme-button:not(:disabled):hover { transform: none; }
.pi-resizer .pi-theme-button:not(:disabled):not([aria-pressed="true"]):hover { color: var(--appearance-toggle-hover,#172b4d); }
.pi-resizer .pi-theme-button:focus-visible { outline: 2px solid var(--appearance-toggle-focus,#175cd3); outline-offset: 2px; }
.pi-resizer :is(.pi-step,.pi-preset) { height: 26px; min-height: 26px; }
.pi-step-icon { display: block; width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.pi-resizer .pi-presets { padding: 2px; border-radius: 999px; }
html[data-theme="dark"] .pi-resizer .pi-presets { background: #26262f; }
.pi-resizer .pi-theme-retry { height: auto; min-height: 26px; color: var(--ink); border: 1px solid var(--line); }
.pi-resizer .pi-theme-retry[hidden] { display: none; }
html[data-theme] .pi-resizer .pi-theme-button:disabled { opacity: 1; color: var(--appearance-toggle-ink,#4b5565); background: transparent; cursor: wait; }
html[data-theme] .pi-resizer .pi-theme-button[aria-pressed="true"]:disabled { background: #1e6fe0; color: #fff; }
@media (forced-colors: active) {
  .pi-theme-toggle { border: 1px solid ButtonText; }
  .pi-resizer .pi-theme-button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
}
/* User-agent controls must follow the page, including controls without component CSS. */
html[data-theme="dark"] :is(input,textarea,select,option) { color: var(--ink); background-color: var(--surface); }
html[data-theme="dark"] :is(input,textarea)::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="dark"] :is(input[type="checkbox"],input[type="radio"],input[type="range"],progress) { accent-color: #9dc4ff; }
html[data-theme="dark"] a:not([class]) { color: var(--appearance-link); }
html[data-theme="dark"] :focus-visible { outline: 3px solid var(--appearance-focus); outline-offset: 3px; box-shadow: 0 0 0 1px var(--canvas); }
html[data-theme="dark"] ::selection { background: #9dc4ff; color: #111827; }
html[data-theme="dark"] :is(dialog,.modal) { color: var(--ink); }
html[data-theme="dark"] .skip-link { background: var(--surface); color: var(--ink); }
html[data-theme="dark"] .opportunity-lifecycle-key::before { outline: 1px solid var(--line); }
/* Roadmap metadata uses white text; severity remains visible in borders and icons. */
html[data-theme="dark"] .roadmap-column {
  --ink: #ffffff;
  --muted: #ffffff;
  --appearance-link: #ffffff;
  --appearance-sense-text: #ffffff;
  color: #ffffff;
}
html[data-theme="dark"] .roadmap-column .artifact-ticket-link,
html[data-theme="dark"] .multi-select-count { color: #ffffff; }
html[data-theme="dark"] .talk-track p { color: #ffffff; }
html[data-theme="dark"] .debt-age { color: #ffffff; font-size: 12px; }
/* Alert outlines separate severity from the surrounding card without bright fills. */
html[data-theme="dark"] :is(.prd-attention-alert,.dependency-alerts>div,.dependency-alerts>button,.dependency-alerts>.roadmap-prd-attention-link) {
  color: var(--ink);
  border: 1px solid var(--appearance-danger-text);
  border-inline-start-width: 4px;
  font-size: 12px;
  line-height: 1.5;
}
html[data-theme="dark"] :is(.prd-attention-alert,.dependency-alerts>div):is(.engineering-estimate-alert,.roadmap-link-alert,.dependency-period-alert) {
  border-color: var(--appearance-warning-text);
}
html[data-theme="dark"] :is(.prd-attention-alert,.dependency-alerts)>b,
html[data-theme="dark"] .dependency-alerts>:is(div,button,a)>b {
  flex-shrink: 0;
  background: var(--appearance-danger-text);
  color: var(--canvas);
}
html[data-theme="dark"] :is(.prd-attention-alert,.dependency-alerts>div):is(.engineering-estimate-alert,.roadmap-link-alert,.dependency-period-alert)>b {
  background: var(--appearance-warning-text);
}
html[data-theme="dark"] #opportunities-view .matrix { background-image: linear-gradient(90deg,transparent 49.8%,var(--line) 50%,transparent 50.2%),linear-gradient(0deg,transparent 49.8%,var(--line) 50%,transparent 50.2%); }
/* Distinguishable controls and readable disabled labels without opacity multiplying
   through modal/form parents. Disabled behavior remains in native attributes. */
html[data-theme="dark"] :is(button,input,select,textarea):disabled { opacity: 1; color: var(--muted); background-color: var(--quiet); border-color: var(--line); }
html[data-theme="dark"] fieldset:disabled { opacity: 1; }
html[data-theme="dark"] .porter-swot-dialog .porter-swot-circle:disabled { color: var(--ink); }
.profile-appearance { margin-block: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--quiet); }
.profile-appearance h3 { margin: 0 0 10px; }
.profile-appearance p { margin: 10px 0; color: var(--muted); }
.profile-appearance label { display: grid; gap: 8px; font-weight: 600; }
.profile-appearance select { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); }
.profile-appearance button { margin-top: 10px; }
.sense-opportunity-archive { margin-block: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--quiet); }
.sense-opportunity-archive-item { margin-block: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow-wrap: anywhere; }
.sense-opportunity-archive-item>a { color: var(--appearance-link,var(--blue)); text-decoration: underline; font-weight: 700; }
.sense-opportunity-archive :is(p,button) { margin-block: 8px; }
@media (max-width: 480px) { .profile-appearance { padding: 16px; } }
/* Let OS high-contrast colors win; no forced-color-adjust:none or image filters. */
@media (forced-colors: active) {
  html[data-theme] :focus-visible { outline: 3px solid Highlight; box-shadow: none; }
}
