/* Shared color roles. Components use these tokens directly in both appearances. */
.analytics-banner { position: fixed; bottom: 16px; left: 16px; right: 16px; z-index: 100; max-width: 720px; margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-dialog); display: flex; gap: 12px; flex-wrap: wrap; }
.analytics-banner[hidden] { display: none; }
.analytics-banner p { margin: 0 0 8px; line-height: 1.6; flex-basis: 100%; }
.analytics-banner button { flex: 1; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-hover); border-radius: 8px; background: var(--control-bg); color: var(--ink); font: inherit; cursor: pointer; }
.analytics-settings { padding: 12px; text-align: center; }
.analytics-settings button { border: 0; padding: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; }
:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --surface: #fff;
  --raised: #f0f3f8;
  --input: #fff;
  --ink: #17253e;
  --muted: #5f6b7e;
  --blue: #274e9a;
  --orange: #ca713c;
  --green: #21846b;
  --red: #b34f57;
  --line: #e4e8ef;
  --input-line: #dce2ec;
  --line-hover: #b8c9e5;
  --divider: #c3cbd8;
  --focus: #5c86d6;
  --soft-bg: #f5f7fb;
  --accent-soft: #edf2fb;
  --accent-line: #cbd8f0;
  --control-bg: #fff;
  --control-hover: #eff3fa;
  --control-ink: #334b72;
  --selected-bg: #fff;
  --primary-bg: #24477f;
  --primary-hover: #1c3967;
  --primary-ink: #fff;
  --spinner-track: #ffffff55;
  --warning: #735b30;
  --warning-bg: #fffcf5;
  --warning-line: #e6d8bd;
  --error-ink: #9b3838;
  --error-bg: #fff8f8;
  --error-line: #efc9c9;
  --positive-ink: #276852;
  --positive-bg: #eaf5ef;
  --historical-bg: #fcf7f2;
  --historical-ink: #a85629;
  --badge-ink: #fff;
  --switch-track: #d8dfe9;
  --switch-thumb: #fff;
  --skeleton-low: #f0f3f8;
  --skeleton-high: #fafbfd;
  --selection-bg: #dce7fc;
  --selection-ink: #17253e;
  --shadow-card: 0 5px 20px #17253e08;
  --shadow-hover: 0 8px 24px #263f6818;
  --shadow-small: 0 1px 4px #17253e17;
  --shadow-primary: 0 3px 8px #24477f18;
  --shadow-dialog: 0 25px 100px #14264245;
  --dialog-backdrop: #14243b70;
  --chart-grid: #f0f2f6;
  --chart-boundary: #b8c4d4;
  --chart-shade: #69768a08;
  --query-shade: #274e9a0d;
  --query-fill: #274e9a06;
  --green-shade: #21846b0d;
  --red-shade: #fbefef;
  --flat-shade: #f2f4f7;
  --candle-up: #21846b;
  --candle-down: #bb6461;
  --hover-bg: #fff;
  --hover-ink: #17253e;
  --inline-code-ink: #37577f;
  --code-bg: #17253e;
  --code-toolbar: #20314d;
  --code-line: #30425d;
  --code-ink: #dce7f6;
  --code-muted: #b1c2dc;
  --code-copy-line: #5a6f8d;
  --code-hover: #304565;
  --code-key: #a9cafa;
  --code-string: #b6decb;
  --code-literal: #e5c18f;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d131e;
  --surface: #172233;
  --raised: #1f2d42;
  --input: #101925;
  --ink: #e7edf6;
  --muted: #9aaac0;
  --blue: #8db6ff;
  --orange: #efa66f;
  --green: #69cfab;
  --red: #f08e99;
  --line: #34445b;
  --input-line: #40536e;
  --line-hover: #627b9e;
  --divider: var(--line-hover);
  --focus: var(--blue);
  --soft-bg: var(--input);
  --accent-soft: #223650;
  --accent-line: #516989;
  --control-bg: var(--raised);
  --control-hover: #293e59;
  --control-ink: var(--ink);
  --selected-bg: var(--raised);
  --primary-bg: #79a3e8;
  --primary-hover: #90b4ef;
  --primary-ink: #10213c;
  --spinner-track: #10213c40;
  --warning: #e4c18a;
  --warning-bg: #2a241c;
  --warning-line: #665437;
  --error-ink: var(--red);
  --error-bg: #302027;
  --error-line: #74404b;
  --positive-ink: var(--green);
  --positive-bg: #203b33;
  --historical-bg: #30271f;
  --historical-ink: var(--orange);
  --badge-ink: var(--bg);
  --switch-track: #4c5c73;
  --switch-thumb: var(--ink);
  --skeleton-low: var(--raised);
  --skeleton-high: #2c405c;
  --selection-bg: #375a8e;
  --selection-ink: var(--ink);
  --shadow-card: 0 8px 24px #00000029;
  --shadow-hover: 0 10px 28px #00000040;
  --shadow-small: 0 1px 4px #00000030;
  --shadow-primary: 0 3px 12px #00000020;
  --shadow-dialog: 0 25px 100px #00000070;
  --dialog-backdrop: #050a13b3;
  --chart-grid: #2c3d54;
  --chart-boundary: #71839e;
  --chart-shade: #9aaac00d;
  --query-shade: #8db6ff0e;
  --query-fill: #8db6ff0b;
  --green-shade: #69cfab1f;
  --red-shade: #f08e9914;
  --flat-shade: #9aaac014;
  --candle-up: var(--green);
  --candle-down: var(--red);
  --hover-bg: #24344b;
  --hover-ink: var(--ink);
  --inline-code-ink: #b3ceff;
  --code-bg: #0d1623;
  --code-toolbar: var(--raised);
  --code-line: var(--line);
}
.header-actions { display: flex; align-items: center; gap: 24px; min-width: 0; }
.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.account-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.account-link:hover { background: var(--control-hover); border-color: var(--line-hover); }
.appearance-control { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }
.appearance-control svg { position: absolute; left: 11px; width: 16px; height: 16px; pointer-events: none; color: var(--muted); }
.appearance-control select {
  min-height: 44px;
  width: 110px;
  padding: 8px 8px 8px 33px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.appearance-control select:hover { border-color: var(--muted); }
/* The icon represents the saved choice, including System in either OS theme. */
.appearance-control [data-appearance-icon] { display: none; }
:root[data-appearance-mode="dark"] [data-appearance-icon="dark"],
:root[data-appearance-mode="light"] [data-appearance-icon="light"],
:root[data-appearance-mode="system"] [data-appearance-icon="system"] { display: block; }
@media (max-width: 680px) {
  .header-actions { gap: 10px; }
  .site-header { gap: 12px; }
  .appearance-control select { width: 93px; font-size: 11px; padding-left: 27px; }
  .appearance-control svg { left: 8px; width: 14px; height: 14px; }
  .header-actions .market { flex-wrap: wrap; justify-content: flex-end; gap: 3px; max-width: 110px; }
  .header-actions .hourly-back { max-width: 115px; line-height: 1.5; }
  .api-header-label, .api-header-divider { display: none; }
  .api-back { max-width: 65px; line-height: 1.5; }
}
@media (max-width: 960px) {
  .site-header--account {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    height: auto;
    column-gap: 10px;
    row-gap: 0;
    padding-top: 14px;
    padding-bottom: 12px;
  }
  .site-header--account > .brand, .site-header--account > .api-header-brand { grid-area: 1 / 1; }
  .site-header--account .header-actions { display: contents; }
  .site-header--account .appearance-control { grid-area: 1 / 2; }
  .site-header--account .account-link { grid-area: 1 / 3; }
  .site-header--account .header-actions > .market:not(a) { display: none; }
  .site-header--account .header-actions > a:not(.account-link) {
    grid-area: 2 / 1 / 3 / -1;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    max-width: none;
    font-size: 12px;
    text-align: left;
  }
  .api-page .site-header--account { height: auto; }
}
@media (max-width: 680px) {
  .site-header--account .appearance-control select {
    width: 44px;
    padding: 0;
    appearance: none;
    color: transparent;
  }
  .site-header--account .appearance-control option { color: var(--ink); }
  .site-header--account .appearance-control svg { left: 13px; width: 18px; height: 18px; }
  .site-header--account .account-link { padding: 0 10px; font-size: 12px; }
}
