/* Desktop visual preferences: shared business DOM, seven presentation systems. */

html[data-ui-style="precision"] {
  --theme-name: "precision";
  --theme-title-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-mono-font: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

html[data-ui-style="nocturne"] {
  --theme-name: "nocturne";
  --theme-title-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-mono-font: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

html[data-ui-style="minimalist"] {
  --theme-name: "minimalist";
  --theme-title-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-mono-font: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --login-bg: #f3f5f9;
  --login-grid: rgba(9, 80, 189, .07);
  --login-glow-primary: rgba(9, 80, 189, .24);
  --login-glow-secondary: rgba(37, 217, 232, .13);
  --login-shell: rgba(255, 255, 255, .92);
  --login-shell-line: #c5cfdb;
  --login-panel: #0d2b4f;
  --login-panel-text: #eef6ff;
  --login-panel-muted: #9ab3ca;
  --login-panel-soft: rgba(9, 80, 189, .16);
  --login-card: #ffffff;
  --login-text: #121825;
  --login-muted: #626e82;
  --login-line: #d1d9e3;
  --login-input: #ffffff;
  --login-placeholder: #626e82;
  --login-accent: #0950bd;
  --login-accent-hover: #06449f;
  --login-button-text: #ffffff;
}

html[data-ui-style="cyberpunk"] {
  --theme-name: "neomorphism";
  --theme-title-font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-mono-font: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --login-bg: #edf2f8;
  --login-grid: rgba(108, 131, 255, .035);
  --login-glow-primary: rgba(108, 131, 255, .2);
  --login-glow-secondary: rgba(56, 207, 211, .14);
  --login-shell: #f3f6fb;
  --login-shell-line: #cbd5e3;
  --login-panel: #edf2f8;
  --login-panel-text: #11213b;
  --login-panel-muted: #586a84;
  --login-panel-soft: #e7edf5;
  --login-card: #f3f6fb;
  --login-text: #11213b;
  --login-muted: #586a84;
  --login-line: #cbd5e3;
  --login-input: #edf2f8;
  --login-placeholder: #65758d;
  --login-accent: #3f51bd;
  --login-accent-hover: #33439f;
  --login-button-text: #ffffff;
}

html[data-ui-style="glass"] {
  --theme-name: "glass";
  --theme-title-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --theme-mono-font: "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

.ui-style-preference-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.ui-style-preference-options button {
  display: grid;
  gap: 5px;
  min-height: 132px;
  border: 1px solid var(--ui-line-strong);
  border-radius: 10px;
  background: var(--ui-surface);
  color: var(--ui-text);
  padding: 10px;
  text-align: left;
}

.ui-style-preference-options button:hover {
  border-color: color-mix(in srgb, var(--ui-brand) 48%, var(--ui-line));
  background: color-mix(in srgb, var(--ui-brand-soft) 54%, var(--ui-surface));
}

.ui-style-preference-options button.active {
  border-color: var(--ui-brand);
  background: var(--ui-brand-soft);
  box-shadow: inset 0 0 0 1px var(--ui-brand);
  color: var(--ui-brand);
}

.ui-style-preference-options button:focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
}

.ui-style-preference-options strong { font: 600 13px/20px inherit; }
.ui-style-preference-options small { color: var(--ui-text-secondary); font: 400 12px/18px inherit; }
.ui-style-preference-status { min-height: 20px; margin: 4px 0 0; color: var(--ui-text-secondary); font-size: 13px; line-height: 20px; }

.ui-style-preview {
  position: relative;
  display: grid;
  height: 58px;
  grid-template-columns: 24px minmax(0, 1fr) 38px;
  gap: 4px;
  overflow: hidden;
  border: 1px solid var(--ui-line);
  border-radius: 6px;
  background: var(--ui-surface-muted);
  padding: 6px;
}

.ui-style-preview i { display: block; min-width: 0; border: 1px solid currentColor; opacity: .58; }
.ui-style-preview-precision { color: #0950bd; background: #f3f5f9; }
.ui-style-preview-precision i:first-child { background: #f8fafc; }
.ui-style-preview-precision i:nth-child(2) { background: #fff; box-shadow: inset 3px 0 #0950bd; }
.ui-style-preview-precision i:last-child { background: #fff; }
.ui-style-preview-nocturne { color: #25d9e8; background: #07111f; }
.ui-style-preview-nocturne i:first-child { border-color: var(--ui-line-strong); background: #050b14; }
.ui-style-preview-nocturne i:nth-child(2) { border-color: #25d9e8; background: #0d1b2b; box-shadow: inset 3px 0 #25d9e8; }
.ui-style-preview-nocturne i:last-child { border-color: var(--ui-line-strong); background: #10263a; }
.ui-style-preview-minimalist { color: #212121; background: #fafafa; }
.ui-style-preview-minimalist i:first-child { border-color: var(--ui-line-strong); background: #ffffff; }
.ui-style-preview-minimalist i:nth-child(2) { border-color: var(--ui-line-strong); background: #ffffff; box-shadow: inset 3px 0 #212121; }
.ui-style-preview-minimalist i:last-child { border-color: var(--ui-line-strong); background: #ffffff; }
.ui-style-preview-cyberpunk { color: #6c83ff; background: #edf2f8; box-shadow: inset 2px 2px 5px rgba(159, 173, 194, .25), inset -2px -2px 5px rgba(255, 255, 255, .86); }
.ui-style-preview-cyberpunk i:first-child { border-color: #d1dae7; background: #f3f6fb; box-shadow: 2px 2px 5px rgba(159, 173, 194, .28), -2px -2px 5px rgba(255, 255, 255, .9); }
.ui-style-preview-cyberpunk i:nth-child(2) { border-color: #cbd5e3; background: #f6f8fc; box-shadow: inset 3px 0 #6c83ff; }
.ui-style-preview-cyberpunk i:last-child { border-color: #cbd5e3; background: linear-gradient(135deg, #38cfd3, #9677f3); }
.ui-style-preview-glass { color: #d7e3f7; background: linear-gradient(135deg, #0b1f4a, #4389f5 58%, #8b78f6); }
.ui-style-preview-glass i:first-child { border-color: rgba(255, 255, 255, .28); background: rgba(11, 31, 74, .64); }
.ui-style-preview-glass i:nth-child(2) { border-color: rgba(118, 168, 255, .72); background: rgba(255, 255, 255, .15); box-shadow: inset 3px 0 #76a8ff; }
.ui-style-preview-glass i:last-child { border-color: rgba(255, 255, 255, .28); background: rgba(247, 250, 255, .2); }

/* B · Precision business system. This is the default and mirrors Figma node 2:5. */
html[data-ui-style="precision"] {
  --brand: #0950bd;
  --brand-hover: #06449f;
  --brand-soft: #e8effe;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-subtle: #f8faff;
  --line: #d1d9e3;
  --line-soft: #e7ebf0;
  --line-strong: #c5cfdb;
  --text: #121825;
  --muted: #596476;
  --muted-soft: #596476;
  --hover: #f1f5ff;
  --ui-brand: #0950bd;
  --ui-brand-hover: #06449f;
  --ui-brand-soft: #e8effe;
  --ui-bg: #f3f5f9;
  --ui-surface: #ffffff;
  --ui-surface-muted: #f8faff;
  --ui-surface-raised: #ffffff;
  --ui-surface-soft: #f8faff;
  --ui-text: #121825;
  --ui-text-secondary: #596476;
  --ui-text-tertiary: #596476;
  --ui-text-inverse: #ffffff;
  --ui-line: #d1d9e3;
  --ui-line-strong: #c5cfdb;
  --ui-focus: #0950bd;
  --ui-overlay: rgba(18, 24, 37, .42);
  --ui-radius-sm: 6px;
  --ui-radius: 8px;
  --ui-radius-lg: 10px;
  --ui-shadow-card: 0 1px 2px rgba(18, 24, 37, .04);
  --ui-shadow-panel: 0 20px 52px rgba(18, 24, 37, .14);
  --login-bg: #f3f5f9;
  --login-grid: rgba(9, 80, 189, .07);
  --login-glow-primary: rgba(9, 80, 189, .24);
  --login-glow-secondary: rgba(37, 217, 232, .13);
  --login-shell: rgba(255, 255, 255, .92);
  --login-shell-line: #c5cfdb;
  --login-panel: #0d2b4f;
  --login-panel-text: #eef6ff;
  --login-panel-muted: #9ab3ca;
  --login-panel-soft: rgba(9, 80, 189, .16);
  --login-card: #ffffff;
  --login-text: #121825;
  --login-muted: #626e82;
  --login-line: #d1d9e3;
  --login-input: #ffffff;
  --login-placeholder: #626e82;
  --login-accent: #0950bd;
  --login-accent-hover: #06449f;
  --login-button-text: #ffffff;
}

html[data-ui-style="precision"] body:not(.login-active) .sidebar { background: #f8fafc; }
html[data-ui-style="precision"] body:not(.login-active) .workspace { padding: calc(var(--desktop-topbar-height) + 30px) 32px 32px; }
html[data-ui-style="precision"] body:not(.login-active) .desktop-topbar { padding-inline: 32px; }
html[data-ui-style="precision"] body:not(.login-active) .brand { height: var(--desktop-topbar-height); min-height: var(--desktop-topbar-height); }
html[data-ui-style="precision"] body:not(.login-active) .workspace-head { padding-bottom: 18px; }
html[data-ui-style="precision"] body:not(.login-active) .workspace-head h1 { font-size: 32px; line-height: 42px; letter-spacing: -.035em; }
html[data-ui-style="precision"] body:not(.login-active) .report-panel { border-radius: 8px; }
html[data-ui-style="precision"] body:not(.login-active) .report-current-card { border-color: var(--ui-line-strong); background: #f8faff; }
html[data-ui-style="precision"] body:not(.login-active) .overview-stage small { color: #5d687a; }

/* C · Nocturne data cockpit. Derived from the approved Penpot night-navigation reference. */
html[data-ui-style="nocturne"] {
  --brand: #25d9e8;
  --brand-hover: #4be7f0;
  --brand-soft: #12354a;
  --bg: #07111f;
  --panel: #0d1b2b;
  --panel-subtle: #10263a;
  --line: #20364b;
  --line-soft: #172b3f;
  --line-strong: #2f4a61;
  --detail-line: #5f7d96;
  --text: #eaf6ff;
  --muted: #a8c0d2;
  --muted-soft: #a8c0d2;
  --hover: #10263a;
  --warn: #ffb547;
  --warn-bg: #2b2118;
  /* 深色主题下「更强的警示文字色」方向与亮色相反：要更浅而非更深，
     否则会回退到基础层的深橙压深底。 */
  --warn-strong: #ffc86b;
  --ok: #43d19e;
  --ok-bg: #12352f;
  --danger: #ff786f;
  --danger-bg: #331d24;
  --purple: #b9a7ff;
  --purple-bg: #25233f;
  --ui-brand: #25d9e8;
  --ui-brand-hover: #4be7f0;
  --ui-brand-soft: #12354a;
  --ui-bg: #07111f;
  --ui-surface: #0d1b2b;
  --ui-surface-muted: #10263a;
  --ui-surface-raised: #10263a;
  --ui-surface-soft: #10263a;
  --ui-text: #eaf6ff;
  --ui-text-secondary: #a8c0d2;
  --ui-text-tertiary: #a8c0d2;
  --ui-text-inverse: #07111f;
  --ui-line: #20364b;
  --ui-line-strong: #2f4a61;
  --ui-success: #43d19e;
  --ui-success-soft: #12352f;
  --ui-warning: #ffb547;
  --ui-warning-soft: #2b2118;
  --ui-danger: #ff786f;
  /* 深色主题「加深一档」方向相反：必须仍是浅色，否则压不亮深底 */
  --ui-danger-strong: #ff9a93;
  --ui-danger-soft: #331d24;
  --ui-focus: #25d9e8;
  --ui-overlay: rgba(1, 7, 15, .76);
  --ui-radius-sm: 6px;
  --ui-radius: 8px;
  --ui-radius-lg: 10px;
  --ui-shadow-card: 0 1px 0 rgba(37, 217, 232, .04);
  --ui-shadow-panel: 0 20px 52px rgba(0, 0, 0, .34);
  --login-bg: #07111f;
  --login-grid: rgba(37, 217, 232, .07);
  --login-glow-primary: rgba(37, 217, 232, .22);
  --login-glow-secondary: rgba(185, 167, 255, .14);
  --login-shell: rgba(5, 11, 20, .94);
  --login-shell-line: #2f4a61;
  --login-panel: #050b14;
  --login-panel-text: #eaf6ff;
  --login-panel-muted: #82a0b8;
  --login-panel-soft: #0d1b2b;
  --login-card: #0d1b2b;
  --login-text: #eaf6ff;
  --login-muted: #82a0b8;
  --login-line: #2f4a61;
  --login-input: #10263a;
  --login-placeholder: #82a0b8;
  --login-accent: #25d9e8;
  --login-accent-hover: #4be7f0;
  --login-button-text: #07111f;
  background: #07111f;
  color: #eaf6ff;
  color-scheme: dark;
  font-family: var(--theme-ui-font);
}

html[data-ui-style="nocturne"] body:not(.login-active) {
  background: #07111f;
  color: #eaf6ff;
  color-scheme: dark;
  font-family: var(--theme-ui-font);
}

html[data-ui-style="nocturne"] body:not(.login-active) .badge:not(.warn, .warning, .risk, .danger, .error, .info, .key, .ok, .healthy) {
  border-color: var(--ui-line-strong);
  background: #10263a;
  color: #a8c0d2;
}

html[data-ui-style="nocturne"] body:not(.login-active) .overview-tag:not(.warn, .danger) {
  background: #10263a;
  color: #a8c0d2;
}

html[data-ui-style="nocturne"] body:not(.login-active) .badge.info {
  border-color: var(--ui-line-strong);
  background: #12354a;
  color: #25d9e8;
}

html[data-ui-style="nocturne"] body:not(.login-active) .badge.key {
  border-color: #7a5a2a;
  background: #2b2118;
  color: #ffb547;
}

html[data-ui-style="nocturne"] body:not(.login-active) :is(.app-shell, .workspace, .today-page, .overview-page, .report-page, .data-center-page) {
  background: #07111f;
  color: #eaf6ff;
}

html[data-ui-style="nocturne"] body:not(.login-active) .sidebar {
  border-right: 1px solid var(--ui-line-strong);
  background: #050b14;
  color: #eaf6ff;
}

/* 与其余主题保持同一套品牌区结构：30px 徽标块 + 真实中文标题 + 副标题。
   不再用 font:0/0 隐藏原文案、也不用伪元素替换成英文标识——真实文案必须可见。
   这里只覆盖 nocturne 的深海配色，布局沿用基础层的两列网格。 */
html[data-ui-style="nocturne"] body:not(.login-active) .brand {
  border-bottom: 1px solid var(--ui-line-strong);
  background: #050b14;
}

html[data-ui-style="nocturne"] body:not(.login-active) .brand::before {
  content: "Y";
  background: var(--ui-brand);
  color: #04121f;
  /* 字重收敛到设计系统允许的 400/500/600 三档（desktop-ui-p1-p2-contract-test 门禁要求）。
     徽标是 15px 单字符，600 与 700 视觉差异不可辨。 */
  font-weight: 600;
  box-shadow: none;
}

html[data-ui-style="nocturne"] body:not(.login-active) .brand-title {
  color: #eaf6ff;
  font-family: var(--theme-ui-font);
  font-weight: 600;
}

html[data-ui-style="nocturne"] body:not(.login-active) .brand-subtitle {
  color: #c3d6e6;
  font-size: 12px;
  line-height: 17px;
}

html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-scroll { padding: 16px 10px; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav { gap: 10px; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav-group { gap: 3px; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav-group h2 {
  display: flex;
  margin: 11px 12px 5px;
  color: #6f8ba2;
  font: 600 11px/16px var(--theme-mono-font);
  letter-spacing: .06em;
}
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-item {
  min-height: 40px;
  flex-direction: row;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #82a0b8;
  padding: 0 12px;
  font-size: 13px;
  line-height: 18px;
  text-align: left;
}
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-icon { width: 16px; height: 16px; flex-basis: 16px; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-label-text {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-count { display: inline-flex; justify-content: center; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-item:hover { border-color: var(--ui-line-strong); background: #0d1b2b; color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-item.active,
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-item.active:hover {
  border-color: #25d9e8;
  background: #25d9e8;
  color: #07111f;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-nav .nav-item.active .nav-count {
  background: rgba(7, 17, 31, .16);
  color: #07111f;
}

html[data-ui-style="nocturne"] body:not(.login-active) .metric-card { display: none; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-footer {
  border-top-color: var(--ui-line-strong);
  background: #050b14;
  padding-inline: 8px;
}
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-footer :is(.status-label, .status-meta, .model-label) { color: #6f8ba2; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-footer :is(.status-text, .model-card .status-text) { color: #eaf6ff; font-size: 11px; }
html[data-ui-style="nocturne"] body:not(.login-active) .sidebar-footer .model-config-button { color: #25d9e8; }

html[data-ui-style="nocturne"] body:not(.login-active) .desktop-topbar {
  height: var(--desktop-topbar-height);
  min-height: var(--desktop-topbar-height);
  border-bottom: 1px solid var(--ui-line-strong);
  background: rgba(7, 17, 31, .98);
  padding-inline: 28px;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) :is(.global-search-button, .account-button, .account-menu) {
  border-color: var(--ui-line-strong);
  background: #0d1b2b;
  color: #eaf6ff;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) .global-search-button:hover,
html[data-ui-style="nocturne"] body:not(.login-active) .account-button:hover { border-color: #25d9e8; background: #10263a; }
html[data-ui-style="nocturne"] body:not(.login-active) .global-search-button kbd { border-color: var(--ui-line-strong); background: #07111f; color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) .topbar-sync-status { color: #43d19e; font: 600 11px/16px var(--theme-mono-font); letter-spacing: .04em; }
html[data-ui-style="nocturne"] body:not(.login-active) .account-menu button { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .account-menu button:hover { background: #10263a; color: #25d9e8; }

html[data-ui-style="nocturne"] body:not(.login-active) .workspace { gap: 16px; padding: calc(var(--desktop-topbar-height) + 24px) 28px 32px; }
html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head { min-height: 72px; border-color: var(--ui-line-strong); padding-block: 4px 8px; }
html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head::before {
  content: "REPORT INTELLIGENCE / CHANNEL OPS";
  position: absolute;
  top: 4px;
  left: 0;
  color: #25d9e8;
  font: 600 11px/14px var(--theme-mono-font);
  letter-spacing: .06em;
  white-space: nowrap;
}
html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head > div:first-child { padding-top: 17px; }
html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head h1 { color: #eaf6ff; font-size: 30px; line-height: 38px; letter-spacing: -.025em; }
html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head p { max-width: 760px; margin-top: 3px; color: #82a0b8; font-size: 13px; line-height: 20px; }
html[data-ui-style="nocturne"] body:not(.login-active) .head-actions { gap: 8px; }

html[data-ui-style="nocturne"] body:not(.login-active) :is(.primary-button, .ghost-button, .report-action-btn, .period-button) { border-radius: 6px; }
html[data-ui-style="nocturne"] body:not(.login-active) .primary-button { border-color: #25d9e8; background: #25d9e8; color: #07111f; }
html[data-ui-style="nocturne"] body:not(.login-active) .primary-button:hover { border-color: #4be7f0; background: #4be7f0; }
html[data-ui-style="nocturne"] body:not(.login-active) .ghost-button { border-color: var(--ui-line-strong); background: #0d1b2b; color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .ghost-button:hover { border-color: #25d9e8; background: #10263a; color: #25d9e8; }

html[data-ui-style="nocturne"] body:not(.login-active) :is(.toolbar, .table-panel, .overview-panel, .today-panel, .report-panel, .data-protection-panel, .detail-panel) {
  border-color: var(--ui-line-strong);
  background: #0d1b2b;
  color: #eaf6ff;
  box-shadow: var(--ui-shadow-card);
}
html[data-ui-style="nocturne"] body:not(.login-active) :is(.panel-title, .overview-block-title, .report-panel-title, .detail-title, .table-panel-title) { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.panel-subtitle, .report-panel-subtitle, .row-meta, .cell-secondary, .field-hint, .empty-state) { color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.table-panel-head, .table-head, thead th) { border-color: var(--ui-line-strong); background: #10263a; color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(tbody tr, tbody td, .data-row) { border-color: var(--ui-line-strong); }
html[data-ui-style="nocturne"] body:not(.login-active) .data-table td { color: #d3e4ef; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.row-title, .table-row-title) { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .row-sub { color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.table-link, .action-link) { border-color: var(--ui-line-strong); background: #10263a; color: #25d9e8; }
html[data-ui-style="nocturne"] body:not(.login-active) tbody tr:hover { background: #10263a; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.text-input, .select-input, .textarea-input, .report-polish-input, .report-polish-select, .report-polish-textarea, .global-search-input) {
  border-color: var(--ui-line-strong);
  background: #07111f;
  color: #eaf6ff;
}
html[data-ui-style="nocturne"] body:not(.login-active) :is(input, textarea)::placeholder { color: #6f8ba2; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.report-polish-dialog, .preferences-dialog, .delete-confirm-dialog, .unsaved-confirm-dialog, .global-search-panel, .modal-card) {
  border-color: var(--ui-line-strong);
  background: #0d1b2b;
  color: #eaf6ff;
  box-shadow: var(--ui-shadow-panel);
}
html[data-ui-style="nocturne"] body:not(.login-active) :is(.report-polish-dialog-head, .detail-panel-head, .global-search-head) { border-color: var(--ui-line-strong); background: #0d1b2b; }
html[data-ui-style="nocturne"] body:not(.login-active) .motion-preference-options button:hover { border-color: #25d9e8; background: #10263a; }

html[data-ui-style="nocturne"] body:not(.login-active) .detail-scroll {
  background: #0d1b2b;
  scrollbar-color: #2f4a61 #0d1b2b;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(
  .related-item,
  .insight-card,
  .ai-extract-panel,
  .project-communication-card,
  .project-note-section,
  .project-note-create-action,
  .field-static,
  .db-detail-section,
  .db-field-row,
  .db-json,
  .customer-project-item,
  .business-summary-grid > div,
  .record-timeline,
  .record-timeline-item
) {
  border-color: var(--detail-line);
  background: #10263a;
  background-image: none;
  color: #eaf6ff;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(.project-communication-card, .record-timeline) {
  background: #0d1b2b;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .record-timeline-item {
  background: #163149;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .insight-card { border-left-color: #25d9e8; }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .insight-card:is(.warn, .warning) {
  border-left-color: #ffb547;
  background: #2b2118;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .insight-card:is(.risk, .danger, .error) {
  border-left-color: #ff786f;
  background: #331d24;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .insight-card:is(.ok, .healthy) {
  border-left-color: #43d19e;
  background: #12352f;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .insight-card.info {
  border-left-color: #25d9e8;
  background: #12354a;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(
  .insight-reason,
  .segmented-control
) {
  border-color: var(--ui-line-strong);
  background: rgba(7, 17, 31, .52);
  color: #d3e4ef;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(
  .detail-title,
  .field-static,
  .related-item strong,
  .insight-title,
  .customer-project-name,
  .business-summary-grid strong,
  .db-detail-title,
  .db-field-row strong,
  .project-communication-title,
  .project-note-create-title,
  .ai-extract-title,
  .record-timeline-head h3,
  .record-timeline-copy strong
) { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(
  .detail-subtitle,
  .field-label,
  .field-hint,
  .related-item span,
  .insight-subtitle,
  .customer-project-meta,
  .customer-project-next,
  .business-summary-grid span,
  .db-field-row span,
  .project-communication-meta,
  .project-communication-source,
  .project-note-create-subtitle,
  .ai-extract-subtitle,
  .ai-extract-message,
  .record-timeline-head > span,
  .record-timeline-section h4,
  .record-timeline-section h4 > span,
  .record-timeline-copy small,
  .record-timeline-meta,
  .record-timeline-labels small
) { color: #c6d9e6; }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(.record-timeline-section, .project-communication-meta) { border-color: var(--detail-line); }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(.ai-extract-message, .project-communication-meta) { border-color: var(--detail-line); }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(.field-input, .field-select, .field-textarea, .ai-extract-textarea) {
  border-color: var(--ui-line-strong);
  background: #07111f;
  color: #eaf6ff;
  color-scheme: dark;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel :is(.field-input, .field-select, .field-textarea):disabled {
  border-color: var(--ui-line-strong);
  background: #10263a;
  color: #82a0b8;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .field-inline-action {
  border-color: var(--ui-line-strong);
  background: #12354a;
  color: #25d9e8;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .field-inline-action:hover { border-color: #25d9e8; background: #16435d; }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .detail-message {
  border-color: var(--ui-line-strong);
  background: #12354a;
  color: #25d9e8;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .segment-button { color: #a8c0d2; }
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .segment-button.active {
  background: #25d9e8;
  color: #07111f;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .record-timeline-item:hover,
html[data-ui-style="nocturne"] body:not(.login-active) .detail-panel .record-timeline-item:focus-visible {
  border-color: #25d9e8;
  background: #12354a;
}

html[data-ui-style="nocturne"] body:not(.login-active) .report-layout { gap: 16px; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-generator-bar,
html[data-ui-style="nocturne"] body:not(.login-active) :is(.report-materials-card, .report-current-card, .report-timeline-card) {
  border-color: var(--ui-line-strong);
  background: #0d1b2b;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) .report-generator-bar { border-radius: 8px; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-generator-bar .report-panel-body { background: transparent; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-control-label { color: #82a0b8; font: 600 11px/15px var(--theme-mono-font); letter-spacing: .04em; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-segmented { border-color: var(--ui-line-strong); background: #07111f; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-segment { color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-segment.active { background: #25d9e8; color: #07111f; box-shadow: none; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.report-date-field, .report-source-item, .report-base-status) { border-color: var(--ui-line-strong); background: #10263a; color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-date-field input { color: #eaf6ff; color-scheme: dark; font-family: var(--theme-mono-font); }
html[data-ui-style="nocturne"] body:not(.login-active) .report-base-status strong { color: #25d9e8; }

html[data-ui-style="nocturne"] body:not(.login-active) .report-summary-strip.compact .report-summary-item {
  border-color: var(--ui-line-strong);
  background: #0d1b2b;
  color: #eaf6ff;
  box-shadow: none;
}
html[data-ui-style="nocturne"] body:not(.login-active) .report-summary-strip.compact .report-summary-item.active { border-color: #25d9e8; background: #10263a; box-shadow: inset 3px 0 #25d9e8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-summary-strip.compact .report-summary-item.report-summary-risk { border-color: #ffb547; background: #2b2118; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-filter-head { border-color: var(--ui-line-strong); }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-card { border-color: var(--ui-line-strong); background: #10263a; box-shadow: none; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-card:hover { border-color: #25d9e8; background: #123047; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-type { color: #25d9e8; font-family: var(--theme-mono-font); }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-title { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-material-tags span { border: 1px solid var(--ui-line-strong); background: #0d1b2b; color: #82a0b8; }

html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card { overflow: hidden; border: 2px solid #25d9e8; background: #0d1b2b; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card > :is(.report-panel-head, .report-panel-body) { background: #0d1b2b; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card > .report-panel-head { border-color: var(--ui-line-strong); }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-panel-title { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card :is(.report-panel-subtitle, .report-draft-status) { color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-current-source,
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-current-source:is(.base, .draft, .polished, .editing) {
  border-color: var(--ui-line-strong);
  background: #10263a;
}
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-current-source strong { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-current-source span { color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-draft-status { border-color: var(--ui-line-strong); background: #10263a; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card :is(.report-workflow, .report-preview-source-status) { border-color: var(--ui-line-strong); background: #10263a; color: #82a0b8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-action-btn { border-color: var(--ui-line-strong); background: #10263a; color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-action-btn:hover:not(:disabled) { border-color: #25d9e8; background: #123047; color: #25d9e8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-action-btn[data-report-action="edit-current"] { border-color: #25d9e8; background: #25d9e8; color: #07111f; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-current-card .report-action-btn[data-report-action="archive-final"] { border-color: #43d19e; background: #43d19e; color: #07111f; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-paper { border: 1px solid var(--ui-line-strong); background: #091522; color: #eaf6ff; box-shadow: none; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-paper :is(h1, h2, h3, h4, strong) { color: #eaf6ff; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-paper :is(h2, h3) { border-color: #25d9e8; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-paper :is(p, li) { color: #d3e4ef; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-edit-textarea { border-color: var(--ui-line-strong); background: #07111f; color: #eaf6ff; font-family: var(--theme-mono-font); }
html[data-ui-style="nocturne"] body:not(.login-active) .report-iterate-bar { border-color: var(--ui-line-strong); background: #10263a; }
html[data-ui-style="nocturne"] body:not(.login-active) :is(.report-polish-helper, .report-iterate-input) { border-color: var(--ui-line-strong); background: #07111f; color: #eaf6ff; }

html[data-ui-style="nocturne"] body:not(.login-active) .report-timeline-card > .report-panel-head { border-color: var(--ui-line-strong); background: #0d1b2b; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-timeline-item { border-color: var(--ui-line-strong); background: #10263a; box-shadow: none; }
html[data-ui-style="nocturne"] body:not(.login-active) .report-timeline-item:first-child { border-color: #43d19e; }
html[data-ui-style="nocturne"] body:not(.login-active) .site-icp-footer {
  border-color: rgba(47, 74, 97, .88);
  background: rgba(13, 27, 43, .9);
  color: #82a0b8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
}

@media (min-width: 961px) and (max-width: 1120px) {
  html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head,
  html[data-ui-style="nocturne"] body:not(.login-active) .app-shell.data-center-mode .workspace-head {
    flex-direction: row;
    align-items: flex-end;
  }

  html[data-ui-style="nocturne"] body:not(.login-active) .head-actions { width: auto; }
  html[data-ui-style="nocturne"] body:not(.login-active) .head-actions :is(.primary-button, .ghost-button) { flex: 0 0 auto; }
}

@media (max-width: 960px) {
  html[data-ui-style="nocturne"] body:not(.login-active) .workspace-head,
  html[data-ui-style="nocturne"] body:not(.login-active) .app-shell.data-center-mode .workspace-head {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 1440px) {

  html[data-ui-style="nocturne"] body:not(.login-active) .report-layout {
    width: 1184px;
    max-width: 100%;
    margin-inline: auto;
    grid-template-columns: 280px minmax(0, 620px) 236px;
    gap: 16px;
  }

  html[data-ui-style="nocturne"] body:not(.login-active) .report-generator-controls {
    grid-template-columns: 236px 336px minmax(0, 320px) 220px;
  }

  html[data-ui-style="nocturne"] body:not(.login-active) .report-generator-bar { grid-column: 1 / -1; }
  html[data-ui-style="nocturne"] body:not(.login-active) .report-workspace-grid { display: contents; }
}

@media (min-width: 1360px) and (max-width: 1439px) {
  html[data-ui-style="precision"] body:not(.login-active) .report-layout {
    width: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  html[data-ui-style="precision"] body:not(.login-active) .report-workspace-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
  }

  html[data-ui-style="precision"] body:not(.login-active) .report-timeline-card { grid-column: auto; }
}

@media (min-width: 1440px) {
  html[data-ui-style="precision"] body:not(.login-active) .report-layout {
    width: 1168px;
    max-width: 100%;
    margin-inline: auto;
    grid-template-columns: 300px minmax(0, 620px) 216px;
    gap: 16px;
  }

  html[data-ui-style="precision"] body:not(.login-active) .report-generator-bar { grid-column: 1 / -1; }
  html[data-ui-style="precision"] body:not(.login-active) .report-workspace-grid { display: contents; }
}

@media (max-width: 700px) {
  .ui-style-preference-options { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui-style="precision"] body:not(.login-active) .ui-style-preference-options button,
  html[data-ui-style="nocturne"] body:not(.login-active) .ui-style-preference-options button {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}

html[data-ui-style="precision"] body:not(.login-active).reduce-motion *,
html[data-ui-style="precision"] body:not(.login-active).reduce-motion *::before,
html[data-ui-style="precision"] body:not(.login-active).reduce-motion *::after,
html[data-ui-style="nocturne"] body:not(.login-active).reduce-motion *,
html[data-ui-style="nocturne"] body:not(.login-active).reduce-motion *::before,
html[data-ui-style="nocturne"] body:not(.login-active).reduce-motion *::after {
  scroll-behavior: auto !important;
  animation: none !important;
  transition-duration: .01ms !important;
}

/* A–C readability safeguards: no DOM or action changes. */
html[data-ui-style="precision"] body:not(.login-active) :is(.metric-value, .nav-count, time),
html[data-ui-style="nocturne"] body:not(.login-active) :is(.metric-value, .nav-count, time) {
  font-variant-numeric: tabular-nums;
}

html[data-ui-style="precision"] body:not(.login-active) :is(.record-summary, .detail-copy, .report-content, .report-paper p),
html[data-ui-style="nocturne"] body:not(.login-active) :is(.record-summary, .detail-copy, .report-content, .report-paper p) {
  line-height: 1.5;
}

html[data-ui-style="precision"] body:not(.login-active) :is(button, a, input, select, textarea):focus-visible,
html[data-ui-style="nocturne"] body:not(.login-active) :is(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
}

html[data-ui-style="precision"] body:not(.login-active) .preferences-dialog,
html[data-ui-style="nocturne"] body:not(.login-active) .preferences-dialog {
  overflow-y: auto;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui-style="precision"] body:not(.login-active) *,
  html[data-ui-style="precision"] body:not(.login-active) *::before,
  html[data-ui-style="precision"] body:not(.login-active) *::after,
  html[data-ui-style="nocturne"] body:not(.login-active) *,
  html[data-ui-style="nocturne"] body:not(.login-active) *::before,
  html[data-ui-style="nocturne"] body:not(.login-active) *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition-duration: .01ms !important;
  }

  html[data-ui-style="precision"] body:not(.login-active) .table-panel,
  html[data-ui-style="nocturne"] body:not(.login-active) .table-panel {
    transform: none;
  }
}

html[data-ui-style="precision"] body:not(.login-active) .overview-stage-matrix-row {
  border-color: var(--ui-brand);
  background: var(--ui-surface);
}

html[data-ui-style="precision"] body:not(.login-active) .overview-stage-index {
  border-radius: 6px;
  border-color: var(--ui-brand);
  color: var(--ui-brand);
}

html[data-ui-style="precision"] body:not(.login-active) .overview-stage-share-track i { background: var(--ui-brand); }
html[data-ui-style="precision"] body:not(.login-active) .overview-stage-signal { color: var(--ui-text-secondary); }

html[data-ui-style="nocturne"] body:not(.login-active) .overview-stage-matrix-row {
  border-color: var(--ui-brand);
  background: var(--ui-surface-muted);
}

html[data-ui-style="nocturne"] body:not(.login-active) .overview-stage-index { color: var(--ui-text); }

html[data-ui-style="nocturne"] body:not(.login-active) .overview-stage-share em { color: var(--ui-text); }

html[data-ui-style="nocturne"] body:not(.login-active) .overview-stage-share-track i { background: var(--ui-brand); }
html[data-ui-style="nocturne"] body:not(.login-active) .overview-stage-signal { color: var(--ui-text-secondary); }

/* Nocturne page-completeness safeguards: keep legacy light report/status components on the dark surface. */
html[data-ui-style="nocturne"] body:not(.login-active) :is(.today-action-order, .today-action-primary, .overview-summary-action) {
  color: #07111f;
}

html[data-ui-style="nocturne"] body:not(.login-active) :is(
  .report-classification-panel, .report-classification-row select,
  .report-empty, .report-center-item, .report-center-source-tags span,
  .report-badge.light, .report-version-item, .report-material-tags span
) {
  border-color: var(--ui-line-strong);
  background: #10263a;
  color: #eaf6ff;
}

html[data-ui-style="nocturne"] body:not(.login-active) :is(
  .report-classification-panel strong, .report-classification-row strong,
  .report-empty strong, .report-center-title-row strong, .report-version-main strong
) {
  color: #eaf6ff;
}

html[data-ui-style="nocturne"] body:not(.login-active) :is(
  .report-date-field span, .report-classification-head span, .report-classification-row small,
  .report-empty span, .report-center-meta, .report-center-main p,
  .report-version-main span, .report-version-main p, .report-timeline-time
) {
  color: #a8c0d2;
}

html[data-ui-style="nocturne"] body:not(.login-active) .report-timeline-kind { color: #a5f0d2; }

html[data-ui-style="nocturne"] body:not(.login-active) :is(
  .report-badge, .report-material-tags span, .report-material-type, .report-material-filter-head span
) {
  border-color: var(--ui-line-strong);
  background: #163149;
  color: #d3e4ef;
}
