/* UX-003: additive presentation layer. Classic keeps the original styles. */
:root {
  --ui-bg: #f5f7f9; --ui-surface: #ffffff; --ui-panel: #f8fafb;
  --ui-primary: #173f5f; --ui-secondary: #287f7a; --ui-accent: #287f7a;
  --ui-text: #263238; --ui-muted: #455a64; --ui-border: #71828b;
  --ui-shadow: 0 12px 36px #173f5f16; --ui-glass: #ffffffed;
  --ui-button: #173f5f; --ui-on-button: #ffffff; --ui-hover: #e8f5f3;
  --ui-focus: #287f7a; --ui-radius: 14px; --ui-motion: 160ms ease;
}
:root[data-ui-theme="command-center"] {
  --ui-bg: #081B32; --ui-surface: #102b46; --ui-panel: #133550;
  --ui-primary: #9adeec; --ui-secondary: #c1b7ff; --ui-accent: #12C6DB;
  --ui-text: #f0f6fc; --ui-muted: #bccfe0; --ui-border: #718fa9;
  --ui-shadow: 0 18px 42px #020e2066; --ui-glass: #102b46f2;
  --ui-button: #164A72; --ui-on-button: #ffffff; --ui-hover: #204460;
  --ui-focus: #12C6DB; --ui-radius: 18px;
  --ui-sage: #164A72; --ui-lake: #12C6DB; --ui-gold: #F3B35B; --ui-purple: #806CF2;
  --color-primary: #9adeec; --color-primary-light: #bbe9f3; --color-primary-dark: #d9f6fc;
  --color-secondary: #a5dad4; --color-secondary-light: #153e43;
  --color-success: #a9dfb0; --color-success-bg: #153c2b;
  --color-warning: #f4c985; --color-warning-bg: #40331d;
  --color-danger: #ffb5b0; --color-danger-bg: #482a34;
  --color-info: #a4d9f5; --color-info-bg: #173b55;
}
:root[data-ui-theme="warm-premium"] {
  --ui-bg: #FAF8F1; --ui-surface: #fffef9; --ui-panel: #edf3eb;
  --ui-primary: #24445A; --ui-secondary: #38655b; --ui-accent: #526d59;
  --ui-text: #24445A; --ui-muted: #536775; --ui-border: #74867d;
  --ui-shadow: 0 18px 42px #24445a12; --ui-glass: #fffef9ed;
  --ui-button: #24445A; --ui-on-button: #ffffff; --ui-hover: #e3eee2;
  --ui-focus: #38655b; --ui-radius: 20px;
  --ui-sage: #D4E5D0; --ui-lake: #8FCBD8; --ui-gold: #D9B77B; --ui-purple: #79A99C;
  --color-primary: #24445A; --color-primary-light: #355c70; --color-primary-dark: #183447;
  --color-secondary: #38655b; --color-secondary-light: #e3eee2;
  --color-success: #286338; --color-success-bg: #e6f0e1;
  --color-warning: #835015; --color-warning-bg: #fff1d7;
  --color-danger: #a12b28; --color-danger-bg: #fbece6;
  --color-info: #265d73; --color-info-bg: #e3f0f3;
}
:root[data-ui-theme]:not([data-ui-theme="classic"]) {
  --color-background: var(--ui-bg); --color-surface: var(--ui-surface); --color-surface-soft: var(--ui-panel);
  --color-text: var(--ui-text); --color-text-secondary: var(--ui-muted); --color-text-muted: var(--ui-muted);
  --color-border: var(--ui-border); --color-border-light: var(--ui-border);
  --border-color: var(--ui-border); --surface-color: var(--ui-surface);
  --shadow-sm: 0 3px 12px #102f4710; --shadow-md: var(--ui-shadow); --shadow-lg: var(--ui-shadow);
  --radius-md: 12px; --radius-lg: var(--ui-radius);
  --transition-fast: var(--ui-motion); --transition-normal: var(--ui-motion);
}
:root[data-ui-surface="business"][data-ui-theme="command-center"] { color-scheme: dark; }
:root[data-ui-surface="business"][data-ui-theme="warm-premium"] { color-scheme: light; }
.theme-only { display: none; }
.ui-theme-trigger, .ui-theme-close {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border);
  min-height: 44px; padding: 10px 14px; border-radius: 10px;
}
.ui-theme-trigger:hover, .ui-theme-close:hover { background: var(--ui-hover); }
.ui-theme-trigger:focus-visible, .ui-theme-dialog button:focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
.ui-theme-dialog {
  box-sizing: border-box; width: min(850px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
  padding: 28px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius); box-shadow: var(--ui-shadow); overflow-y: auto;
  font-family: "Microsoft JhengHei", system-ui, sans-serif; line-height: 1.6;
}
.ui-theme-dialog::backdrop { background: #0516279c; }
.ui-theme-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui-theme-dialog h2 { margin: 0; font-size: 22px; }
.ui-theme-close { flex-shrink: 0; }
.ui-theme-description, .ui-theme-status { color: var(--ui-muted); font-size: 14px; }
.ui-theme-status { min-height: 3em; margin-bottom: 0; }
.ui-theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ui-theme-card {
  display: flex; flex-direction: column; gap: 7px; min-width: 0; padding: 12px;
  font: inherit; text-align: left; color: var(--ui-text); background: var(--ui-panel);
  border: 2px solid var(--ui-border); border-radius: 14px; cursor: pointer;
}
.ui-theme-card:hover { background: var(--ui-hover); }
.ui-theme-card[aria-pressed="true"] { border-color: var(--ui-focus); box-shadow: 0 0 0 1px var(--ui-focus); }
.ui-theme-card strong { font-size: 16px; }
.ui-theme-label, .ui-theme-selected { font-size: 14px; font-weight: 700; }
.ui-theme-detail { font-size: 13px; color: var(--ui-muted); }
.ui-theme-selected { margin-top: auto; padding-top: 10px; color: var(--ui-primary); }
.ui-theme-sample { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; width: 100%; height: 110px; padding: 10px; border-radius: 8px; background: var(--sample-bg); }
.ui-theme-card[data-theme-choice="classic"] { --sample-bg: #f5f7f9; --sample-panel: #ffffff; --sample-accent: #173f5f; --sample-other: #287f7a; }
.ui-theme-card[data-theme-choice="command-center"] { --sample-bg: #081B32; --sample-panel: #164A72; --sample-accent: #12C6DB; --sample-other: #806CF2; }
.ui-theme-card[data-theme-choice="warm-premium"] { --sample-bg: #FAF8F1; --sample-panel: #D4E5D0; --sample-accent: #79A99C; --sample-other: #D9B77B; }
.ui-theme-mini-bar { grid-column: 1 / -1; height: 9px; border-radius: 3px; background: var(--sample-accent); }
.ui-theme-mini-core { grid-column: 2; grid-row: 2 / 4; border-radius: 8px; background: var(--sample-accent); box-shadow: 3px 5px 0 var(--sample-other); }
.ui-theme-mini-node { background: var(--sample-panel); border: 1px solid var(--sample-accent); border-radius: 5px; }
.ui-theme-swatches { display: flex; gap: 5px; padding: 2px 0; }
.ui-theme-swatches span { height: 12px; width: 22px; border-radius: 6px; background: var(--sample-accent); border: 1px solid var(--ui-border); }
.ui-theme-swatches span:nth-child(2) { background: var(--sample-bg); }
.ui-theme-swatches span:nth-child(3) { background: var(--sample-panel); }
.ui-theme-swatches span:nth-child(4) { background: var(--sample-other); }
/* Existing business components inherit tokens; forms and handlers stay intact. */
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) body { background: var(--ui-bg); color: var(--ui-text); }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(.module-panel, .auth-card, .topbar) { box-shadow: var(--shadow-sm); }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(button, .btn, .primary-button, .secondary-button):not(.ui-theme-card) {
  font: inherit; font-size: 14px; min-height: 44px; padding: 9px 14px; border-radius: 10px;
  color: var(--ui-text); background: var(--ui-surface); border: 1px solid var(--ui-border); cursor: pointer;
}
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(.btn-primary, .primary-button) { background: var(--ui-button); color: var(--ui-on-button); }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(button, .btn, .primary-button, .secondary-button):hover:not(:disabled):not(.ui-theme-card) { background: var(--ui-hover); color: var(--ui-text); }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(input, select, textarea) {
  font: inherit; color: var(--ui-text); background: var(--ui-surface); border-color: var(--ui-border); accent-color: var(--ui-secondary);
}
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) ::placeholder { color: var(--ui-muted); opacity: 1; }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(a, button, input, select, textarea):focus-visible { outline: 3px solid var(--ui-focus); outline-offset: 3px; }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :disabled { cursor: not-allowed; opacity: .65; }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) .sidebar { background: var(--ui-button); }
:root[data-ui-surface="business"][data-ui-theme]:not([data-ui-theme="classic"]) :is(.sidebar-group-name, .sidebar-system-en, .sidebar-footer, .nav-link) { color: #e3edf4; }
:root[data-ui-theme="command-center"] .demo-alert-icon { color: #081B32; }
/* Version 3C: the same HTML routes become a dimensional governance platform. */
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home { width: min(100% - 48px, 1240px); padding: 32px 0; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .theme-only { display: block; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-header { margin-bottom: 24px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home h1 { margin-bottom: 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .home-subtitle { color: var(--ui-muted); font-size: 13px; margin: 0; letter-spacing: .08em; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-kicker { text-transform: uppercase; font-size: 11px; letter-spacing: .14em; margin-bottom: 8px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .privacy-note { border-left-color: var(--ui-gold); border-radius: 0 10px 10px 0; font-size: 13px; margin-bottom: 28px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-platform {
  position: relative; padding: 30px; border: 1px solid var(--ui-border); border-radius: 28px;
  background: radial-gradient(ellipse at 50% 62%, color-mix(in srgb, var(--ui-sage) 65%, transparent), transparent 65%), var(--ui-surface);
  box-shadow: var(--ui-shadow);
}
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-intro { display: flex !important; justify-content: space-between; align-items: start; gap: 16px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-intro h2 { margin: 0 0 6px; font-size: 22px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-intro p { margin: 0; color: var(--ui-muted); font-size: 13px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-edition { color: var(--ui-secondary); border: 1px solid var(--ui-border); border-radius: 30px; padding: 5px 10px; font-size: 11px; white-space: nowrap; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list {
  list-style: none; padding: 0; margin: 32px 0 16px; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 1.3fr) minmax(0, 1fr); grid-template-rows: repeat(4, minmax(88px, auto)); gap: 14px 32px;
}
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li { min-width: 0; position: relative; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:first-child { grid-column: 2; grid-row: 1 / 5; align-self: center; z-index: 1; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(n+2):nth-child(-n+5) { grid-column: 1; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(n+6) { grid-column: 3; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(2), :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(6) { grid-row: 1; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(3), :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(7) { grid-row: 2; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(4), :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(8) { grid-row: 3; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(5), :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list li:nth-child(9) { grid-row: 4; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list a {
  display: flex; flex-direction: column; justify-content: center; height: 100%; padding: 16px 20px;
  background: var(--ui-glass); border: 1px solid var(--ui-border); border-bottom-width: 3px; border-radius: 16px;
  box-shadow: 0 7px 0 color-mix(in srgb, var(--ui-sage) 45%, transparent), 0 14px 20px #102f470a;
  backdrop-filter: blur(8px); transition: transform var(--ui-motion), box-shadow var(--ui-motion);
  font-size: 16px; font-weight: 650; line-height: 1.5;
}
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list a:hover { transform: translateY(-3px); background: var(--ui-hover); box-shadow: 0 10px 0 color-mix(in srgb, var(--ui-sage) 55%, transparent), var(--ui-shadow); }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-number { color: var(--ui-secondary); font-size: 10px; font-weight: 700; letter-spacing: .16em; margin-bottom: 6px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-arrow { position: absolute; right: 18px; top: 16px; color: var(--ui-secondary); font-size: 16px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list li:first-child a {
  text-align: center; min-height: 295px; padding: 24px 16px; border-color: var(--ui-secondary);
  border-radius: 28px; background: linear-gradient(150deg, var(--ui-surface), var(--ui-panel));
  box-shadow: 0 14px 0 color-mix(in srgb, var(--ui-sage) 85%, var(--ui-surface)), 0 25px 0 color-mix(in srgb, var(--ui-sage) 50%, var(--ui-surface)), 0 36px 38px #102f4720;
}
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-core-art { width: min(100%, 205px); height: 140px; margin: 0 auto 12px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-core-caption { font-size: 12px; font-weight: 400; color: var(--ui-muted); margin-top: 10px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-footnote { font-size: 11px; color: var(--ui-muted); margin: 28px 0 0; text-align: center; letter-spacing: .06em; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 24px; margin-top: 22px; padding: 22px 28px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-boundary { grid-column: 1 / -1; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry .field-help { margin: 6px 0 0; font-size: 12px; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry .hub-enter-label { display: inline; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry .hub-classic-label { display: none; }
:root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry-title { font-size: 17px; font-weight: 700; }
/* 3D views: outer chrome only. No scene tokens, canvas, camera or panels touched. */
:root[data-ui-surface="scene"][data-ui-theme]:not([data-ui-theme="classic"]) body > header { color: var(--ui-text); background: var(--ui-surface); border-bottom-color: var(--ui-border); }
:root[data-ui-surface="scene"][data-ui-theme]:not([data-ui-theme="classic"]) body > header :is(p, strong, .return-hub) { color: var(--ui-secondary); }
:root[data-ui-surface="scene"][data-ui-theme]:not([data-ui-theme="classic"]) body > header a { color: var(--ui-text); background: var(--ui-panel); border-color: var(--ui-border); }
:root[data-ui-surface="scene"][data-ui-theme]:not([data-ui-theme="classic"]) body > header a:hover { background: var(--ui-hover); }
:root[data-ui-surface="scene"][data-ui-theme]:not([data-ui-theme="classic"]) body > header a:focus-visible { outline-color: var(--ui-focus); }
@media (max-width: 900px) {
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-header { flex-wrap: wrap; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-platform { padding: 22px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list { gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(210px, 1.15fr) minmax(0, 1fr); }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list a { padding: 14px 12px; font-size: 14px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .portal-arrow { display: none; }
}
@media (max-width: 650px) {
  .ui-theme-dialog { padding: 18px; }
  .ui-theme-dialog h2 { font-size: 18px; }
  .ui-theme-cards { grid-template-columns: 1fr; }
  .ui-theme-card { display: grid; grid-template-columns: 78px 1fr; column-gap: 14px; }
  .ui-theme-sample { grid-row: 1 / 6; height: 105px; padding: 7px; gap: 4px; }
  .ui-theme-swatches { display: none; }
  .ui-theme-selected { padding-top: 0; }
  .ui-theme-detail { display: none; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home { width: calc(100% - 32px); padding: 22px 0; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-platform { padding: 18px 14px; border-radius: 20px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-intro { flex-direction: column; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .module-link-list { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; gap: 18px 12px; margin-top: 22px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list li:nth-child(n) { grid-column: auto; grid-row: auto; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list li:first-child { grid-column: 1 / -1; margin: 0 6px 24px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list li:first-child a { min-height: 230px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-core-art { height: 115px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .hub-entry a { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --ui-motion: 0s; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list a { transition: none; }
  :root[data-ui-theme]:not([data-ui-theme="classic"]) .governance-home .module-link-list a:hover { transform: none; }
}

:root[data-ui-theme]:not([data-ui-theme="classic"]) .portal-route-prefix { display: none; }
