/* Theme System — Dark Mode Only
   Light mode uses original CSS files unchanged.
   Dark mode selectively overrides original colors via tokens. */

/* DARK MODE */
[data-theme="dark"] {
  /* Background Layers */
  --bg-base: #0e1116;
  --bg-elevated: #161a22;
  --bg-card: #222831;
  --bg-overlay: rgba(0, 0, 0, 0.8);
  --bg-form-mode-increase: #16281c;

  /* Text Colors */
  --text-primary: #e6edf3;
  --text-secondary: #9aa4b2;
  --text-secondary-accent: #d4a574;
  --text-muted: #6e7681;
  --text-inverse: #0e1116;

  /* Borders */
  --border-subtle: #30363d;
  --border-strong: #444c56;

  /* Financial & Intent Colors */
  --accent-buy: #3fb950;
  --accent-sell: #f85149;
  --accent-neutral: #79c0ff;

  /* P&L Colors */
  --accent-pnl-pos: #3fb950;
  --accent-pnl-neg: #f85149;
  --accent-pnl-flat: #79c0ff;

  /* Status Colors */
  --status-open: #bc8ef9;
  --status-complete: #3fb950;
  --status-rejected: #f85149;
  --status-cancelled: #8dafcd;
  --status-trigpend: #bc8ef9;

  /* Accent Colors */
  --accent-primary: #58a6ff;
  --accent-info: #79c0ff;
  --accent-warning: #d29922;
  --accent-danger: #f85149;
  --accent-success: #3fb950;

  /* Exchange Colors */
  --exchange-nse: #6366f1;
  --exchange-bse: #a78bfa;
  --exchange-mcx: #fb8500;

  /* Card System */
  --card-radius: 5px;
  --card-shadow: 0 1px 20px 0 rgba(0, 0, 0, 0.3);
  --card-bg: #222831;
  --card-border: #30363d;

  /* Row & Table */
  --row-hover: rgba(255, 255, 255, 0.04);
  --table-header-bg: #161a22;
  --table-header-text: #e6edf3;

  /* Chrome */
  --navbar-bg: #161a22;
  --navbar-text: #e6edf3;
  --sidebar-bg: #0e1116;
  --sidebar-text: #e6edf3;
  --footer-bg: #0e1116;
  --footer-text: #9aa4b2;

  /* Update Time Badge */
  --bg-update-time: #3d2e4e;
  --text-update-time: #d8b9ff;

  /* Tooltip (sd-tooltip) */
  --tooltip-bg: #2d333b;
  --tooltip-text: #e6edf3;
  --tooltip-border: #444c56;
  --tooltip-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 1px 3px rgba(0, 0, 0, 0.3);

  /* Static-IP note box + address labels (setting/trading-account-edit) */
  --sd-ipnote-bg: #12202e;
  --sd-ipnote-text: #e6edf3;
  --sd-ipnote-accent: #58a6ff;
}

/* Tooltip (sd-tooltip) — light mode. First light-mode token block in this file
   (everything else here is dark-only, overriding original CSS unchanged in
   light mode); sd-tooltip has no separate "original" stylesheet to fall back
   on, so it needs real tokens on both sides. Scoped with :not([data-theme="dark"])
   rather than a bare :root: a bare :root here has the SAME specificity as
   [data-theme="dark"] above, so on a plain source-order tie the later rule (this
   one) always won and silently discarded the dark block's tokens — dark mode was
   getting the light palette regardless of theme. */
:root:not([data-theme="dark"]) {
  --tooltip-bg: #26292e;
  --tooltip-text: #ffffff;
  --tooltip-border: #26292e;
  --tooltip-shadow: 0 4px 14px rgba(23, 43, 77, 0.18), 0 1px 3px rgba(23, 43, 77, 0.1);

  /* Static-IP note box + address labels (setting/trading-account-edit) */
  --sd-ipnote-bg: #eaf2fd;
  --sd-ipnote-text: #24333f;
  --sd-ipnote-accent: #0b5ca8;
}
