/* Shared palette and layout, after the module styles. Home keeps its compact workspace. */
:root[data-ui-theme] {
  --ui-bg: #f6f4ef; --ui-card: #fffdf9; --ui-soft: #eeebe5;
  --ui-text: #282723; --ui-muted: #6b665e; --ui-line: #d8d2c8;
  --ui-brand: #ad4c32; --ui-brand-hover: #903c27; --ui-brand-soft: #f7e7df;
  --ui-success: #246b51; --ui-success-soft: #e7f3eb;
  --ui-warning: #895c12; --ui-warning-soft: #faf0d9;
  --ui-error: #b33835; --ui-error-soft: #fbe9e7;
  --ui-info: #2e6586; --ui-info-soft: #e7f0f6;
  --background: var(--ui-bg); --foreground: var(--ui-text); --card: var(--ui-card);
  --muted: var(--ui-muted); --muted-bg: var(--ui-soft); --border: var(--ui-line);
  --primary: var(--ui-brand); --primary-dark: var(--ui-brand-hover); --primary-foreground: #fff;
  --secondary: var(--ui-card); --success: var(--ui-success); --destructive: var(--ui-error); --ring: var(--ui-brand);
  color-scheme: light;
}
:root[data-ui-theme="dark"] {
  --ui-bg: #1b1b19; --ui-card: #252522; --ui-soft: #30302b;
  --ui-text: #f2efe8; --ui-muted: #b9b4aa; --ui-line: #4b4840;
  --ui-brand: #e09172; --ui-brand-hover: #efaa8f; --ui-brand-soft: #442c23;
  --ui-success: #8bc5a6; --ui-success-soft: #21372b;
  --ui-warning: #eac07b; --ui-warning-soft: #3c3221;
  --ui-error: #f19a92; --ui-error-soft: #422925;
  --ui-info: #9fc6df; --ui-info-soft: #26343f;
  color-scheme: dark;
}
html[data-ui-theme] body:not(.dashboard-compact) {
  background: var(--ui-bg); color: var(--ui-text); font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  --bn-bg: var(--ui-bg); --bn-panel: var(--ui-card); --bn-panel-2: var(--ui-soft); --bn-text: var(--ui-text); --bn-muted: var(--ui-muted); --bn-line: var(--ui-line); --bn-yellow: var(--ui-brand); --bn-green: var(--ui-success); --bn-red: var(--ui-error);
  --general-bg: var(--ui-bg); --general-panel: var(--ui-card); --general-panel-soft: var(--ui-soft); --general-text: var(--ui-text); --general-muted: var(--ui-muted); --general-line: var(--ui-line); --general-accent: var(--ui-brand); --general-good: var(--ui-success); --general-danger: var(--ui-error);
  --alpha-bg: var(--ui-bg); --alpha-card: var(--ui-card); --alpha-card-2: var(--ui-soft); --alpha-text: var(--ui-text); --alpha-muted: var(--ui-muted); --alpha-line: var(--ui-line); --alpha-gold: var(--ui-brand); --alpha-green: var(--ui-success); --alpha-red: var(--ui-error);
  --market-bg: var(--ui-bg); --market-panel: var(--ui-card); --market-panel-2: var(--ui-soft); --market-text: var(--ui-text); --market-muted: var(--ui-muted); --market-line: var(--ui-line); --market-line-soft: var(--ui-line); --market-accent: var(--ui-brand); --market-success: var(--ui-success); --market-cyan: var(--ui-info); --market-warning: var(--ui-warning); --market-danger: var(--ui-error);
  --service-bg: var(--ui-bg); --service-panel: var(--ui-card); --service-panel-soft: var(--ui-soft); --service-text: var(--ui-text); --service-muted: var(--ui-muted); --service-line: var(--ui-line); --service-line-soft: var(--ui-line); --service-accent: var(--ui-brand); --service-accent-rgb: 173, 76, 50; --service-success: var(--ui-success); --service-danger: var(--ui-error);
  --credential-bg: var(--ui-bg); --credential-surface: var(--ui-card); --credential-surface-strong: var(--ui-soft); --credential-text: var(--ui-text); --credential-muted: var(--ui-muted); --credential-line: var(--ui-line); --credential-green: var(--ui-brand); --credential-cyan: var(--ui-info); --credential-amber: var(--ui-warning); --credential-accent: var(--ui-brand);
  --account-bg: var(--ui-bg); --account-surface: var(--ui-card); --account-surface-soft: var(--ui-soft); --account-text: var(--ui-text); --account-muted: var(--ui-muted); --account-line: var(--ui-line); --account-line-strong: var(--ui-line); --account-green: var(--ui-success); --account-green-soft: var(--ui-success-soft); --account-blue: var(--ui-info); --account-amber: var(--ui-warning); --account-red: var(--ui-error);
  --operations-ink: var(--ui-text); --operations-muted: var(--ui-muted); --operations-line: var(--ui-line); --operations-paper: var(--ui-card); --operations-green: var(--ui-success); --operations-amber: var(--ui-warning); --operations-red: var(--ui-error);
}
html[data-ui-theme] body:not(.dashboard-compact)::before,
html[data-ui-theme] body:not(.dashboard-compact)::after { display: none; }
html[data-ui-theme] body:not(.dashboard-compact) :is(.binance-shell, .market-console-shell, .general-monitor-shell, .alpha-shell, .service-shell, .raidbot-shell, .notification-shell, .signal-shell, .operations-shell, .account-shell, .account-admin-shell, .page-shell) {
  width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding-top: 24px;
}
html[data-ui-theme] .ui-page-header {
  position: relative; z-index: 30; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 20px; margin: 0; padding: 20px 24px; min-height: 100px; width: 100%; box-sizing: border-box;
  border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-card); color: var(--ui-text); box-shadow: none; overflow: visible;
}
html[data-ui-theme] .ui-page-header h1 { margin: 0; font-size: 28px; line-height: 1.25; letter-spacing: -.025em; color: var(--ui-text); }
html[data-ui-theme] .ui-page-header :is(nav, [class$="actions"]) { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
html[data-ui-theme] .ui-page-header p { color: var(--ui-muted); font-size: 13px; }
html[data-ui-theme] .ui-page-header [class$="brand"] { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
html[data-ui-theme] :is(.binance-kicker, .alpha-kicker, .market-kicker, .service-kicker, .notification-kicker, .general-monitor-kicker, .eyebrow) { color: var(--ui-brand); }
html[data-ui-theme] :is(.binance-back, .market-back, .alpha-back, .service-back, .notification-back, .general-monitor-back) { color: var(--ui-brand); background: var(--ui-brand-soft); border-color: var(--ui-line); box-shadow: none; min-height: 40px; }
.ui-timezone { margin: 10px 4px 18px; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
.ui-error { margin: 12px 0; padding: 12px 16px; border: 1px solid var(--ui-error); border-radius: 8px; color: var(--ui-error); background: var(--ui-error-soft); overflow-wrap: anywhere; }
.ui-error[hidden] { display: none; }
.ui-skip-link { position: fixed; top: -80px; left: 12px; z-index: 10000; padding: 12px 18px; color: var(--ui-text); background: var(--ui-card); border: 2px solid var(--ui-brand); border-radius: 8px; }
.ui-skip-link:focus { top: 12px; }
/* Surfaces that previously had fixed light or terminal colors. */
html[data-ui-theme] body:not(.dashboard-compact) :is(.panel, .overview, .terminal, .general-panel, .general-provider-panel, .general-provider-card, .alpha-focus-card, .alpha-pulse-card, .alpha-source-strip, .alpha-channel-card, .alpha-feed-panel, .alpha-calendar-panel, .alpha-log-drawer, .market-command-card, .market-service-card, .market-panel, .market-workbench, .market-log-drawer, .market-config-card, .binance-panel, .binance-security-drawer, .binance-defaults, .symbol-card, .ticker, .incident, .service-panel, .service-focus-card, .service-log-drawer, .service-channel-card, .credential-channel, .notification-policy-panel, .notification-card, .account-section, .account-create-panel, .account-list-section, .account-invite-panel, .account-security-panel, .account-limit-panel, .account-overview, .account-admin-metrics, .signal-summary, .signal-stream, .operations-panel, .operations-summary article, .attention-panel, .symbol-detail-dialog, .symbol-detail-shell, .account-dialog, .signal-read-dialog, .notification-retry-dialog, .raidbot-profile-dialog, .raidbot-profile-dialog-card) {
  background: var(--ui-card); color: var(--ui-text); border-color: var(--ui-line); box-shadow: none;
}
html[data-ui-theme] body:not(.dashboard-compact) :is(.market-hero-meta div, .market-module-strip div, .market-toggle-grid label, .market-choice-group, .market-save-bar, .source-health-card, .market-signal-row, .market-config-chip, .service-mini-grid > div, .service-detail > div, .zealy-url-preview, .telegram-rule, .service-channel-card > label, .general-overview article, .general-toggles label, .alpha-reward-grid > div, .alpha-timeline-card, .alpha-channel-controls label, .credential-list-row, .notification-policy-metrics, .notification-route-module, .signal-filters, .signal-stream-head, .signal-row-rail, .signal-source-record, .signal-bulk-bar, .signal-focus-notice, .operations-panel-head, .operations-table-foot, .account-module-row, .account-list-head, .account-mfa-metrics, .account-quota-fieldset, .account-create-quotas, .account-invite-meta, .symbol-detail-metrics > div, .symbol-chart-stage, .symbol-chart-tooltip, .symbol-target-picker, .binance-metric-grid > div, .binance-rule-summary > div, .binance-posture-item, .binance-source-health-list > div, .binance-channel-field label, .binance-symbol-channels label, .binance-ack-policy, .raidbot-node, .raidbot-profile-switcher, .raidbot-profile-item, .raidbot-profile-chip, .raidbot-profile-manage, .raidbot-profile-identity, .raidbot-profile-meta div, .raidbot-login-callout, .raidbot-browser-callout, .raidbot-browser-steps li, .raidbot-delay-config, .raidbot-delay-switch, .raidbot-reply-console, .raidbot-reply-row, .raidbot-reply-import, .backtest-card, .backtest-metrics div, .validation-card, .backtest-empty) {
  background: var(--ui-soft); color: var(--ui-text); border-color: var(--ui-line);
}
html[data-ui-theme] body:not(.dashboard-compact) :is(.signal-row, .signal-row-body, .signal-delivery, .signal-tags, .signal-tag, .signal-task, .outbox-table td, .outbox-table th, .data-table td, .data-table th, .general-table td, .general-table th, .signal-event-detail, .signal-event-detail h4, .signal-bulk-bar strong, .signal-bulk-bar small, .signal-bulk-bar > span, .attention-metrics strong, .attention-content, .attention-list a, .account-mfa-secret, .account-mfa-recovery-codes, .symbol-chart-tooltip strong, .raidbot-profile-chip code) {
  color: var(--ui-text); border-color: var(--ui-line);
}
html[data-ui-theme] body:not(.dashboard-compact) :is(.signal-row-rail time, .signal-row-rail span, .signal-row-body p, .signal-delivery small, .signal-task p, .signal-stream-note, .signal-empty, .outbox-table small, .attention-bulk-note, .attention-metrics span, .outbox-status, .raidbot-login-warning) { color: var(--ui-muted); }
html[data-ui-theme] body:not(.dashboard-compact) :is(input, textarea, select) {
  color: var(--ui-text); background: var(--ui-card); border-color: var(--ui-line); accent-color: var(--ui-brand); box-shadow: none;
}
html[data-ui-theme] body:not(.dashboard-compact) :is(input, textarea)::placeholder { color: var(--ui-muted); opacity: 1; }
html[data-ui-theme] option { color: var(--ui-text); background: var(--ui-card); }
html[data-ui-theme] body:not(.dashboard-compact) :is(button, .button, [class$="button"], .button-link, summary) {
  color: var(--ui-text); background: var(--ui-card); border-color: var(--ui-line); box-shadow: none; transform: none;
}
html[data-ui-theme] :is(button, .button, summary, input, select, textarea, a):focus-visible { outline: 2px solid var(--ui-brand); outline-offset: 3px; }
html[data-ui-theme] body:not(.dashboard-compact) :is(button, .button, summary):hover { background: var(--ui-soft); transform: none; }
html[data-ui-theme] body:not(.dashboard-compact) :is(.primary, .binance-button-accent, .market-button-accent, .alpha-button-accent, .service-button-accent, .general-monitor-primary, .notification-primary, .credential-primary, .ui-auth form button) { color: #fff; background: #ad4c32; border-color: #ad4c32; }
html[data-ui-theme] body:not(.dashboard-compact) :is(.primary, .binance-button-accent, .market-button-accent, .alpha-button-accent, .service-button-accent, .general-monitor-primary, .ui-auth form button):hover { color: #fff; background: #903c27; }
html[data-ui-theme] :is(.is-danger, .danger, .outbox-error, .error) { color: var(--ui-error) !important; }
html[data-ui-theme] :is(.badge.ok, .is-online, .freshness-good, .account-status-active, .outbox-table tr[data-state="sent"] .outbox-status, .health-component-row[data-state="healthy"] .operations-state) { color: var(--ui-success); background: var(--ui-success-soft); border-color: var(--ui-success); }
html[data-ui-theme] :is(.badge.bad, .freshness-bad, .account-status-disabled, .signal-tag-severity-critical, .outbox-table tr[data-state="dead"] .outbox-status, .health-component-row[data-state="error"] .operations-state) { color: var(--ui-error); background: var(--ui-error-soft); border-color: var(--ui-error); }
html[data-ui-theme] :is(.is-partial, .freshness-warn, .account-status-pending, .signal-tag-severity-important, .outbox-table tr[data-state="pending"] .outbox-status, .health-component-row[data-state="degraded"] .operations-state) { color: var(--ui-warning); background: var(--ui-warning-soft); border-color: var(--ui-warning); }
html[data-ui-theme] :is(.signal-tag-symbol, .signal-tag-correlated) { color: var(--ui-info); background: var(--ui-info-soft); border-color: var(--ui-info); }
html[data-ui-theme] :is(.signal-tag-type, .signal-tag-rule, .signal-tag-source, .signal-tag-delivery) { background: var(--ui-soft); color: var(--ui-text); border-color: var(--ui-line); }
html[data-ui-theme] :is(.signal-summary span, .signal-filters label, .signal-header-actions > span, .signal-stream-head > strong, .credential-list-empty, .account-mfa-secret small) { color: var(--ui-muted); }
html[data-ui-theme] :is(.credential-channel-mark, .credential-status) { background: var(--ui-soft); color: var(--ui-muted); border-color: var(--ui-line); }
html[data-ui-theme] .credential-status.is-ready { background: var(--ui-success-soft); color: var(--ui-success); border-color: var(--ui-success); }
html[data-ui-theme] .credential-status.is-warning { background: var(--ui-warning-soft); color: var(--ui-warning); border-color: var(--ui-warning); }
html[data-ui-theme] .credential-savebar button { color: #fff; background: #ad4c32; }
html[data-ui-theme] :is(.text-good, .binance-console .text-good, .market-console .text-good) { color: var(--ui-success); }
html[data-ui-theme] :is(.text-bad, .binance-console .text-bad, .market-console .text-bad) { color: var(--ui-error); }
html[data-ui-theme] :is(.binance-source-tag, .binance-source-legend [data-source]) { color: var(--ui-info); background: var(--ui-info-soft); border-color: var(--ui-line); }
html[data-ui-theme] :is(.binance-console .ticker .price, .binance-console .ticker .reference) { color: var(--ui-text); }
html[data-ui-theme] .signal-row[data-severity="critical"] { border-left-color: var(--ui-error); }
html[data-ui-theme] .signal-row[data-severity="important"] { border-left-color: var(--ui-warning); }
html[data-ui-theme] :is(.log-box, .alpha-log-box, .market-action-output) { background: var(--ui-soft) !important; color: var(--ui-text) !important; }
html[data-ui-theme] .toast { color: var(--ui-text); background: var(--ui-card); border: 1px solid var(--ui-line); z-index: 1000; }
html[data-ui-theme] header details { position: relative; }
html[data-ui-theme] header details[open] { z-index: 100; }
html[data-ui-theme] header details > :is(div, button),
html[data-ui-theme] :is(.market-more-menu, .service-more > div) { background: var(--ui-card); color: var(--ui-text); border-color: var(--ui-line); }
html[data-ui-theme] header details > div { max-height: min(480px, 70vh); overflow-y: auto; }
html[data-ui-theme] .binance-more .ui-header-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 100; width: 180px; padding: 8px; display: grid; gap: 6px; border: 1px solid var(--ui-line); border-radius: 8px; box-shadow: 0 12px 32px #0002; }
html[data-ui-theme] .binance-more .ui-header-menu button { position: static; width: 100%; margin: 0; }
.ui-draft-note { margin: 12px 0; padding: 10px 14px; border-radius: 8px; color: var(--ui-warning); background: var(--ui-warning-soft); font-size: 12px; }
.ui-draft-note[hidden] { display: none; }
html[data-ui-theme] :is(button.ui-theme-toggle, .ui-page-header button, .ui-page-header summary) { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; font-size: 12px; line-height: 1; border-radius: 7px; white-space: nowrap; }
html[data-ui-theme] dialog { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow: auto; box-sizing: border-box; }
html[data-ui-theme] dialog::backdrop { background: rgba(0,0,0,.45); }
html[data-ui-theme] body:not(.dashboard-compact) dialog.symbol-detail-dialog { background: transparent; box-shadow: none; max-width: none; max-height: none; overflow: hidden; }
html[data-ui-theme] :is(.price-float, .desktop-widget-dialog) { background: var(--ui-card); color: var(--ui-text); border-color: var(--ui-line); color-scheme: inherit; --pf-up: var(--ui-success); --pf-down: var(--ui-error); --pf-accent: var(--ui-brand); }
html[data-ui-theme] .price-float { background: color-mix(in srgb, var(--ui-card) calc(var(--pf-opacity, 1) * 100%), transparent); }
html[data-ui-theme] .price-float.pf-red-up { --pf-up: var(--ui-error); --pf-down: var(--ui-success); }
html[data-ui-theme] :is(.pf-meta, .pf-rule, .pf-signal, .pf-footer, .pf-settings, .pf-empty, .desktop-widget-dialog p, .desktop-widget-dialog li) { color: var(--ui-muted); }
html[data-ui-theme] :is(.pf-row, .pf-head, .pf-tools, .pf-footer) { border-color: var(--ui-line); }
html[data-ui-theme] body:not(.dashboard-compact) svg text { fill: var(--ui-muted); }
html[data-ui-theme] .ui-auth { display: grid; place-items: center; min-height: 100dvh; padding: 24px 0; box-sizing: border-box; background: var(--ui-bg); color: var(--ui-text); }
html[data-ui-theme] .ui-auth main { width: min(420px, calc(100% - 32px)); padding: 28px; box-sizing: border-box; border: 1px solid var(--ui-line); border-radius: 12px; background: var(--ui-card); }
html[data-ui-theme] .ui-auth :is(p, label) { color: var(--ui-muted); }
html[data-ui-theme] .ui-auth a { color: var(--ui-brand); }
html[data-ui-theme] button.ui-auth-theme { position: fixed; right: 20px; top: 20px; width: auto; margin: 0; z-index: 20; color: var(--ui-text); background: var(--ui-card); border: 1px solid var(--ui-line); }
.curve-description { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.curve-module-count { display: block; margin-top: 4px; color: var(--text, var(--ui-text)); font-size: 11px; font-weight: 650; }
@media (max-width: 720px) {
  html[data-ui-theme] body:not(.dashboard-compact) :is(.binance-shell, .market-console-shell, .general-monitor-shell, .alpha-shell, .service-shell, .raidbot-shell, .notification-shell, .signal-shell, .operations-shell, .account-shell, .account-admin-shell, .page-shell) { width: calc(100% - 24px); padding-top: 12px; }
  html[data-ui-theme] .ui-page-header { padding: 16px; gap: 16px; }
  html[data-ui-theme] .ui-page-header h1 { font-size: 24px; }
  html[data-ui-theme] .ui-page-header :is(nav, [class$="actions"]) { width: 100%; justify-content: flex-start; }
  html[data-ui-theme] :is(button, .button, summary) { min-height: 44px; }
  html[data-ui-theme] header details > div { max-width: calc(100vw - 40px); }
  html[data-ui-theme] .signal-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-ui-theme] .signal-filters > * { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-ui-theme] *, html[data-ui-theme] *::before, html[data-ui-theme] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
