/*
 * Visual theme tokens. The current green/white interface is intentionally
 * kept as the minimal default; the other templates only change the visual
 * layer and do not alter CRM data or routes.
 */
body.theme-minimal {
  --green: #00a844;
  --green-dark: #008d39;
  --ink: #242b35;
  --muted: #7c8798;
  --line: #e5e8ee;
  --page: #f4f6f8;
  --nav: #202020;
  --surface: #ffffff;
  --surface-alt: #f7f8fa;
  --surface-soft: #f3faf5;
  --accent-soft: #e4f6eb;
  --field-bg: #ffffff;
}

body.theme-enterprise {
  --green: #0078d4;
  --green-dark: #005a9e;
  --ink: #252525;
  --muted: #616161;
  --line: #e1e1e1;
  --page: #f3f3f3;
  --nav: #2d2d30;
  --surface: #ffffff;
  --surface-alt: #f7f7f7;
  --surface-soft: #eaf3fb;
  --accent-soft: #deecf9;
  --field-bg: #ffffff;
}

body.theme-dynamic {
  --green: #0da9e5;
  --green-dark: #0786b7;
  --ink: #25384a;
  --muted: #718396;
  --line: #d8e6ef;
  --page: #f4f7fa;
  --nav: #2f82bd;
  --surface: #ffffff;
  --surface-alt: #f4f8fb;
  --surface-soft: #e6f7fd;
  --accent-soft: #dff4fc;
  --field-bg: #ffffff;
}

body.theme-professional {
  --green: #007aff;
  --green-dark: #0066d6;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #dedee2;
  --page: #f5f5f7;
  --nav: #f2f2f7;
  --surface: #ffffff;
  --surface-alt: #f5f5f7;
  --surface-soft: #eaf3ff;
  --accent-soft: #e5f0ff;
  --field-bg: #ffffff;
}

body.theme-dark {
  color-scheme: dark;
  --green: #111111;
  --green-dark: #000000;
  --ink: #f3f3f3;
  --muted: #b2b2b2;
  --line: #383838;
  --page: #0b0b0b;
  --nav: #050505;
  --surface: #171717;
  --surface-alt: #222222;
  --surface-soft: #292929;
  --accent-soft: #303030;
  --field-bg: #111111;
}

body.theme-red {
  --green: #d64545;
  --green-dark: #b52f3a;
  --ink: #3d2528;
  --muted: #8f7075;
  --line: #efd7da;
  --page: #fff7f7;
  --nav: #b4232d;
  --surface: #ffffff;
  --surface-alt: #fff4f4;
  --surface-soft: #fff0f0;
  --accent-soft: #ffe0e3;
  --field-bg: #ffffff;
}

body.theme-orange {
  --green: #e67e22;
  --green-dark: #c85b0d;
  --ink: #453222;
  --muted: #927b67;
  --line: #f1dfc8;
  --page: #fffaf4;
  --nav: #c85b0d;
  --surface: #ffffff;
  --surface-alt: #fff7ed;
  --surface-soft: #fff2df;
  --accent-soft: #ffead0;
  --field-bg: #ffffff;
}

body.theme-purple {
  --green: #7c3aed;
  --green-dark: #5b21b6;
  --ink: #32264b;
  --muted: #81769b;
  --line: #e6def7;
  --page: #faf8ff;
  --nav: #5b21b6;
  --surface: #ffffff;
  --surface-alt: #f8f5ff;
  --surface-soft: #f3edff;
  --accent-soft: #ede4ff;
  --field-bg: #ffffff;
}

body.theme-monochrome {
  --green: #222222;
  --green-dark: #000000;
  --ink: #242424;
  --muted: #737373;
  --line: #dddddd;
  --page: #f6f6f6;
  --nav: #222222;
  --surface: #ffffff;
  --surface-alt: #f4f4f4;
  --surface-soft: #eeeeee;
  --accent-soft: #e6e6e6;
  --field-bg: #ffffff;
}

body.theme-custom {
  --green: var(--custom-color, #0da9e5);
  --green-dark: color-mix(in srgb, var(--custom-color, #0da9e5) 78%, #000000);
  --ink: #25384a;
  --muted: #718396;
  --line: #d8e6ef;
  --page: #f6f8fb;
  --nav: var(--custom-color, #0da9e5);
  --surface: #ffffff;
  --surface-alt: #f5f8fb;
  --surface-soft: color-mix(in srgb, var(--custom-color, #0da9e5) 10%, #ffffff);
  --accent-soft: color-mix(in srgb, var(--custom-color, #0da9e5) 14%, #ffffff);
  --field-bg: #ffffff;
}

/* Shared surfaces and accents for the four non-default templates. */
body.theme-enterprise .topbar,
body.theme-enterprise .tabs,
body.theme-enterprise .workspace-tabs,
body.theme-enterprise .secondary-sidebar,
body.theme-enterprise .metric-card,
body.theme-enterprise .panel,
body.theme-enterprise .form-card,
body.theme-enterprise .searchbar,
body.theme-dynamic .topbar,
body.theme-dynamic .tabs,
body.theme-dynamic .workspace-tabs,
body.theme-dynamic .secondary-sidebar,
body.theme-dynamic .metric-card,
body.theme-dynamic .panel,
body.theme-dynamic .form-card,
body.theme-dynamic .searchbar,
body.theme-professional .topbar,
body.theme-professional .tabs,
body.theme-professional .workspace-tabs,
body.theme-professional .secondary-sidebar,
body.theme-professional .metric-card,
body.theme-professional .panel,
body.theme-professional .form-card,
body.theme-professional .searchbar,
body.theme-dark .topbar,
body.theme-dark .tabs,
body.theme-dark .workspace-tabs,
body.theme-dark .secondary-sidebar,
body.theme-dark .metric-card,
body.theme-dark .panel,
body.theme-dark .form-card,
body.theme-dark .searchbar {
  background: var(--surface);
  border-color: var(--line);
}

body.theme-enterprise .brand span,
body.theme-dynamic .brand span,
body.theme-professional .brand span,
body.theme-dark .brand span {
  color: var(--green);
}

body.theme-enterprise .secondary-nav-item.active,
body.theme-dynamic .secondary-nav-item.active,
body.theme-professional .secondary-nav-item.active,
body.theme-dark .secondary-nav-item.active,
body.theme-enterprise .tabs span:first-child,
body.theme-dynamic .tabs span:first-child,
body.theme-professional .tabs span:first-child,
body.theme-dark .tabs span:first-child,
body.theme-enterprise .workspace-tab.active,
body.theme-dynamic .workspace-tab.active,
body.theme-professional .workspace-tab.active,
body.theme-dark .workspace-tab.active {
  background: var(--accent-soft);
  color: var(--green);
}

body.theme-enterprise .workspace-tab:hover,
body.theme-dynamic .workspace-tab:hover,
body.theme-professional .workspace-tab:hover,
body.theme-dark .workspace-tab:hover {
  background: var(--accent-soft);
  color: var(--green);
}

body.theme-enterprise .actions button,
body.theme-dynamic .actions button,
body.theme-professional .actions button,
body.theme-dark .actions button,
body.theme-enterprise .searchbar a,
body.theme-dynamic .searchbar a,
body.theme-professional .searchbar a,
body.theme-dark .searchbar a {
  color: var(--green);
}

body.theme-enterprise .primary-sidebar { background: linear-gradient(180deg, #2d2d30, #1f1f21); }
body.theme-dynamic .primary-sidebar { background: linear-gradient(180deg, #2f82bd, #175879); }
body.theme-professional .primary-sidebar { background: #f2f2f7; border-right: 1px solid #dedee2; }
body.theme-dark .primary-sidebar { background: linear-gradient(180deg, #11263a, #0b1d2c); }
body.theme-professional .brand { color: #1d1d1f; }

body.theme-enterprise .primary-nav-item { background: #38383b; }
body.theme-enterprise .primary-nav-item:hover { background: #464649; }
body.theme-dynamic .primary-nav-item { background: #367fae; }
body.theme-dynamic .primary-nav-item:hover { background: #428fc0; }
body.theme-professional .primary-nav-item { background: #e7e7ec; color: #3a3a3c; }
body.theme-professional .primary-nav-item:hover { background: #dcdce2; }
body.theme-professional .primary-nav-item i { color: #6e6e73; }
body.theme-professional .primary-nav-item:not(.active) .pi-nav-icon { color: #6e6e73; }
body.theme-dark .primary-nav-item { background: #17344b; }
body.theme-dark .primary-nav-item:hover { background: #21465f; }

body.theme-red .primary-sidebar { background: linear-gradient(180deg, #c53642, #8f1722); }
body.theme-orange .primary-sidebar { background: linear-gradient(180deg, #ed8b2f, #b94d08); }
body.theme-purple .primary-sidebar { background: linear-gradient(180deg, #7c3aed, #4c1d95); }
body.theme-monochrome .primary-sidebar { background: linear-gradient(180deg, #303030, #111111); }
body.theme-custom .primary-sidebar { background: linear-gradient(180deg, color-mix(in srgb, var(--custom-color, #0da9e5) 88%, #ffffff), color-mix(in srgb, var(--custom-color, #0da9e5) 78%, #000000)); }

body.theme-red .primary-nav-item { background: #c63b46; color: #ffffff; }
body.theme-red .primary-nav-item:hover { background: #d34b55; }
body.theme-orange .primary-nav-item { background: #d8751e; color: #ffffff; }
body.theme-orange .primary-nav-item:hover { background: #e4872e; }
body.theme-purple .primary-nav-item { background: #6d2ed1; color: #ffffff; }
body.theme-purple .primary-nav-item:hover { background: #7c3aed; }
body.theme-monochrome .primary-nav-item { background: #3b3b3b; color: #ffffff; }
body.theme-monochrome .primary-nav-item:hover { background: #4b4b4b; }
body.theme-custom .primary-nav-item { background: color-mix(in srgb, var(--custom-color, #0da9e5) 82%, #000000); color: #ffffff; }
body.theme-custom .primary-nav-item:hover { background: color-mix(in srgb, var(--custom-color, #0da9e5) 90%, #000000); }

body.theme-red .primary-sidebar .brand,
body.theme-red .primary-sidebar .brand span,
body.theme-orange .primary-sidebar .brand,
body.theme-orange .primary-sidebar .brand span,
body.theme-purple .primary-sidebar .brand,
body.theme-purple .primary-sidebar .brand span,
body.theme-monochrome .primary-sidebar .brand,
body.theme-monochrome .primary-sidebar .brand span,
body.theme-custom .primary-sidebar .brand,
body.theme-custom .primary-sidebar .brand span {
  color: #ffffff;
}

/* Keep the dashboard's status cards aligned with the selected accent. */
body.theme-enterprise .attention-row b,
body.theme-enterprise .tool-green i,
body.theme-dynamic .attention-row b,
body.theme-dynamic .tool-green i,
body.theme-professional .attention-row b,
body.theme-professional .tool-green i,
body.theme-dark .attention-row b,
body.theme-dark .tool-green i {
  background: var(--green);
  color: #ffffff;
}

body.theme-enterprise .attention-row strong,
body.theme-enterprise .ranking-panel p b,
body.theme-dynamic .attention-row strong,
body.theme-dynamic .ranking-panel p b,
body.theme-professional .attention-row strong,
body.theme-professional .ranking-panel p b,
body.theme-dark .attention-row strong,
body.theme-dark .ranking-panel p b {
  color: var(--green);
}

body.theme-enterprise .metric-icon.green,
body.theme-dynamic .metric-icon.green,
body.theme-professional .metric-icon.green,
body.theme-dark .metric-icon.green {
  background: var(--accent-soft);
  color: var(--green);
}

/* Template-specific login treatments. */
body.theme-enterprise.login-page { background: linear-gradient(135deg, #2d2d30 0%, #e9f2fb 72%); }
body.theme-dynamic.login-page { background: linear-gradient(135deg, #1b587b 0%, #eaf8fd 72%); }
body.theme-professional.login-page { background: linear-gradient(135deg, #c9c9d1 0%, #f5f5f7 72%); }
body.theme-dark.login-page { background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%); }
body.theme-red.login-page { background: linear-gradient(135deg, #8f1722 0%, #fff1f1 72%); }
body.theme-orange.login-page { background: linear-gradient(135deg, #b94d08 0%, #fff4e6 72%); }
body.theme-purple.login-page { background: linear-gradient(135deg, #4c1d95 0%, #f4efff 72%); }
body.theme-monochrome.login-page { background: linear-gradient(135deg, #202020 0%, #f2f2f2 72%); }
body.theme-custom.login-page { background: linear-gradient(135deg, color-mix(in srgb, var(--custom-color, #0da9e5) 72%, #000000), color-mix(in srgb, var(--custom-color, #0da9e5) 8%, #ffffff) 72%); }
body.theme-dark.login-page::before { background: rgba(5, 9, 15, .48); }

body.theme-enterprise .login-accent { background: #0078d4; }
body.theme-dynamic .login-accent { background: linear-gradient(90deg, #0da9e5, #49d3ee, #1677b7); }
body.theme-professional .login-accent { background: #007aff; }
body.theme-dark .login-accent { background: linear-gradient(90deg, #2ac6ec, #79e3f6); }

body.theme-enterprise .login-field { background: transparent; }
body.theme-dynamic .login-field { background: transparent; }
body.theme-professional .login-field { background: transparent; }
body.theme-enterprise .login-field-control { background: #e8f1ff; }
body.theme-dynamic .login-field-control { background: #e6f7fd; }
body.theme-professional .login-field-control { background: #ededf2; }
body.theme-dark .login-card { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 22px 60px rgba(0, 0, 0, .38); }
body.theme-dark .login-card h1 { color: var(--ink); }
body.theme-dark .login-card .remember-option { color: #c9d4e2; }
body.theme-dark .remember-help { color: #8d9db2; }
body.theme-dark .login-field { background: transparent; }
body.theme-dark .login-field-control { background: #242424; }
body.theme-dark .login-field > i,
body.theme-dark .password-toggle { color: #9aabc0; }
body.theme-dark .login-field input { color: var(--ink); }
body.theme-dark .login-field input::placeholder { color: #9ab6c5; }

body.theme-enterprise .login-submit,
body.theme-dynamic .login-submit,
body.theme-professional .login-submit,
body.theme-dark .login-submit {
  background: var(--green);
}
body.theme-enterprise .login-submit:hover,
body.theme-dynamic .login-submit:hover,
body.theme-professional .login-submit:hover,
body.theme-dark .login-submit:hover {
  background: var(--green-dark);
}

/* Dark template: make tables, form controls and secondary copy readable. */
body.theme-dark .crumb,
body.theme-dark .crumb i,
body.theme-dark .user,
body.theme-dark .secondary-nav-item,
body.theme-dark .workspace-tab,
body.theme-dark .workspace-tab-close,
body.theme-dark .metric-card,
body.theme-dark .panel,
body.theme-dark .form-card,
body.theme-dark .searchbar,
body.theme-dark .section-head,
body.theme-dark .settings-help,
body.theme-dark .muted {
  color: var(--ink);
}
body.theme-dark .crumb em { color: #53647a; }
body.theme-dark .secondary-nav-item { color: #b5c2d3; }
body.theme-dark .primary-nav-item { color: #c5d0df; }
body.theme-dark .primary-nav-item i { color: #8fa1b7; }
body.theme-dark .user button,
body.theme-dark .panel-title-row button,
body.theme-dark .filters button,
body.theme-dark button:not(.primary):not(.password-toggle):not(.workspace-tab-close) {
  background: #1f2b3b;
  color: #d6e0ed;
}
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: var(--field-bg);
  color: var(--ink);
  border-color: var(--line);
}
body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder { color: #7d8da3; }
body.theme-dark th { background: var(--surface-alt); color: #c2cfdf; }
body.theme-dark td { color: #e0e8f2; border-color: var(--line); }
body.theme-dark .sales-brief .metric-card,
body.theme-dark .attention-row { background: var(--surface-alt); border-color: var(--line); }
body.theme-dark .metric-card strong { color: var(--ink); }
body.theme-dark .tool-row a,
body.theme-dark .tool-row span { background: #1b2a39; color: #c9d5e4; }
body.theme-dark .summary { background: var(--surface-soft); color: #8de0ae; }
body.theme-dark .chart-empty { background: #101a28; border-color: var(--line); color: #9aa9bd; }
body.theme-dark .style-option,
body.theme-dark .font-option { background: var(--surface); border-color: var(--line); }
body.theme-dark .style-option small,
body.theme-dark .font-option small { color: #96a6ba; }
body.theme-dark .theme-preview { border-color: #3a4b61; }

body.theme-dynamic .panel,
body.theme-dynamic .form-card,
body.theme-dynamic .metric-card { box-shadow: 0 10px 26px rgba(86, 49, 137, .08); }
body.theme-dynamic .primary-nav-item.active { box-shadow: 0 0 0 1px rgba(255, 255, 255, .18), 0 8px 22px rgba(139, 92, 246, .28); }
body.theme-dynamic .login-card { box-shadow: 0 22px 56px rgba(68, 36, 112, .2); }

@media (prefers-reduced-motion: reduce) {
  body.theme-dynamic .primary-nav-item.active { animation: none; }
}

/* All interactive accents follow the selected theme. A few legacy module
 * styles still contain the original green literals, so this final layer keeps
 * links, controls, status markers and dashboard accents in sync. */
body[class*="theme-"] {
  --accent-foreground: var(--green);
}

body.theme-dark {
  --accent-foreground: #f3f3f3;
}

body[class*="theme-"] a:not(.primary):not(.danger),
body[class*="theme-"] .actions a:not(.primary):not(.danger),
body[class*="theme-"] .actions button:not(.primary):not(.danger),
body[class*="theme-"] .table-link:not(.danger),
body[class*="theme-"] .list-reset,
body[class*="theme-"] .price-reset,
body[class*="theme-"] .catalog-reset,
body[class*="theme-"] .role-reset,
body[class*="theme-"] .calculator-template-link,
body[class*="theme-"] .project-toolbar-actions > a:not(.primary):not(.danger),
body[class*="theme-"] .delivery-actions a:not(.danger),
body[class*="theme-"] .delivery-actions button:not(.danger),
body[class*="theme-"] .orders-actions a:not(.danger),
body[class*="theme-"] .orders-actions button:not(.danger),
body[class*="theme-"] .supplier-row-actions button:not(.danger),
body[class*="theme-"] .supplier-edit-details button:not(.danger),
body[class*="theme-"] .category-actions .table-link:not(.danger),
body[class*="theme-"] .product-actions a:not(.danger),
body[class*="theme-"] .price-actions .table-link:not(.danger),
body[class*="theme-"] .catalog-actions .table-link:not(.danger),
body[class*="theme-"] .role-actions a:not(.danger),
body[class*="theme-"] .review-row-actions a:not(.danger),
body[class*="theme-"] .review-node-picker button:hover,
body[class*="theme-"] .certificate-project-heading > a,
body[class*="theme-"] .certificate-add summary {
  color: var(--accent-foreground);
}

body[class*="theme-"] a:not(.primary):not(.danger):hover,
body[class*="theme-"] .actions a:not(.primary):not(.danger):hover,
body[class*="theme-"] .actions button:not(.primary):not(.danger):hover,
body[class*="theme-"] .table-link:not(.danger):hover,
body[class*="theme-"] .list-reset:hover,
body[class*="theme-"] .price-reset:hover,
body[class*="theme-"] .catalog-reset:hover,
body[class*="theme-"] .role-reset:hover,
body[class*="theme-"] .calculator-template-link:hover,
body[class*="theme-"] .project-toolbar-actions > a:not(.primary):not(.danger):hover,
body[class*="theme-"] .delivery-actions a:not(.danger):hover,
body[class*="theme-"] .delivery-actions button:not(.danger):hover,
body[class*="theme-"] .orders-actions a:not(.danger):hover,
body[class*="theme-"] .orders-actions button:not(.danger):hover,
body[class*="theme-"] .supplier-row-actions button:not(.danger):hover,
body[class*="theme-"] .supplier-edit-details button:not(.danger):hover,
body[class*="theme-"] .review-row-actions a:not(.danger):hover,
body[class*="theme-"] .certificate-project-heading > a:hover,
body[class*="theme-"] .certificate-add summary:hover {
  color: var(--green-dark);
}

body[class*="theme-"] .tabs span:first-child,
body[class*="theme-"] .secondary-nav-item.active,
body[class*="theme-"] .workspace-tab.active,
body[class*="theme-"] .workspace-tab:hover,
body[class*="theme-"] .summary,
body[class*="theme-"] .tag,
body[class*="theme-"] .flash.success,
body[class*="theme-"] .review-status-switch.on,
body[class*="theme-"] .source-switch.on,
body[class*="theme-"] .orders-pagination b,
body[class*="theme-"] .delivery-pagination b {
  color: var(--accent-foreground);
}

body[class*="theme-"] .secondary-nav-item.active,
body[class*="theme-"] .workspace-tab.active,
body[class*="theme-"] .workspace-tab:hover,
body[class*="theme-"] .summary,
body[class*="theme-"] .tag,
body[class*="theme-"] .flash.success {
  background: var(--accent-soft);
}

body[class*="theme-"] .summary,
body[class*="theme-"] .panel h2,
body[class*="theme-"] .form-card h2,
body[class*="theme-"] .project-card-heading h1,
body[class*="theme-"] .project-card-heading h2,
body[class*="theme-"] .review-editor-section h3,
body[class*="theme-"] .calculator-imported-card {
  border-left-color: var(--green);
}

body[class*="theme-"] .brand span,
body[class*="theme-"] .metric-card small,
body[class*="theme-"] .calculator-total b,
body[class*="theme-"] .pi-config-message {
  color: var(--accent-foreground);
}

body[class*="theme-"] .project-status.done,
body[class*="theme-"] .delivery-status-tag.is-done,
body[class*="theme-"] .pi-status.is-ready {
  color: var(--accent-foreground);
  background: var(--accent-soft);
}

body[class*="theme-"] .fee-status-已打款 {
  color: var(--accent-foreground) !important;
}

/* Dark theme: replace the remaining legacy light content blocks with a
 * restrained charcoal scale while keeping figures and supporting copy legible. */
body.theme-dark .delivery-summary,
body.theme-dark .delivery-order-row td,
body.theme-dark .delivery-followup-row td,
body.theme-dark .orders-group-row td,
body.theme-dark .orders-note-row td,
body.theme-dark .delivery-reset,
body.theme-dark .system-resource-item,
body.theme-dark .from-pi .pi-message-body {
  background: #24282e;
  border-color: #3a414a;
}

body.theme-dark .delivery-summary,
body.theme-dark .delivery-order-row td,
body.theme-dark .orders-group-row td,
body.theme-dark .orders-note-row td,
body.theme-dark .from-pi .pi-message-body {
  color: #e2e7ed;
}

body.theme-dark .delivery-followup-row td,
body.theme-dark .delivery-product-cell strong,
body.theme-dark .delivery-source,
body.theme-dark .delivery-contact,
body.theme-dark .delivery-order-meta,
body.theme-dark .delivery-table td small,
body.theme-dark .delivery-owner-cell small,
body.theme-dark .delivery-time-cell small,
body.theme-dark .delivery-workflow-progress strong,
body.theme-dark .orders-source-table td small,
body.theme-dark .orders-group-row td > span,
body.theme-dark .orders-group-meta {
  color: #b9c3cf;
}

body.theme-dark .delivery-product-cell strong,
body.theme-dark .delivery-source { color: #e5e9ee; }
body.theme-dark .delivery-reset { color: #d7dee7; }
body.theme-dark .delivery-reset:hover { background: #30363e; color: #ffffff; }

body.theme-dark .system-info-heading { color: #e4e8ee; }
body.theme-dark .system-info-heading small,
body.theme-dark .system-resource-item small { color: #aab4c1; }
body.theme-dark .system-resource-item header { color: #c6ced9; }
body.theme-dark .system-resource-item header i { color: #d4dbe3; }
body.theme-dark .system-resource-item header strong { color: #f0f2f5; }
body.theme-dark .system-resource-meter { background: #3a414a; }
body.theme-dark .system-resource-meter i { background: #aab4c0; }

body.theme-dark .pi-message-role,
body.theme-dark .pi-chat-empty,
body.theme-dark .pi-config-note,
body.theme-dark .pi-config-card label small { color: #aab4c1; }
body.theme-dark .pi-config-card label { color: #d5dce5; }
body.theme-dark .from-pi .pi-message-body { border: 1px solid #3a414a; }
body.theme-dark .button-light { background: #24282e; border-color: #3a414a; color: #dbe2ea; }
body.theme-dark .pi-chat-sidebar-heading,
body.theme-dark .pi-archived-chats summary { color: #c2ccd8; }
body.theme-dark .pi-chat-sidebar,
body.theme-dark .pi-chat-item-actions { background: #24282e; border-color: #3a414a; }
body.theme-dark .pi-chat-item.is-active { background: #263c54; }
body.theme-dark .pi-chat-item-link { color: #e2e7ed; }
body.theme-dark .pi-chat-item-link small,
body.theme-dark .pi-chat-item-link time,
body.theme-dark .pi-chat-sidebar-heading span,
body.theme-dark .pi-archived-chats summary span { color: #aab4c1; }
body.theme-dark .pi-chat-item-actions button { background: #303944; color: #dbe2ea; }
body.theme-dark .pi-chat-item-actions button:hover { background: #3a4654; }
body.theme-dark .pi-chat-item-actions > a { color: #c7d1dc; }
body.theme-dark .pi-chat-item-actions > a:hover { background: #303944; color: #ffffff; }
body.theme-dark .pi-chat-archived-notice { border-color: #66562d; color: #e1c87a; background: #332d1d; }

body[class*="theme-"] input[type="checkbox"],
body[class*="theme-"] input[type="radio"],
body[class*="theme-"] .style-option input,
body[class*="theme-"] .font-option input,
body[class*="theme-"] .size-options input,
body[class*="theme-"] .review-radio-list input,
body[class*="theme-"] .review-form-config-row input,
body[class*="theme-"] .calculator-picker-group input,
body[class*="theme-"] .calculator-agency-form input,
body[class*="theme-"] .product-check-grid input,
body[class*="theme-"] .allocation-mode input {
  accent-color: var(--green);
}

body[class*="theme-"] .primary,
body[class*="theme-"] .calculator-action.primary,
body[class*="theme-"] .calculator-detail-button,
body[class*="theme-"] .review-plus-button,
body[class*="theme-"] .review-status-switch.on span,
body[class*="theme-"] .source-switch.on span,
body[class*="theme-"] .attention-row b,
body[class*="theme-"] .tool-green i,
body[class*="theme-"] .common-tools .tool-row i,
body[class*="theme-"] .login-submit {
  background: var(--green);
}

body[class*="theme-"] .primary:hover,
body[class*="theme-"] .calculator-action.primary:hover,
body[class*="theme-"] .calculator-detail-button:hover,
body[class*="theme-"] .review-plus-button:hover,
body[class*="theme-"] .login-submit:hover {
  background: var(--green-dark);
}

body[class*="theme-"] .common-tools .tool-row i,
body[class*="theme-"] .metric-icon.green {
  color: var(--accent-foreground);
  background: var(--accent-soft);
}

body[class*="theme-"] .sales-brief .metric-card small,
body[class*="theme-"] .attention-row strong,
body[class*="theme-"] .ranking-panel p b,
body[class*="theme-"] .orders-progress span.done,
body[class*="theme-"] .orders-progress span.done i,
body[class*="theme-"] .project-flow span.completed,
body[class*="theme-"] .project-flow span.completed i {
  color: var(--accent-foreground);
}

body[class*="theme-"] .review-node-branch .review-node-head {
  background: var(--green);
}

body[class*="theme-"] .calculator-picker-trigger:focus,
body[class*="theme-"] .calculator-picker-trigger[aria-expanded="true"],
body[class*="theme-"] .login-field:focus-within {
  border-color: var(--green);
  outline-color: var(--accent-soft);
}

body[class*="theme-"] .calculator-picker-title button,
body[class*="theme-"] .calculator-step h2 b,
body[class*="theme-"] .calculator-step ul,
body[class*="theme-"] .calculator-template-link {
  color: var(--accent-foreground);
}

body[class*="theme-"] .calculator-step ul {
  border-color: var(--green);
}

body[class*="theme-"] .calculator-step ul::before {
  border-bottom-color: var(--green);
}

body[class*="theme-"] .login-accent,
body[class*="theme-"] .remember-option input {
  background: var(--green);
  accent-color: var(--green);
}

body.theme-dark .primary-sidebar {
  background: linear-gradient(180deg, #050505, #000000);
}

body.theme-dark .primary-nav-item,
body.theme-dark .primary-nav-item:hover {
  background: #1b1b1b;
}

body.theme-dark .primary-nav-item.active {
  background: #000000;
  box-shadow: inset 0 0 0 1px #555555;
}

body.theme-dark .secondary-nav-item.active,
body.theme-dark .tabs span:first-child,
body.theme-dark .workspace-tab.active,
body.theme-dark .workspace-tab:hover,
body.theme-dark .tag,
body.theme-dark .summary,
body.theme-dark .flash.success {
  color: #f3f3f3;
  background: #303030;
}

body.theme-dark .actions a:not(.primary):not(.danger),
body.theme-dark .actions button:not(.primary):not(.danger),
body.theme-dark .table-link:not(.danger),
body.theme-dark .list-reset,
body.theme-dark .price-reset,
body.theme-dark .catalog-reset,
body.theme-dark .role-reset,
body.theme-dark .calculator-template-link,
body.theme-dark .project-toolbar-actions > a:not(.primary):not(.danger),
body.theme-dark .delivery-actions a:not(.danger),
body.theme-dark .delivery-actions button:not(.danger),
body.theme-dark .orders-actions a:not(.danger),
body.theme-dark .orders-actions button:not(.danger),
body.theme-dark .review-row-actions a:not(.danger),
body.theme-dark .certificate-project-heading > a,
body.theme-dark .certificate-add summary {
  color: #f3f3f3;
}

body.theme-dark .primary,
body.theme-dark .calculator-action.primary,
body.theme-dark .calculator-detail-button,
body.theme-dark .review-plus-button,
body.theme-dark .review-status-switch.on span,
body.theme-dark .source-switch.on span,
body.theme-dark .attention-row b,
body.theme-dark .tool-green i,
body.theme-dark .login-submit,
body.theme-dark .login-accent {
  background: #000000;
  border: 1px solid #555555;
}

body.theme-dark .primary:hover,
body.theme-dark .calculator-action.primary:hover,
body.theme-dark .calculator-detail-button:hover,
body.theme-dark .review-plus-button:hover,
body.theme-dark .login-submit:hover {
  background: #222222;
}

body.theme-dark .common-tools .tool-row i,
body.theme-dark .metric-icon.green {
  color: #f3f3f3;
  background: #303030;
}

body.theme-dark .login-brand span {
  color: #f3f3f3;
}

/* Main function-bar placement selected in 全局配置 → 主题. */
body.nav-right .primary-sidebar {
  left: auto;
  right: 0;
  width: 88px;
}

body.nav-right .secondary-sidebar {
  left: 0;
  right: auto;
}

body.nav-right .app-shell {
  margin-left: 180px;
  margin-right: 88px;
}

body.nav-right.dashboard-page .app-shell {
  margin-left: 0;
  margin-right: 88px;
}

body.nav-top .primary-sidebar,
body.nav-bottom .primary-sidebar {
  left: 0;
  right: 0;
  top: 0;
  bottom: auto;
  width: 100%;
  height: 88px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
}

body.nav-bottom .primary-sidebar {
  top: auto;
  bottom: 0;
}

body.nav-top .brand,
body.nav-bottom .brand {
  flex: 0 0 136px;
  width: 136px;
  height: 48px;
}

body.nav-top .primary-nav,
body.nav-bottom .primary-nav {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: max-content;
  padding: 4px 0;
}

body.nav-top .primary-nav-item,
body.nav-bottom .primary-nav-item {
  width: 82px;
  min-width: 82px;
  height: 68px;
}

body.nav-top .secondary-sidebar {
  left: 0;
  top: 88px;
  width: 180px;
}

body.nav-top .app-shell {
  margin-left: 180px;
  margin-top: 88px;
}

body.nav-top.dashboard-page .app-shell {
  margin-left: 0;
  margin-top: 88px;
}

body.nav-bottom .secondary-sidebar {
  left: 88px;
  top: 48px;
  bottom: 88px;
  width: 180px;
}

body.nav-bottom .app-shell {
  margin-left: 268px;
  margin-bottom: 88px;
}

body.nav-bottom.dashboard-page .app-shell {
  margin-left: 88px;
  margin-bottom: 88px;
}

body.theme-dark .nav-position-option {
  background: var(--surface);
  border-color: var(--line);
}

body.theme-dark .nav-position-preview {
  border-color: #444;
  background: linear-gradient(#333 0 0) 18px 9px / 30px 4px no-repeat, linear-gradient(#555 0 0) 18px 18px / 25px 3px no-repeat, linear-gradient(#555 0 0) 18px 26px / 18px 3px no-repeat, #222;
}

/* Keep the account popover readable and transparent in the dark template. */
body.theme-dark .topbar-icon-button,
body.theme-dark .topbar-account-trigger {
  color: #d6e0ed;
  background: transparent;
}
body.theme-dark .topbar-icon-button:hover,
body.theme-dark .topbar-account-trigger:hover,
body.theme-dark .topbar-account-trigger[aria-expanded="true"] {
  background: #1f2b3b;
  color: #ffffff;
}
body.theme-dark .topbar-account-trigger > i,
body.theme-dark .topbar-notification-menu i,
body.theme-dark .topbar-account-menu i {
  color: #9aabc0;
}
body.theme-dark .topbar-notification-menu,
body.theme-dark .topbar-account-menu {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .42);
}
body.theme-dark .topbar-popover-heading,
body.theme-dark .topbar-account-menu > form,
body.theme-dark .topbar-notification-menu > a,
body.theme-dark .topbar-account-menu > a,
body.theme-dark .topbar-account-menu > form button {
  color: #d6e0ed;
  background: transparent;
}
body.theme-dark .topbar-popover-heading,
body.theme-dark .topbar-account-menu > form {
  border-color: var(--line);
}
body.theme-dark .topbar-notification-menu > a:hover,
body.theme-dark .topbar-account-menu > a:hover,
body.theme-dark .topbar-account-menu > form button:hover {
  background: #1f2b3b;
  color: #ffffff;
}

/* Message status colors stay readable and consistent across themes. */
body[class*="theme-"] .message-read-tag {
  background: #e6f0ff;
  color: #1674e8;
}
body[class*="theme-"] .message-unread-button {
  background: #fff1df;
  color: #f08a24;
}
body[class*="theme-"] .message-unread-button:hover {
  background: #ffe6c9;
  color: #d97413;
}

/* Close the remaining light controls and grouping surfaces in the dark theme. */
body.theme-dark .orders-reset,
body.theme-dark .orders-tool,
body.theme-dark .customer-tool {
  background: #24282e;
  border-color: #3a414a;
  color: #d7dee7;
}
body.theme-dark .orders-reset:hover,
body.theme-dark .orders-tool:hover,
body.theme-dark .customer-tool:hover {
  background: #30363e;
  color: #ffffff;
}

body.theme-dark .category-row td {
  background: #24282e;
  border-color: #3a414a;
  color: #e2e7ed;
}
body.theme-dark .category-line strong { color: #e5e9ee; }
body.theme-dark .category-count { color: #aab4c1; }
body.theme-dark .category-toggle {
  background: #1c2025;
  border-color: #4a535e;
  color: #d7dee7;
}

body.theme-dark .logo-preview,
body.theme-dark .logo-placeholder,
body.theme-dark .login-background-preview,
body.theme-dark .login-background-placeholder {
  background: #24282e;
  border-color: #3a414a;
  color: #aab4c1;
}
body.theme-dark .operations-page-actions input[type="file"] {
  background: #1f242a;
  border-color: #3a414a;
  color: #d7dee7;
}
body.theme-dark .theme-preview {
  background: #1f242a;
  border-color: #3a414a;
}
body.theme-dark .topbar-notification-menu,
body.theme-dark .topbar-account-menu {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .topbar-popover-heading {
  color: #e2e7ed;
  border-color: #3a414a;
}

/* Order/detail cards use a separate stylesheet with light defaults. */
body.theme-dark .project-back {
  background: #24282e;
  color: #d7dee7;
}
body.theme-dark .project-back:hover {
  background: #30363e;
  color: #ffffff;
}
body.theme-dark .project-basic-grid > div,
body.theme-dark .project-read-list > div,
body.theme-dark .project-basic-grid > div,
body.theme-dark .certificate-detail-grid > div,
body.theme-dark .project-progress-readonly > div {
  border-color: #3a414a;
}
body.theme-dark .project-basic-grid span,
body.theme-dark .project-read-list span,
body.theme-dark .project-form-readonly span,
body.theme-dark .certificate-detail-grid dt,
body.theme-dark .project-progress-readonly span {
  color: #9da9b8;
}
body.theme-dark .project-basic-grid strong,
body.theme-dark .project-read-list strong,
body.theme-dark .project-form-readonly strong,
body.theme-dark .certificate-detail-grid dd,
body.theme-dark .project-progress-readonly strong {
  color: #e0e6ed;
}
body.theme-dark .project-product-card,
body.theme-dark .certificate-project-card {
  background: #1f242a;
  border-color: #3a414a;
}
body.theme-dark .project-status,
body.theme-dark .delivery-status-tag {
  background: #1f3047;
  color: #a9c8f2;
}
body.theme-dark .project-status.progress {
  background: #1f3047;
  color: #a9c8f2;
}
body.theme-dark .project-status.waiting {
  background: #44341f;
  color: #f0c68b;
}
body.theme-dark .project-status.danger {
  background: #432426;
  color: #f2a4a0;
}
body.theme-dark .project-status.done,
body.theme-dark .delivery-status-tag.is-done {
  background: #193a27;
  color: #8bd9a5;
}
body.theme-dark .delivery-status-tag.is-danger {
  background: #432426;
  color: #f2a4a0;
}
body.theme-dark .project-product-heading,
body.theme-dark .certificate-project-heading {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .project-product-heading h3,
body.theme-dark .certificate-project-heading h3 {
  color: #e0e6ed;
}
body.theme-dark .project-product-heading span,
body.theme-dark .certificate-project-heading span,
body.theme-dark .project-product-meta,
body.theme-dark .project-task-row,
body.theme-dark .project-progress-heading span,
body.theme-dark .product-workflow-progress-heading span {
  color: #aab4c1;
}
body.theme-dark .project-contract-line,
body.theme-dark .project-task-row,
body.theme-dark .certificate-files,
body.theme-dark .project-status-editor,
body.theme-dark .project-progress-panel,
body.theme-dark .product-workflow-progress-panel {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .project-contract-line,
body.theme-dark .project-contract-line strong,
body.theme-dark .project-progress-heading strong,
body.theme-dark .product-workflow-progress-heading strong {
  color: #d7dee7;
}
body.theme-dark .project-flow,
body.theme-dark .project-progress-heading,
body.theme-dark .product-workflow-progress-heading,
body.theme-dark .product-workflow-progress-steps,
body.theme-dark .certificate-files,
body.theme-dark .certificate-add,
body.theme-dark .project-progress-readonly > div,
body.theme-dark .product-workflow-progress-readonly > div {
  border-color: #3a414a;
}
body.theme-dark .project-status-option span,
body.theme-dark .project-progress-form input,
body.theme-dark .project-progress-form select,
body.theme-dark .project-progress-form textarea,
body.theme-dark .product-workflow-progress-row,
body.theme-dark .product-workflow-progress-row input,
body.theme-dark .product-workflow-progress-row select,
body.theme-dark .product-workflow-progress-row textarea {
  background: #1f242a;
  border-color: #3a414a;
  color: #d7dee7;
}
body.theme-dark .project-status-option.passed span {
  background: #1f3047;
  border-color: #4f8fdd;
  color: #a9c8f2;
}
body.theme-dark .project-status-editor legend,
body.theme-dark .project-progress-form label,
body.theme-dark .product-workflow-progress-row label,
body.theme-dark .product-workflow-progress-row legend,
body.theme-dark .product-workflow-progress-row legend small,
body.theme-dark .certificate-upload-form label,
body.theme-dark .certificate-upload-form small {
  color: #aab4c1;
}
body.theme-dark .certificate-upload-form {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .certificate-upload-form input[type="file"] {
  background: #1f242a;
}
body.theme-dark .product-workflow-progress-row {
  background: #24282e;
}

body.theme-dark .workflow-progress-bar {
  background: #303030;
}

body.theme-dark .workflow-progress-bar > strong {
  color: #f3f3f3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}

body.theme-dark .pi-network-option,
body.theme-dark .pi-skill-row,
body.theme-dark .pi-github-result {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .pi-network-option strong,
body.theme-dark .pi-skill-row strong,
body.theme-dark .pi-github-result strong {
  color: #e0e6ed;
}
body.theme-dark .pi-network-option small,
body.theme-dark .pi-skill-row small,
body.theme-dark .pi-github-result p,
body.theme-dark .pi-github-result small {
  color: #aab4c1;
}
body.theme-dark .pi-skill-badge {
  background: #1f3047;
  color: #a9c8f2;
}
body.theme-dark .pi-automation-note,
body.theme-dark .pi-automation-builder-head small,
body.theme-dark .pi-automation-basic-grid label > span,
body.theme-dark .pi-automation-field > span,
body.theme-dark .pi-automation-step-description,
body.theme-dark .pi-automation-paths,
body.theme-dark .pi-automation-saved-main small {
  color: #aab4c1;
}
body.theme-dark .pi-automation-step,
body.theme-dark .pi-automation-saved-row,
body.theme-dark .pi-automation-result pre {
  background: #24282e;
  border-color: #3a414a;
}
body.theme-dark .pi-automation-step-head strong,
body.theme-dark .pi-automation-saved-main strong,
body.theme-dark .pi-automation-enabled {
  color: #e0e6ed;
}
body.theme-dark .pi-automation-type,
body.theme-dark .pi-automation-control,
body.theme-dark .pi-automation-result pre {
  background: #1f242a;
  border-color: #3a414a;
  color: #d7dee7;
}
body.theme-dark .pi-automation-builder-head {
  border-color: #3a414a;
}
body.theme-dark .pi-automation-status.status-success { background: #1f3a2b; color: #9bd6ae; }
body.theme-dark .pi-automation-status.status-error { background: #402b2a; color: #f2a39a; }
body.theme-dark .pi-automation-status.status-running { background: #403621; color: #e6c37a; }
body.theme-dark .pi-automation-status.status-idle { background: #1f3047; color: #a9c8f2; }

/* Topbar layout controls: keep the three tools aligned and make each one actionable. */
.topbar .crumb { min-width: 0; gap: 10px; }
.topbar .crumb-tool { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #59677a; cursor: pointer; }
.topbar .crumb-tool i { font-size: 20px; line-height: 1; color: inherit; pointer-events: none; }
.topbar .crumb-tool:hover, .topbar .crumb-tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--green); }
.topbar .crumb-tool:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.topbar .crumb > em { flex: 0 0 auto; }
.topbar .crumb-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapse the left function bar to an icon rail while keeping navigation available. */
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .primary-sidebar { width: 54px; padding: 0 3px; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .brand { width: 48px; font-size: 0; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .brand img { width: 32px; height: 32px; margin: 0; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .brand span,
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .primary-nav-item span { display: none; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .primary-nav-item { height: 54px; gap: 0; padding: 7px 0; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .primary-nav-item i { font-size: 19px; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .pi-nav-icon { width: 24px; height: 24px; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .secondary-sidebar { left: 54px; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom) .app-shell { margin-left: 234px; }
body.layout-sidebar-collapsed:not(.nav-right):not(.nav-top):not(.nav-bottom).dashboard-page .app-shell { margin-left: 54px; }

body.nav-right.layout-sidebar-collapsed .primary-sidebar { width: 54px; }
body.nav-right.layout-sidebar-collapsed .app-shell { margin-right: 54px; }
body.nav-right.layout-sidebar-collapsed.dashboard-page .app-shell { margin-right: 54px; }

/* Maximize the working area without leaving the page; the same button restores it. */
body.layout-content-maximized .primary-sidebar,
body.layout-content-maximized .secondary-sidebar,
body.layout-content-maximized .workspace-tabs { display: none; }
body.layout-content-maximized .app-shell,
body.layout-content-maximized.dashboard-page .app-shell,
body.nav-right.layout-content-maximized .app-shell,
body.nav-top.layout-content-maximized .app-shell,
body.nav-bottom.layout-content-maximized .app-shell { width: 100%; min-width: 0; margin: 0 !important; }
body.layout-content-maximized .topbar { position: sticky; top: 0; z-index: 50; }
body.layout-content-maximized .content { max-width: none; }

/* Argon light: keep the blue sidebar's brand, labels and navigation icons
 * legible with one consistent white foreground. */
body.theme-dynamic .primary-sidebar .brand,
body.theme-dynamic .primary-sidebar .brand span,
body.theme-dynamic .primary-sidebar .primary-nav-item,
body.theme-dynamic .primary-sidebar .primary-nav-item:hover,
body.theme-dynamic .primary-sidebar .primary-nav-item i,
body.theme-dynamic .primary-sidebar .primary-nav-item .pi-nav-icon {
  color: #ffffff;
}
body.theme-dynamic .primary-sidebar .primary-nav-item .pi-icon-wand { stroke: #ffffff; }
body.theme-dynamic .primary-sidebar .primary-nav-item .pi-icon-star { fill: #ffffff; }

body.theme-red .primary-sidebar .primary-nav-item,
body.theme-red .primary-sidebar .primary-nav-item:hover,
body.theme-red .primary-sidebar .primary-nav-item i,
body.theme-red .primary-sidebar .primary-nav-item .pi-nav-icon,
body.theme-orange .primary-sidebar .primary-nav-item,
body.theme-orange .primary-sidebar .primary-nav-item:hover,
body.theme-orange .primary-sidebar .primary-nav-item i,
body.theme-orange .primary-sidebar .primary-nav-item .pi-nav-icon,
body.theme-purple .primary-sidebar .primary-nav-item,
body.theme-purple .primary-sidebar .primary-nav-item:hover,
body.theme-purple .primary-sidebar .primary-nav-item i,
body.theme-purple .primary-sidebar .primary-nav-item .pi-nav-icon,
body.theme-monochrome .primary-sidebar .primary-nav-item,
body.theme-monochrome .primary-sidebar .primary-nav-item:hover,
body.theme-monochrome .primary-sidebar .primary-nav-item i,
body.theme-monochrome .primary-sidebar .primary-nav-item .pi-nav-icon,
body.theme-custom .primary-sidebar .primary-nav-item,
body.theme-custom .primary-sidebar .primary-nav-item:hover,
body.theme-custom .primary-sidebar .primary-nav-item i,
body.theme-custom .primary-sidebar .primary-nav-item .pi-nav-icon {
  color: #ffffff;
}
body.theme-red .primary-sidebar .primary-nav-item .pi-icon-wand,
body.theme-orange .primary-sidebar .primary-nav-item .pi-icon-wand,
body.theme-purple .primary-sidebar .primary-nav-item .pi-icon-wand,
body.theme-monochrome .primary-sidebar .primary-nav-item .pi-icon-wand,
body.theme-custom .primary-sidebar .primary-nav-item .pi-icon-wand { stroke: #ffffff; }
body.theme-red .primary-sidebar .primary-nav-item .pi-icon-star,
body.theme-orange .primary-sidebar .primary-nav-item .pi-icon-star,
body.theme-purple .primary-sidebar .primary-nav-item .pi-icon-star,
body.theme-monochrome .primary-sidebar .primary-nav-item .pi-icon-star,
body.theme-custom .primary-sidebar .primary-nav-item .pi-icon-star { fill: #ffffff; }

/* Keep colorful sidebar labels readable against their saturated cards. */
body.theme-red .primary-sidebar .primary-nav-item > span,
body.theme-orange .primary-sidebar .primary-nav-item > span,
body.theme-purple .primary-sidebar .primary-nav-item > span,
body.theme-monochrome .primary-sidebar .primary-nav-item > span,
body.theme-custom .primary-sidebar .primary-nav-item > span {
  color: #f5f7fa;
}

/* Match the regular sidebar icon states: gray when idle, soft white when selected. */
body[class*="theme-"] .primary-sidebar .primary-nav-item:not(.active) .pi-icon-wand {
  stroke: #98a1ae;
}
body[class*="theme-"] .primary-sidebar .primary-nav-item:not(.active) .pi-icon-star {
  fill: #98a1ae;
  stroke: #98a1ae;
}
body[class*="theme-"] .primary-sidebar .primary-nav-item.active .pi-icon-wand {
  stroke: #f5f7fa;
}
body[class*="theme-"] .primary-sidebar .primary-nav-item.active .pi-icon-star {
  fill: #f5f7fa;
  stroke: #f5f7fa;
}

/* Use the same idle/active contrast for every colorful five-theme sidebar. */
body.theme-red .primary-sidebar .primary-nav-item:not(.active) i,
body.theme-red .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-red .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-orange .primary-sidebar .primary-nav-item:not(.active) i,
body.theme-orange .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-orange .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-purple .primary-sidebar .primary-nav-item:not(.active) i,
body.theme-purple .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-purple .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-monochrome .primary-sidebar .primary-nav-item:not(.active) i,
body.theme-monochrome .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-monochrome .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-custom .primary-sidebar .primary-nav-item:not(.active) i,
body.theme-custom .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-custom .primary-sidebar .primary-nav-item:not(.active) > span {
  color: #98a1ae;
}
body.theme-red .primary-sidebar .primary-nav-item.active i,
body.theme-red .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-red .primary-sidebar .primary-nav-item.active > span,
body.theme-orange .primary-sidebar .primary-nav-item.active i,
body.theme-orange .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-orange .primary-sidebar .primary-nav-item.active > span,
body.theme-purple .primary-sidebar .primary-nav-item.active i,
body.theme-purple .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-purple .primary-sidebar .primary-nav-item.active > span,
body.theme-monochrome .primary-sidebar .primary-nav-item.active i,
body.theme-monochrome .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-monochrome .primary-sidebar .primary-nav-item.active > span,
body.theme-custom .primary-sidebar .primary-nav-item.active i,
body.theme-custom .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-custom .primary-sidebar .primary-nav-item.active > span {
  color: #f5f7fa;
}

/* Pi助手 follows the same foreground states in the original five themes. */
body[class*="theme-"] .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body[class*="theme-"] .primary-sidebar .primary-nav-item:not(.active) > span {
  color: #98a1ae;
}
body[class*="theme-"] .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body[class*="theme-"] .primary-sidebar .primary-nav-item.active > span {
  color: #f5f7fa;
}

/* Keep the system name white on dark/colored sidebars. */
body.theme-minimal .primary-sidebar a.brand,
body.theme-minimal .primary-sidebar a.brand > span,
body.theme-enterprise .primary-sidebar a.brand,
body.theme-enterprise .primary-sidebar a.brand > span,
body.theme-dynamic .primary-sidebar a.brand,
body.theme-dynamic .primary-sidebar a.brand > span,
body.theme-dark .primary-sidebar a.brand,
body.theme-dark .primary-sidebar a.brand > span,
body.theme-red .primary-sidebar a.brand,
body.theme-red .primary-sidebar a.brand > span,
body.theme-orange .primary-sidebar a.brand,
body.theme-orange .primary-sidebar a.brand > span,
body.theme-purple .primary-sidebar a.brand,
body.theme-purple .primary-sidebar a.brand > span,
body.theme-monochrome .primary-sidebar a.brand,
body.theme-monochrome .primary-sidebar a.brand > span,
body.theme-custom .primary-sidebar a.brand,
body.theme-custom .primary-sidebar a.brand > span {
  color: #ffffff;
}

/* The Mac theme uses a light sidebar, so keep its brand dark for contrast. */
body.theme-professional .primary-sidebar a.brand,
body.theme-professional .primary-sidebar a.brand > span {
  color: #1d1d1f;
}

/* Match Pi助手 to the existing navigation icon palette in Argon and Mac. */
body.theme-dynamic .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-dynamic .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-dynamic .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-dynamic .primary-sidebar .primary-nav-item.active > span {
  color: #ffffff;
}
body.theme-dynamic .primary-sidebar .primary-nav-item:not(.active) .pi-icon-wand,
body.theme-dynamic .primary-sidebar .primary-nav-item.active .pi-icon-wand {
  stroke: #ffffff;
}
body.theme-dynamic .primary-sidebar .primary-nav-item:not(.active) .pi-icon-star,
body.theme-dynamic .primary-sidebar .primary-nav-item.active .pi-icon-star {
  fill: #ffffff;
  stroke: #ffffff;
}
body.theme-professional .primary-sidebar .primary-nav-item:not(.active) .pi-nav-icon,
body.theme-professional .primary-sidebar .primary-nav-item:not(.active) > span,
body.theme-professional .primary-sidebar .primary-nav-item.active .pi-nav-icon,
body.theme-professional .primary-sidebar .primary-nav-item.active > span {
  color: #6e6e73;
}
body.theme-professional .primary-sidebar .primary-nav-item:not(.active) .pi-icon-wand,
body.theme-professional .primary-sidebar .primary-nav-item.active .pi-icon-wand {
  stroke: #6e6e73;
}
body.theme-professional .primary-sidebar .primary-nav-item:not(.active) .pi-icon-star,
body.theme-professional .primary-sidebar .primary-nav-item.active .pi-icon-star {
  fill: #6e6e73;
  stroke: #6e6e73;
}
