/* Site-wide light/dark palette. Data colors and user images keep their own meaning. */

html[data-theme="dark"] {
  --color-primary: #e8ebf0;
  --color-primary-active: #ffffff;
  --color-ink: #f1f3f6;
  --color-body: #dce0e6;
  --color-muted: #a5acb8;
  --color-hairline: #373d47;
  --color-border-strong: #59616e;
  --color-canvas: #15171c;
  --color-surface-soft: #22262e;
  --color-surface-strong: #303640;
  --color-surface-dark: #15171c;
  --color-surface-dark-elevated: #303640;
  --color-link: #c4d5ff;
  --color-link-active: #e0eaff;
  --color-info-border: #b8c0cd;
  --color-on-primary: #15171c;
  --color-on-dark: #f4f5f7;
  --color-signature-coral: #d9a4ab;
  --color-signature-cream: #292e36;
  --color-signature-peach: #333038;
  --color-signature-mint: #263a32;
  --color-signature-yellow: #3d3725;
  --color-signature-mustard: #695c35;
  --color-signature-sky: #283440;
  --color-signature-lilac: #302d40;
  --color-signature-sage: #2b372e;
  --color-signature-blush: #3a2c32;
  --color-data-up: #ef7d88;
  --color-data-down: #83a8ff;
  --muted: #a5acb8;
  --hairline: #454c57;
  background: #15171c;
}
html[data-theme="dark"] body { background: #15171c; color: var(--color-body); }
html[data-theme="dark"] a { color: var(--color-link); }
html[data-theme="dark"] .section-title,
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 { color: var(--color-ink); }
html[data-theme="dark"] .top-nav { background: #20242b; border-color: var(--color-hairline); }
html[data-theme="dark"] .top-nav__brand { color: var(--color-ink); }
html[data-theme="dark"] .top-nav__settings,
html[data-theme="dark"] .top-nav__account { background: #2b3039; color: var(--color-ink); border-color: var(--color-hairline); }
html[data-theme="dark"] .top-nav__settings:hover,
html[data-theme="dark"] .top-nav__account:hover { background: #383f49; }
html[data-theme="dark"] :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), textarea, select) { background-color: #242932; color: #f0f2f5; border-color: #4a515e; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color: #929baa; opacity: 1; }
html[data-theme="dark"] :is(button,a,input,textarea,select,summary):focus-visible { outline-color: #d6e0f1; }
html[data-theme="dark"] :is(dialog,[role="dialog"]) { background-color: #252a33; color: #e9ecf1; border-color: #4a515e; }
html[data-theme="dark"] .footer { background: #20242b; color: #e9ecf1; }
html[data-theme="dark"] .footer__brand,
html[data-theme="dark"] .footer__email { color: #e8ebf0 !important; }
html[data-theme="dark"] .footer__legal { color: #a5acb8; }
html[data-theme="dark"] :is(.data-table, .data-table td, .data-table th, .treemap__list, .treemap__detail) { border-color: #3d444e; }
html[data-theme="dark"] .data-table th { background: #2d333c; color: #e9ecf1; }
html[data-theme="dark"] .data-table td { background: #22262e; color: #e0e4e9; }
html[data-theme="dark"] .data-table tr:hover td { background: #303640; }
html[data-theme="dark"] .dash__row,
html[data-theme="dark"] .dash__day,
html[data-theme="dark"] .dash__ratio,
html[data-theme="dark"] .dash-feed,
html[data-theme="dark"] .dash__stat { background: #2b3038; }
html[data-theme="dark"] .chip-toggle:not(.is-active):not([aria-pressed="true"]),
html[data-theme="dark"] .cell-btn,
html[data-theme="dark"] .document-toolbar button { background: #29303a; color: #e9ecf1; border-color: #454d59; }
html[data-theme="dark"] .btn-refresh { background: #e8ebf0; color: #15171c; border-color: #e8ebf0; }
html[data-theme="dark"] .btn-refresh:hover { background: #cbd2dc; }
html[data-theme="dark"] :is(.login-card button[type="submit"],.folder-create button,.demo-grid-card__edit-actions .is-primary,.chip-toggle.is-active,#favorites-filter.is-active,.jh-tab.is-active,.jh-me-chip,.treemap__switch button[aria-pressed="true"],.feature-star.is-favorited) { color: #15171c; }
html[data-theme="dark"] .treemap__row { background: #272d36; color: #e9ecf1; }
html[data-theme="dark"] .treemap__row:hover { background: #333a44; }

/* Home launcher */
html[data-theme="dark"] .home-page { background: #15171c; }
html[data-theme="dark"] .home-page .top-nav { background: #20242bef; border-color: #383e48; }
html[data-theme="dark"] .home-page .hero-band { background: transparent; }
html[data-theme="dark"] .home-page .hero-band p,
html[data-theme="dark"] .home-tools-heading .eyebrow,
html[data-theme="dark"] .home-tool-count,
html[data-theme="dark"] .home-size-control,
html[data-theme="dark"] .home-page .feature-folder__count,
html[data-theme="dark"] .home-page .feature-frequent__period,
html[data-theme="dark"] .home-page .feature-frequent__hint { color: #a5acb8; }
html[data-theme="dark"] .home-status-dot { box-shadow: 0 0 0 5px #353b45; }
html[data-theme="dark"] .home-page .dash__card { background: #22262e; border-color: #383e48; }
html[data-theme="dark"] .home-page :is(.dash__row,.dash__day,.dash-feed) { background: #2d333c; }
html[data-theme="dark"] .home-page .search-input-wrap { background: #252a33; border-color: #373d47; }
html[data-theme="dark"] .home-page .chip-toggle { border-color: #444b56; color: #e9ecf1; }
html[data-theme="dark"] .home-page .chip-toggle.is-active,
html[data-theme="dark"] .home-page .chip-toggle[aria-pressed="true"] { background: #e8ebf0; color: #15171c; border-color: #e8ebf0; }
html[data-theme="dark"] .home-page .feature-folder__count { background: #303640; }
html[data-theme="dark"] .home-page .feature-frequent { border-color: #3a414b; }
html[data-theme="dark"] .home-page .demo-grid-card:hover { background: #252a33; }
html[data-theme="dark"] .home-page .demo-grid-card__actions { background: #2d333c; border-color: #454c57; }
html[data-theme="dark"] .home-page .feature-star.is-favorited { background: #444b56; }
html[data-theme="dark"] .home-page .feature-pin.is-active { background: #e8ebf0; color: #15171c; }
html[data-theme="dark"] .home-page .feature-folder__empty { background: #22262e; border-color: #454c57; }
html[data-theme="dark"] .home-page .demo-grid-card__edit-form { background: #242932; color: #e9ecf1; border-color: #49515c; }
html[data-theme="dark"] .home-page .footer { background: #20242b; color: #a5acb8; }
html[data-theme="dark"] .home-page .footer__brand,
html[data-theme="dark"] .home-page .footer__email { color: #e8ebf0 !important; }

/* Pages with white surfaces outside the shared design tokens. */
html[data-theme="dark"] .admins-page :is(button:not(.admin-primary),.admins-summary,.admin-account__credentials,.admin-account__state,.admins-editor,#admin-message) { background: #282e37; color: #e5e9ef; border-color: #454c57; }
html[data-theme="dark"] .admins-page :is(.admin-account,.admins-search,.admins-empty) { border-color: #454c57; }
html[data-theme="dark"] .admins-page .admin-account.is-selected { background: #252b34; }
html[data-theme="dark"] .admins-page :is(.admins-summary strong,.admin-account__credentials dd) { color: #f0f2f5; }
html[data-theme="dark"] .admins-page .admin-primary { background: #e8ebf0; color: #15171c; }
html[data-theme="dark"] :is(.logs-workspace,.log-actions,.os-source-bar,.os-credentials,.os-progress,.os-analysis-panel,.os-modal-card,.os-research-card textarea,.os-game-moves,.os-board-panel) { background-color: #242932; color: #e4e8ed; border-color: #454c57; }
html[data-theme="dark"] :is(.logs-refresh,.logs-search,.logs-limit select,.log-panel,.log-actions button,.os-review-actions button,.os-more,.os-game-nav button,.os-copy,.os-research-actions button:not(:last-child),.os-credentials input,.os-path button) { background: #2d333c; color: #e4e8ed; border-color: #4a515d; }
html[data-theme="dark"] .logs-tabs button[aria-pressed="true"] { background: #e8ebf0; color: #15171c; }
html[data-theme="dark"] :is(.logs-tabs button,.logs-search input,.os-move-row,.os-game-row) { color: #e4e8ed; }
html[data-theme="dark"] :is(.logs-tabs button:hover,.os-move-row:hover,.os-game-row:hover) { background: #353b45; color: #f4f6f8; }
html[data-theme="dark"] .log-panel summary::after { background: #39414c; color: #c5cbd4; }
html[data-theme="dark"] .usage-page select { background: #242932; color: #e4e8ed; }
html[data-theme="dark"] .usage-stat--primary { background: #dce3ed; color: #15171c; }
html[data-theme="dark"] .usage-stat--primary p { color: #4e5865; }
html[data-theme="dark"] .usage-stat--primary h3 { color: #15171c; }
html[data-theme="dark"] .document-toolbar button { background: #29303a; }
html[data-theme="dark"] .filesystem-page :is(button,input,select) { color: #e9ecf1; }
html[data-theme="dark"] .filesystem-page :is(.filesystem-sidebar,.filesystem-panel,.filesystem-pinned,.filesystem-pin-item,.filesystem-info-dialog) { background: #242932; color: #e4e8ed; border-color: #454c57; }
html[data-theme="dark"] .filesystem-page button:not(.filesystem-star),
html[data-theme="dark"] .filesystem-page .filesystem-preview-actions a { background: #2d333c; color: #e9ecf1; border-color: #4a515d; }
html[data-theme="dark"] .filesystem-page .filesystem-entry-row:hover { background: #303e4d; }
html[data-theme="dark"] .filesystem-page :is(.filesystem-empty,.filesystem-meta,.filesystem-info-dialog label) { color: #aab2bf; }
html[data-theme="dark"] :is(.filesystem-message.is-error,#status-message.is-error,#logs-message.is-error,#life-message[data-error]) { color: #ff9aa5; }
html[data-theme="dark"] #logs-message.is-error::before { background: #ff9aa5; }
html[data-theme="dark"] .os-page :is(.os-card,.os-position-details,.os-global-results,.os-engine-line,.os-search-results,.os-search-results button,.os-color-tab) { background: #242932; color: #e4e8ed; border-color: #454c57; }
html[data-theme="dark"] .os-page .os-message { background: #44262b; color: #ffbdc5; border-color: #7d3d47; }
html[data-theme="dark"] .os-page .os-message.is-success { background: #243b2d; color: #b7e5c4; border-color: #416e4f; }
html[data-theme="dark"] .life-page :is(.appearance-actions,.life-settings-group) { background: #242932; color: #e4e8ed; border-color: #454c57; }
html[data-theme="dark"] .life-page .life-settings-group strong { color: #e9ecf1; }
html[data-theme="dark"] .life-page :is(.life-settings-group p,.life-note) { color: #aab2bf; }
html[data-theme="dark"] .life-page :is(.life-photo p,#photo-count) { color: #aab2bf; }
html[data-theme="dark"] .life-settings-group > summary span { color: #aab2bf; }
html[data-theme="dark"] .life-page .life-panel hr { border-color: #454c57; }

/* Market map has its own dark palette; its light version changes the chrome only. */
html[data-theme="light"] .marketmap-page { background: #f5f6f8; color: #20242b; }
html[data-theme="light"] .marketmap-page .top-nav { background: #fff; border-color: #dce0e5; }
html[data-theme="light"] .marketmap-page .top-nav__brand,
html[data-theme="light"] .marketmap-page .section-title { color: #1d222a; }
html[data-theme="light"] .marketmap-page .heatmap-meta { color: #636b78; }
html[data-theme="light"] .marketmap-page .btn-refresh { background: #e9edf2; border-color: #cdd3dc; color: #20242b; }
html[data-theme="light"] .marketmap-page .btn-refresh:hover { background: #dfe4eb; }
html[data-theme="light"] .marketmap-panel { background: #fff; border-color: #dfe3e9; }
html[data-theme="light"] .marketmap-chips button { background: #ebedf1; color: #343a44; }
html[data-theme="light"] .marketmap-chips button[aria-pressed="true"] { background: #252a33; color: #fff; }
html[data-theme="light"] .marketmap-chips button:hover:not([aria-pressed="true"]) { background: #d9dee5; }
html[data-theme="light"] .marketmap-view { background: #e5e8ed; }
html[data-theme="light"] .marketmap-view button { color: #5e6875; }
html[data-theme="light"] .marketmap-view button[aria-pressed="true"] { background: #fff; color: #1d222a; }
html[data-theme="light"] :is(.marketmap-summary,.marketmap-list__row) { color: #252a33; }
html[data-theme="light"] :is(.marketmap-subline,.marketmap-counts,.marketmap-footnote) { color: #68717e; }
html[data-theme="light"] .marketmap-index { background: #f1f3f6; color: #4c5664; border-color: #d9dee5; }
html[data-theme="light"] .marketmap-list { background: #f9fafb; }
html[data-theme="light"] .marketmap-list__row { border-color: #dfe3e9; }
html[data-theme="light"] .marketmap-list__row:hover { background: #edf0f4; }
html[data-theme="light"] .marketmap-list__row span { color: #68717e; }
html[data-theme="light"] .marketmap-page .footer { background: #e9edf2; color: #252a33; }
html[data-theme="light"] .marketmap-page .footer__brand,
html[data-theme="light"] .marketmap-page .footer__email { color: #252a33 !important; }
html[data-theme="light"] .marketmap-detail { background: #fff; color: #252a33; border-color: #cbd2dc; }
html[data-theme="light"] .marketmap-detail > button { background: #e8ebf0; color: #252a33; }
html[data-theme="light"] .marketmap-detail__row,
html[data-theme="light"] .marketmap-detail__stock { border-color: #dce1e8; color: #252a33; }
html[data-theme="light"] .marketmap-detail__row span,
html[data-theme="light"] .marketmap-detail__summary { color: #68717e; }

/* Standalone MCP and documentation pages. */
html[data-theme="dark"] body:has(#connections),
html[data-theme="dark"] body:has(> .docs-layout) { background: #15171c; color: #e3e7ed; }
html[data-theme="dark"] body:has(#connections) main { background: #22262e; }
html[data-theme="dark"] body:has(#connections) section { border-color: #3e4550; }
html[data-theme="dark"] body:has(#connections) button.secondary { background: #39414d; color: #f0f2f5; }
html[data-theme="dark"] body:has(form[action="/mcp/consent"]) main { background: #22262e; }
html[data-theme="dark"] body:has(> .docs-layout) :is(header,aside,h2,pre,td,th) { border-color: #414854; }
html[data-theme="dark"] body:has(> .docs-layout) :is(pre,th) { background: #252b34; }
html[data-theme="dark"] body:has(> .docs-layout) aside a:hover { background: #343b46; }
html[data-theme="dark"] body:has(> .docs-layout) aside .sub { color: #aab2bf; }
body:has(> .docs-layout) > header nav { align-items: center; }
