/* ============================================================
   DATANITIV COMMAND CENTER — premium theme overlay
   Loads AFTER styles.css. Additive only: re-skins existing
   class names, adds an animation system, and never changes
   layout mechanics that app.js depends on (sticky columns,
   frozen offsets, conic donut, inline accent colors).
   ============================================================ */

/* ---------- 1. Design tokens ---------- */

:root {
  color-scheme: dark;
  --bg-main: #070d18;
  --bg-page: #08111f;
  --bg-panel: #0d1624;
  --bg-card: #101a2a;
  --bg-card-soft: #131e31;
  --bg-control: #0a1322;
  --text-primary: #f4f7fb;
  --text-secondary: #aab7cc;
  --text-muted: #6f7f99;
  --text-disabled: #46566f;
  --border-subtle: rgba(148, 163, 184, 0.18);
  --border-medium: rgba(148, 163, 184, 0.28);
  --border-strong: rgba(148, 163, 184, 0.38);
  --accent-primary: #2dd4ff;
  --accent-primary-soft: rgba(45, 212, 255, 0.14);
  --accent-primary-glow: rgba(45, 212, 255, 0.35);
  --accent-success: #3ee6c4;
  --accent-success-soft: rgba(62, 230, 196, 0.14);
  --accent-warning: #f5b84b;
  --accent-warning-soft: rgba(245, 184, 75, 0.14);
  --accent-critical: #ff4d8d;
  --accent-critical-soft: rgba(255, 77, 141, 0.14);
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.28);
  --shadow-panel: 0 18px 42px rgba(0, 0, 0, 0.35);

  --bg: var(--bg-main);
  --panel: var(--bg-panel);
  --panel-2: var(--bg-card);
  --line: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-primary);
  --cyan: var(--accent-primary);
  --amber: var(--accent-warning);
  --red: var(--accent-critical);
  --magenta: var(--accent-critical);
  --purple: #8b7cf6;
  --violet: #8b7cf6;
  --teal: var(--accent-success);
  --stripe: rgba(255, 255, 255, 0.03);
  --table-bg: rgba(4, 8, 16, 0.35);
  --th-bg: #111c2d;
  --hover-bg: rgba(45, 212, 255, 0.08);
  --modal-mask: rgba(2, 5, 12, 0.66);

  --cc-radius: 6px;
  --cc-radius-sm: 4px;
  --cc-ease: cubic-bezier(0.22, 0.9, 0.3, 1);
  --cc-shadow-1: var(--shadow-card);
  --cc-shadow-2: var(--shadow-panel);
  --cc-shadow-3: 0 24px 90px -18px rgba(0, 0, 0, 0.75);
  --cc-card-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 40%);
  --cc-grad-primary: linear-gradient(135deg, var(--accent-primary), color-mix(in srgb, var(--accent-primary), #ffffff 8%));
  --cc-glow-blue: 0 0 0 1px color-mix(in srgb, var(--accent-primary), transparent 55%), 0 8px 30px -8px color-mix(in srgb, var(--accent-primary), transparent 55%);
}

body.light {
  color-scheme: light;
  --bg-main: #f7f6f3;
  --bg-page: #fbfbfa;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-soft: #f9f9f8;
  --bg-control: #ffffff;
  --text-primary: #2f3437;
  --text-secondary: #787774;
  --text-muted: #9b9a97;
  --text-disabled: #b7b5b0;
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-medium: rgba(0, 0, 0, 0.11);
  --border-strong: rgba(0, 0, 0, 0.16);
  --accent-primary: #1f6c9f;
  --accent-primary-soft: #e1f3fe;
  --accent-primary-glow: rgba(31, 108, 159, 0.16);
  --accent-success: #346538;
  --accent-success-soft: #edf3ec;
  --accent-warning: #956400;
  --accent-warning-soft: #fbf3db;
  --accent-critical: #9f2f2d;
  --accent-critical-soft: #fdebec;
  --shadow-card: 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-panel: 0 2px 8px rgba(17, 17, 17, 0.055);

  --bg: var(--bg-main);
  --panel: var(--bg-panel);
  --panel-2: var(--bg-card-soft);
  --line: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-primary);
  --cyan: var(--accent-primary);
  --amber: var(--accent-warning);
  --red: var(--accent-critical);
  --magenta: var(--accent-critical);
  --purple: var(--accent-warning);
  --violet: var(--accent-warning);
  --teal: var(--accent-success);
  --stripe: rgba(28, 56, 102, 0.04);
  --table-bg: #ffffff;
  --th-bg: #f7f6f3;
  --hover-bg: #f4f8fb;
  --modal-mask: rgba(13, 26, 48, 0.45);

  --cc-shadow-1: var(--shadow-card);
  --cc-shadow-2: var(--shadow-panel);
  --cc-shadow-3: 0 18px 46px rgba(47, 52, 55, 0.16);
  --cc-card-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 40%);
  --cc-grad-primary: linear-gradient(135deg, #1f6c9f, #3f7da5);
  --cc-glow-blue: 0 0 0 1px rgba(31, 108, 159, 0.16);
}

/* ---------- 2. Base surface & typography ---------- */

body {
  font-family: "Plus Jakarta Sans", "Segoe UI Variable", "Segoe UI", sans-serif;
  background:
    radial-gradient(900px 520px at 82% -8%, color-mix(in srgb, var(--accent-primary), transparent 91%), transparent 62%),
    radial-gradient(720px 480px at -8% 110%, rgba(148, 163, 184, 0.06), transparent 62%),
    linear-gradient(135deg, var(--bg-main), var(--bg-page));
  background-attachment: fixed;
}

body::before {
  opacity: 0.22;
  background:
    linear-gradient(110deg, transparent 0 38%, rgba(45, 212, 255, 0.08) 39%, transparent 41% 100%),
    repeating-linear-gradient(90deg, rgba(148, 163, 184, 0.035) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.025) 0 1px, transparent 1px 72px);
}

body::after {
  opacity: 0.12;
  background:
    radial-gradient(circle at 26% 38%, rgba(45, 212, 255, 0.26) 0 1px, transparent 2px),
    radial-gradient(circle at 66% 18%, rgba(148, 163, 184, 0.2) 0 1px, transparent 2px);
}

h1, h2, h3 {
  letter-spacing: -0.01em;
}

.topbar h1 {
  font-size: 27px;
  font-weight: 800;
  background: linear-gradient(100deg, var(--text-primary) 34%, color-mix(in srgb, var(--accent-primary), var(--text-primary) 18%) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}

:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 3. Boot loader ---------- */

#ccBootLoader {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(800px 500px at 50% 30%, color-mix(in srgb, var(--blue), transparent 88%), transparent 65%),
    var(--bg);
  color: var(--text);
  transition: opacity 0.45s ease;
}

#ccBootLoader.done {
  opacity: 0;
  pointer-events: none;
}

#ccBootLoader img {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  animation: ccPulse 1.6s ease-in-out infinite;
}

#ccBootLoader strong {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

#ccBootLoader span {
  color: var(--muted);
  font-size: 13px;
}

#ccBootLoader .cc-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--blue), transparent 78%);
  border-top-color: var(--blue);
  animation: ccSpin 0.9s linear infinite;
}

/* ---------- 4. Sidebar ---------- */

.sidebar {
  background: linear-gradient(190deg, color-mix(in srgb, var(--panel), var(--blue) 4%), var(--panel) 38%);
  border-right: 1px solid color-mix(in srgb, var(--line), transparent 20%);
}

.brand-mark {
  box-shadow: 0 8px 26px color-mix(in srgb, var(--blue), transparent 60%);
}

.brand h1 {
  font-weight: 800;
}

.filter-section h2 {
  font-weight: 800;
}

select,
input[type="number"],
input[type="search"],
input[type="file"],
.filter-multi-toggle {
  border-radius: var(--cc-radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

select:hover,
input[type="number"]:hover,
input[type="search"]:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 40%);
}

select:focus,
input[type="number"]:focus,
input[type="search"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue), transparent 84%);
}

/* ---------- 5. Buttons ---------- */

.mode-button,
#resetButton,
#refreshButton,
#uploadButton,
.sidebar-toggle,
.font-toggle,
.export-button,
.guide-button,
.threshold-mode-button {
  border-radius: var(--cc-radius-sm);
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease,
    transform 0.16s var(--cc-ease), box-shadow 0.16s ease;
  font-weight: 650;
}

.sidebar-toggle,
.guide-button {
  border-radius: 999px;
}

.mode-button:hover,
#resetButton:hover,
#refreshButton:hover,
#uploadButton:hover,
.export-button:hover,
.tab:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 30%);
  background: var(--hover-bg);
}

.mode-button:active,
#resetButton:active,
#uploadButton:active,
.export-button:active,
.tab:active,
.metric-card:active,
.movement-card:active {
  transform: scale(0.985);
}

#uploadButton,
.auditor-access-actions .primary,
#processUploadButton {
  border: 0;
  background: var(--cc-grad-primary);
  color: #fff;
  font-weight: 750;
  box-shadow: 0 6px 22px -8px color-mix(in srgb, var(--blue), transparent 35%);
}

#uploadButton:hover,
.auditor-access-actions .primary:hover,
#processUploadButton:hover {
  background: var(--cc-grad-primary);
  filter: brightness(1.08);
  box-shadow: 0 10px 28px -8px color-mix(in srgb, var(--blue), transparent 25%);
  transform: translateY(-1px);
}

.section-actions #uploadButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 156px;
  margin-top: 0;
  padding: 0 14px;
  white-space: nowrap;
}

/* ---------- 6. Tabs: segmented command bar ---------- */

.tabs {
  position: relative;
  isolation: isolate;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(55, 231, 255, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 50%),
    var(--bg-card);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(45, 212, 255, 0.05),
    var(--shadow-card);
  margin-top: 20px;
  overflow-x: auto;
}

.tabs::before,
.tabs::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
}

.tabs::before {
  inset: 1px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(45, 212, 255, 0.08) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, rgba(148, 163, 184, 0.045) 0 1px, transparent 1px 18px);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  opacity: 0.38;
}

.tabs::after {
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(45, 212, 255, 0.72), transparent);
  box-shadow: 0 0 16px rgba(45, 212, 255, 0.24);
  opacity: 0.62;
}

.tab {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  color: var(--text-secondary);
  text-shadow: none;
  transition:
    transform 520ms cubic-bezier(0.32, 0.72, 0, 1),
    color 520ms cubic-bezier(0.32, 0.72, 0, 1),
    background 520ms cubic-bezier(0.32, 0.72, 0, 1),
    box-shadow 520ms cubic-bezier(0.32, 0.72, 0, 1);
}

.tab::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -2;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent 10%, rgba(245, 253, 255, 0.9) 48%, rgba(255, 255, 255, 0.68) 50%, rgba(245, 253, 255, 0.9) 52%, transparent 90%) top / 100% 2px no-repeat,
    linear-gradient(180deg, rgba(245, 253, 255, 0.86), rgba(45, 212, 255, 0.86) 14%, rgba(17, 91, 116, 0.9) 48%, rgba(255, 255, 255, 0.12)),
    linear-gradient(90deg, rgba(5, 39, 57, 0.95), rgba(45, 212, 255, 0.96), rgba(5, 39, 57, 0.95));
  opacity: 0;
  transform: scaleX(0.78) scaleY(0.88);
  transition:
    opacity 520ms cubic-bezier(0.32, 0.72, 0, 1),
    transform 520ms cubic-bezier(0.32, 0.72, 0, 1);
}

.tab::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 253, 255, 0.18), transparent 42%),
    linear-gradient(135deg, rgba(8, 24, 40, 0.98), rgba(10, 18, 32, 0.94));
  opacity: 0;
  transition: opacity 520ms cubic-bezier(0.32, 0.72, 0, 1);
}

.tab:hover {
  color: var(--text-primary);
  background: var(--accent-primary-soft);
  transform: translateY(-1px);
}

.tab.active {
  color: #fff;
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 12px 26px rgba(45, 212, 255, 0.16),
    0 0 30px rgba(45, 212, 255, 0.16);
  text-shadow: 0 0 14px rgba(45, 212, 255, 0.35);
  transform: translateY(-2px);
}

.tab.active::before,
.tab.active::after {
  opacity: 1;
  transform: scaleX(1) scaleY(1);
}

body.light .tab.active {
  color: #0f172a;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.72),
    0 13px 30px rgba(37, 99, 235, 0.16),
    0 0 38px rgba(219, 39, 119, 0.15);
  text-shadow: none;
}

body.light .tabs {
  border-color: rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(239, 246, 255, 0.82)),
    rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 18px 42px rgba(15, 23, 42, 0.08);
}

body.light .tabs::before {
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0 1px, transparent 1px 72px),
    linear-gradient(180deg, rgba(15, 23, 42, 0.045) 0 1px, transparent 1px 18px);
}

body.light .tabs::after {
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.58), rgba(219, 39, 119, 0.58), transparent);
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.2);
}

body.light .tab {
  color: rgba(54, 70, 101, 0.84);
}

body.light .tab:hover {
  color: #15233d;
  background: rgba(37, 99, 235, 0.07);
}

body.light .tab::after {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.78), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(239, 246, 255, 0.9));
}

/* ---------- 7. Cards & panels ---------- */

.metric-card,
.executive-card,
.overview-block,
.auditor-panel,
.movement-card,
.audit-bucket,
.freshness-badge,
.active-card-filter,
.auditor-filter-strip,
footer {
  border-radius: var(--cc-radius);
}

.metric-card,
.executive-card,
.overview-block,
.auditor-panel {
  border-color: var(--border-subtle);
  background:
    var(--cc-card-sheen),
    linear-gradient(180deg, var(--bg-card), color-mix(in srgb, var(--bg-card), #000 10%));
  box-shadow: var(--shadow-card);
}

.overview-block,
.auditor-panel {
  overflow: visible;
}

.block-head {
  min-height: 30px;
  align-items: start;
  gap: 12px;
  padding-top: 2px;
}

.block-head h3 {
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
}

.block-head span {
  line-height: 1.25;
}

.movement-card,
.audit-bucket {
  background: var(--cc-card-sheen), var(--panel-2);
}

.metric-card,
.executive-card,
.movement-card {
  transition: transform 0.18s var(--cc-ease), box-shadow 0.18s ease, border-color 0.18s ease;
}

.metric-card:hover,
.executive-card[data-kpi-tab]:hover,
.movement-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent-primary), var(--border-medium) 54%);
  box-shadow: var(--shadow-panel);
}

.executive-card[data-kpi-tab] {
  cursor: pointer;
}

/* tone washes — meaning-bearing, subtle */
.executive-card.good,
.movement-card.good,
.audit-bucket.good {
  background: linear-gradient(180deg, var(--accent-success-soft), transparent 52%), var(--bg-card);
}

.executive-card.warn,
.movement-card.warn,
.audit-bucket.warn {
  background: linear-gradient(180deg, var(--accent-warning-soft), transparent 52%), var(--bg-card);
}

.executive-card.bad,
.movement-card.bad,
.audit-bucket.bad {
  background: linear-gradient(180deg, var(--accent-critical-soft), transparent 52%), var(--bg-card);
}

.executive-card.neutral,
.movement-card.neutral,
.audit-bucket.neutral {
  background: linear-gradient(180deg, var(--accent-primary-soft), transparent 52%), var(--bg-card);
}

/* Reusable metallic dashboard rim.
   Color controls:
   --metal-base = dark edge tone
   --metal-mid = main rim color
   --metal-highlight = bright colored rim highlight
   --metal-reflection = near-white specular streak
   --metal-glow = soft outer glow. */
.metal-border,
.metal-rim-card {
  --metal-base: rgba(5, 39, 57, 0.94);
  --metal-mid: rgba(22, 164, 196, 0.58);
  --metal-highlight: rgba(45, 212, 255, 0.92);
  --metal-reflection: rgba(245, 253, 255, 0.9);
  --metal-glow: rgba(45, 212, 255, 0.24);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--metal-mid), transparent 64%);
  border-top: 0;
  background:
    radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--metal-mid), transparent 88%), transparent 55%),
    linear-gradient(180deg, rgba(16, 28, 58, 0.78), rgba(6, 14, 33, 0.84));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 20px 44px rgba(0, 0, 0, 0.22),
    0 0 32px color-mix(in srgb, var(--metal-glow), transparent 24%),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -18px 34px rgba(0, 0, 0, 0.2);
}

.metal-border::before,
.metal-rim-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background:
    linear-gradient(90deg, transparent 8%, var(--metal-reflection) 47%, rgba(255, 255, 255, 0.72) 50%, var(--metal-reflection) 53%, transparent 92%) top / 100% 2px no-repeat,
    linear-gradient(180deg, var(--metal-reflection) 0%, var(--metal-highlight) 7%, var(--metal-mid) 18%, color-mix(in srgb, var(--metal-base), transparent 18%) 47%, rgba(255, 255, 255, 0.11) 100%),
    linear-gradient(90deg, color-mix(in srgb, var(--metal-base), transparent 12%), var(--metal-highlight), color-mix(in srgb, var(--metal-base), transparent 12%));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.metal-border::after,
.metal-rim-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  pointer-events: none;
  border-radius: calc(var(--cc-radius) - 1px);
  background:
    radial-gradient(70% 28% at 50% 0%, color-mix(in srgb, var(--metal-reflection), transparent 22%), transparent 64%),
    linear-gradient(112deg, transparent 0 25%, color-mix(in srgb, var(--metal-reflection), transparent 84%) 39%, transparent 54%),
    linear-gradient(180deg, color-mix(in srgb, var(--metal-highlight), transparent 88%) 0%, transparent 42%);
  opacity: 0.82;
}

.metal-border > *,
.metal-rim-card > * {
  position: relative;
  z-index: 1;
}

.metal-border:hover,
.metal-rim-card:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.045),
    0 22px 48px rgba(0, 0, 0, 0.25),
    0 0 42px color-mix(in srgb, var(--metal-glow), transparent 4%),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -18px 34px rgba(0, 0, 0, 0.22);
}

.metal-border--amber,
.metric-card--orange,
.metric-card--gold {
  --metal-base: rgba(75, 38, 4, 0.95);
  --metal-mid: rgba(219, 126, 19, 0.64);
  --metal-highlight: rgba(255, 184, 42, 0.96);
  --metal-reflection: rgba(255, 247, 221, 0.95);
  --metal-glow: rgba(255, 170, 26, 0.28);
}

.metal-border--cyan,
.metric-card--cyan,
.metric-card--blue {
  --metal-base: rgba(4, 43, 66, 0.95);
  --metal-mid: rgba(18, 176, 218, 0.64);
  --metal-highlight: rgba(76, 238, 255, 0.96);
  --metal-reflection: rgba(231, 253, 255, 0.95);
  --metal-glow: rgba(55, 231, 255, 0.28);
}

.metric-card--purple,
.metric-card--violet {
  --metal-base: rgba(40, 21, 83, 0.95);
  --metal-mid: rgba(130, 92, 255, 0.62);
  --metal-highlight: rgba(183, 148, 255, 0.96);
  --metal-reflection: rgba(247, 240, 255, 0.95);
  --metal-glow: rgba(138, 92, 255, 0.3);
}

.metal-border--success,
.metric-card--green,
.metric-card--emerald {
  --metal-base: rgba(5, 56, 45, 0.95);
  --metal-mid: rgba(20, 178, 134, 0.62);
  --metal-highlight: rgba(55, 237, 182, 0.95);
  --metal-reflection: rgba(229, 255, 247, 0.95);
  --metal-glow: rgba(25, 220, 167, 0.26);
}

.metal-border--critical,
.metric-card--red,
.metric-card--crimson {
  --metal-base: rgba(80, 14, 30, 0.95);
  --metal-mid: rgba(224, 52, 85, 0.62);
  --metal-highlight: rgba(255, 91, 126, 0.96);
  --metal-reflection: rgba(255, 232, 238, 0.95);
  --metal-glow: rgba(255, 73, 112, 0.28);
}

.executive-card strong,
.metric-card .value,
.movement-card strong,
.audit-bucket strong,
.audited-kpi strong,
.audited-donut strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.executive-card strong {
  font-weight: 750;
}

.metric-card .value {
  font-weight: 750;
}

.freshness-badge {
  box-shadow: var(--cc-shadow-1);
}

/* ---------- 8. Tables ---------- */

.table-wrap {
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow-1);
}

th {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.9px;
}

tbody tr {
  transition: background-color 0.12s ease;
}

tbody tr:hover td {
  background: var(--hover-bg);
}

/* keep frozen-column cells opaque on hover so sticky columns don't bleed */
.sticky-key-table tbody tr:hover td:first-child {
  background: color-mix(in srgb, var(--hover-bg), var(--panel) 35%);
}

.client-link {
  transition: color 0.12s ease;
}

/* ---------- 9. Modals & drawers ---------- */

.modal-backdrop,
.guide-backdrop {
  backdrop-filter: blur(7px) saturate(1.1);
  -webkit-backdrop-filter: blur(7px) saturate(1.1);
}

.modal.open .modal-backdrop,
.guide-drawer.open .guide-backdrop {
  animation: ccFadeIn 0.24s ease both;
}

.modal-panel {
  border-radius: var(--cc-radius);
  box-shadow: var(--cc-shadow-3);
}

.modal.open .modal-panel {
  animation: ccModalIn 0.28s var(--cc-ease) both;
}

.guide-panel {
  box-shadow: var(--cc-shadow-3);
}

.guide-drawer.open .guide-panel {
  animation: ccDrawerIn 0.32s var(--cc-ease) both;
}

.modal-head {
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue), transparent 95%), transparent);
}

/* ---------- 10. Animation system ---------- */

@keyframes ccFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ccPanelIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes ccCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes ccModalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes ccDrawerIn {
  from { opacity: 0.4; transform: translateX(48px); }
  to { opacity: 1; transform: none; }
}

@keyframes ccGrowX {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes ccSpin {
  to { transform: rotate(360deg); }
}

@keyframes ccPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.07); opacity: 0.85; }
}

.panel.active {
  animation: ccPanelIn 0.3s var(--cc-ease) both;
}

/* staggered KPI entrances (replays when app.js re-renders = live feedback) */
#executiveKpis .executive-card,
#cards .metric-card,
#auditorKpis .executive-card,
.weekly-movement .movement-card {
  animation: ccCardIn 0.38s var(--cc-ease) both;
}

#executiveKpis .executive-card:nth-child(2),
#cards .metric-card:nth-child(2),
#auditorKpis .executive-card:nth-child(2),
.weekly-movement .movement-card:nth-child(2) { animation-delay: 0.04s; }

#executiveKpis .executive-card:nth-child(3),
#cards .metric-card:nth-child(3),
#auditorKpis .executive-card:nth-child(3),
.weekly-movement .movement-card:nth-child(3) { animation-delay: 0.08s; }

#executiveKpis .executive-card:nth-child(4),
#cards .metric-card:nth-child(4),
#auditorKpis .executive-card:nth-child(4),
.weekly-movement .movement-card:nth-child(4) { animation-delay: 0.12s; }

#executiveKpis .executive-card:nth-child(5),
#cards .metric-card:nth-child(5),
#auditorKpis .executive-card:nth-child(5),
.weekly-movement .movement-card:nth-child(5) { animation-delay: 0.16s; }

#executiveKpis .executive-card:nth-child(6),
#cards .metric-card:nth-child(6),
.weekly-movement .movement-card:nth-child(6) { animation-delay: 0.2s; }

#executiveKpis .executive-card:nth-child(7),
#cards .metric-card:nth-child(7),
.weekly-movement .movement-card:nth-child(7) { animation-delay: 0.24s; }

.pareto-bar {
  transform-origin: left center;
  animation: ccGrowX 0.55s var(--cc-ease) both;
}

.audited-donut {
  transition: transform 0.2s var(--cc-ease), box-shadow 0.2s ease;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.4);
}

.audited-donut:hover {
  transform: scale(1.03);
}

/* ============================================================
   POPUP & DRILL-THROUGH REDESIGN
   Unified treatment for every modal/drawer: client drill-through,
   exemptions, exemption form, director portfolio, migration
   evidence, audited clients, auditor detail, access gate.
   ============================================================ */

/* ---------- 12. Modal chrome ---------- */

.modal-head > div > span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 2px;
}

#modalClose,
#directorModalClose,
#auditorDetailClose,
#auditedClientsClose,
#exemptionsClose,
#migrationEvidenceClose,
#guideClose,
#auditorsGuideClose,
#uploadClose,
[data-close-auditor-access][aria-label],
[data-close-exemption-form][aria-label] {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    transform 0.22s var(--cc-ease);
}

#modalClose:hover,
#directorModalClose:hover,
#auditorDetailClose:hover,
#auditedClientsClose:hover,
#exemptionsClose:hover,
#migrationEvidenceClose:hover,
#guideClose:hover,
#auditorsGuideClose:hover,
#uploadClose:hover,
[data-close-auditor-access][aria-label]:hover,
[data-close-exemption-form][aria-label]:hover {
  color: var(--red);
  border-color: color-mix(in srgb, var(--red), var(--line) 45%);
  background: color-mix(in srgb, var(--red), transparent 90%);
  transform: rotate(90deg);
}

/* ---------- 13. Drill-through chips ---------- */

.modal-meta .pill {
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, transform 0.15s var(--cc-ease), box-shadow 0.15s ease;
  animation: ccCardIn 0.32s var(--cc-ease) both;
}

.modal-meta .pill:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 35%);
  transform: translateY(-1px);
  box-shadow: var(--cc-shadow-1);
}

.modal-meta .pill:nth-child(2) { animation-delay: 0.03s; }
.modal-meta .pill:nth-child(3) { animation-delay: 0.06s; }
.modal-meta .pill:nth-child(4) { animation-delay: 0.09s; }
.modal-meta .pill:nth-child(5) { animation-delay: 0.12s; }
.modal-meta .pill:nth-child(6) { animation-delay: 0.15s; }
.modal-meta .pill:nth-child(7) { animation-delay: 0.18s; }
.modal-meta .pill:nth-child(8) { animation-delay: 0.21s; }

.modal-meta .chip-label {
  color: var(--muted);
  font-weight: 600;
}

/* ---------- 14. Diagnostic tiles, insight cards, evidence cards ---------- */

.diagnostic-summary article {
  border-radius: var(--cc-radius-sm);
  background: var(--cc-card-sheen), var(--panel);
  transition: border-color 0.16s ease, transform 0.16s var(--cc-ease), box-shadow 0.16s ease;
  animation: ccCardIn 0.36s var(--cc-ease) both;
}

.diagnostic-summary article:nth-child(2) { animation-delay: 0.05s; }
.diagnostic-summary article:nth-child(3) { animation-delay: 0.1s; }
.diagnostic-summary article:nth-child(4) { animation-delay: 0.15s; }
.diagnostic-summary article:nth-child(5) { animation-delay: 0.2s; }

.diagnostic-summary article:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 40%);
  transform: translateY(-2px);
  box-shadow: var(--cc-shadow-1);
}

.insight-card {
  border-radius: var(--cc-radius-sm);
  transition: transform 0.18s var(--cc-ease), box-shadow 0.18s ease;
  animation: ccCardIn 0.4s var(--cc-ease) both;
}

.insight-card:nth-child(2) { animation-delay: 0.07s; }
.insight-card:nth-child(3) { animation-delay: 0.14s; }

.insight-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--cc-shadow-2);
}

.insight-card.good { background: linear-gradient(180deg, color-mix(in srgb, var(--teal), transparent 94%), transparent 45%), var(--panel); }
.insight-card.warn { background: linear-gradient(180deg, color-mix(in srgb, var(--amber), transparent 94%), transparent 45%), var(--panel); }
.insight-card.bad { background: linear-gradient(180deg, color-mix(in srgb, var(--red), transparent 94%), transparent 45%), var(--panel); }

.insight-card ul li::marker {
  color: var(--blue);
}

.diagnostic-card {
  border-radius: var(--cc-radius-sm);
  background: var(--cc-card-sheen), var(--panel);
  transition: transform 0.18s var(--cc-ease), box-shadow 0.18s ease;
  animation: ccCardIn 0.4s var(--cc-ease) both;
}

.diagnostic-card:nth-child(2) { animation-delay: 0.06s; }
.diagnostic-card:nth-child(3) { animation-delay: 0.12s; }
.diagnostic-card:nth-child(4) { animation-delay: 0.18s; }
.diagnostic-card:nth-child(5) { animation-delay: 0.24s; }
.diagnostic-card:nth-child(6) { animation-delay: 0.3s; }

.diagnostic-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--cc-shadow-2);
}

.empty-state {
  border: 1.5px dashed var(--line);
  border-radius: var(--cc-radius-sm);
  padding: 22px;
  text-align: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2), transparent 40%);
}

/* ---------- 15. Exemptions: client-modal section ---------- */

.modal-exemption-actions button {
  border: 1px solid color-mix(in srgb, var(--blue), var(--line) 45%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue), var(--panel) 90%);
  color: var(--text);
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease,
    transform 0.16s var(--cc-ease), box-shadow 0.16s ease;
}

.modal-exemption-actions button:hover {
  border-color: transparent;
  background: var(--cc-grad-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--blue), transparent 35%);
}

.modal-exemption-list article {
  border-radius: var(--cc-radius-sm);
  transition: border-color 0.15s ease, transform 0.15s var(--cc-ease);
  animation: ccCardIn 0.32s var(--cc-ease) both;
}

.modal-exemption-list article:hover {
  border-color: color-mix(in srgb, var(--amber), var(--line) 45%);
  transform: translateY(-1px);
}

/* ---------- 16. Exemptions modal: summary + remove flow ---------- */

.summary-pill {
  border-radius: 999px;
  transition: transform 0.15s var(--cc-ease), box-shadow 0.15s ease;
  animation: ccCardIn 0.32s var(--cc-ease) both;
}

.summary-pill:nth-child(2) { animation-delay: 0.05s; }
.summary-pill:nth-child(3) { animation-delay: 0.1s; }
.summary-pill:nth-child(4) { animation-delay: 0.15s; }

.summary-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--cc-shadow-1);
}

.remove-exemption {
  border-radius: 999px;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.remove-exemption:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.remove-exemption.confirming {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
  animation: ccPulse 1s ease-in-out infinite;
}

/* ---------- 17. Exemption form modal ---------- */

.exemption-form-modal {
  z-index: 125;
}

.exemption-form-panel {
  inset: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px));
  max-height: min(86vh, 760px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

/* translate-centered panels must not run ccModalIn (it ends at
   transform: none, which would wipe their centering translate) */
.exemption-form-modal.open .exemption-form-panel,
.auditor-access-modal.open .auditor-access-panel {
  animation: ccFadeIn 0.26s ease both;
}

.exemption-form {
  display: grid;
  gap: 16px;
  padding: 20px 22px 24px;
  overflow-y: auto;
}

.exemption-form-notice {
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--amber), var(--line) 40%);
  border-radius: var(--cc-radius-sm);
  background: color-mix(in srgb, var(--amber), transparent 90%);
  color: var(--amber);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.45;
}

.exemption-form-field {
  margin-bottom: 0;
}

.exemption-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.exemption-form textarea,
.exemption-form input[type="file"],
.exemption-form input[type="date"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--cc-radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.exemption-form input[type="date"] {
  min-height: 38px;
  padding: 0 12px;
}

.exemption-form textarea:focus,
.exemption-form input[type="file"]:focus,
.exemption-form input[type="date"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue), transparent 84%);
}

.exemption-form-metrics {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--cc-radius-sm);
  background: color-mix(in srgb, var(--panel-2), transparent 30%);
}

.exemption-form-metrics legend {
  padding: 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 11.5px;
  font-weight: 800;
}

.exemption-metric-list {
  display: grid;
  gap: 6px;
}

.exemption-metric-option {
  display: grid;
  grid-template-columns: 18px minmax(0, auto) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--cc-radius-sm);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13.5px;
  color: var(--text);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.exemption-metric-option:hover {
  background: var(--hover-bg);
  border-color: color-mix(in srgb, var(--blue), var(--line) 50%);
}

.exemption-metric-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--blue), var(--line) 25%);
  background: color-mix(in srgb, var(--blue), transparent 92%);
}

.exemption-metric-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.exemption-metric-name {
  font-weight: 750;
  white-space: nowrap;
}

.exemption-metric-option small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exemption-form .auditor-access-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.exemption-form .auditor-access-actions button {
  min-height: 38px;
  padding: 0 18px;
  border-radius: var(--cc-radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s var(--cc-ease), box-shadow 0.16s ease, filter 0.16s ease;
}

.exemption-form .auditor-access-actions button:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 30%);
}

.exemption-form .auditor-access-actions button.primary {
  border: 0;
  background: var(--cc-grad-primary);
  color: #fff;
  font-weight: 750;
}

.exemption-form .auditor-access-actions button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- 18. Audited Clients modal interactivity ---------- */

.audited-filter-row select,
.audited-filter-row input[type="search"] {
  border-radius: var(--cc-radius-sm);
}

.page-buttons button {
  border-radius: var(--cc-radius-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.15s var(--cc-ease);
}

.page-buttons button:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.page-buttons button.active,
.page-buttons button[aria-current="page"] {
  background: var(--cc-grad-primary);
  border-color: transparent;
  color: #fff;
}

.audited-panel-link {
  transition: color 0.15s ease, transform 0.18s var(--cc-ease);
}

.audited-panel-link:hover {
  color: var(--blue);
  transform: translateX(3px);
}

.audited-legend-row {
  border-radius: 7px;
  padding: 3px 6px;
  transition: background-color 0.14s ease;
}

.audited-legend-row:hover {
  background: var(--hover-bg);
}

/* ---------- 19. Director portfolio + sort headers ---------- */

.sort-header {
  transition: color 0.14s ease;
}

.sort-header:hover {
  color: var(--blue);
}

/* ---------- 20. Auditor detail drawer ---------- */

.audit-detail-summary article {
  border-radius: var(--cc-radius-sm);
  background: var(--cc-card-sheen), var(--panel);
  transition: border-color 0.16s ease, transform 0.16s var(--cc-ease), box-shadow 0.16s ease;
  animation: ccCardIn 0.36s var(--cc-ease) both;
}

.audit-detail-summary article:nth-child(2) { animation-delay: 0.05s; }
.audit-detail-summary article:nth-child(3) { animation-delay: 0.1s; }
.audit-detail-summary article:nth-child(4) { animation-delay: 0.15s; }
.audit-detail-summary article:nth-child(5) { animation-delay: 0.2s; }
.audit-detail-summary article:nth-child(6) { animation-delay: 0.25s; }

.audit-detail-summary article:hover {
  border-color: color-mix(in srgb, var(--blue), var(--line) 40%);
  transform: translateY(-2px);
  box-shadow: var(--cc-shadow-1);
}

.audit-field-list p {
  border-radius: 7px;
  transition: background-color 0.14s ease;
}

.audit-field-list p:hover {
  background: var(--hover-bg);
}

.audit-form textarea,
.audit-form input[type="text"],
.audit-form input[type="date"] {
  border-radius: var(--cc-radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.audit-form textarea:focus,
.audit-form input[type="text"]:focus,
.audit-form input[type="date"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue), transparent 84%);
}

#saveAuditRecordButton {
  border: 0;
  background: var(--cc-grad-primary);
  color: #fff;
  font-weight: 750;
  box-shadow: 0 6px 22px -8px color-mix(in srgb, var(--blue), transparent 35%);
}

#saveAuditRecordButton:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.auditor-detail-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.audit-drawer-actions {
  position: absolute;
  top: 20px;
  right: 74px;
  bottom: auto;
  left: auto;
  z-index: 60;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.audit-drawer-actions[hidden] {
  display: none;
}

.audit-drawer-actions .mode-button {
  width: auto;
  min-width: 170px;
}

.auditor-detail-panel .guide-body {
  padding-bottom: 28px;
}

/* ---------- 21. Evidence + guide drawers ---------- */

.evidence-link {
  position: relative;
}

.evidence-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s var(--cc-ease);
}

.evidence-link:hover {
  text-decoration: none;
}

.evidence-link:hover::after {
  transform: scaleX(1);
}

.guide-section {
  animation: ccCardIn 0.4s var(--cc-ease) both;
}

.guide-section:nth-child(2) { animation-delay: 0.06s; }
.guide-section:nth-child(3) { animation-delay: 0.12s; }
.guide-section:nth-child(4) { animation-delay: 0.18s; }

/* ---------- 22. Motion & accessibility guards ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    /* transition: none (not a 0.01ms duration) — a bare duration would
       activate transition-property: all on every element */
    transition: none !important;
  }
}

.evidence-download-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.evidence-download-link:hover {
  color: var(--teal);
  text-decoration: underline;
}

/* ---------- 23. Executive command-center normalization ---------- */

body:not(.light) {
  background:
    radial-gradient(920px 520px at 82% -8%, color-mix(in srgb, var(--accent-primary), transparent 91%), transparent 62%),
    radial-gradient(760px 520px at -10% 105%, rgba(148, 163, 184, 0.06), transparent 62%),
    linear-gradient(135deg, var(--bg-main), var(--bg-page)) !important;
}

body:not(.light) .sidebar {
  border-right-color: var(--border-medium);
  background:
    linear-gradient(180deg, rgba(13, 22, 36, 0.96), rgba(7, 13, 24, 0.94)),
    var(--bg-panel);
  box-shadow: 14px 0 34px rgba(0, 0, 0, 0.26), inset -1px 0 0 rgba(255, 255, 255, 0.035);
}

body:not(.light) .topbar {
  border-bottom-color: var(--border-subtle);
}

body:not(.light) .topbar h1 {
  color: var(--text-primary);
  text-shadow: none;
}

body:not(.light) .font-toggle,
body:not(.light) .guide-button,
body:not(.light) .freshness-badge,
body:not(.light) .mode-button,
body:not(.light) .export-button,
body:not(.light) .compact-action,
body:not(.light) .threshold-mode-button,
body:not(.light) input,
body:not(.light) select,
body:not(.light) textarea,
body:not(.light) .dropdown-button {
  border-color: var(--border-subtle);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 55%), var(--bg-control);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body:not(.light) .font-toggle:hover,
body:not(.light) .guide-button:hover,
body:not(.light) .mode-button:hover,
body:not(.light) .export-button:hover,
body:not(.light) .compact-action:hover,
body:not(.light) .threshold-mode-button:hover,
body:not(.light) .dropdown-button:hover {
  border-color: color-mix(in srgb, var(--accent-primary), var(--border-medium) 45%);
  background: linear-gradient(180deg, var(--accent-primary-soft), transparent 64%), var(--bg-control);
  box-shadow: 0 0 0 1px rgba(45, 212, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.18);
}

body:not(.light) .tab-badge {
  background: #243248;
  color: var(--text-secondary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body:not(.light) .tab.active .tab-badge {
  background: color-mix(in srgb, var(--accent-primary), var(--bg-card) 38%);
  color: var(--text-primary);
  box-shadow: 0 0 14px rgba(45, 212, 255, 0.22);
}

body:not(.light) .executive-card:not(.metal-border),
body:not(.light) .metric-card:not(.metal-border),
body:not(.light) .overview-block,
body:not(.light) .auditor-panel,
body:not(.light) .movement-card,
body:not(.light) .audit-bucket,
body:not(.light) .readiness-lane,
body:not(.light) .owner-report-panel,
body:not(.light) .audited-panel,
body:not(.light) .auditor-trend-card,
body:not(.light) .action-risk-card,
body:not(.light) .quality-card,
body:not(.light) .insight-card,
body:not(.light) .diagnostic-card {
  border-color: var(--border-subtle);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 40%),
    var(--bg-card);
  box-shadow: var(--shadow-card);
}

body:not(.light) .executive-card:not(.metal-border)::after,
body:not(.light) .metric-card:not(.metal-border)::after,
body:not(.light) .overview-block::after,
body:not(.light) .auditor-panel::after,
body:not(.light) .modal-panel::after {
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.035), transparent 36%, rgba(45, 212, 255, 0.035));
  opacity: 0.56;
}

body:not(.light) .executive-card.good,
body:not(.light) .movement-card.good,
body:not(.light) .audit-bucket.good,
body:not(.light) .readiness-lane.good {
  border-top-color: var(--accent-success);
}

body:not(.light) .executive-card.warn,
body:not(.light) .movement-card.warn,
body:not(.light) .audit-bucket.warn,
body:not(.light) .readiness-lane.warn {
  border-top-color: var(--accent-warning);
}

body:not(.light) .executive-card.bad,
body:not(.light) .movement-card.bad,
body:not(.light) .audit-bucket.bad,
body:not(.light) .readiness-lane.bad {
  border-top-color: var(--accent-critical);
}

body:not(.light) .executive-card.neutral,
body:not(.light) .movement-card.neutral,
body:not(.light) .audit-bucket.neutral {
  border-top-color: var(--border-strong);
}

body:not(.light) .metric-card,
body:not(.light) .executive-card:not(.metal-border) {
  border-top-width: 1px;
}

body:not(.light) .readiness-lane.good .lane-head span,
body:not(.light) .delta.up,
body:not(.light) .mini-badge.good,
body:not(.light) .audited-kpi.good i,
body:not(.light) .audited-risk-table strong.good {
  color: var(--accent-success);
}

body:not(.light) .readiness-lane.warn .lane-head span,
body:not(.light) .mini-badge.warn,
body:not(.light) .audited-kpi.warn strong,
body:not(.light) .audited-kpi i.icon-amber {
  color: var(--accent-warning);
}

body:not(.light) .readiness-lane.bad .lane-head span,
body:not(.light) .delta.down,
body:not(.light) .mini-badge.bad,
body:not(.light) .audited-kpi.bad strong,
body:not(.light) .audited-kpi i.icon-red,
body:not(.light) .queue-rank-1,
body:not(.light) .intervention-row b,
body:not(.light) .audited-risk-table strong.bad {
  color: var(--accent-critical);
}

body:not(.light) .table-wrap,
body:not(.light) .modal-table,
body:not(.light) .audited-table-wrap,
body:not(.light) .owner-report-table-wrap,
body:not(.light) .heatmap {
  border-color: var(--border-subtle);
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}

body:not(.light) .table-wrap thead th,
body:not(.light) .modal-table thead th,
body:not(.light) .audited-clients-table th {
  background: linear-gradient(180deg, #142033, #101a2a);
  color: var(--text-secondary);
}

body:not(.light) tbody tr:hover td,
body:not(.light) .owner-row:hover,
body:not(.light) .batch-row:hover,
body:not(.light) .intervention-row:hover,
body:not(.light) .lane-client:hover,
body:not(.light) .audit-field-list p:hover {
  background: var(--accent-primary-soft);
}

body:not(.light) .bar-fill,
body:not(.light) .progress-fill,
body:not(.light) .batch-bar span,
body:not(.light) .workload-bar-completed,
body:not(.light) .quality-fill,
body:not(.light) .pareto-bar {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-primary), #ffffff 5%), var(--accent-primary));
}

body:not(.light) .status-good,
body:not(.light) .pill.good,
body:not(.light) .badge.good {
  color: var(--accent-success);
  border-color: color-mix(in srgb, var(--accent-success), var(--border-subtle) 44%);
  background: var(--accent-success-soft);
}

body:not(.light) .status-warn,
body:not(.light) .pill.warn,
body:not(.light) .badge.warn {
  color: var(--accent-warning);
  border-color: color-mix(in srgb, var(--accent-warning), var(--border-subtle) 44%);
  background: var(--accent-warning-soft);
}

body:not(.light) .status-bad,
body:not(.light) .pill.bad,
body:not(.light) .badge.bad {
  color: var(--accent-critical);
  border-color: color-mix(in srgb, var(--accent-critical), var(--border-subtle) 44%);
  background: var(--accent-critical-soft);
}

body:not(.light) .modal-panel,
body:not(.light) .guide-panel,
body:not(.light) .audited-clients-panel,
body:not(.light) .audited-guide-panel,
body:not(.light) .drawer-panel,
body:not(.light) .owner-report-page {
  border-color: var(--border-medium);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%),
    var(--bg-panel);
  box-shadow: var(--cc-shadow-3);
}

body:not(.light) .modal-backdrop,
body:not(.light) .guide-backdrop,
body:not(.light) .audited-guide-backdrop {
  background: rgba(2, 6, 14, 0.78);
}

body:not(.light) .range-slicer::after {
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.3), var(--accent-primary));
  box-shadow: 0 0 14px rgba(45, 212, 255, 0.18);
}

body:not(.light) input[type="range"]::-webkit-slider-thumb {
  background: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(45, 212, 255, 0.12);
}

body:not(.light) input[type="range"]::-moz-range-thumb {
  background: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(45, 212, 255, 0.12);
}

body:not(.light) .metric-card:not(.metal-border),
body:not(.light) #cards .metric-card,
body:not(.light) .executive-card:not(.metal-border) {
  border: 1px solid var(--border-subtle) !important;
}

body:not(.light) .metal-border {
  border: 1px solid color-mix(in srgb, var(--metal-mid), transparent 58%) !important;
  background:
    radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--metal-mid), transparent 88%), transparent 55%),
    linear-gradient(180deg, rgba(16, 28, 58, 0.78), rgba(6, 14, 33, 0.84)) !important;
}

body:not(.light) #cards .metric-card {
  border-top-color: var(--border-subtle) !important;
}

body:not(.light) .metal-border--cyan {
  --metal-base: rgba(5, 39, 57, 0.94);
  --metal-mid: rgba(22, 164, 196, 0.58);
  --metal-highlight: rgba(45, 212, 255, 0.92);
  --metal-reflection: rgba(245, 253, 255, 0.9);
  --metal-glow: rgba(45, 212, 255, 0.24);
}

body:not(.light) .metal-border--amber {
  --metal-base: rgba(70, 45, 11, 0.94);
  --metal-mid: rgba(210, 143, 37, 0.58);
  --metal-highlight: rgba(245, 184, 75, 0.92);
  --metal-reflection: rgba(255, 247, 224, 0.92);
  --metal-glow: rgba(245, 184, 75, 0.24);
}

body:not(.light) .metal-border--success {
  --metal-base: rgba(5, 56, 45, 0.94);
  --metal-mid: rgba(20, 178, 134, 0.58);
  --metal-highlight: rgba(62, 230, 196, 0.92);
  --metal-reflection: rgba(229, 255, 247, 0.92);
  --metal-glow: rgba(62, 230, 196, 0.22);
}

body:not(.light) .metal-border--critical {
  --metal-base: rgba(80, 14, 38, 0.94);
  --metal-mid: rgba(218, 45, 94, 0.58);
  --metal-highlight: rgba(255, 77, 141, 0.92);
  --metal-reflection: rgba(255, 232, 240, 0.92);
  --metal-glow: rgba(255, 77, 141, 0.24);
}

/* ---------- 24. Minimal light mode normalization ---------- */

body.light {
  background:
    radial-gradient(820px 520px at 82% -10%, rgba(31, 108, 159, 0.055), transparent 60%),
    radial-gradient(680px 420px at -8% 105%, rgba(149, 100, 0, 0.035), transparent 62%),
    var(--bg-main) !important;
  color: var(--text-primary);
}

body.light::before,
body.light::after {
  display: none;
}

body.light .sidebar {
  border-right-color: var(--border-subtle);
  background: var(--bg-panel);
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.04);
}

body.light .brand h1,
body.light .topbar h1,
body.light .section-head h2,
body.light .block-head h3,
body.light .table-section-head h2 {
  color: var(--text-primary);
  -webkit-text-fill-color: currentColor;
  background: none;
  text-shadow: none;
}

body.light .brand p,
body.light .topbar p,
body.light .section-head p,
body.light .block-head span,
body.light .source-note,
body.light label,
body.light .executive-card span,
body.light .executive-card small,
body.light .metric-card h3,
body.light .metric-card .caption {
  color: var(--text-secondary);
}

body.light .topbar {
  border-bottom-color: var(--border-subtle);
}

body.light .tabs {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}

body.light .tabs::before,
body.light .tabs::after {
  opacity: 0;
}

body.light .tab {
  color: var(--text-secondary);
  background: transparent;
  text-shadow: none;
}

body.light .tab::before,
body.light .tab::after {
  opacity: 0;
}

body.light .tab:hover {
  color: var(--text-primary);
  background: var(--accent-primary-soft);
  transform: none;
}

body.light .tab.active {
  color: var(--accent-primary);
  border: 1px solid color-mix(in srgb, var(--accent-primary), white 72%);
  background: var(--accent-primary-soft);
  box-shadow: none;
  text-shadow: none;
  transform: none;
}

body.light .tab-badge,
body.light .tab.active .tab-badge {
  background: rgba(47, 52, 55, 0.08);
  color: var(--text-secondary);
  box-shadow: none;
}

body.light .tab.active .tab-badge {
  background: rgba(31, 108, 159, 0.12);
  color: var(--accent-primary);
}

body.light .font-toggle,
body.light .guide-button,
body.light .freshness-badge,
body.light .mode-button,
body.light .export-button,
body.light .compact-action,
body.light .threshold-mode-button,
body.light input,
body.light input[type="search"],
body.light select,
body.light textarea,
body.light .dropdown-button {
  border: 1px solid var(--border-subtle);
  background: var(--bg-control) !important;
  color: var(--text-primary);
  box-shadow: none;
}

body.light input::placeholder,
body.light textarea::placeholder {
  color: var(--text-muted);
}

body.light .font-toggle:hover,
body.light .guide-button:hover,
body.light .freshness-badge:hover,
body.light .mode-button:hover,
body.light .export-button:hover,
body.light .compact-action:hover,
body.light .threshold-mode-button:hover,
body.light .dropdown-button:hover {
  border-color: var(--border-medium);
  background: #f9f9f8;
  box-shadow: var(--shadow-card);
}

body.light .executive-card,
body.light .metric-card,
body.light .overview-block,
body.light .auditor-panel,
body.light .movement-card,
body.light .audit-bucket,
body.light .readiness-lane,
body.light .owner-report-panel,
body.light .audited-panel,
body.light .auditor-trend-card,
body.light .action-risk-card,
body.light .quality-card,
body.light .insight-card,
body.light .diagnostic-card {
  border: 1px solid var(--border-subtle) !important;
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

body.light .executive-card::before,
body.light .executive-card::after,
body.light .metric-card::before,
body.light .metric-card::after,
body.light .overview-block::after,
body.light .auditor-panel::after,
body.light .modal-panel::after {
  opacity: 0;
}

body.light .executive-card:hover,
body.light .metric-card:hover,
body.light .movement-card:hover,
body.light .auditor-panel:hover {
  border-color: var(--border-medium) !important;
  box-shadow: var(--shadow-panel);
}

body.light .executive-card strong,
body.light .metric-card .value,
body.light .movement-card strong,
body.light .audit-bucket strong {
  color: var(--text-primary);
  text-shadow: none;
}

body.light #cards .metric-card .value[style*="--accent-primary"],
body.light #cards .metric-card .value[style*="--blue"],
body.light .pill[style*="--accent-primary"],
body.light .pill[style*="--blue"] {
  color: var(--accent-primary) !important;
}

body.light #cards .metric-card .value[style*="--accent-warning"],
body.light #cards .metric-card .value[style*="--amber"],
body.light .pill[style*="--accent-warning"],
body.light .pill[style*="--amber"] {
  color: var(--accent-warning) !important;
}

body.light #cards .metric-card .value[style*="--accent-critical"],
body.light #cards .metric-card .value[style*="--red"],
body.light .pill[style*="--accent-critical"],
body.light .pill[style*="--red"] {
  color: var(--accent-critical) !important;
}

body.light .readiness-lane.good,
body.light .executive-card.good,
body.light .movement-card.good,
body.light .audit-bucket.good {
  border-top-color: color-mix(in srgb, var(--accent-success), white 62%) !important;
}

body.light .readiness-lane.warn,
body.light .executive-card.warn,
body.light .movement-card.warn,
body.light .audit-bucket.warn {
  border-top-color: color-mix(in srgb, var(--accent-warning), white 60%) !important;
}

body.light .readiness-lane.bad,
body.light .executive-card.bad,
body.light .movement-card.bad,
body.light .audit-bucket.bad {
  border-top-color: color-mix(in srgb, var(--accent-critical), white 62%) !important;
}

body.light .table-wrap,
body.light .modal-table,
body.light .audited-table-wrap,
body.light .owner-report-table-wrap,
body.light .heatmap {
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  box-shadow: none;
}

body.light .table-wrap thead th,
body.light .modal-table thead th,
body.light .audited-clients-table th {
  background: var(--bg-card-soft);
  color: var(--text-secondary);
  box-shadow: 0 1px 0 var(--border-subtle);
}

body.light td,
body.light th {
  border-color: var(--border-subtle);
}

body.light tbody tr:hover td,
body.light .owner-row:hover,
body.light .batch-row:hover,
body.light .intervention-row:hover,
body.light .lane-client:hover,
body.light .audit-field-list p:hover {
  background: var(--accent-primary-soft);
}

body.light .lane-client,
body.light .owner-row,
body.light .batch-row,
body.light .intervention-row,
body.light .audited-list-row,
body.light .client-chip,
body.light .audit-field-list p {
  border-color: var(--border-subtle);
  background: #ffffff !important;
  color: var(--text-primary);
}

body.light .lane-client:hover,
body.light .owner-row:hover,
body.light .batch-row:hover,
body.light .intervention-row:hover,
body.light .audited-list-row:hover,
body.light .client-chip:hover,
body.light .audit-field-list p:hover {
  background: var(--accent-primary-soft) !important;
}

body.light .lane-client span,
body.light .owner-row span,
body.light .batch-row span,
body.light .intervention-row small,
body.light .client-chip small {
  color: var(--text-secondary);
}

body.light .pill,
body.light .summary-pill,
body.light .mini-badge,
body.light .badge,
body.light .portfolio-status {
  background: #f9f9f8;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

body.light .pill.good,
body.light .mini-badge.good,
body.light .badge.good {
  background: var(--accent-success-soft);
  color: var(--accent-success);
  border-color: color-mix(in srgb, var(--accent-success), white 72%);
}

body.light .pill.warn,
body.light .mini-badge.warn,
body.light .badge.warn {
  background: var(--accent-warning-soft);
  color: var(--accent-warning);
  border-color: color-mix(in srgb, var(--accent-warning), white 70%);
}

body.light .pill.bad,
body.light .mini-badge.bad,
body.light .badge.bad {
  background: var(--accent-critical-soft);
  color: var(--accent-critical);
  border-color: color-mix(in srgb, var(--accent-critical), white 72%);
}

body.light .bar-fill,
body.light .progress-fill,
body.light .batch-bar span,
body.light .workload-bar-completed,
body.light .quality-fill,
body.light .pareto-bar {
  background: var(--accent-primary);
}

body.light .range-slicer::after {
  background: linear-gradient(90deg, #d8d6d0, var(--accent-primary));
  box-shadow: none;
}

body.light input[type="range"]::-webkit-slider-thumb {
  background: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 108, 159, 0.12);
}

body.light input[type="range"]::-moz-range-thumb {
  background: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(31, 108, 159, 0.12);
}

body.light .modal-panel,
body.light .guide-panel,
body.light .audited-clients-panel,
body.light .audited-guide-panel,
body.light .drawer-panel,
body.light .owner-report-page {
  border: 1px solid var(--border-subtle);
  background: var(--bg-panel);
  box-shadow: var(--cc-shadow-3);
}

body.light .modal-backdrop,
body.light .guide-backdrop,
body.light .audited-guide-backdrop {
  background: rgba(47, 52, 55, 0.28);
}

/* ---------- 25. Brand, tooltip, and sidebar toggle polish ---------- */

.brand {
  align-items: center;
}

.brand > div {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.05;
  letter-spacing: 0.2px;
}

.brand p {
  margin: 5px 0 0;
  color: color-mix(in srgb, var(--text-secondary), #ffffff 8%);
  font-size: 10px;
  line-height: 1.28;
  letter-spacing: 1.1px;
}

.brand-mark.tp-brand-mark,
.brand-mark.tp-dashboard-brand-mark {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
  background: transparent;
  padding: 0;
}

body:not(.light) .brand-mark.tp-brand-mark,
body:not(.light) .brand-mark.tp-dashboard-brand-mark {
  filter:
    drop-shadow(0 0 10px rgba(45, 212, 255, 0.16))
    drop-shadow(0 0 12px rgba(255, 79, 216, 0.08))
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.3));
}

body.light .brand-mark.tp-brand-mark,
body.light .brand-mark.tp-dashboard-brand-mark {
  background: #07101f;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  filter: drop-shadow(0 8px 14px rgba(31, 108, 159, 0.1));
}

.sidebar-toggle {
  top: 14px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 0;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
    border-color 240ms cubic-bezier(0.16, 1, 0.3, 1),
    background 240ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-toggle::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent);
  pointer-events: none;
}

.sidebar-toggle::after {
  content: "";
  width: 9px;
  height: 9px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(-45deg) translate(1px, 1px);
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .sidebar-toggle::after {
  transform: rotate(135deg) translate(1px, 1px);
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
}

.sidebar-toggle:active {
  transform: scale(0.96);
}

body:not(.light) .sidebar-toggle {
  border-color: rgba(45, 212, 255, 0.2);
  background: rgba(10, 19, 34, 0.78);
  color: var(--accent-primary);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body:not(.light) .sidebar-toggle:hover {
  border-color: rgba(45, 212, 255, 0.44);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), 0 0 18px rgba(45, 212, 255, 0.12);
}

body.light .sidebar-toggle {
  border-color: var(--border-subtle);
  background: #ffffff;
  color: var(--accent-primary);
  box-shadow: 0 8px 18px rgba(47, 52, 55, 0.07);
}

body.light .sidebar-toggle:hover {
  border-color: color-mix(in srgb, var(--accent-primary), white 72%);
  background: var(--accent-primary-soft);
}

.mobile-sidebar-toggle {
  font-size: 0;
  border-radius: 12px;
}

.mobile-sidebar-toggle::before {
  content: attr(data-label);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

body.light .dashboard-tooltip {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-primary);
  box-shadow: 0 12px 28px rgba(47, 52, 55, 0.14);
}

body.light .dashboard-tooltip::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  pointer-events: none;
}

body.light .auditor-focus-list button[data-risk-tooltip]::after {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-primary);
  box-shadow: 0 12px 28px rgba(47, 52, 55, 0.14);
}

/* ---------- 26. Executive graphite visual system ---------- */

:root {
  --font-ui: "Manrope", "Plus Jakarta Sans", "Segoe UI Variable", "Segoe UI", sans-serif;
  --font-heading: "Rajdhani", "Space Grotesk", "Manrope", "Segoe UI", sans-serif;
  --font-accent: "Kalam", "Segoe Print", "Bradley Hand ITC", cursive;

  --bg-main: #050914;
  --bg-page: #08101c;
  --bg-panel: #0b1422;
  --bg-card: #101928;
  --bg-card-soft: #141f31;
  --bg-control: #0a1220;
  --text-primary: #f4f7fb;
  --text-secondary: #b2bdcd;
  --text-muted: #7f8ca1;
  --border-subtle: rgba(170, 188, 210, 0.15);
  --border-medium: rgba(170, 188, 210, 0.25);
  --border-strong: rgba(203, 213, 225, 0.38);
  --accent-primary: #98acc4;
  --accent-primary-soft: rgba(152, 172, 196, 0.13);
  --accent-primary-glow: rgba(152, 172, 196, 0.22);
  --accent-success: #86b6a2;
  --accent-success-soft: rgba(134, 182, 162, 0.13);
  --accent-warning: #b7a276;
  --accent-warning-soft: rgba(183, 162, 118, 0.13);
  --accent-critical: #c07f8b;
  --accent-critical-soft: rgba(192, 127, 139, 0.14);

  --bg: var(--bg-main);
  --panel: var(--bg-panel);
  --panel-2: var(--bg-card);
  --line: var(--border-subtle);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --blue: var(--accent-primary);
  --cyan: var(--accent-primary);
  --amber: var(--accent-warning);
  --red: var(--accent-critical);
  --magenta: #b08a9a;
  --purple: #9f9ab3;
  --violet: #9f9ab3;
  --teal: var(--accent-success);
  --hover-bg: rgba(152, 172, 196, 0.1);
  --table-bg: rgba(6, 12, 22, 0.46);
  --th-bg: #111b2b;

  --executive-line: rgba(187, 202, 220, 0.17);
  --executive-line-strong: rgba(221, 229, 238, 0.32);
  --executive-surface: linear-gradient(180deg, rgba(23, 34, 50, 0.94) 0%, rgba(10, 19, 33, 0.92) 58%, rgba(6, 11, 21, 0.96) 100%);
  --executive-surface-raised: linear-gradient(180deg, rgba(28, 40, 58, 0.96) 0%, rgba(12, 22, 37, 0.94) 58%, rgba(6, 11, 21, 0.98) 100%);
  --executive-inner-light: inset 0 1px 0 rgba(255, 255, 255, 0.095), inset 0 -26px 42px rgba(0, 0, 0, 0.2);
  --executive-shadow: 0 28px 80px rgba(0, 0, 0, 0.34), 0 10px 28px rgba(0, 0, 0, 0.22), var(--executive-inner-light);
  --executive-hover-shadow: 0 34px 96px rgba(0, 0, 0, 0.42), 0 14px 34px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(221, 229, 238, 0.1), var(--executive-inner-light);
  --cc-grad-primary: linear-gradient(135deg, #b9c7d8, #7f91a7 52%, #dce5ee);
  --cc-glow-blue: 0 0 0 1px rgba(187, 202, 220, 0.18), 0 14px 34px rgba(0, 0, 0, 0.24);
}

body.light {
  --bg-main: #f5f6f7;
  --bg-page: #fbfbfc;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-soft: #f6f8fa;
  --bg-control: #ffffff;
  --text-primary: #202832;
  --text-secondary: #637083;
  --text-muted: #8994a3;
  --border-subtle: rgba(31, 42, 55, 0.09);
  --border-medium: rgba(31, 42, 55, 0.14);
  --border-strong: rgba(31, 42, 55, 0.24);
  --accent-primary: #536a84;
  --accent-primary-soft: rgba(83, 106, 132, 0.1);
  --accent-primary-glow: rgba(83, 106, 132, 0.14);
  --accent-success: #587c6b;
  --accent-success-soft: rgba(88, 124, 107, 0.1);
  --accent-warning: #8b7651;
  --accent-warning-soft: rgba(139, 118, 81, 0.1);
  --accent-critical: #9a646d;
  --accent-critical-soft: rgba(154, 100, 109, 0.11);
  --blue: var(--accent-primary);
  --cyan: var(--accent-primary);
  --amber: var(--accent-warning);
  --red: var(--accent-critical);
  --magenta: var(--accent-critical);
  --purple: #746f86;
  --violet: #746f86;
  --teal: var(--accent-success);
  --hover-bg: rgba(83, 106, 132, 0.07);
  --table-bg: #ffffff;
  --th-bg: #f1f4f7;
  --executive-line: rgba(31, 42, 55, 0.1);
  --executive-line-strong: rgba(31, 42, 55, 0.18);
  --executive-surface: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
  --executive-surface-raised: linear-gradient(180deg, #ffffff 0%, #f5f7f9 100%);
  --executive-shadow: 0 16px 36px rgba(31, 42, 55, 0.08), 0 1px 0 rgba(255, 255, 255, 0.92) inset;
  --executive-hover-shadow: 0 22px 46px rgba(31, 42, 55, 0.12), 0 1px 0 rgba(255, 255, 255, 0.96) inset;
}

.font-ui {
  font-family: var(--font-ui);
}

.font-heading {
  font-family: var(--font-heading);
  letter-spacing: 0.02em;
}

.font-accent,
.accent-script-label,
.accent-handwritten-note {
  font-family: var(--font-accent);
}

.accent-script-label {
  color: color-mix(in srgb, var(--accent-primary), #ffffff 18%);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
}

.accent-handwritten-note {
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.25;
  letter-spacing: 0;
}

body {
  font-family: var(--font-ui) !important;
  letter-spacing: 0;
}

body:not(.light) {
  background:
    radial-gradient(980px 560px at 80% -10%, rgba(143, 159, 181, 0.12), transparent 58%),
    radial-gradient(780px 500px at -12% 108%, rgba(91, 108, 130, 0.1), transparent 64%),
    linear-gradient(135deg, #050914 0%, #08101c 46%, #030711 100%) !important;
}

body:not(.light)::before {
  opacity: 0.16;
  background:
    linear-gradient(110deg, transparent 0 39%, rgba(221, 229, 238, 0.045) 40%, transparent 42% 100%),
    repeating-linear-gradient(90deg, rgba(203, 213, 225, 0.024) 0 1px, transparent 1px 86px),
    repeating-linear-gradient(0deg, rgba(203, 213, 225, 0.018) 0 1px, transparent 1px 74px);
}

body.light {
  background:
    radial-gradient(900px 560px at 82% -12%, rgba(83, 106, 132, 0.055), transparent 60%),
    radial-gradient(700px 460px at -8% 105%, rgba(31, 42, 55, 0.035), transparent 62%),
    var(--bg-main) !important;
}

.topbar h1,
.block-head h3,
.section-head h2,
.tabs .tab,
.brand h1,
.metric-card h3,
.executive-card span,
.readiness-lane h3,
.owner-queue h3,
.intervention-list h3,
.batch-readiness h3,
.auditor-panel h3,
.audited-panel h3,
.drawer-panel h2,
.modal-panel h2,
.guide-panel h2,
.audited-guide-panel h2 {
  font-family: var(--font-heading);
  letter-spacing: 0.025em;
}

.topbar h1 {
  font-weight: 700;
}

body:not(.light) .topbar h1,
body:not(.light) .block-head h3,
body:not(.light) .section-head h2 {
  color: #f3f7fc;
  text-shadow: 0 12px 34px rgba(0, 0, 0, 0.36);
}

body:not(.light) .sidebar {
  border-right-color: rgba(187, 202, 220, 0.18);
  background:
    linear-gradient(180deg, rgba(11, 20, 34, 0.98), rgba(5, 9, 20, 0.96)),
    var(--bg-panel);
  box-shadow:
    16px 0 40px rgba(0, 0, 0, 0.34),
    inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

body:not(.light) .brand-mark.tp-brand-mark,
body:not(.light) .brand-mark.tp-dashboard-brand-mark {
  filter:
    drop-shadow(0 12px 20px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 12px rgba(203, 213, 225, 0.12));
}

body:not(.light) .brand-mark {
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24), 0 0 20px rgba(203, 213, 225, 0.1);
}

body:not(.light) .topbar,
body:not(.light) .tabs {
  border-color: var(--executive-line);
}

body:not(.light) .tabs {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 48%),
    rgba(10, 18, 31, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

body:not(.light) .tab {
  color: color-mix(in srgb, var(--text-secondary), #ffffff 8%);
}

body:not(.light) .tab.active {
  border-color: rgba(221, 229, 238, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035)),
    rgba(152, 172, 196, 0.12);
  color: #ffffff;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

body:not(.light) .tab.active::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.58), transparent);
}

body:not(.light) .tab-badge,
body:not(.light) .tab.active .tab-badge {
  background: linear-gradient(180deg, rgba(232, 238, 246, 0.22), rgba(110, 128, 150, 0.2));
  color: #f5f8fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px rgba(0, 0, 0, 0.22);
}

body:not(.light) .font-toggle,
body:not(.light) .guide-button,
body:not(.light) .freshness-badge,
body:not(.light) .mode-button,
body:not(.light) .export-button,
body:not(.light) .compact-action,
body:not(.light) .threshold-mode-button,
body:not(.light) .audited-guide-toggle,
body:not(.light) input,
body:not(.light) select,
body:not(.light) textarea,
body:not(.light) .dropdown-button,
body:not(.light) .sidebar-toggle {
  border-color: rgba(187, 202, 220, 0.17);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    rgba(9, 17, 30, 0.82);
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 10px 24px rgba(0, 0, 0, 0.18);
}

body:not(.light) .font-toggle:hover,
body:not(.light) .guide-button:hover,
body:not(.light) .mode-button:hover,
body:not(.light) .export-button:hover,
body:not(.light) .compact-action:hover,
body:not(.light) .threshold-mode-button:hover,
body:not(.light) .audited-guide-toggle:hover,
body:not(.light) .dropdown-button:hover,
body:not(.light) .sidebar-toggle:hover {
  border-color: rgba(221, 229, 238, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)),
    rgba(17, 28, 45, 0.9);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

body:not(.light) .metric-card:not(.metal-border),
body:not(.light) .executive-card:not(.metal-border),
body:not(.light) .overview-block,
body:not(.light) .auditor-panel,
body:not(.light) .movement-card,
body:not(.light) .audit-bucket,
body:not(.light) .readiness-lane,
body:not(.light) .owner-report-panel,
body:not(.light) .audited-panel,
body:not(.light) .auditor-trend-card,
body:not(.light) .action-risk-card,
body:not(.light) .quality-card,
body:not(.light) .insight-card,
body:not(.light) .diagnostic-card,
body:not(.light) .owner-queue,
body:not(.light) .intervention-list,
body:not(.light) .batch-readiness {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transform-style: preserve-3d;
  border: 1px solid var(--executive-line) !important;
  background: var(--executive-surface) !important;
  box-shadow: var(--executive-shadow) !important;
  backdrop-filter: blur(18px);
}

body:not(.light) .metric-card:not(.metal-border)::before,
body:not(.light) .executive-card:not(.metal-border)::before,
body:not(.light) .overview-block::before,
body:not(.light) .auditor-panel::before,
body:not(.light) .movement-card::before,
body:not(.light) .audit-bucket::before,
body:not(.light) .readiness-lane::before,
body:not(.light) .owner-report-panel::before,
body:not(.light) .audited-panel::before,
body:not(.light) .auditor-trend-card::before,
body:not(.light) .action-risk-card::before,
body:not(.light) .quality-card::before,
body:not(.light) .insight-card::before,
body:not(.light) .diagnostic-card::before,
body:not(.light) .owner-queue::before,
body:not(.light) .intervention-list::before,
body:not(.light) .batch-readiness::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background:
    linear-gradient(90deg, transparent 10%, rgba(255, 255, 255, 0.72) 50%, transparent 90%) top / 100% 1px no-repeat,
    linear-gradient(145deg, rgba(255, 255, 255, 0.32), rgba(152, 172, 196, 0.08) 34%, rgba(255, 255, 255, 0.08) 74%, rgba(152, 172, 196, 0.18));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: 0.72;
}

body:not(.light) .metric-card:not(.metal-border)::after,
body:not(.light) .executive-card:not(.metal-border)::after,
body:not(.light) .overview-block::after,
body:not(.light) .auditor-panel::after,
body:not(.light) .movement-card::after,
body:not(.light) .audit-bucket::after,
body:not(.light) .readiness-lane::after,
body:not(.light) .owner-report-panel::after,
body:not(.light) .audited-panel::after,
body:not(.light) .auditor-trend-card::after,
body:not(.light) .action-risk-card::after,
body:not(.light) .quality-card::after,
body:not(.light) .insight-card::after,
body:not(.light) .diagnostic-card::after,
body:not(.light) .owner-queue::after,
body:not(.light) .intervention-list::after,
body:not(.light) .batch-readiness::after {
  content: "";
  position: absolute;
  inset: 1px;
  z-index: 0;
  pointer-events: none;
  border-radius: calc(var(--cc-radius) - 1px);
  background:
    radial-gradient(80% 30% at 50% 0%, rgba(255, 255, 255, 0.1), transparent 62%),
    linear-gradient(118deg, transparent 0 22%, rgba(255, 255, 255, 0.045) 38%, transparent 54%);
  opacity: 0.86;
}

body:not(.light) .metric-card:not(.metal-border) > *,
body:not(.light) .executive-card:not(.metal-border) > *,
body:not(.light) .overview-block > *,
body:not(.light) .auditor-panel > *,
body:not(.light) .movement-card > *,
body:not(.light) .audit-bucket > *,
body:not(.light) .readiness-lane > *,
body:not(.light) .owner-report-panel > *,
body:not(.light) .audited-panel > *,
body:not(.light) .auditor-trend-card > *,
body:not(.light) .action-risk-card > *,
body:not(.light) .quality-card > *,
body:not(.light) .insight-card > *,
body:not(.light) .diagnostic-card > *,
body:not(.light) .owner-queue > *,
body:not(.light) .intervention-list > *,
body:not(.light) .batch-readiness > * {
  position: relative;
  z-index: 1;
}

body:not(.light) .metric-card:hover,
body:not(.light) .executive-card[data-kpi-tab]:hover,
body:not(.light) .movement-card:hover,
body:not(.light) .quality-card:hover,
body:not(.light) .insight-card:hover,
body:not(.light) .diagnostic-card:hover {
  transform: perspective(900px) translate3d(0, -3px, 14px);
  border-color: var(--executive-line-strong) !important;
  background: var(--executive-surface-raised) !important;
  box-shadow: var(--executive-hover-shadow) !important;
}

body:not(.light) .executive-card.good,
body:not(.light) .movement-card.good,
body:not(.light) .audit-bucket.good,
body:not(.light) .readiness-lane.good {
  box-shadow: var(--executive-shadow), inset 0 3px 0 rgba(134, 182, 162, 0.58) !important;
}

body:not(.light) .executive-card.warn,
body:not(.light) .movement-card.warn,
body:not(.light) .audit-bucket.warn,
body:not(.light) .readiness-lane.warn {
  box-shadow: var(--executive-shadow), inset 0 3px 0 rgba(183, 162, 118, 0.58) !important;
}

body:not(.light) .executive-card.bad,
body:not(.light) .movement-card.bad,
body:not(.light) .audit-bucket.bad,
body:not(.light) .readiness-lane.bad {
  box-shadow: var(--executive-shadow), inset 0 3px 0 rgba(192, 127, 139, 0.6) !important;
}

body:not(.light) .executive-card.neutral,
body:not(.light) .movement-card.neutral,
body:not(.light) .audit-bucket.neutral {
  box-shadow: var(--executive-shadow), inset 0 3px 0 rgba(152, 172, 196, 0.54) !important;
}

body:not(.light) .metric-card .value,
body:not(.light) .executive-card strong,
body:not(.light) .movement-card strong,
body:not(.light) .audit-bucket strong,
body:not(.light) .audited-kpi strong,
body:not(.light) .audited-donut strong {
  color: #f8fbff;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
}

body:not(.light) .metric-card h3,
body:not(.light) .metric-card .caption,
body:not(.light) .executive-card span,
body:not(.light) .executive-card small {
  color: color-mix(in srgb, var(--text-secondary), #ffffff 4%);
}

body:not(.light) .table-wrap,
body:not(.light) .modal-table,
body:not(.light) .audited-table-wrap,
body:not(.light) .owner-report-table-wrap,
body:not(.light) .heatmap,
body:not(.light) .audited-risk-table,
body:not(.light) .auditor-workload-list,
body:not(.light) .auditor-focus-list {
  border-color: var(--executive-line);
  background: var(--executive-surface);
  box-shadow: var(--executive-shadow);
}

body:not(.light) .table-wrap thead th,
body:not(.light) .modal-table thead th,
body:not(.light) .audited-clients-table th,
body:not(.light) .owner-report-table-wrap th {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)),
    #111b2b;
  color: color-mix(in srgb, var(--text-secondary), #ffffff 10%);
  font-family: var(--font-heading);
  letter-spacing: 0.06em;
}

body:not(.light) tbody tr:hover td,
body:not(.light) .owner-row:hover,
body:not(.light) .batch-row:hover,
body:not(.light) .intervention-row:hover,
body:not(.light) .lane-client:hover,
body:not(.light) .audit-field-list p:hover,
body:not(.light) .audited-queue-row:hover,
body:not(.light) .audited-risk-table button:hover,
body:not(.light) .auditor-workload-list button:hover,
body:not(.light) .auditor-focus-list button:hover {
  background: rgba(152, 172, 196, 0.1) !important;
}

body:not(.light) .lane-client,
body:not(.light) .owner-row,
body:not(.light) .batch-row,
body:not(.light) .intervention-row,
body:not(.light) .audited-queue-row,
body:not(.light) .audited-risk-table button,
body:not(.light) .auditor-workload-list button,
body:not(.light) .auditor-focus-list button {
  border-color: rgba(187, 202, 220, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 62%),
    rgba(8, 15, 27, 0.46);
}

body:not(.light) .bar-fill,
body:not(.light) .progress-fill,
body:not(.light) .batch-bar span,
body:not(.light) .workload-bar-completed,
body:not(.light) .quality-fill,
body:not(.light) .pareto-bar,
body:not(.light) .range-slicer::after {
  background: linear-gradient(90deg, #607289, #aebed0 52%, #7f91a7) !important;
  box-shadow: 0 0 18px rgba(152, 172, 196, 0.16);
}

body:not(.light) input[type="range"]::-webkit-slider-thumb {
  background: #d5dee8;
  box-shadow: 0 0 0 4px rgba(152, 172, 196, 0.13), 0 7px 18px rgba(0, 0, 0, 0.28);
}

body:not(.light) input[type="range"]::-moz-range-thumb {
  background: #d5dee8;
  box-shadow: 0 0 0 4px rgba(152, 172, 196, 0.13), 0 7px 18px rgba(0, 0, 0, 0.28);
}

body:not(.light) .modal-panel,
body:not(.light) .guide-panel,
body:not(.light) .audited-clients-panel,
body:not(.light) .audited-guide-panel,
body:not(.light) .drawer-panel,
body:not(.light) .owner-report-page {
  border-color: var(--executive-line-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), transparent 42%),
    linear-gradient(180deg, rgba(16, 27, 44, 0.98), rgba(7, 13, 24, 0.98));
  box-shadow:
    0 42px 120px rgba(0, 0, 0, 0.54),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body:not(.light) .modal-backdrop,
body:not(.light) .guide-backdrop,
body:not(.light) .audited-guide-backdrop {
  background: rgba(3, 7, 14, 0.82);
  backdrop-filter: blur(10px);
}

body:not(.light) .dashboard-tooltip,
body:not(.light) .auditor-focus-list button[data-risk-tooltip]::after {
  border: 1px solid rgba(221, 229, 238, 0.22);
  background:
    linear-gradient(180deg, rgba(24, 36, 53, 0.98), rgba(8, 15, 27, 0.98));
  color: #f8fbff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body:not(.light) .metal-border,
body:not(.light) .metal-rim-card {
  --metal-base: rgba(9, 16, 28, 0.96);
  --metal-mid: rgba(129, 148, 170, 0.56);
  --metal-highlight: rgba(226, 234, 243, 0.76);
  --metal-reflection: rgba(255, 255, 255, 0.86);
  --metal-glow: rgba(152, 172, 196, 0.18);
  background:
    radial-gradient(120% 90% at 50% -20%, color-mix(in srgb, var(--metal-mid), transparent 86%), transparent 56%),
    var(--executive-surface) !important;
}

body:not(.light) .metal-border--cyan,
body:not(.light) .metric-card--cyan,
body:not(.light) .metric-card--blue {
  --metal-base: rgba(9, 16, 28, 0.96);
  --metal-mid: rgba(126, 151, 179, 0.58);
  --metal-highlight: rgba(221, 231, 242, 0.82);
  --metal-reflection: rgba(255, 255, 255, 0.9);
  --metal-glow: rgba(126, 151, 179, 0.2);
}

body:not(.light) .metal-border--amber,
body:not(.light) .metric-card--orange,
body:not(.light) .metric-card--gold {
  --metal-base: rgba(38, 31, 21, 0.96);
  --metal-mid: rgba(171, 151, 111, 0.54);
  --metal-highlight: rgba(225, 211, 176, 0.78);
  --metal-reflection: rgba(255, 250, 236, 0.88);
  --metal-glow: rgba(183, 162, 118, 0.16);
}

body:not(.light) .metric-card--purple,
body:not(.light) .metric-card--violet {
  --metal-base: rgba(23, 21, 34, 0.96);
  --metal-mid: rgba(150, 145, 169, 0.54);
  --metal-highlight: rgba(219, 216, 232, 0.78);
  --metal-reflection: rgba(255, 255, 255, 0.88);
  --metal-glow: rgba(159, 154, 179, 0.16);
}

body:not(.light) .metal-border--success,
body:not(.light) .metric-card--green,
body:not(.light) .metric-card--emerald {
  --metal-base: rgba(14, 32, 27, 0.96);
  --metal-mid: rgba(117, 163, 143, 0.54);
  --metal-highlight: rgba(203, 226, 216, 0.78);
  --metal-reflection: rgba(247, 255, 251, 0.88);
  --metal-glow: rgba(134, 182, 162, 0.16);
}

body:not(.light) .metal-border--critical,
body:not(.light) .metric-card--red,
body:not(.light) .metric-card--crimson {
  --metal-base: rgba(43, 22, 27, 0.96);
  --metal-mid: rgba(180, 116, 128, 0.54);
  --metal-highlight: rgba(231, 199, 205, 0.78);
  --metal-reflection: rgba(255, 246, 248, 0.88);
  --metal-glow: rgba(192, 127, 139, 0.16);
}

body.light .metric-card,
body.light .executive-card,
body.light .overview-block,
body.light .auditor-panel,
body.light .movement-card,
body.light .audit-bucket,
body.light .readiness-lane,
body.light .owner-report-panel,
body.light .audited-panel,
body.light .auditor-trend-card,
body.light .action-risk-card,
body.light .quality-card,
body.light .insight-card,
body.light .diagnostic-card,
body.light .owner-queue,
body.light .intervention-list,
body.light .batch-readiness,
body.light .table-wrap,
body.light .modal-table,
body.light .audited-table-wrap,
body.light .owner-report-table-wrap {
  border-color: var(--executive-line);
  background: var(--executive-surface);
  box-shadow: var(--executive-shadow);
}

body.light .tab.active {
  border-color: rgba(31, 42, 55, 0.18);
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(31, 42, 55, 0.08);
}

body.light .mode-button,
body.light .threshold-mode-button,
body.light .export-button,
body.light .compact-action,
body.light .audited-guide-toggle,
body.light .font-toggle,
body.light .guide-button,
body.light .dropdown-button,
body.light .sidebar-toggle {
  border-color: var(--border-subtle);
  background: #ffffff;
  color: var(--text-primary);
}

body.light #uploadButton,
body.light #processUploadButton,
body.light #saveAuditRecordButton {
  border-color: #1f6c9f !important;
  background: linear-gradient(135deg, #1f6c9f, #2f7fab) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 22px rgba(31, 108, 159, 0.18);
}

body.light #uploadButton:hover,
body.light #processUploadButton:hover,
body.light #saveAuditRecordButton:hover {
  border-color: #174d73 !important;
  background: linear-gradient(135deg, #174d73, #286e99) !important;
  color: #ffffff !important;
}

body.light .audit-drawer-actions {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.light #notifyOwnerButton {
  border-color: var(--border-medium) !important;
  background: #f9f9f8 !important;
  color: var(--text-primary) !important;
}

/* ---------- 27. Risk priority refinement ---------- */

:root {
  --risk-primary: #dd6f91;
  --risk-strong: #f28ca8;
  --risk-ink: #ffd4df;
  --risk-soft: rgba(221, 111, 145, 0.18);
  --risk-wash: rgba(221, 111, 145, 0.105);
  --risk-glow: rgba(221, 111, 145, 0.24);
  --risk-line: rgba(242, 140, 168, 0.52);
  --accent-critical: var(--risk-primary);
  --accent-critical-soft: var(--risk-soft);
  --red: var(--risk-primary);
  --magenta: var(--risk-primary);
}

body.light {
  --risk-primary: #b84763;
  --risk-strong: #d15e7b;
  --risk-ink: #6f2036;
  --risk-soft: rgba(184, 71, 99, 0.12);
  --risk-wash: rgba(184, 71, 99, 0.065);
  --risk-glow: rgba(184, 71, 99, 0.12);
  --risk-line: rgba(184, 71, 99, 0.28);
  --accent-critical: var(--risk-primary);
  --accent-critical-soft: var(--risk-soft);
  --red: var(--risk-primary);
  --magenta: var(--risk-primary);
}

body:not(.light) #executiveKpis .executive-card:nth-child(4),
body:not(.light) .executive-card.bad,
body:not(.light) .readiness-lane.bad,
body:not(.light) .audit-bucket.bad,
body:not(.light) .movement-card.bad,
body:not(.light) .diagnostic-card.bad,
body:not(.light) .insight-card.bad {
  border-color: var(--risk-line) !important;
  background:
    radial-gradient(130% 78% at 50% -12%, rgba(255, 184, 203, 0.11), transparent 48%),
    linear-gradient(180deg, var(--risk-wash), transparent 56%),
    var(--executive-surface) !important;
  box-shadow:
    var(--executive-shadow),
    inset 0 3px 0 rgba(242, 140, 168, 0.84),
    inset 4px 0 0 rgba(221, 111, 145, 0.38),
    0 0 34px rgba(221, 111, 145, 0.13) !important;
}

body:not(.light) #executiveKpis .executive-card:nth-child(4)::before,
body:not(.light) .readiness-lane.bad::before {
  opacity: 0.96;
  background:
    linear-gradient(90deg, transparent 9%, rgba(255, 221, 230, 0.82) 50%, transparent 91%) top / 100% 1px no-repeat,
    linear-gradient(145deg, rgba(242, 140, 168, 0.54), rgba(221, 111, 145, 0.15) 34%, rgba(255, 255, 255, 0.08) 72%, rgba(242, 140, 168, 0.28));
}

body:not(.light) #executiveKpis .executive-card:nth-child(4):hover,
body:not(.light) .readiness-lane.bad:hover {
  border-color: rgba(255, 164, 189, 0.66) !important;
  box-shadow:
    var(--executive-hover-shadow),
    inset 0 3px 0 rgba(255, 151, 180, 0.95),
    inset 4px 0 0 rgba(221, 111, 145, 0.48),
    0 0 42px rgba(221, 111, 145, 0.18) !important;
}

body:not(.light) #executiveKpis .executive-card:nth-child(4) span,
body:not(.light) .readiness-lane.bad .lane-head strong,
body:not(.light) .intervention-list h3,
body:not(.light) .top-intervention-list h3 {
  color: color-mix(in srgb, var(--risk-ink), #ffffff 8%);
}

body:not(.light) #executiveKpis .executive-card:nth-child(4) strong,
body:not(.light) .executive-card.bad strong,
body:not(.light) .intervention-row strong,
body:not(.light) .intervention-row strong.bad,
body:not(.light) .portfolio-score.bad,
body:not(.light) .diagnostic-summary strong.bad,
body:not(.light) .diagnostic-card.bad strong,
body:not(.light) .insight-card.bad strong,
body:not(.light) .audited-risk-table strong.bad,
body:not(.light) .auditor-focus-list strong.bad {
  color: var(--risk-strong) !important;
  font-weight: 800;
  text-shadow: 0 0 16px rgba(221, 111, 145, 0.2), 0 14px 30px rgba(0, 0, 0, 0.34);
}

body:not(.light) .readiness-lane.bad .lane-head span,
body:not(.light) .queue-rank-1,
body:not(.light) .score-badge.bad,
body:not(.light) .mini-badge.bad {
  color: var(--risk-ink) !important;
  border-color: rgba(242, 140, 168, 0.42) !important;
  background: linear-gradient(180deg, rgba(221, 111, 145, 0.3), rgba(221, 111, 145, 0.14)) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 18px rgba(221, 111, 145, 0.14);
}

body:not(.light) .readiness-lane.bad .client-chip {
  border-color: rgba(242, 140, 168, 0.22);
  background:
    linear-gradient(90deg, rgba(221, 111, 145, 0.12), transparent 58%),
    rgba(8, 15, 27, 0.52);
}

body:not(.light) .readiness-lane.bad .client-chip small {
  color: var(--risk-strong);
  font-weight: 850;
}

body:not(.light) .readiness-lane.bad .client-chip:hover {
  border-color: rgba(242, 140, 168, 0.5);
  background:
    linear-gradient(90deg, rgba(221, 111, 145, 0.18), transparent 64%),
    rgba(14, 22, 36, 0.72);
  box-shadow: 0 0 20px rgba(221, 111, 145, 0.12);
}

body:not(.light) #interventionList .intervention-row {
  border-color: rgba(242, 140, 168, 0.22);
  background:
    linear-gradient(90deg, rgba(221, 111, 145, 0.12), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 62%),
    rgba(8, 15, 27, 0.56);
  box-shadow: inset 3px 0 0 rgba(221, 111, 145, 0.46);
}

body:not(.light) #interventionList .intervention-row:hover {
  border-color: rgba(242, 140, 168, 0.58) !important;
  background:
    linear-gradient(90deg, rgba(221, 111, 145, 0.18), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 62%),
    rgba(14, 22, 36, 0.74) !important;
  box-shadow: inset 3px 0 0 rgba(242, 140, 168, 0.76), 0 0 24px rgba(221, 111, 145, 0.14);
}

body:not(.light) #interventionList .intervention-row small,
body:not(.light) .signoff-status.pending,
body:not(.light) .status-label.bad,
body:not(.light) .summary-pill.bad,
body:not(.light) .pill.bad,
body:not(.light) .badge.bad {
  color: var(--risk-ink) !important;
  border-color: rgba(242, 140, 168, 0.42) !important;
  background: rgba(221, 111, 145, 0.14) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body:not(.light) #interventionList .intervention-row small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(242, 140, 168, 0.42);
  border-radius: 999px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

body:not(.light) .signoff-status.pending::before,
body:not(.light) .status-label.bad::before {
  background: var(--risk-strong);
  box-shadow: 0 0 12px rgba(221, 111, 145, 0.32);
}

body:not(.light) #ownerQueue .owner-row div:nth-child(4) {
  border-radius: 8px;
  background: rgba(221, 111, 145, 0.075);
}

body:not(.light) #ownerQueue .owner-row div:nth-child(4) b {
  color: var(--risk-strong);
  font-weight: 850;
  text-shadow: 0 0 14px rgba(221, 111, 145, 0.18);
}

body:not(.light) #ownerQueue .owner-row div:nth-child(4) span {
  color: color-mix(in srgb, var(--risk-ink), var(--text-secondary) 18%);
}

body:not(.light) #ownerQueue .owner-row:hover div:nth-child(4) {
  background: rgba(221, 111, 145, 0.13);
}

body:not(.light) .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 1) { fill: #7388a0 !important; }
body:not(.light) .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 2) { fill: #a6966c !important; }
body:not(.light) .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 3) { fill: #8d8aa4 !important; }
body:not(.light) .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 4) { fill: #779f91 !important; }
body:not(.light) .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n) { fill: #ad7480 !important; }

body.light #executiveKpis .executive-card:nth-child(4),
body.light .executive-card.bad,
body.light .readiness-lane.bad,
body.light .audit-bucket.bad,
body.light .movement-card.bad,
body.light .diagnostic-card.bad,
body.light .insight-card.bad {
  border-color: var(--risk-line) !important;
  background:
    linear-gradient(180deg, var(--risk-wash), transparent 58%),
    var(--executive-surface) !important;
  box-shadow:
    var(--executive-shadow),
    inset 0 3px 0 rgba(184, 71, 99, 0.48),
    inset 4px 0 0 rgba(184, 71, 99, 0.16) !important;
}

body.light #executiveKpis .executive-card:nth-child(4) strong,
body.light .executive-card.bad strong,
body.light .intervention-row strong,
body.light .intervention-row strong.bad,
body.light .portfolio-score.bad,
body.light .diagnostic-summary strong.bad,
body.light .diagnostic-card.bad strong,
body.light .insight-card.bad strong,
body.light .audited-risk-table strong.bad,
body.light .auditor-focus-list strong.bad {
  color: var(--risk-primary) !important;
  font-weight: 800;
}

body.light .readiness-lane.bad .lane-head span,
body.light .queue-rank-1,
body.light .score-badge.bad,
body.light .mini-badge.bad {
  color: var(--risk-ink) !important;
  border-color: rgba(184, 71, 99, 0.26) !important;
  background: rgba(184, 71, 99, 0.1) !important;
}

body.light .readiness-lane.bad .client-chip,
body.light #interventionList .intervention-row {
  border-color: rgba(184, 71, 99, 0.2);
  background:
    linear-gradient(90deg, rgba(184, 71, 99, 0.075), transparent 58%),
    #ffffff;
  box-shadow: inset 3px 0 0 rgba(184, 71, 99, 0.22);
}

body.light .readiness-lane.bad .client-chip:hover,
body.light #interventionList .intervention-row:hover {
  border-color: rgba(184, 71, 99, 0.34) !important;
  background:
    linear-gradient(90deg, rgba(184, 71, 99, 0.11), transparent 60%),
    #ffffff !important;
}

body.light #interventionList .intervention-row small,
body.light .signoff-status.pending,
body.light .status-label.bad,
body.light .summary-pill.bad,
body.light .pill.bad,
body.light .badge.bad {
  color: var(--risk-ink) !important;
  border-color: rgba(184, 71, 99, 0.25) !important;
  background: rgba(184, 71, 99, 0.075) !important;
}

body.light #interventionList .intervention-row small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(184, 71, 99, 0.25);
  border-radius: 999px;
  font-weight: 850;
  letter-spacing: 0.01em;
}

body.light #ownerQueue .owner-row div:nth-child(4) {
  border-radius: 8px;
  background: rgba(184, 71, 99, 0.055);
}

body.light #ownerQueue .owner-row div:nth-child(4) b {
  color: var(--risk-primary);
  font-weight: 850;
}

body.light #ownerQueue .owner-row div:nth-child(4) span {
  color: color-mix(in srgb, var(--risk-primary), var(--text-secondary) 26%);
}

body.light .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 1) { fill: #8494a7 !important; }
body.light .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 2) { fill: #b1a37e !important; }
body.light .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 3) { fill: #9a97ad !important; }
body.light .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n + 4) { fill: #89aa9d !important; }
body.light .pareto-combo-svg .pareto-bar-rect:nth-of-type(5n) { fill: #ba8490 !important; }

/* ---------- 28. Header dimensional gradient ---------- */

.topbar h1,
.topbar p {
  display: block;
  width: fit-content;
  max-width: 100%;
  background-color: transparent;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar h1 {
  --header-gradient-from: #63def1;
  --header-gradient-to: #e27aa2;
  padding-bottom: 2px;
  background: linear-gradient(106deg, var(--header-gradient-from) 8%, var(--header-gradient-to) 92%);
  -webkit-text-stroke: 0.25px rgba(255, 255, 255, 0.18);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 rgba(3, 9, 18, 0.38),
    0 11px 20px rgba(0, 0, 0, 0.42),
    -8px 0 30px color-mix(in srgb, var(--accent-primary), transparent 70%),
    8px 0 30px color-mix(in srgb, var(--accent-critical), transparent 76%);
}

.topbar p {
  --subtitle-gradient-from: color-mix(in srgb, #63def1, var(--text-secondary) 52%);
  --subtitle-gradient-to: color-mix(in srgb, #e27aa2, var(--text-secondary) 58%);
  max-width: 72ch;
  background: linear-gradient(104deg, var(--subtitle-gradient-from) 0%, var(--subtitle-gradient-to) 100%);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

body:not(.light) .topbar h1 {
  color: var(--text-primary);
  background: linear-gradient(106deg, #63def1 8%, #e27aa2 92%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 0 rgba(3, 9, 18, 0.38),
    0 11px 20px rgba(0, 0, 0, 0.42),
    -8px 0 30px rgba(99, 222, 241, 0.24),
    8px 0 30px rgba(226, 122, 162, 0.2);
}

body:not(.light) .topbar p {
  background: linear-gradient(104deg, color-mix(in srgb, #63def1, var(--text-secondary) 52%) 0%, color-mix(in srgb, #e27aa2, var(--text-secondary) 58%) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.light .topbar h1 {
  --header-gradient-from: #00384f;
  --header-gradient-to: #741239;
  color: var(--text-primary);
  font-weight: 800;
  background: linear-gradient(106deg, var(--header-gradient-from) 8%, var(--header-gradient-to) 92%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 0.32px rgba(19, 28, 40, 0.3);
  filter: drop-shadow(0 5px 8px rgba(19, 28, 40, 0.18));
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28),
    0 2px 0 rgba(19, 28, 40, 0.22),
    -4px 0 14px rgba(0, 56, 79, 0.16),
    4px 0 14px rgba(116, 18, 57, 0.14);
}

body.light .topbar p {
  --subtitle-gradient-from: color-mix(in srgb, #00384f, var(--text-secondary) 10%);
  --subtitle-gradient-to: color-mix(in srgb, #741239, var(--text-secondary) 14%);
  color: var(--text-secondary);
  font-weight: 650;
  background: linear-gradient(104deg, var(--subtitle-gradient-from) 0%, var(--subtitle-gradient-to) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.34),
    0 2px 4px rgba(19, 28, 40, 0.14);
}

/* ---------- 29. Owner report alignment fixes ---------- */

body:not(.light) .owner-report-panel {
  overflow: visible;
}

body:not(.light) .owner-report-section-head {
  border-bottom-color: var(--executive-line);
}
