/* Position Analyzer design system вЂ” shared geometry, semantic theme tokens. */
:root {
  --pa-sidebar-width: 236px;
  --pa-sidebar-compact: 84px;
  --pa-header-height: 84px;
  --pa-content-max: 1680px;
  --pa-control-height: 42px;
  --pa-radius-control: 11px;
  --pa-radius-card: 16px;
  --pa-radius-panel: 20px;
  --pa-space-1: 4px;
  --pa-space-2: 8px;
  --pa-space-3: 12px;
  --pa-space-4: 16px;
  --pa-space-5: 20px;
  --pa-space-6: 24px;
  --pa-space-7: 28px;
  --pa-font: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  --pa-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-design-theme="dark-premium"],
html[data-design-theme="dark-premium"] body {
  color-scheme: dark;
  --page-bg: #090f19;
  --sidebar-bg: #0d1420;
  --topbar-bg: rgba(9, 15, 25, .88);
  --surface-primary: #111925;
  --surface-secondary: #151f2d;
  --surface-tertiary: #1b2737;
  --surface-elevated: #182332;
  --surface-hover: #202d3e;
  --surface-active: #682238;
  --surface-disabled: #151d28;
  --overlay-bg: rgba(17, 25, 37, .96);
  --backdrop-bg: rgba(2, 5, 10, .76);
  --text-primary: #f1ede5;
  --text-secondary: #c2b8aa;
  --text-muted: #8e8790;
  --text-disabled: #626876;
  --text-inverse: #fff8eb;
  --text-link: #e6c18b;
  --text-link-hover: #f6d6a5;
  --border-default: #293445;
  --border-soft: #202b3b;
  --border-strong: #3b485b;
  --border-focus: #c58f4c;
  --accent-primary: #7c203c;
  --accent-primary-hover: #91304c;
  --accent-primary-active: #64172f;
  --accent-primary-text: #fff8f1;
  --accent-secondary: #d0a15d;
  --accent-soft: rgba(124, 32, 60, .22);
  --success: #8bcf72;
  --success-bg: rgba(77, 139, 75, .16);
  --success-border: rgba(139, 207, 114, .34);
  --danger: #ec7183;
  --danger-bg: rgba(159, 49, 70, .18);
  --danger-border: rgba(236, 113, 131, .35);
  --warning: #e0b46d;
  --warning-bg: rgba(171, 121, 45, .18);
  --warning-border: rgba(224, 180, 109, .34);
  --info: #b39af5;
  --info-bg: rgba(117, 87, 190, .18);
  --info-border: rgba(179, 154, 245, .34);
  --neutral: #a8a6ae;
  --neutral-bg: rgba(136, 143, 155, .14);
  --neutral-border: rgba(168, 166, 174, .28);
  --input-bg: #0d141f;
  --input-text: #f1ede5;
  --input-placeholder: #777f8c;
  --input-border: #334052;
  --input-hover-border: #4a596d;
  --input-focus-border: #c58f4c;
  --input-disabled-bg: #151d28;
  --table-header-bg: #161f2c;
  --table-row-bg: #111925;
  --table-row-alt-bg: #141e2b;
  --table-row-hover-bg: #1b2838;
  --table-row-selected-bg: #252f42;
  --table-border: #263244;
  --table-footer-bg: #0d141f;
  --shadow-card: 0 14px 38px rgba(0, 0, 0, .18);
  --shadow-dropdown: 0 20px 52px rgba(0, 0, 0, .48);
  --shadow-modal: 0 30px 90px rgba(0, 0, 0, .62);
  --shadow-focus: 0 0 0 3px rgba(197, 143, 76, .24);
  --chart-line-primary: #b13a62;
  --chart-line-secondary: #a878ed;
  --chart-grid: #273345;
  --chart-axis: #435066;
  --chart-label: #a9a1a0;
  --chart-tooltip-bg: #1b2533;
  --chart-tooltip-text: #f6eee2;
  --chart-segment-1: #bd345d;
  --chart-segment-2: #963350;
  --chart-segment-3: #d18d5b;
  --chart-segment-4: #d8b987;
  --chart-segment-5: #5d6470;
  --chart-segment-6: #343b46;
  --public-bg: var(--page-bg);
  --public-sidebar: var(--sidebar-bg);
  --public-panel: var(--surface-primary);
  --public-panel-2: var(--surface-secondary);
  --public-panel-3: var(--surface-tertiary);
  --public-text: var(--text-primary);
  --public-muted: var(--text-secondary);
  --public-soft: var(--text-muted);
  --public-border: var(--border-default);
  --public-accent: var(--accent-primary);
  --public-accent-2: var(--accent-secondary);
  --public-good: var(--success);
  --public-warn: var(--warning);
  --public-inverse: var(--accent-primary-text);
  --public-shadow: var(--shadow-modal);
  --public-shadow-soft: var(--shadow-dropdown);
}

html[data-design-theme="light-premium"],
html[data-design-theme="light-premium"] body {
  color-scheme: light;
  --page-bg: #f4f0e9;
  --sidebar-bg: #fbf8f2;
  --topbar-bg: rgba(244, 240, 233, .9);
  --surface-primary: #fffdf8;
  --surface-secondary: #f8f3eb;
  --surface-tertiary: #eee5d8;
  --surface-elevated: #fffaf3;
  --surface-hover: #f1e7da;
  --surface-active: #791d37;
  --surface-disabled: #ece4da;
  --overlay-bg: rgba(255, 253, 248, .96);
  --backdrop-bg: rgba(54, 40, 34, .44);
  --text-primary: #241b18;
  --text-secondary: #6e6058;
  --text-muted: #95877d;
  --text-disabled: #b7aa9d;
  --text-inverse: #fffaf3;
  --text-link: #791d37;
  --text-link-hover: #561125;
  --border-default: #ded3c5;
  --border-soft: #ece3d8;
  --border-strong: #bfae9d;
  --border-focus: #8d2a44;
  --accent-primary: #791d37;
  --accent-primary-hover: #8f2c49;
  --accent-primary-active: #5b1228;
  --accent-primary-text: #fffaf4;
  --accent-secondary: #a5793c;
  --accent-soft: rgba(121, 29, 55, .1);
  --success: #278b52;
  --success-bg: #e9f4ec;
  --success-border: #badbc3;
  --danger: #c83f54;
  --danger-bg: #f8e8eb;
  --danger-border: #e8b8c1;
  --warning: #9a6b22;
  --warning-bg: #f7eddc;
  --warning-border: #e5ca98;
  --info: #6e5a9c;
  --info-bg: #eeeaf7;
  --info-border: #cdc2e3;
  --neutral: #756b65;
  --neutral-bg: #f0ebe4;
  --neutral-border: #d9cec2;
  --input-bg: #fffefa;
  --input-text: #241b18;
  --input-placeholder: #9a8b80;
  --input-border: #d8cbbb;
  --input-hover-border: #b9a692;
  --input-focus-border: #8d2a44;
  --input-disabled-bg: #eee7de;
  --table-header-bg: #f2e9dd;
  --table-row-bg: #fffdf8;
  --table-row-alt-bg: #faf5ee;
  --table-row-hover-bg: #f2e6d9;
  --table-row-selected-bg: #ead8c8;
  --table-border: #e5dacd;
  --table-footer-bg: #faf4eb;
  --shadow-card: 0 10px 32px rgba(58, 44, 35, .08), 0 1px 2px rgba(58, 44, 35, .05);
  --shadow-dropdown: 0 20px 50px rgba(58, 44, 35, .16);
  --shadow-modal: 0 30px 90px rgba(58, 44, 35, .22);
  --shadow-focus: 0 0 0 3px rgba(121, 29, 55, .14);
  --chart-line-primary: #8d2340;
  --chart-line-secondary: #a5793c;
  --chart-grid: #e4d9cd;
  --chart-axis: #c4b5a4;
  --chart-label: #75675f;
  --chart-tooltip-bg: #2b201c;
  --chart-tooltip-text: #fffaf3;
  --chart-segment-1: #791d37;
  --chart-segment-2: #a02e4c;
  --chart-segment-3: #a5793c;
  --chart-segment-4: #c6a56f;
  --chart-segment-5: #d8c9b8;
  --chart-segment-6: #eee5d9;
  --public-bg: var(--page-bg);
  --public-sidebar: var(--sidebar-bg);
  --public-panel: var(--surface-primary);
  --public-panel-2: var(--surface-secondary);
  --public-panel-3: var(--surface-tertiary);
  --public-text: var(--text-primary);
  --public-muted: var(--text-secondary);
  --public-soft: var(--text-muted);
  --public-border: var(--border-default);
  --public-accent: var(--accent-primary);
  --public-accent-2: var(--accent-secondary);
  --public-good: var(--success);
  --public-warn: var(--warning);
  --public-inverse: var(--accent-primary-text);
  --public-shadow: var(--shadow-modal);
  --public-shadow-soft: var(--shadow-dropdown);
}

html[data-design-theme="green-retro"],
html[data-design-theme="green-retro"] body {
  color-scheme: dark;
  --page-bg: #102319;
  --sidebar-bg: #132a1e;
  --topbar-bg: rgba(16, 35, 25, .9);
  --surface-primary: #183224;
  --surface-secondary: #1d3b2a;
  --surface-tertiary: #274a34;
  --surface-elevated: #1e3d2b;
  --surface-hover: #294d38;
  --surface-active: #6e6b2e;
  --surface-disabled: #173023;
  --overlay-bg: rgba(24, 50, 36, .96);
  --backdrop-bg: rgba(3, 14, 8, .68);
  --text-primary: #f0ebce;
  --text-secondary: #cdc69f;
  --text-muted: #9f9b72;
  --text-disabled: #737556;
  --text-inverse: #152016;
  --text-link: #e1d98c;
  --text-link-hover: #fff5b6;
  --border-default: #405b3d;
  --border-soft: #304b35;
  --border-strong: #60734d;
  --border-focus: #c8bd61;
  --accent-primary: #a7a247;
  --accent-primary-hover: #bbb65b;
  --accent-primary-active: #898531;
  --accent-primary-text: #142016;
  --accent-secondary: #d2c47a;
  --accent-soft: rgba(167, 162, 71, .16);
  --success: #a9cf78;
  --success-bg: rgba(105, 151, 70, .18);
  --success-border: rgba(169, 207, 120, .38);
  --danger: #e1a071;
  --danger-bg: rgba(163, 88, 49, .2);
  --danger-border: rgba(225, 160, 113, .38);
  --warning: #ded273;
  --warning-bg: rgba(155, 145, 50, .2);
  --warning-border: rgba(222, 210, 115, .38);
  --info: #c8bd61;
  --info-bg: rgba(140, 136, 58, .2);
  --info-border: rgba(200, 189, 97, .38);
  --neutral: #c1bc96;
  --neutral-bg: rgba(151, 151, 110, .15);
  --neutral-border: rgba(193, 188, 150, .3);
  --input-bg: #0e2017;
  --input-text: #f0ebce;
  --input-placeholder: #898963;
  --input-border: #486241;
  --input-hover-border: #697d55;
  --input-focus-border: #c8bd61;
  --input-disabled-bg: #183024;
  --table-header-bg: #dde3b9;
  --table-row-bg: #f5f0d3;
  --table-row-alt-bg: #ece9c8;
  --table-row-hover-bg: #e2e7b8;
  --table-row-selected-bg: #d4dda6;
  --table-border: #b7be8f;
  --table-footer-bg: #e8e5c3;
  --retro-sheet-bg: #f5f0d3;
  --retro-sheet-bg-alt: #ece9c8;
  --retro-sheet-head: #2d542f;
  --retro-sheet-head-light: #dde3b9;
  --retro-sheet-grid: #b7be8f;
  --retro-sheet-text: #192019;
  --retro-sheet-muted: #5e6653;
  --shadow-card: 0 14px 38px rgba(3, 13, 7, .2);
  --shadow-dropdown: 0 20px 52px rgba(3, 13, 7, .5);
  --shadow-modal: 0 30px 90px rgba(3, 13, 7, .65);
  --shadow-focus: 0 0 0 3px rgba(200, 189, 97, .22);
  --chart-line-primary: #d5ca66;
  --chart-line-secondary: #a2b45e;
  --chart-grid: #38543a;
  --chart-axis: #60734d;
  --chart-label: #c1bc96;
  --chart-tooltip-bg: #0d1c14;
  --chart-tooltip-text: #f0ebce;
  --chart-segment-1: #d7ca66;
  --chart-segment-2: #b5ac4e;
  --chart-segment-3: #8d913f;
  --chart-segment-4: #6c7b3c;
  --chart-segment-5: #50643b;
  --chart-segment-6: #334a33;
  --public-bg: var(--page-bg);
  --public-sidebar: var(--sidebar-bg);
  --public-panel: var(--surface-primary);
  --public-panel-2: var(--surface-secondary);
  --public-panel-3: var(--retro-sheet-bg);
  --public-text: var(--text-primary);
  --public-muted: var(--text-secondary);
  --public-soft: var(--text-muted);
  --public-border: var(--border-default);
  --public-accent: var(--accent-primary);
  --public-accent-2: var(--accent-secondary);
  --public-good: var(--success);
  --public-warn: var(--warning);
  --public-inverse: var(--accent-primary-text);
  --public-shadow: var(--shadow-modal);
  --public-shadow-soft: var(--shadow-dropdown);
}

html[data-design-theme] body {
  --bg: var(--page-bg);
  --panel: var(--surface-primary);
  --panel2: var(--surface-secondary);
  --border: var(--border-default);
  --border2: var(--border-soft);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --muted2: var(--text-muted);
  --accent: var(--accent-primary);
  --accent2: var(--accent-primary-hover);
  --pa-bg: var(--page-bg);
  --pa-surface: var(--surface-primary);
  --pa-surface-muted: var(--surface-secondary);
  --pa-surface-inset: var(--surface-tertiary);
  --pa-text: var(--text-primary);
  --pa-text-muted: var(--text-secondary);
  --pa-text-subtle: var(--text-muted);
  --pa-border: var(--border-default);
  --pa-border-subtle: var(--border-soft);
  --pa-accent: var(--accent-primary);
  --pa-accent-hover: var(--accent-primary-hover);
  --pa-success: var(--success);
  --pa-success-soft: var(--success-bg);
  --pa-danger: var(--danger);
  --pa-danger-soft: var(--danger-bg);
  --pa-warning: var(--warning);
  --pa-warning-soft: var(--warning-bg);
  --matrix-bg: var(--table-row-bg);
  --matrix-bg-2: var(--table-row-alt-bg);
  --matrix-bg-3: var(--surface-tertiary);
  --matrix-line: var(--table-border);
  --matrix-line-soft: var(--border-soft);
  min-width: 0;
  margin: 0;
  background:
    radial-gradient(circle at 82% 0%, color-mix(in srgb, var(--accent-primary) 8%, transparent), transparent 30rem),
    var(--page-bg) !important;
  color: var(--text-primary) !important;
  font-family: var(--pa-font) !important;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-design-theme] *,
html[data-design-theme] *::before,
html[data-design-theme] *::after { box-sizing: border-box; }

html[data-design-theme] :focus-visible {
  outline: 2px solid var(--border-focus) !important;
  outline-offset: 2px;
  box-shadow: var(--shadow-focus) !important;
}

html[data-design-theme] ::selection {
  background: color-mix(in srgb, var(--accent-primary) 72%, transparent);
  color: var(--text-inverse);
}

html[data-design-theme] h1,
html[data-design-theme] h2,
html[data-design-theme] h3,
html[data-design-theme] h4,
html[data-design-theme] strong,
html[data-design-theme] b { color: var(--text-primary); }

html[data-design-theme] a { color: var(--text-link); }
html[data-design-theme] a:hover { color: var(--text-link-hover); }

html[data-design-theme] button,
html[data-design-theme] input,
html[data-design-theme] textarea,
html[data-design-theme] select { font: inherit; }

html[data-design-theme] button,
html[data-design-theme] a,
html[data-design-theme] input,
html[data-design-theme] textarea,
html[data-design-theme] select { -webkit-tap-highlight-color: transparent; }

html[data-design-theme] ::-webkit-scrollbar { width: 10px; height: 10px; }
html[data-design-theme] ::-webkit-scrollbar-track { background: var(--surface-secondary); }
html[data-design-theme] ::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-secondary);
  border-radius: 999px;
  background: var(--border-strong);
}

/* Application shell */
html[data-design-theme] body.home-page,
html[data-design-theme] body.project-page {
  display: block !important;
  grid-template-columns: none !important;
  padding-left: var(--pa-sidebar-width) !important;
  padding-right: 0 !important;
}

html[data-design-theme] body > header {
  position: sticky !important;
  top: 0;
  z-index: 90;
  min-height: var(--pa-header-height);
  border: 0 !important;
  border-bottom: 1px solid var(--border-soft) !important;
  background: var(--topbar-bg) !important;
  backdrop-filter: blur(18px);
  box-shadow: none !important;
}

html[data-design-theme] body > header .container,
html[data-design-theme] body > .container,
html[data-design-theme] body > main.container {
  width: min(100%, var(--pa-content-max)) !important;
  max-width: var(--pa-content-max) !important;
  margin-inline: auto !important;
  padding-inline: clamp(18px, 2vw, 32px) !important;
}

html[data-design-theme] body > header .header-content {
  min-height: var(--pa-header-height) !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

html[data-design-theme] .logo { display: none !important; }

html[data-design-theme] .premium-context {
  display: grid !important;
  min-width: 0;
  gap: 1px;
}
html[data-design-theme] .premium-context > span {
  display: block;
  margin-bottom: 2px;
  color: var(--accent-secondary) !important;
  font-size: 11px !important;
  font-weight: 760 !important;
  letter-spacing: .08em;
  text-transform: uppercase;
}
html[data-design-theme] .premium-context h1 {
  max-width: min(52vw, 680px);
  margin: 0 !important;
  overflow: hidden;
  color: var(--text-primary) !important;
  font-size: clamp(20px, 2vw, 27px) !important;
  line-height: 1.12 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-design-theme] .premium-context p {
  max-width: min(55vw, 760px);
  margin: 4px 0 0 !important;
  overflow: hidden;
  color: var(--text-secondary) !important;
  font-size: 12px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] .premium-sidebar {
  position: fixed !important;
  inset: 0 auto 0 0 !important;
  z-index: 120 !important;
  display: flex !important;
  width: var(--pa-sidebar-width) !important;
  padding: 22px 14px 16px !important;
  flex-direction: column;
  border: 0 !important;
  border-right: 1px solid var(--border-default) !important;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 5%, transparent), transparent 36%),
    var(--sidebar-bg) !important;
  box-shadow: none !important;
}

html[data-design-theme] .premium-sidebar-brand { padding: 2px 10px 24px !important; }
html[data-design-theme] .premium-sidebar-brand a {
  display: inline-flex !important;
  align-items: center;
  gap: 11px;
  color: var(--text-primary) !important;
  font-size: 20px !important;
  font-weight: 820 !important;
  letter-spacing: -.02em;
  text-decoration: none;
}
html[data-design-theme] .premium-sidebar-brand i { color: var(--accent-secondary) !important; }

html[data-design-theme] .premium-sidebar-nav {
  display: flex !important;
  min-height: 0;
  gap: 4px !important;
  flex: 1 1 auto;
  flex-direction: column;
  overflow-y: auto;
}

html[data-design-theme] .premium-sidebar-nav a,
html[data-design-theme] .premium-sidebar-bottom a,
html[data-design-theme] .premium-sidebar-bottom button {
  position: relative;
  display: flex !important;
  min-height: 43px !important;
  padding: 0 13px !important;
  align-items: center;
  gap: 12px !important;
  border: 1px solid transparent !important;
  border-radius: 11px !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  line-height: 1.15;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

html[data-design-theme] .premium-sidebar-nav a i,
html[data-design-theme] .premium-sidebar-bottom a > i:first-child,
html[data-design-theme] .premium-sidebar-bottom button > i:first-child {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  flex: 0 0 18px;
  color: var(--accent-secondary) !important;
  font-size: 15px;
}

html[data-design-theme] .premium-sidebar-nav a:hover,
html[data-design-theme] .premium-sidebar-bottom a:hover,
html[data-design-theme] .premium-sidebar-bottom button:hover {
  border-color: var(--border-soft) !important;
  background: var(--surface-hover) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] .premium-sidebar-nav a.active {
  border-color: color-mix(in srgb, var(--accent-primary) 58%, var(--border-default)) !important;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-primary) 72%, var(--surface-secondary)), var(--accent-primary)) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-primary) 22%, transparent) !important;
}
html[data-design-theme] .premium-sidebar-nav a.active i { color: var(--accent-primary-text) !important; }

html[data-design-theme] .premium-sidebar-bottom {
  display: grid !important;
  gap: 4px !important;
  margin-top: 12px;
  padding-top: 12px !important;
  border-top: 1px solid var(--border-soft) !important;
}

html[data-design-theme] .premium-sidebar-theme-button .theme-dots {
  display: inline-flex !important;
  margin-left: auto;
  gap: 5px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
  pointer-events: none;
}
html[data-design-theme] .premium-sidebar-theme-button:hover .theme-dots,
html[data-design-theme] .premium-sidebar-theme-button:focus-visible .theme-dots,
html[data-design-theme] .premium-sidebar-theme-button:focus-within .theme-dots {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
html[data-design-theme] .theme-dot {
  width: 10px !important;
  height: 10px !important;
  border: 1px solid color-mix(in srgb, var(--text-primary) 28%, transparent) !important;
  border-radius: 50% !important;
}
html[data-design-theme] .theme-dot-dark { background: #7c203c !important; }
html[data-design-theme] .theme-dot-light { background: #f6efe5 !important; }
html[data-design-theme] .theme-dot-retro { background: #25452d !important; }
html[data-design-theme] .theme-dot.active { box-shadow: 0 0 0 2px var(--sidebar-bg), 0 0 0 3px var(--accent-secondary) !important; }

html[data-design-theme] body .account-console-pill #account-initials {
  width: auto !important;
  min-width: 24px;
  height: auto !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--accent-secondary) !important;
  font-weight: 850 !important;
}
html[data-design-theme="light-premium"] body .account-console-pill #account-initials {
  color: var(--text-primary) !important;
}

/* Controls */
html[data-design-theme] .btn,
html[data-design-theme] .header-control,
html[data-design-theme] .icon-btn,
html[data-design-theme] .premium-icon-button,
html[data-design-theme] button.audit-refresh {
  display: inline-flex !important;
  min-height: var(--pa-control-height) !important;
  padding: 0 15px !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-control) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
  font-weight: 720 !important;
  line-height: 1 !important;
  text-decoration: none;
  box-shadow: none !important;
  cursor: pointer;
}
html[data-design-theme] .btn:hover,
html[data-design-theme] .header-control:hover,
html[data-design-theme] .icon-btn:hover,
html[data-design-theme] .premium-icon-button:hover {
  border-color: var(--border-strong) !important;
  background: var(--surface-hover) !important;
  transform: none !important;
}
html[data-design-theme] .btn.btn-primary,
html[data-design-theme] .premium-top-action {
  border-color: color-mix(in srgb, var(--accent-primary) 75%, var(--border-strong)) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 88%, #fff 5%), var(--accent-primary)) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-primary) 22%, transparent) !important;
}
html[data-design-theme] .btn.btn-primary:hover,
html[data-design-theme] .premium-top-action:hover { background: var(--accent-primary-hover) !important; }

/* Keep legacy theme selectors from splitting a primary control's background and
   foreground across two different palettes. These selectors intentionally carry
   the same body-level specificity as the legacy stylesheet. */
html[data-design-theme] body .btn.btn-primary,
html[data-design-theme] body .premium-top-action,
html[data-design-theme] body.theme-light-premium .btn.btn-primary,
html[data-design-theme] body.theme-light-premium .premium-top-action {
  border-color: color-mix(in srgb, var(--accent-primary) 75%, var(--border-strong)) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-primary) 88%, #fff 5%), var(--accent-primary)) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent-primary) 22%, transparent) !important;
}
html[data-design-theme] body .btn.btn-primary *,
html[data-design-theme] body .premium-top-action *,
html[data-design-theme] body.theme-light-premium .btn.btn-primary *,
html[data-design-theme] body.theme-light-premium .premium-top-action * { color: inherit !important; }
html[data-design-theme] body .btn.btn-primary:hover,
html[data-design-theme] body .premium-top-action:hover,
html[data-design-theme] body.theme-light-premium .btn.btn-primary:hover,
html[data-design-theme] body.theme-light-premium .premium-top-action:hover {
  border-color: var(--accent-primary-hover) !important;
  background: var(--accent-primary-hover) !important;
}
html[data-design-theme] body .premium-icon-button,
html[data-design-theme] body button.audit-refresh,
html[data-design-theme] body .analytics-summary .premium-icon-button {
  color: var(--text-primary) !important;
}
html[data-design-theme] body .premium-icon-button *,
html[data-design-theme] body button.audit-refresh *,
html[data-design-theme] body .analytics-summary .premium-icon-button * { color: inherit !important; }
html[data-design-theme] .btn.btn-danger { border-color: var(--danger-border) !important; background: var(--danger-bg) !important; color: var(--danger) !important; }
html[data-design-theme] .btn:disabled,
html[data-design-theme] button:disabled { opacity: .65 !important; cursor: not-allowed !important; }
html[data-design-theme] .icon-btn,
html[data-design-theme] .premium-icon-button,
html[data-design-theme] .inline-edit,
html[data-design-theme] button.audit-refresh {
  width: 40px !important;
  min-width: 40px !important;
  padding: 0 !important;
}

html[data-design-theme] input:not([type="checkbox"]):not([type="radio"]),
html[data-design-theme] textarea,
html[data-design-theme] select {
  min-height: var(--pa-control-height) !important;
  border: 1px solid var(--input-border) !important;
  border-radius: var(--pa-radius-control) !important;
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  box-shadow: none !important;
}
html[data-design-theme] input:not([type="checkbox"]):not([type="radio"]),
html[data-design-theme] select { padding: 0 12px !important; }
html[data-design-theme] textarea { min-height: 112px; padding: 11px 12px !important; resize: vertical; }
html[data-design-theme] input::placeholder,
html[data-design-theme] textarea::placeholder { color: var(--input-placeholder) !important; opacity: 1; }
html[data-design-theme] input:hover,
html[data-design-theme] textarea:hover,
html[data-design-theme] select:hover { border-color: var(--input-hover-border) !important; }
html[data-design-theme] input:focus,
html[data-design-theme] textarea:focus,
html[data-design-theme] select:focus { border-color: var(--input-focus-border) !important; outline: 0; box-shadow: var(--shadow-focus) !important; }
html[data-design-theme] .form-group label,
html[data-design-theme] .form-group > span,
html[data-design-theme] label { color: var(--text-secondary); }

/* Shared surfaces */
html[data-design-theme] .card,
html[data-design-theme] .premium-card,
html[data-design-theme] .home-panel,
html[data-design-theme] .semantics-panel,
html[data-design-theme] .matrix-section,
html[data-design-theme] .audit-summary-panel,
html[data-design-theme] .audit-tab-content,
html[data-design-theme] .lead-panel,
html[data-design-theme] .lead-table-section,
html[data-design-theme] .monitoring-panel,
html[data-design-theme] .project-category-section {
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-panel) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-design-theme] .premium-card,
html[data-design-theme] .home-panel,
html[data-design-theme] .semantics-panel,
html[data-design-theme] .audit-summary-panel,
html[data-design-theme] .audit-tab-content { padding: clamp(18px, 2vw, 26px) !important; }

html[data-design-theme] .premium-card-head span,
html[data-design-theme] .premium-card-head p,
html[data-design-theme] .home-section-head p,
html[data-design-theme] .semantic-head p,
html[data-design-theme] .audit-title-block p { color: var(--text-secondary) !important; }

html[data-design-theme] .premium-card-dark,
html[data-design-theme] .premium-card-accent {
  border-color: color-mix(in srgb, var(--accent-primary) 58%, var(--border-default)) !important;
  background:
    radial-gradient(circle at 82% 16%, color-mix(in srgb, var(--accent-secondary) 14%, transparent), transparent 13rem),
    linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 76%, var(--surface-primary)), color-mix(in srgb, var(--accent-primary) 36%, var(--surface-primary))) !important;
}

html[data-design-theme] .premium-card-dark *,
html[data-design-theme] .premium-card-accent * { color: var(--accent-primary-text) !important; }

/* Project passport */
html[data-design-theme] .project-info {
  position: relative;
  display: grid !important;
  grid-template-columns: 108px minmax(260px, 1.15fr) minmax(280px, .85fr) !important;
  min-height: 230px;
  margin: 0 0 18px !important;
  padding: 26px !important;
  align-items: stretch;
  gap: 24px !important;
  overflow: visible !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-panel) !important;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-primary) 5%, transparent), transparent 46%),
    var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}
html[data-design-theme] .project-avatar,
html[data-design-theme] .project-main { align-self: center; }
html[data-design-theme] .project-avatar {
  display: grid !important;
  width: 102px !important;
  height: 102px !important;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent-secondary) 52%, var(--border-default)) !important;
  border-radius: 18px !important;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 52%, var(--surface-secondary)), var(--surface-secondary)) !important;
  color: var(--accent-secondary) !important;
  font-size: 32px !important;
  font-weight: 850 !important;
  letter-spacing: -.04em;
}
html[data-design-theme] .project-main {
  display: grid !important;
  min-width: 0;
  padding-right: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  column-gap: 24px;
  border-right: 1px solid var(--border-soft);
}
html[data-design-theme] .project-title-row { display: flex; align-items: center; gap: 10px; }
html[data-design-theme] .project-title-row h2 { margin: 0 !important; font-size: clamp(24px, 2.2vw, 32px) !important; letter-spacing: -.03em; }
html[data-design-theme] .project-title-row,
html[data-design-theme] .project-domain-link { grid-column: 1 / -1; }
html[data-design-theme] .project-domain-link { display: inline-flex; width: fit-content; margin: 8px 0 12px; align-items: center; gap: 7px; color: var(--text-secondary) !important; text-decoration: none; }
html[data-design-theme] .project-domain-link:hover { color: var(--text-link-hover) !important; }
html[data-design-theme] .project-meta-row,
html[data-design-theme] .project-access-row { display: grid !important; margin-top: 18px !important; gap: 0 !important; }
html[data-design-theme] .project-meta-row,
html[data-design-theme] .project-access-row {
  grid-template-columns: 1fr;
  margin-top: 0 !important;
  align-content: start;
}
html[data-design-theme] .project-meta-row > span,
html[data-design-theme] .project-access-row > span {
  display: flex !important;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px !important;
  align-items: center;
  gap: 9px;
  border: 0 !important;
  border-bottom: 1px solid var(--border-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-secondary) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-design-theme] .project-meta-row i,
html[data-design-theme] .project-access-row i { width: 18px; color: var(--accent-secondary) !important; text-align: center; }
html[data-design-theme] .access-on { color: var(--success) !important; }
html[data-design-theme] .access-off { color: var(--text-muted) !important; }
html[data-design-theme] .project-status-side {
  display: flex !important;
  min-width: 0;
  padding: 10px 0 10px 24px !important;
  align-self: stretch;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: center;
  border: 0 !important;
  border-left: 1px solid var(--border-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
html[data-design-theme] .tracking-status { align-self: flex-start; padding: 5px 10px; border: 1px solid var(--border-default); border-radius: 999px; background: var(--surface-secondary); color: var(--text-secondary); font-size: 12px; font-weight: 720; }
html[data-design-theme] .project-update-row { margin: 18px 0 16px !important; color: var(--text-secondary) !important; }
html[data-design-theme] .project-info-actions { display: grid !important; grid-template-columns: 1fr 42px; gap: 8px !important; }
html[data-design-theme] .project-info-actions .btn { width: 100%; min-width: 0; white-space: nowrap; }
html[data-design-theme] .project-info-actions .btn { grid-column: 1; }
html[data-design-theme] .project-info-actions .btn-primary { grid-row: 1; }
html[data-design-theme] .project-info-actions .btn-secondary { grid-row: 2; }
html[data-design-theme] .project-info-actions .project-page-row-menu {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: stretch;
}
html[data-design-theme] .project-info-actions .project-page-row-menu > .project-action-trigger { height: 100% !important; }
html[data-design-theme] .schedule-panel { grid-column: 1 / -1; margin-top: 4px; padding: 22px !important; border: 1px solid var(--border-default) !important; border-radius: var(--pa-radius-card) !important; background: var(--surface-secondary) !important; }

/* KPI and charts */
html[data-design-theme] .analytics-summary,
html[data-design-theme] .audit-kpi-grid { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px !important; }
html[data-design-theme] .analytics-summary > *,
html[data-design-theme] .audit-kpi-grid > * {
  min-width: 0;
  min-height: 142px !important;
  padding: 20px !important;
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-card) !important;
  background: var(--surface-primary) !important;
  box-shadow: var(--shadow-card) !important;
}
html[data-design-theme] .analytics-summary > :nth-child(2) {
  border-color: color-mix(in srgb, var(--accent-primary) 62%, var(--border-default)) !important;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 58%, var(--surface-primary)), color-mix(in srgb, var(--accent-primary) 24%, var(--surface-primary))) !important;
}
html[data-design-theme] .analytics-summary > :nth-child(2) * { color: var(--accent-primary-text) !important; }
html[data-design-theme] .premium-project-dashboard { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 16px; }
html[data-design-theme] .premium-project-dashboard > * { min-width: 0; }
html[data-design-theme] svg text { fill: var(--chart-label) !important; font-family: var(--pa-font) !important; }
html[data-design-theme] .premium-line-chart .premium-chart-grid { stroke: var(--chart-grid) !important; }
html[data-design-theme] .premium-line-chart .premium-chart-path { stroke: var(--chart-line-primary) !important; stroke-width: 2.25px !important; }

/* Tables */
html[data-design-theme] .table-wrap,
html[data-design-theme] .matrix-shell,
html[data-design-theme] .wordstat-table-wrap,
html[data-design-theme] .lead-table-wrap,
html[data-design-theme] .audit-table-wrap,
html[data-design-theme] .project-category-table-shell {
  max-width: 100%;
  overflow: auto !important;
  border: 1px solid var(--table-border) !important;
  border-radius: 13px !important;
  background: var(--table-row-bg) !important;
}
html[data-design-theme] .projects-grid,
html[data-design-theme] .project-category-board,
html[data-design-theme] .project-category-section {
  min-width: 0 !important;
  max-width: 100% !important;
}
html[data-design-theme] .project-category-section {
  width: 100% !important;
  overflow: hidden !important;
}
html[data-design-theme] .project-category-table-shell {
  width: 100% !important;
  min-width: 0 !important;
}
html[data-design-theme] .project-table { min-width: 1120px; }
html[data-design-theme] .project-table thead th {
  overflow: hidden;
  overflow-wrap: anywhere;
  white-space: normal !important;
}
html[data-design-theme] .project-table .project-name-cell,
html[data-design-theme] .project-table .project-name-cell > div { min-width: 0 !important; }
html[data-design-theme] .project-table .project-name-cell b,
html[data-design-theme] .project-table td > a {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[data-design-theme] table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  background: var(--table-row-bg) !important;
  color: var(--text-primary) !important;
  font-variant-numeric: tabular-nums;
}
html[data-design-theme] table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 44px;
  padding: 11px 12px !important;
  border: 0 !important;
  border-right: 1px solid var(--table-border) !important;
  border-bottom: 1px solid var(--table-border) !important;
  background: var(--table-header-bg) !important;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
html[data-design-theme] table tbody td {
  min-height: 42px;
  padding: 10px 12px !important;
  border: 0 !important;
  border-right: 1px solid var(--table-border) !important;
  border-bottom: 1px solid var(--table-border) !important;
  background: var(--table-row-bg) !important;
  color: var(--text-primary) !important;
  vertical-align: middle;
}
html[data-design-theme] table tbody tr:nth-child(even) td { background: var(--table-row-alt-bg) !important; }
html[data-design-theme] table tbody tr:hover td { background: var(--table-row-hover-bg) !important; }
html[data-design-theme] table tbody td:last-child,
html[data-design-theme] table thead th:last-child { border-right: 0 !important; }
html[data-design-theme] table a { color: var(--text-link) !important; }
html[data-design-theme] .empty,
html[data-design-theme] .empty-state,
html[data-design-theme] .premium-chart-empty { color: var(--text-muted) !important; }

/* Menus, dialogs, status */
html[data-design-theme] .header-dropdown,
html[data-design-theme] .project-action-menu,
html[data-design-theme] .modal-content {
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-card) !important;
  background: var(--surface-elevated) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-dropdown) !important;
}
html[data-design-theme] .modal {
  padding: 22px !important;
  background: var(--backdrop-bg) !important;
  backdrop-filter: blur(8px);
}
html[data-design-theme] .modal-content { width: min(720px, 100%) !important; max-height: calc(100dvh - 44px); overflow: auto; padding: 24px !important; box-shadow: var(--shadow-modal) !important; }
html[data-design-theme] .modal-header { padding: 0 0 18px !important; border-bottom: 1px solid var(--border-soft) !important; }
html[data-design-theme] .modal-actions { padding-top: 18px; border-top: 1px solid var(--border-soft); }
html[data-design-theme] .close { color: var(--text-secondary) !important; }
html[data-design-theme] .alert,
html[data-design-theme] .toast { border-radius: var(--pa-radius-control) !important; }
html[data-design-theme] .alert.success,
html[data-design-theme] .toast.success { border-color: var(--success-border) !important; background: var(--success-bg) !important; color: var(--success) !important; }
html[data-design-theme] .alert.error,
html[data-design-theme] .toast.error { border-color: var(--danger-border) !important; background: var(--danger-bg) !important; color: var(--danger) !important; }

/* Audit */
html[data-design-theme] .audit-page-shell { padding-block: 20px 42px !important; }
html[data-design-theme] .audit-toolbar { display: flex !important; align-items: flex-end !important; justify-content: space-between; gap: 18px; }
html[data-design-theme] .audit-title-block h1 { margin: 0 0 4px !important; font-size: 28px !important; }
html[data-design-theme] .audit-actions { display: flex !important; flex-wrap: wrap; justify-content: flex-end; gap: 8px !important; }
html[data-design-theme] .audit-summary-panel { margin-top: 14px; }
html[data-design-theme] .audit-score-card { border-right: 1px solid var(--border-soft); }
html[data-design-theme] .audit-tabs { display: flex; max-width: 100%; gap: 4px; overflow-x: auto; }
html[data-design-theme] .audit-tabs button,
html[data-design-theme] .audit-target-mode button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
}
html[data-design-theme] .audit-tabs button.active,
html[data-design-theme] .audit-target-mode button.active { border-color: var(--border-default); background: var(--surface-active); color: var(--accent-primary-text); }

/* Public utility pages */
html[data-design-theme] body.login-page,
html[data-design-theme] body.lead-page,
html[data-design-theme] body.monitoring-page { min-height: 100dvh; background: var(--page-bg) !important; }
html[data-design-theme] .login-card,
html[data-design-theme] .login-panel {
  border: 1px solid var(--border-default) !important;
  border-radius: var(--pa-radius-panel) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-modal) !important;
}
html[data-design-theme] .lead-header,
html[data-design-theme] .monitoring-header { border-bottom: 1px solid var(--border-soft) !important; background: var(--surface-primary) !important; }
html[data-design-theme] .lead-shell,
html[data-design-theme] .monitoring-shell { width: min(100% - 32px, var(--pa-content-max)) !important; margin-inline: auto !important; }
html[data-design-theme] .lead-table { min-width: 1220px; }

/* Green retro: dark workbook chrome with light, Excel-like data sheets. */
html[data-design-theme="green-retro"] body .table-wrap,
html[data-design-theme="green-retro"] body .matrix-shell,
html[data-design-theme="green-retro"] body .wordstat-table-wrap,
html[data-design-theme="green-retro"] body .lead-table-wrap,
html[data-design-theme="green-retro"] body .audit-table-wrap,
html[data-design-theme="green-retro"] body .project-category-table-shell,
html[data-design-theme="green-retro"] body .results-table-wrap {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22) !important;
}

html[data-design-theme="green-retro"] body table {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body table thead th,
html[data-design-theme="green-retro"] body .matrix-table thead th,
html[data-design-theme="green-retro"] body .matrix-table thead th * {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-head-light) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body table tbody td,
html[data-design-theme="green-retro"] body .matrix-table tbody td,
html[data-design-theme="green-retro"] body .matrix-table .matrix-keyword,
html[data-design-theme="green-retro"] body .matrix-table .topvisor-cell-button,
html[data-design-theme="green-retro"] body .matrix-table .topvisor-position-value {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body table tbody tr:nth-child(even) td,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:nth-child(even) td,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--retro-sheet-bg-alt) !important;
}

html[data-design-theme="green-retro"] body table tbody tr:hover td,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:hover td,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:hover .topvisor-keyword-cell,
html[data-design-theme="green-retro"] body .matrix-table tbody tr:hover .topvisor-frequency-cell {
  background: var(--table-row-hover-bg) !important;
}

html[data-design-theme="green-retro"] body table a,
html[data-design-theme="green-retro"] body table strong,
html[data-design-theme="green-retro"] body table b,
html[data-design-theme="green-retro"] body table small,
html[data-design-theme="green-retro"] body table span {
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body .matrix-toolbar,
html[data-design-theme="green-retro"] body .matrix-search-wrap,
html[data-design-theme="green-retro"] body .matrix-mode-segment,
html[data-design-theme="green-retro"] body .matrix-view-toggle,
html[data-design-theme="green-retro"] body .matrix-toolbar-btn,
html[data-design-theme="green-retro"] body .matrix-filter-select,
html[data-design-theme="green-retro"] body .matrix-filter-count,
html[data-design-theme="green-retro"] body .wordstat-result-toolbar {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body .matrix-toolbar input,
html[data-design-theme="green-retro"] body .matrix-toolbar select,
html[data-design-theme="green-retro"] body .matrix-toolbar button:not(.active),
html[data-design-theme="green-retro"] body .wordstat-result-toolbar input,
html[data-design-theme="green-retro"] body .wordstat-result-toolbar select,
html[data-design-theme="green-retro"] body table input,
html[data-design-theme="green-retro"] body table textarea,
html[data-design-theme="green-retro"] body table select {
  border-color: var(--retro-sheet-grid) !important;
  background: #fffbe2 !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body .matrix-toolbar input::placeholder,
html[data-design-theme="green-retro"] body table input::placeholder,
html[data-design-theme="green-retro"] body table textarea::placeholder { color: var(--retro-sheet-muted) !important; }

html[data-design-theme="green-retro"] body .topvisor-position-cell.is-up,
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-new { background: #dce8bd !important; }
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-down,
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-lost { background: #edd8c6 !important; }
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-same,
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-neutral,
html[data-design-theme="green-retro"] body .topvisor-position-cell.is-missing { background: var(--retro-sheet-bg-alt) !important; }

html[data-design-theme="green-retro"] body .lead-panel,
html[data-design-theme="green-retro"] body .lead-table-section {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

/* Final contrast guard: accent-card inheritance must not recolor controls that
   sit on their own pale/neutral button surface. */
html[data-design-theme] body .analytics-summary > * .premium-icon-button,
html[data-design-theme] body .analytics-summary > * .premium-icon-button *,
html[data-design-theme] body #premium-overview-card .premium-icon-button,
html[data-design-theme] body #premium-overview-card .premium-icon-button *,
html[data-design-theme] body.theme-light-premium #premium-overview-card .premium-icon-button,
html[data-design-theme] body.theme-light-premium #premium-overview-card .premium-icon-button * {
  color: var(--text-primary) !important;
}

html[data-design-theme] body .matrix-table thead button,
html[data-design-theme] body .matrix-table thead button * {
  background: transparent !important;
  color: var(--text-primary) !important;
}
html[data-design-theme="green-retro"] body .matrix-table thead button,
html[data-design-theme="green-retro"] body .matrix-table thead button * {
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body .btn:not(.btn-primary),
html[data-design-theme="green-retro"] body .header-control:not(.premium-top-action),
html[data-design-theme="green-retro"] body .matrix-toolbar-btn,
html[data-design-theme="green-retro"] body .icon-btn,
html[data-design-theme="green-retro"] body .inline-edit {
  border-color: var(--border-default) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}
html[data-design-theme="green-retro"] body .btn:not(.btn-primary) *,
html[data-design-theme="green-retro"] body .header-control:not(.premium-top-action) *,
html[data-design-theme="green-retro"] body .matrix-toolbar-btn *,
html[data-design-theme="green-retro"] body .icon-btn *,
html[data-design-theme="green-retro"] body .inline-edit * { color: inherit !important; }
html[data-design-theme="green-retro"] body .account-console-pill #account-initials {
  color: var(--accent-secondary) !important;
}
html[data-design-theme="green-retro"] body .audit-tabs button.active,
html[data-design-theme="green-retro"] body .audit-target-mode button.active {
  border-color: var(--accent-primary) !important;
  background: var(--accent-primary) !important;
  color: var(--accent-primary-text) !important;
}
html[data-design-theme="green-retro"] body .audit-tabs button.active *,
html[data-design-theme="green-retro"] body .audit-target-mode button.active * { color: inherit !important; }

html[data-design-theme] body .matrix-mode-segment button:disabled {
  background: var(--surface-secondary) !important;
  color: var(--text-secondary) !important;
  opacity: 1 !important;
}

/* Responsive */
@media (max-width: 1240px) {
  :root { --pa-sidebar-width: var(--pa-sidebar-compact); }
  html[data-design-theme] .premium-sidebar { width: var(--pa-sidebar-compact) !important; padding-inline: 10px !important; }
  html[data-design-theme] .premium-sidebar-brand { padding-inline: 0 !important; text-align: center; }
  html[data-design-theme] .premium-sidebar-brand a { justify-content: center; }
  html[data-design-theme] .premium-sidebar-brand span,
  html[data-design-theme] .premium-sidebar-nav span,
  html[data-design-theme] .premium-sidebar-bottom > a span,
  html[data-design-theme] .premium-sidebar-bottom > button > span:not(.theme-dots) { display: none !important; }
  html[data-design-theme] .premium-sidebar-nav a,
  html[data-design-theme] .premium-sidebar-bottom a,
  html[data-design-theme] .premium-sidebar-bottom button { justify-content: center; padding-inline: 0 !important; }
  html[data-design-theme] .premium-sidebar-theme-button { position: relative; overflow: visible !important; }
  html[data-design-theme] body .premium-sidebar .premium-sidebar-theme-button .theme-dots,
  html[data-design-theme] body.theme-light-premium .premium-sidebar .premium-sidebar-theme-button .theme-dots {
    position: absolute;
    z-index: 40;
    left: calc(100% + 10px);
    display: inline-flex !important;
    width: max-content;
    margin: 0 !important;
    padding: 11px 12px;
    gap: 9px;
    border: 1px solid var(--border-default);
    border-radius: 999px;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    pointer-events: none;
  }
  html[data-design-theme] body .premium-sidebar .premium-sidebar-theme-button:hover .theme-dots,
  html[data-design-theme] body .premium-sidebar .premium-sidebar-theme-button:focus-visible .theme-dots,
  html[data-design-theme] body .premium-sidebar .premium-sidebar-theme-button:focus-within .theme-dots,
  html[data-design-theme] body.theme-light-premium .premium-sidebar .premium-sidebar-theme-button:hover .theme-dots,
  html[data-design-theme] body.theme-light-premium .premium-sidebar .premium-sidebar-theme-button:focus-visible .theme-dots,
  html[data-design-theme] body.theme-light-premium .premium-sidebar .premium-sidebar-theme-button:focus-within .theme-dots {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
  }
  html[data-design-theme] body .premium-sidebar-theme-button .theme-dot {
    width: 14px !important;
    height: 14px !important;
  }
  html[data-design-theme] .project-info { grid-template-columns: 92px 1fr minmax(260px, .75fr) !important; padding: 22px !important; gap: 18px !important; }
  html[data-design-theme] .project-avatar { width: 86px !important; height: 86px !important; }
  html[data-design-theme] .analytics-summary,
  html[data-design-theme] .audit-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  html[data-design-theme] .project-info { grid-template-columns: 88px 1fr !important; }
  html[data-design-theme] .project-main { padding-right: 0; border-right: 0; }
  html[data-design-theme] .project-status-side {
    grid-column: 1 / -1;
    padding: 18px 0 0 !important;
    border-left: 0 !important;
    border-top: 1px solid var(--border-soft) !important;
  }
  html[data-design-theme] .premium-project-dashboard { grid-template-columns: 1fr; }
  html[data-design-theme] .audit-toolbar { align-items: stretch !important; flex-direction: column; }
  html[data-design-theme] .audit-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  :root { --pa-header-height: 70px; }
  html[data-design-theme] body.home-page,
  html[data-design-theme] body.project-page { padding-left: 0 !important; padding-bottom: 74px; }
  html[data-design-theme] .premium-sidebar {
    inset: auto 10px 10px !important;
    width: auto !important;
    height: 58px;
    padding: 6px !important;
    flex-direction: row;
    border: 1px solid var(--border-default) !important;
    border-radius: 16px !important;
    box-shadow: var(--shadow-dropdown) !important;
  }
  html[data-design-theme] .premium-sidebar-brand,
  html[data-design-theme] .premium-sidebar-bottom { display: none !important; }
  html[data-design-theme] .premium-sidebar-nav { display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(48px, 1fr); width: 100%; gap: 3px !important; overflow-x: auto; }
  html[data-design-theme] .premium-sidebar-nav a { min-height: 44px !important; }
  html[data-design-theme] .premium-sidebar-nav a i { font-size: 16px; }
  html[data-design-theme] body > header .container,
  html[data-design-theme] body > .container,
  html[data-design-theme] body > main.container { padding-inline: 14px !important; }
  html[data-design-theme] .premium-context > span,
  html[data-design-theme] .premium-context p { display: none; }
  html[data-design-theme] .premium-context h1 { max-width: 48vw; font-size: 19px !important; }
  html[data-design-theme] .premium-top-action span { display: none; }
  html[data-design-theme] .premium-top-action { width: 42px; padding: 0 !important; }
  html[data-design-theme] .project-info { grid-template-columns: 64px 1fr !important; padding: 18px !important; gap: 14px !important; }
  html[data-design-theme] .project-avatar { width: 62px !important; height: 62px !important; border-radius: 14px !important; font-size: 22px !important; }
  html[data-design-theme] .project-main { grid-template-columns: 1fr !important; }
  html[data-design-theme] .project-title-row h2 { font-size: 22px !important; }
  html[data-design-theme] .project-meta-row,
  html[data-design-theme] .project-access-row { grid-column: 1 / -1; grid-template-columns: 1fr; }
  html[data-design-theme] .project-status-side { grid-column: 1 / -1; }
  html[data-design-theme] .project-info-actions { grid-template-columns: 1fr 42px; }
  html[data-design-theme] .project-info-actions .btn-secondary { grid-column: 1; grid-row: 2; }
  html[data-design-theme] .analytics-summary,
  html[data-design-theme] .audit-kpi-grid { display: flex !important; padding-bottom: 8px; overflow-x: auto; scroll-snap-type: x mandatory; }
  html[data-design-theme] .analytics-summary > *,
  html[data-design-theme] .audit-kpi-grid > * { min-width: min(82vw, 320px); scroll-snap-align: start; }
  html[data-design-theme] .premium-card,
  html[data-design-theme] .home-panel,
  html[data-design-theme] .semantics-panel,
  html[data-design-theme] .audit-summary-panel,
  html[data-design-theme] .audit-tab-content { padding: 16px !important; }
  html[data-design-theme] .audit-actions > * { width: 100%; }
  html[data-design-theme] .audit-actions .audit-icon-action { width: 42px; }
  html[data-design-theme] body.project-page .matrix-table,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table {
    display: table !important;
    width: 960px !important;
    min-width: 960px !important;
    table-layout: fixed !important;
  }
  html[data-design-theme] body.project-page .matrix-table thead,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table thead { display: table-header-group !important; }
  html[data-design-theme] body.project-page .matrix-table tbody,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table tbody { display: table-row-group !important; }
  html[data-design-theme] body.project-page .matrix-table tr,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table tr { display: table-row !important; }
  html[data-design-theme] body.project-page .matrix-table th,
  html[data-design-theme] body.project-page .matrix-table td,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table th,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table td {
    position: static !important;
    display: table-cell !important;
    height: auto !important;
    grid-template-columns: none !important;
  }
  html[data-design-theme] body.project-page .matrix-table td::before,
  html[data-design-theme] body.theme-light-premium.project-page .matrix-table td::before {
    display: none !important;
    content: none !important;
  }
  html[data-design-theme] .modal { padding: 10px !important; align-items: flex-end !important; }
  html[data-design-theme] .modal-content { max-height: calc(100dvh - 20px); padding: 18px !important; border-radius: 18px 18px 12px 12px !important; }
  html[data-design-theme] body.project-page .matrix-section { max-width: 100%; overflow: hidden !important; }
  html[data-design-theme] body.project-page .matrix-toolbar {
    display: flex !important;
    max-width: 100% !important;
    padding-bottom: 8px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
  }
  html[data-design-theme] body.project-page .matrix-toolbar-primary,
  html[data-design-theme] body.project-page .matrix-toolbar-actions {
    width: max-content !important;
    min-width: max-content !important;
    flex-wrap: nowrap !important;
    scroll-snap-align: start;
  }
}

@media (max-width: 420px) {
  html[data-design-theme] .project-info { grid-template-columns: 1fr !important; }
  html[data-design-theme] .project-avatar { width: 56px !important; height: 56px !important; }
  html[data-design-theme] .project-info-actions { grid-template-columns: 1fr 42px; }
  html[data-design-theme] .btn { min-height: 44px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html[data-design-theme] *,
  html[data-design-theme] *::before,
  html[data-design-theme] *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Final specificity guard against legacy stage styles loaded before this file. */
html[data-design-theme] body.theme-light-premium,
html[data-design-theme] body.theme-light,
html[data-design-theme] body.home-page,
html[data-design-theme] body.project-page {
  --page-bg: inherit !important;
  --surface-white: var(--surface-primary) !important;
  --surface: var(--surface-secondary) !important;
  --surface-muted: var(--surface-tertiary) !important;
  --surface-inset: var(--surface-tertiary) !important;
  --surface-dark: var(--accent-primary) !important;
  --text-main: var(--text-primary) !important;
  --text-secondary: inherit !important;
  --text-muted: inherit !important;
  --text-inverse: var(--accent-primary-text) !important;
  --border-soft: inherit !important;
  --accent-secondary: inherit !important;
  --success: inherit !important;
  --danger: inherit !important;
  --warning: inherit !important;
  --border: var(--border-default) !important;
  --border2: var(--border-soft) !important;
  --text: var(--text-primary) !important;
  --muted: var(--text-secondary) !important;
  --muted2: var(--text-muted) !important;
  --accent: var(--accent-primary) !important;
  --accent2: var(--accent-primary-hover) !important;
}

html[data-design-theme] body.theme-light-premium .analytics-summary .summary-item:not(:nth-child(2)) {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .analytics-summary .summary-item:not(:nth-child(2)) span {
  color: var(--text-secondary) !important;
}

html[data-design-theme] body.theme-light-premium .analytics-summary .summary-item:not(:nth-child(2)) b {
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-change-grid button {
  border-color: var(--border-default) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-change-grid button b,
html[data-design-theme] body.theme-light-premium .premium-change-grid button span {
  color: inherit !important;
}

html[data-design-theme] body.theme-light-premium .premium-range-legend button b {
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .tracking-status {
  border-color: var(--border-default) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.home-page,
html[data-design-theme] body.project-page,
html[data-design-theme] body.theme-light,
html[data-design-theme] body.theme-light-premium {
  background:
    radial-gradient(circle at 82% 0%, color-mix(in srgb, var(--accent-primary) 8%, transparent), transparent 30rem),
    var(--page-bg) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-card,
html[data-design-theme] body.theme-light-premium .card,
html[data-design-theme] body.theme-light-premium .manual-card,
html[data-design-theme] body.theme-light-premium .project-card,
html[data-design-theme] body.theme-light-premium .premium-latest-card,
html[data-design-theme] body.theme-light-premium .premium-issues-card,
html[data-design-theme] body.theme-light-premium .premium-trend-card,
html[data-design-theme] body.theme-light-premium .premium-progress-card,
html[data-design-theme] body.theme-light-premium .home-panel,
html[data-design-theme] body.theme-light-premium .manual-section,
html[data-design-theme] body.theme-light-premium .project-category-section,
html[data-design-theme] body.theme-light-premium .semantics-panel,
html[data-design-theme] body.theme-light-premium .matrix-section,
html[data-design-theme] body.theme-light-premium .audit-summary-panel,
html[data-design-theme] body.theme-light-premium .audit-tab-content {
  border-color: var(--border-default) !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-card-dark,
html[data-design-theme] body.theme-light-premium .premium-card-accent,
html[data-design-theme] body.theme-light-premium #premium-overview-card {
  border-color: color-mix(in srgb, var(--accent-primary) 62%, var(--border-default)) !important;
  background:
    radial-gradient(circle at 82% 16%, color-mix(in srgb, var(--accent-secondary) 14%, transparent), transparent 13rem),
    linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 76%, var(--surface-primary)), color-mix(in srgb, var(--accent-primary) 36%, var(--surface-primary))) !important;
}

html[data-design-theme] body.theme-light-premium .manual-card,
html[data-design-theme] body.theme-light-premium .project-card,
html[data-design-theme] body.theme-light-premium .premium-chart-empty,
html[data-design-theme] body.theme-light-premium .premium-project-empty,
html[data-design-theme] body.theme-light-premium .premium-issues-empty,
html[data-design-theme] body.theme-light-premium .premium-progress-empty {
  border-color: var(--border-soft) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-secondary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-card h1,
html[data-design-theme] body.theme-light-premium .premium-card h2,
html[data-design-theme] body.theme-light-premium .premium-card h3,
html[data-design-theme] body.theme-light-premium .manual-card h3,
html[data-design-theme] body.theme-light-premium .project-card h3,
html[data-design-theme] body.theme-light-premium .home-panel h2,
html[data-design-theme] body.theme-light-premium .home-panel h3,
html[data-design-theme] body.theme-light-premium .section-title,
html[data-design-theme] body.theme-light-premium .semantic-head h2,
html[data-design-theme] body.theme-light-premium .results-title {
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-card p,
html[data-design-theme] body.theme-light-premium .premium-card span,
html[data-design-theme] body.theme-light-premium .manual-card p,
html[data-design-theme] body.theme-light-premium .project-card p,
html[data-design-theme] body.theme-light-premium .home-section-head p,
html[data-design-theme] body.theme-light-premium .premium-chart-empty,
html[data-design-theme] body.theme-light-premium .premium-project-empty,
html[data-design-theme] body.theme-light-premium .premium-issues-empty {
  color: var(--text-secondary) !important;
}

html[data-design-theme] body.theme-light-premium .premium-card-dark h1,
html[data-design-theme] body.theme-light-premium .premium-card-dark h2,
html[data-design-theme] body.theme-light-premium .premium-card-dark h3,
html[data-design-theme] body.theme-light-premium .premium-card-dark p,
html[data-design-theme] body.theme-light-premium .premium-card-dark span,
html[data-design-theme] body.theme-light-premium .premium-card-dark b,
html[data-design-theme] body.theme-light-premium .premium-card-dark strong,
html[data-design-theme] body.theme-light-premium #premium-overview-card * {
  color: var(--accent-primary-text) !important;
}

html[data-design-theme] body.theme-light-premium .premium-chart-empty h3,
html[data-design-theme] body.theme-light-premium .premium-chart-empty b,
html[data-design-theme] body.theme-light-premium .premium-project-empty b,
html[data-design-theme] body.theme-light-premium .premium-issues-empty b {
  color: var(--text-primary) !important;
}

html[data-design-theme] body.theme-light-premium .manual-card input,
html[data-design-theme] body.theme-light-premium .manual-card textarea,
html[data-design-theme] body.theme-light-premium .manual-card select,
html[data-design-theme] body.theme-light-premium .form-group input,
html[data-design-theme] body.theme-light-premium .form-group textarea,
html[data-design-theme] body.theme-light-premium .form-group select {
  border-color: var(--input-border) !important;
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
}

html[data-design-theme] body.theme-light-premium .premium-sidebar,
html[data-design-theme] body.theme-light-premium header {
  border-color: var(--border-default) !important;
}

html[data-design-theme] body.project-page .matrix-shell,
html[data-design-theme] body.project-page .matrix-shell.is-topvisor-mode {
  max-width: 100% !important;
  overflow: auto !important;
  overscroll-behavior-inline: contain;
}

html[data-design-theme] body.project-page .matrix-table.is-summary {
  width: max(100%, 960px) !important;
  min-width: 960px !important;
  table-layout: fixed !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-shell,
html[data-design-theme="green-retro"] body.project-page .matrix-shell.is-topvisor-mode,
html[data-design-theme="green-retro"] body.project-page .matrix-toolbar,
html[data-design-theme="green-retro"] body.project-page .matrix-search-wrap,
html[data-design-theme="green-retro"] body.project-page .matrix-mode-segment,
html[data-design-theme="green-retro"] body.project-page .matrix-view-toggle,
html[data-design-theme="green-retro"] body.project-page .matrix-toolbar-btn,
html[data-design-theme="green-retro"] body.project-page .matrix-filter-select,
html[data-design-theme="green-retro"] body.project-page .matrix-filter-count {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-table,
html[data-design-theme="green-retro"] body.project-page .matrix-table.is-summary,
html[data-design-theme="green-retro"] body.project-page .matrix-table.is-topvisor {
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-table thead th,
html[data-design-theme="green-retro"] body.project-page .matrix-table thead th *,
html[data-design-theme="green-retro"] body.project-page .matrix-table.is-topvisor thead th,
html[data-design-theme="green-retro"] body.project-page .matrix-table.is-topvisor thead .topvisor-keyword-head,
html[data-design-theme="green-retro"] body.project-page .matrix-table.is-topvisor thead .topvisor-frequency-head {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-head-light) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-table tbody td,
html[data-design-theme="green-retro"] body.project-page .matrix-table .topvisor-keyword-cell,
html[data-design-theme="green-retro"] body.project-page .matrix-table .topvisor-frequency-cell,
html[data-design-theme="green-retro"] body.project-page .matrix-table .matrix-keyword,
html[data-design-theme="green-retro"] body.project-page .matrix-table .topvisor-cell-button,
html[data-design-theme="green-retro"] body.project-page .matrix-table .topvisor-position-value {
  border-color: var(--retro-sheet-grid) !important;
  background: var(--retro-sheet-bg) !important;
  color: var(--retro-sheet-text) !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(even) td,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: var(--retro-sheet-bg-alt) !important;
}

/* Project passport вЂ” compact reference geometry. Kept last to supersede legacy stages. */
html[data-design-theme] body.project-page:not(.tech-audit-page) {
  font-family: var(--pa-font) !important;
  padding-top: 0 !important;
}

html[data-design-theme] body.project-page:not(.tech-audit-page) > .container {
  width: min(100%, var(--pa-content-max)) !important;
  max-width: var(--pa-content-max) !important;
  padding: 16px clamp(18px, 1.7vw, 30px) 34px !important;
}

html[data-design-theme] body.project-page:not(.tech-audit-page) .project-passport-reference {
  display: grid !important;
  grid-template-columns: minmax(280px, 1.15fr) minmax(205px, .82fr) minmax(235px, .9fr) minmax(270px, 1fr) !important;
  min-height: 224px !important;
  margin: 0 0 16px !important;
  padding: 22px 24px !important;
  align-items: stretch !important;
  gap: 0 !important;
  overflow: visible !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 11% 48%, color-mix(in srgb, var(--accent-secondary) 7%, transparent), transparent 20rem),
    var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-design-theme] body.project-page .project-passport-reference > section {
  min-width: 0;
}

html[data-design-theme] body.project-page .passport-identity {
  display: grid !important;
  grid-template-columns: 102px minmax(0, 1fr);
  padding: 0 24px 0 2px;
  align-items: center;
  gap: 22px;
}

html[data-design-theme] body.project-page .project-avatar {
  display: grid !important;
  width: 96px !important;
  min-width: 96px !important;
  height: 96px !important;
  place-items: center;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent-secondary) 68%, var(--border-default)) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 28% 18%, color-mix(in srgb, var(--accent-secondary) 28%, transparent), transparent 44%),
    linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 76%, var(--surface-secondary)), color-mix(in srgb, var(--surface-primary) 86%, #08110b)) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 7%, transparent), 0 12px 28px color-mix(in srgb, var(--accent-primary) 14%, transparent) !important;
  color: var(--accent-secondary) !important;
  font-size: 31px !important;
  font-weight: 850 !important;
  letter-spacing: -.055em !important;
}

html[data-design-theme] body.project-page .project-avatar-fallback {
  background: linear-gradient(145deg, #f9e7b1 8%, #bc833c 42%, #fff1c5 61%, #8d263f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 color-mix(in srgb, #fff 30%, transparent));
}

html[data-design-theme] body.project-page .passport-identity-copy {
  min-width: 0;
}

html[data-design-theme] body.project-page .project-title-row {
  display: flex !important;
  min-width: 0;
  align-items: center;
  gap: 9px !important;
}

html[data-design-theme] body.project-page .project-title-row h2 {
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  color: var(--text-primary) !important;
  font-size: clamp(21px, 1.45vw, 27px) !important;
  font-weight: 790 !important;
  line-height: 1.12 !important;
  letter-spacing: -.035em !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .project-title-row .inline-edit {
  width: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  flex: 0 0 36px;
  border-color: var(--border-soft) !important;
  background: var(--surface-secondary) !important;
  color: var(--accent-secondary) !important;
}

html[data-design-theme] body.project-page .project-domain-link {
  display: inline-flex !important;
  width: fit-content;
  max-width: 100%;
  margin: 13px 0 15px !important;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--text-secondary) !important;
  font-size: 13px !important;
  text-decoration: none;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .project-domain-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-design-theme] body.project-page .passport-identity-location {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  color: var(--text-secondary) !important;
  font-size: 13px;
}

html[data-design-theme] body.project-page .passport-column,
html[data-design-theme] body.project-page .project-passport-reference .project-status-side {
  padding: 1px 22px !important;
  border: 0 !important;
  border-left: 1px solid var(--border-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-design-theme] body.project-page .passport-column > h3,
html[data-design-theme] body.project-page .passport-status-head > h3 {
  margin: 0 0 8px !important;
  color: var(--accent-secondary) !important;
  font-size: 11px !important;
  font-weight: 720 !important;
  line-height: 1.2 !important;
  letter-spacing: .015em;
}

html[data-design-theme] body.project-page .passport-list {
  display: grid !important;
  margin: 0 !important;
  gap: 0 !important;
}

html[data-design-theme] body.project-page .passport-row {
  display: grid !important;
  grid-template-columns: 27px minmax(0, 1fr);
  min-width: 0;
  min-height: 39px !important;
  padding: 4px 0 !important;
  align-items: center;
  gap: 8px !important;
  overflow: hidden;
  border: 0 !important;
  border-bottom: 1px solid var(--border-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.project-page .passport-row:last-child {
  border-bottom-color: transparent !important;
}

html[data-design-theme] body.project-page .passport-row > span:not(.passport-metal-icon) {
  min-width: 0;
}

html[data-design-theme] body.project-page .passport-row small {
  display: block;
  margin-bottom: 1px;
  overflow: hidden;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 540 !important;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .passport-row b {
  display: block;
  overflow: hidden;
  color: var(--text-primary) !important;
  font-size: 11px !important;
  font-weight: 720 !important;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .passport-metal-icon {
  display: inline-grid !important;
  width: 25px !important;
  height: 25px !important;
  place-items: center;
  flex: 0 0 25px;
  background: linear-gradient(145deg, #f3d79a 5%, #a16d2e 39%, #f8e6b6 58%, #7c203c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  -webkit-text-fill-color: transparent;
  font-size: 16px !important;
  font-weight: 800 !important;
  filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--accent-primary) 17%, transparent));
}

html[data-design-theme] body.project-page .passport-yandex-icon {
  font-family: Georgia, serif;
  font-size: 21px !important;
  font-weight: 500 !important;
}

html[data-design-theme] body.project-page .passport-integrations .passport-row {
  grid-template-columns: 27px minmax(72px, 1fr) auto;
}

html[data-design-theme] body.project-page .passport-access-name,
html[data-design-theme] body.project-page .passport-access-state {
  overflow: hidden;
  font-size: 11px !important;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .passport-access-name {
  color: var(--text-primary) !important;
  font-weight: 620;
}

html[data-design-theme] body.project-page .passport-access-state {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--text-secondary) !important;
  font-weight: 590;
}

html[data-design-theme] body.project-page .passport-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--success) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 12%, transparent);
}

html[data-design-theme] body.project-page .access-off .passport-status-dot {
  background: var(--text-muted) !important;
  box-shadow: none;
}

html[data-design-theme] body.project-page .project-passport-reference .project-status-side {
  display: flex !important;
  min-width: 0;
  flex-direction: column;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

html[data-design-theme] body.project-page .passport-status-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  min-height: 30px;
  align-items: center;
  gap: 8px;
}

html[data-design-theme] body.project-page .passport-status-head > h3 {
  margin: 0 !important;
}

html[data-design-theme] body.project-page .tracking-status {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--success) !important;
  font-size: 10px !important;
  font-weight: 690 !important;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .tracking-status.tracking-muted {
  color: var(--text-muted) !important;
}

html[data-design-theme] body.project-page .passport-toggle {
  position: relative;
  width: 46px;
  min-width: 46px;
  height: 25px;
  padding: 0 !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 999px !important;
  background: var(--surface-tertiary) !important;
  cursor: pointer;
}

html[data-design-theme] body.project-page .passport-toggle span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--surface-primary) !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .22);
  transition: transform .18s ease;
}

html[data-design-theme] body.project-page .passport-toggle.is-on {
  border-color: color-mix(in srgb, var(--accent-secondary) 70%, var(--border-default)) !important;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent-secondary) 80%, #5e431e), #e6c680) !important;
}

html[data-design-theme] body.project-page .passport-toggle.is-on span {
  transform: translateX(21px);
}

html[data-design-theme] body.project-page .project-update-row {
  display: grid !important;
  margin: 12px 0 13px !important;
  gap: 5px;
  color: var(--text-secondary) !important;
}

html[data-design-theme] body.project-page .project-update-row small {
  color: var(--text-secondary) !important;
  font-size: 10px !important;
}

html[data-design-theme] body.project-page .project-update-row > span {
  display: flex;
  align-items: center;
  gap: 8px;
}

html[data-design-theme] body.project-page .project-update-row b {
  overflow: hidden;
  color: var(--text-primary) !important;
  font-size: 13px !important;
  font-weight: 630 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .project-update-row i {
  color: var(--accent-secondary) !important;
  font-size: 11px;
}

html[data-design-theme] body.project-page .project-info-actions {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 42px !important;
  width: 100%;
  gap: 7px !important;
}

html[data-design-theme] body.project-page .project-info-actions .btn {
  min-height: 39px !important;
  padding-inline: 10px !important;
  overflow: hidden;
  font-size: 12px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .project-info-actions .project-page-row-menu {
  grid-column: 2 !important;
  grid-row: 1 / 3 !important;
}

html[data-design-theme] body.project-page .project-info-actions .project-action-trigger {
  width: 42px !important;
  min-width: 42px !important;
  height: 100% !important;
}

html[data-design-theme] body.project-page .project-passport-reference .schedule-panel {
  grid-column: 1 / -1;
  margin-top: 18px;
}

/* KPI cards match the reference row and remain readable in every palette. */
html[data-design-theme] body.project-page .analytics-summary {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  margin: 0 0 16px !important;
  gap: 14px !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item {
  position: relative;
  display: flex !important;
  min-width: 0;
  min-height: 126px !important;
  padding: 17px 18px !important;
  align-items: center !important;
  justify-content: space-between !important;
  overflow: hidden;
  border: 1px solid var(--border-default) !important;
  border-radius: 16px !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item:nth-child(2) {
  border-color: color-mix(in srgb, var(--accent-primary) 70%, var(--border-default)) !important;
  background:
    radial-gradient(circle at 88% 24%, color-mix(in srgb, var(--accent-secondary) 20%, transparent), transparent 9rem),
    linear-gradient(145deg, color-mix(in srgb, var(--accent-primary) 94%, #180b10), color-mix(in srgb, var(--accent-primary) 63%, #120c10)) !important;
  color: var(--accent-primary-text) !important;
  box-shadow: 0 15px 34px color-mix(in srgb, var(--accent-primary) 18%, transparent) !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item span {
  overflow: hidden;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-weight: 680 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item b {
  color: var(--text-primary) !important;
  font-size: clamp(22px, 1.7vw, 28px) !important;
  font-weight: 790 !important;
  line-height: 1.08 !important;
  letter-spacing: -.025em;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item em {
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  font-style: normal !important;
  font-weight: 720 !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item .metric-up { color: var(--success) !important; }
html[data-design-theme] body.project-page .analytics-summary .summary-item .metric-down { color: var(--danger) !important; }

html[data-design-theme] body.project-page .analytics-summary .summary-item:nth-child(2) span,
html[data-design-theme] body.project-page .analytics-summary .summary-item:nth-child(2) b,
html[data-design-theme] body.project-page .analytics-summary .summary-item:nth-child(2) em {
  color: var(--accent-primary-text) !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item > svg {
  width: 78px !important;
  min-width: 62px;
  height: 38px !important;
  overflow: visible;
  fill: none !important;
}

html[data-design-theme] body.project-page .analytics-summary .summary-item > svg path {
  fill: none !important;
  stroke: var(--chart-line-primary) !important;
  stroke-width: 2.7 !important;
  stroke-linecap: round;
}

html[data-design-theme="dark-premium"] body.project-page .analytics-summary .summary-item:not(:nth-child(2)) > svg path { stroke: #a878ed !important; }
html[data-design-theme="green-retro"] body.project-page .analytics-summary .summary-item:not(:nth-child(2)) > svg path { stroke: #9d6fe4 !important; }
html[data-design-theme] body.project-page .analytics-summary .summary-item:nth-child(2) > svg path { stroke: color-mix(in srgb, var(--accent-primary-text) 82%, var(--accent-secondary)) !important; }

html[data-design-theme] body.project-page .analytics-summary .summary-item > i {
  display: grid;
  width: 38px !important;
  min-width: 38px;
  height: 38px !important;
  place-items: center;
  border: 1px solid var(--border-default) !important;
  border-radius: 11px;
  background: var(--surface-secondary) !important;
  color: var(--accent-secondary) !important;
  font-size: 14px !important;
}

/* Charts start inside the first desktop viewport at 100% zoom. */
html[data-design-theme] body.project-page .premium-project-dashboard {
  display: grid !important;
  grid-template-columns: minmax(0, 1.48fr) minmax(340px, .95fr) !important;
  margin: 0 !important;
  gap: 14px !important;
}

html[data-design-theme] body.project-page .premium-project-dashboard > .premium-card {
  min-width: 0;
  min-height: 344px;
  padding: 22px 24px !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 17px !important;
  background: var(--surface-primary) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-design-theme] body.project-page .premium-card-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
}

html[data-design-theme] body.project-page .premium-card-head span {
  color: var(--accent-secondary) !important;
  font-size: 10px !important;
  font-weight: 650 !important;
}

html[data-design-theme] body.project-page .premium-card-head h2 {
  margin: 5px 0 0 !important;
  color: var(--text-primary) !important;
  font-size: 18px !important;
  font-weight: 780 !important;
  line-height: 1.1 !important;
  letter-spacing: -.02em;
}

html[data-design-theme] body.project-page .premium-project-periods {
  position: relative;
  display: inline-flex;
  min-width: 132px;
  align-items: center;
}

html[data-design-theme] body.project-page .premium-project-periods select {
  width: 100%;
  min-height: 38px !important;
  padding: 0 34px 0 13px !important;
  border-color: var(--border-default) !important;
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  appearance: none;
}

html[data-design-theme] body.project-page .premium-project-periods > i {
  position: absolute;
  right: 12px;
  color: var(--text-secondary) !important;
  font-size: 10px;
  pointer-events: none;
}

html[data-design-theme] body.project-page .premium-line-chart {
  display: block;
  width: 100% !important;
  height: 258px !important;
  margin-top: 10px;
  overflow: visible;
}

html[data-design-theme] body.project-page .premium-line-chart .premium-chart-grid line {
  stroke: var(--chart-grid) !important;
  stroke-width: 1 !important;
  stroke-dasharray: 3 4;
}

html[data-design-theme] body.project-page .premium-line-chart .premium-chart-area {
  fill: url(#premium-position-area) !important;
  stroke: none !important;
}

html[data-design-theme] body.project-page .premium-line-chart .premium-chart-path {
  fill: none !important;
  stroke: var(--chart-line-primary) !important;
  stroke-width: 2.35 !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-design-theme] body.project-page .premium-line-chart circle {
  fill: var(--chart-line-primary) !important;
  stroke: var(--surface-primary) !important;
  stroke-width: 1.5 !important;
}

html[data-design-theme] body.project-page .premium-line-chart text {
  fill: var(--chart-label) !important;
  font-size: 10px !important;
  font-weight: 520 !important;
}

html[data-design-theme] body.project-page .premium-line-chart .premium-chart-value {
  text-anchor: start;
}

html[data-design-theme] body.project-page .premium-donut-wrap {
  display: grid !important;
  grid-template-columns: minmax(150px, .8fr) minmax(170px, 1fr) !important;
  min-height: 252px;
  align-items: center !important;
  gap: 25px !important;
}

html[data-design-theme] body.project-page .premium-ranges-donut {
  position: relative;
  display: grid !important;
  width: 158px !important;
  height: 158px !important;
  margin: auto;
  place-items: center;
  border-radius: 50% !important;
}

html[data-design-theme] body.project-page .premium-ranges-donut::after {
  position: absolute;
  inset: 21px;
  border-radius: 50%;
  background: var(--surface-primary) !important;
  content: "";
}

html[data-design-theme] body.project-page .premium-ranges-donut span {
  position: relative;
  z-index: 1;
  color: var(--text-primary) !important;
  font-size: 28px !important;
  font-weight: 790 !important;
}

html[data-design-theme] body.project-page .premium-ranges-donut span::after {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 9px;
  font-weight: 560;
  text-align: center;
  content: "РєР»СЋС‡РµР№";
}

html[data-design-theme] body.project-page .premium-range-legend {
  display: grid !important;
  gap: 3px !important;
}

html[data-design-theme] body.project-page .premium-range-legend button {
  display: grid !important;
  grid-template-columns: 8px minmax(0, 1fr) 30px;
  min-height: 31px !important;
  padding: 0 6px !important;
  align-items: center;
  gap: 9px;
  border: 0 !important;
  border-radius: 9px;
  background: transparent !important;
  color: var(--text-secondary) !important;
  font-size: 11px !important;
  text-align: left;
}

html[data-design-theme] body.project-page .premium-range-legend button:hover,
html[data-design-theme] body.project-page .premium-range-legend button.active {
  background: var(--surface-secondary) !important;
  color: var(--text-primary) !important;
}

html[data-design-theme] body.project-page .premium-range-legend button i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

html[data-design-theme] body.project-page .premium-range-legend button b {
  justify-self: end;
  color: var(--text-primary) !important;
  font-weight: 700 !important;
}

html[data-design-theme] body.project-page .premium-range-legend button:nth-child(1) i { background: var(--chart-segment-1) !important; }
html[data-design-theme] body.project-page .premium-range-legend button:nth-child(2) i { background: var(--chart-segment-2) !important; }
html[data-design-theme] body.project-page .premium-range-legend button:nth-child(3) i { background: var(--chart-segment-3) !important; }
html[data-design-theme] body.project-page .premium-range-legend button:nth-child(4) i { background: var(--chart-segment-4) !important; }
html[data-design-theme] body.project-page .premium-range-legend button:nth-child(5) i { background: var(--chart-segment-5) !important; }
html[data-design-theme] body.project-page .premium-range-legend button:nth-child(6) i { background: var(--chart-segment-6) !important; }

html[data-design-theme] body.project-page .premium-change-card {
  grid-column: 1 / -1;
  min-height: 0 !important;
}

@media (max-width: 1420px) {
  html[data-design-theme] body.project-page:not(.tech-audit-page) .project-passport-reference {
    grid-template-columns: minmax(250px, 1.05fr) minmax(185px, .78fr) minmax(205px, .86fr) minmax(235px, .95fr) !important;
    padding-inline: 18px !important;
  }
  html[data-design-theme] body.project-page .passport-identity { grid-template-columns: 82px minmax(0, 1fr); padding-right: 16px; gap: 14px; }
  html[data-design-theme] body.project-page .project-avatar { width: 78px !important; min-width: 78px !important; height: 78px !important; font-size: 27px !important; }
  html[data-design-theme] body.project-page .passport-column,
  html[data-design-theme] body.project-page .project-passport-reference .project-status-side { padding-inline: 16px !important; }
  html[data-design-theme] body.project-page .passport-access-state { max-width: 86px; }
}

@media (max-width: 1120px) {
  html[data-design-theme] body.project-page:not(.tech-audit-page) .project-passport-reference {
    grid-template-columns: 1fr 1fr !important;
  }
  html[data-design-theme] body.project-page .passport-integrations { border-left: 0 !important; border-top: 1px solid var(--border-soft) !important; padding-top: 18px !important; }
  html[data-design-theme] body.project-page .project-passport-reference .project-status-side { border-top: 1px solid var(--border-soft) !important; padding-top: 18px !important; }
  html[data-design-theme] body.project-page .analytics-summary { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  html[data-design-theme] body.project-page .premium-project-dashboard { grid-template-columns: 1fr !important; }
}

@media (max-width: 760px) {
  html[data-design-theme] body.project-page:not(.tech-audit-page) > .container { padding: 14px 12px 88px !important; }
  html[data-design-theme] body.project-page:not(.tech-audit-page) .project-passport-reference { grid-template-columns: 1fr !important; padding: 18px !important; }
  html[data-design-theme] body.project-page .passport-identity { padding: 0 0 18px; }
  html[data-design-theme] body.project-page .passport-column,
  html[data-design-theme] body.project-page .project-passport-reference .project-status-side { border-left: 0 !important; border-top: 1px solid var(--border-soft) !important; padding: 18px 0 0 !important; }
  html[data-design-theme] body.project-page .analytics-summary { grid-template-columns: 1fr 1fr !important; }
  html[data-design-theme] body.project-page .premium-project-dashboard > .premium-card { padding: 18px !important; }
  html[data-design-theme] body.project-page .premium-donut-wrap { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  html[data-design-theme] body.project-page .analytics-summary { grid-template-columns: 1fr !important; }
  html[data-design-theme] body.project-page .passport-identity { grid-template-columns: 68px minmax(0, 1fr); gap: 12px; }
  html[data-design-theme] body.project-page .project-avatar { width: 64px !important; min-width: 64px !important; height: 64px !important; font-size: 23px !important; }
}

/* Dashboard: premium burgundy + bronze treatment from the approved reference. */
html[data-design-theme="light-premium"] body.home-page #premium-overview-card,
html[data-design-theme="light"] body.home-page #premium-overview-card {
  position: relative;
  overflow: hidden;
  border-color: #9f7546 !important;
  background:
    radial-gradient(circle at 84% 14%, rgba(244, 216, 151, .26), transparent 27%),
    linear-gradient(112deg, transparent 42%, rgba(255, 236, 187, .12) 54%, transparent 66%),
    linear-gradient(145deg, #8b2442 0%, #68182f 48%, #3f111f 100%) !important;
  color: #fff8ed !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 241, 202, .32),
    inset 0 -1px 0 rgba(39, 6, 17, .48),
    0 18px 42px rgba(92, 23, 45, .20) !important;
}

html[data-design-theme="light-premium"] body.home-page #premium-overview-card::after,
html[data-design-theme="light"] body.home-page #premium-overview-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(118deg, transparent 0 58%, rgba(255,255,255,.10) 63%, transparent 70%);
  content: "";
}

html[data-design-theme="light-premium"] body.home-page #premium-overview-card h2,
html[data-design-theme="light-premium"] body.home-page #premium-overview-card b,
html[data-design-theme="light-premium"] body.home-page #premium-overview-card strong,
html[data-design-theme="light"] body.home-page #premium-overview-card h2,
html[data-design-theme="light"] body.home-page #premium-overview-card b,
html[data-design-theme="light"] body.home-page #premium-overview-card strong {
  color: #fffaf1 !important;
}

html[data-design-theme="light-premium"] body.home-page #premium-overview-card span,
html[data-design-theme="light-premium"] body.home-page #premium-overview-card p,
html[data-design-theme="light"] body.home-page #premium-overview-card span,
html[data-design-theme="light"] body.home-page #premium-overview-card p {
  color: #ead8c4 !important;
}

html[data-design-theme="light-premium"] body.home-page #premium-overview-card .premium-icon-button,
html[data-design-theme="light"] body.home-page #premium-overview-card .premium-icon-button {
  position: relative;
  z-index: 2;
  border-color: rgba(238, 211, 157, .48) !important;
  background: linear-gradient(145deg, #f7ead1, #d8b982) !important;
  color: #40121f !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.74), 0 8px 20px rgba(32,7,16,.18) !important;
}

html[data-design-theme="light-premium"] body.home-page #premium-overview-card .premium-overview-metrics > div,
html[data-design-theme="light"] body.home-page #premium-overview-card .premium-overview-metrics > div {
  border-color: rgba(228, 197, 136, .24) !important;
  background: rgba(44, 9, 21, .20) !important;
  box-shadow: inset 0 1px 0 rgba(255, 240, 203, .08) !important;
}

html[data-design-theme="light-premium"] body.home-page .premium-project-card-dark,
html[data-design-theme="light"] body.home-page .premium-project-card-dark {
  border-color: #a67c49 !important;
  background:
    radial-gradient(circle at 82% 15%, rgba(237, 207, 146, .19), transparent 26%),
    linear-gradient(145deg, #7e203c, #42121f) !important;
  color: #fff8ed !important;
  box-shadow: inset 0 1px 0 rgba(255, 239, 198, .20), 0 12px 28px rgba(92, 23, 45, .16) !important;
}

html[data-design-theme="light-premium"] body.home-page .premium-project-card-dark *,
html[data-design-theme="light"] body.home-page .premium-project-card-dark * {
  color: inherit !important;
}

/* Laptop-height layout: the complete graph cards remain inside the first viewport. */
@media (min-width: 761px) and (max-height: 780px) {
  html[data-design-theme] body.project-page:not(.tech-audit-page) > .container {
    padding-top: 9px !important;
    padding-bottom: 22px !important;
  }

  html[data-design-theme] body.project-page .project-passport-reference {
    min-height: 0 !important;
    margin-bottom: 10px !important;
    padding: 13px 18px !important;
    border-radius: 16px !important;
  }

  html[data-design-theme] body.project-page .project-passport-reference > section {
    min-height: 151px !important;
  }

  html[data-design-theme] body.project-page .passport-identity {
    grid-template-columns: 80px minmax(0, 1fr);
    padding-right: 16px;
    gap: 14px;
  }

  html[data-design-theme] body.project-page .project-avatar {
    width: 76px !important;
    min-width: 76px !important;
    height: 76px !important;
    border-radius: 15px !important;
    font-size: 26px !important;
  }

  html[data-design-theme] body.project-page .project-title-row h2 {
    font-size: clamp(19px, 1.35vw, 23px) !important;
  }

  html[data-design-theme] body.project-page .project-title-row .inline-edit {
    width: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    flex-basis: 32px;
  }

  html[data-design-theme] body.project-page .project-domain-link {
    margin: 8px 0 9px !important;
  }

  html[data-design-theme] body.project-page .passport-column,
  html[data-design-theme] body.project-page .project-passport-reference .project-status-side {
    padding-inline: 15px !important;
  }

  html[data-design-theme] body.project-page .passport-column > h3,
  html[data-design-theme] body.project-page .passport-status-head > h3 {
    margin-bottom: 3px !important;
  }

  html[data-design-theme] body.project-page .passport-row {
    min-height: 33px !important;
    padding-block: 2px !important;
  }

  html[data-design-theme] body.project-page .passport-status-head {
    min-height: 25px;
  }

  html[data-design-theme] body.project-page .project-update-row {
    margin: 6px 0 7px !important;
    gap: 2px;
  }

  html[data-design-theme] body.project-page .project-info-actions {
    gap: 5px !important;
  }

  html[data-design-theme] body.project-page .project-info-actions .btn {
    min-height: 33px !important;
  }

  html[data-design-theme] body.project-page .analytics-summary {
    margin-bottom: 10px !important;
    gap: 10px !important;
  }

  html[data-design-theme] body.project-page .analytics-summary .summary-item {
    min-height: 100px !important;
    padding: 13px 15px !important;
    border-radius: 14px !important;
  }

  html[data-design-theme] body.project-page .analytics-summary .summary-item b {
    font-size: clamp(20px, 1.5vw, 25px) !important;
  }

  html[data-design-theme] body.project-page .analytics-summary .summary-item > svg {
    width: 68px !important;
    height: 34px !important;
  }

  html[data-design-theme] body.project-page .premium-project-dashboard {
    gap: 10px !important;
  }

  html[data-design-theme] body.project-page .premium-project-dashboard > .premium-card {
    min-height: 286px !important;
    padding: 17px 20px !important;
    border-radius: 15px !important;
  }

  html[data-design-theme] body.project-page .premium-card-head h2 {
    font-size: 17px !important;
  }

  html[data-design-theme] body.project-page .premium-line-chart {
    height: 216px !important;
    margin-top: 2px !important;
  }

  html[data-design-theme] body.project-page .premium-donut-wrap {
    min-height: 208px !important;
    gap: 18px !important;
  }

  html[data-design-theme] body.project-page .premium-ranges-donut {
    width: 136px !important;
    height: 136px !important;
  }

  html[data-design-theme] body.project-page .premium-ranges-donut::after {
    inset: 19px !important;
  }

  html[data-design-theme] body.project-page .premium-range-legend button {
    min-height: 28px !important;
  }
}

/* Green-retro contrast guard for every light workbook surface. */
html[data-design-theme="green-retro"] body.home-page .project-category-table-shell,
html[data-design-theme="green-retro"] body.home-page .project-table-shell,
html[data-design-theme="green-retro"] body.project-page .matrix-shell,
html[data-design-theme="green-retro"] body.project-page .matrix-shell.is-topvisor-mode {
  border-color: #9ca677 !important;
  background: #f5f0d3 !important;
  color: #192019 !important;
}

html[data-design-theme="green-retro"] body.home-page .project-table thead th,
html[data-design-theme="green-retro"] body.home-page .project-table thead th *,
html[data-design-theme="green-retro"] body.project-page .matrix-table thead th,
html[data-design-theme="green-retro"] body.project-page .matrix-table thead th * {
  border-color: #a9b181 !important;
  background: #dde3b9 !important;
  color: #303a2c !important;
  text-shadow: none !important;
}

html[data-design-theme="green-retro"] body.home-page .project-table tbody td,
html[data-design-theme="green-retro"] body.home-page .project-table tbody td > *:not(.project-action-menu),
html[data-design-theme="green-retro"] body.home-page .project-table .project-name-cell b,
html[data-design-theme="green-retro"] body.home-page .project-table .project-name-cell span,
html[data-design-theme="green-retro"] body.home-page .project-table tbody td a,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody td,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody td > * {
  border-color: #b7be8f !important;
  color: #192019 !important;
  text-shadow: none !important;
}

html[data-design-theme="green-retro"] body.home-page .project-table tbody td,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody td {
  background: #f5f0d3 !important;
}

html[data-design-theme="green-retro"] body.home-page .project-table tbody tr:nth-child(even) td,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(even) td,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(odd) .topvisor-keyword-cell,
html[data-design-theme="green-retro"] body.project-page .matrix-table tbody tr:nth-child(odd) .topvisor-frequency-cell {
  background: #ece9c8 !important;
}

html[data-design-theme="green-retro"] body.home-page .project-action-trigger,
html[data-design-theme="green-retro"] body.home-page .project-action-trigger *,
html[data-design-theme="green-retro"] body.project-page .topvisor-cell-button,
html[data-design-theme="green-retro"] body.project-page .topvisor-cell-button * {
  border-color: #274a34 !important;
  background: #183224 !important;
  color: #f4efca !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button:not(.active):not(:disabled),
html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button:not(.active):not(:disabled) * {
  border-color: #486241 !important;
  background: #183224 !important;
  color: #f0ebce !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button.active,
html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button.active * {
  border-color: #c5ba61 !important;
  background: #aaa64a !important;
  color: #142016 !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button:disabled,
html[data-design-theme="green-retro"] body.project-page .matrix-toolbar button:disabled * {
  border-color: #b7be8f !important;
  background: #f5f0d3 !important;
  color: #56604c !important;
  opacity: 1 !important;
}

html[data-design-theme="green-retro"] body.project-page .matrix-table thead .topvisor-date-head.is-active-date,
html[data-design-theme="green-retro"] body.project-page .matrix-table thead .topvisor-date-head.is-active-date *,
html[data-design-theme="green-retro"] body.project-page .matrix-table thead .topvisor-date-head.is-active-date button {
  background: #2d542f !important;
  color: #fff5c5 !important;
}

html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-up,
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-new { background: #dce8bd !important; }
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-down,
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-lost { background: #edd8c6 !important; }
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-same,
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-neutral,
html[data-design-theme="green-retro"] body.project-page .topvisor-position-cell.is-missing { background: #ece9c8 !important; }

html[data-design-theme="green-retro"] body.project-page .topvisor-position-value,
html[data-design-theme="green-retro"] body.project-page .topvisor-delta,
html[data-design-theme="green-retro"] body.project-page .matrix-keyword {
  color: #192019 !important;
}

html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-mode-segment button:disabled,
html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-mode-segment button:disabled *,
html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-view-toggle button:disabled,
html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-view-toggle button:disabled * {
  border-color: #b7be8f !important;
  background: #f5f0d3 !important;
  color: #4e5945 !important;
  opacity: 1 !important;
}

html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-table tbody td > .matrix-history-trail,
html[data-design-theme="green-retro"] body.theme-light-premium.project-page .matrix-table tbody td > .matrix-history-trail * {
  border-color: #2d542f !important;
  background: #1d3b2a !important;
  color: #f0ebce !important;
}
