/* Bot Discord -> MT5 dashboard. "Midnight desk": the deep-navy glow and glass-shard backdrop of the
   AIBots reference, with the disciplined card system, status pills and electric-blue accents of the
   Selimor reference. A small gold accent keeps the XAUUSD identity.
   Chart palettes validated with the dataviz validator (validate_palette.js):
     dark  surface #0a1029: categorical #4a7bff,#c87a14,#17a57e,#9b6bff  P/L #16a6b8 / #e2475f
     light surface #f8faff: categorical #2d63e6,#e07410,#0f9e78,#7b4ce0  P/L #0a8ea8 / #d93d4c   */

/* ------------------------------------------------------------------ tokens: dark (default) */
:root {
  color-scheme: dark;
  --page: #03050f;
  --page-2: #060a1f;
  --surface: #0a1029;           /* chart / card surface (validated) */
  --surface-2: #0d1433;
  --surface-3: #131c45;
  --glass: linear-gradient(180deg, rgba(20, 32, 84, .66) 0%, rgba(9, 14, 38, .82) 58%, rgba(7, 11, 30, .88) 100%);
  --glass-hi: rgba(150, 180, 255, .09);
  --ink: #eef2ff;
  --ink-2: #aab6dc;
  --muted: #8795c2;
  --grid: #18214b;
  --axis: #2b3872;
  --line: rgba(120, 150, 255, .13);
  --line-strong: rgba(120, 150, 255, .26);
  --accent: #4d7cff;            /* electric blue */
  --accent-2: #6fa0ff;
  --accent-text: #8fb0ff;       /* text-safe on navy */
  --accent-glow: rgba(77, 124, 255, .38);
  --accent-wash: rgba(77, 124, 255, .12);
  --accent-grad: linear-gradient(135deg, #3a63ff 0%, #5d8dff 55%, #7fb2ff 100%);
  --accent-strong: #3559f0;     /* white text 5.5:1 */
  --gold: #f2c464;              /* text-safe gold on navy */
  --gold-1: #d9a33a;
  --gold-2: #ffe29a;
  --gold-wash: rgba(242, 196, 100, .10);
  --s1: #4a7bff; --s2: #c87a14; --s3: #17a57e; --s4: #9b6bff;
  --pos: #16a6b8; --neg: #e2475f; --mid: #1e2754;
  --pos-text: #5fd9e6; --neg-text: #ff8595; --warn-text: #ffcf6b;
  --flash-up: var(--pos-text); --flash-down: var(--neg-text); --warn-icon: var(--warning);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236f9bff' stroke-width='1.8'/%3E%3C/svg%3E");
  --good: #22c55e; --warning: #f5b544; --serious: #fb8a4c; --critical: #f0445c;
  --shadow: 0 1px 0 var(--glass-hi) inset, 0 0 0 1px rgba(4, 8, 30, .6), 0 30px 60px -34px rgba(0, 3, 24, .95);
  --glow-edge: 0 0 0 1px rgba(93, 141, 255, .34), 0 0 28px -6px rgba(77, 124, 255, .45);
  --header-bg: rgba(4, 7, 22, .72);
  --tip-bg: rgba(10, 16, 44, .96);
  --backdrop-opacity: 1;
  --f-display: "Sora", "Segoe UI", "Helvetica Neue", sans-serif;
  --f-sans: "Manrope", "Segoe UI", "Helvetica Neue", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 16px;
  --radius-sm: 11px;
}

/* ------------------------------------------------------------------ tokens: light */
:root[data-theme="light"] {
  color-scheme: light;
  --page: #e9eefb;
  --page-2: #f3f6fe;
  --surface: #f8faff;
  --surface-2: #eef3ff;
  --surface-3: #e2e9fb;
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(246, 249, 255, .9) 100%);
  --glass-hi: rgba(255, 255, 255, .9);
  --ink: #0b1433;
  --ink-2: #3c4870;
  --muted: #525e86;
  --grid: #e1e7f6;
  --axis: #8f9cc4;
  --line: rgba(30, 55, 140, .12);
  --line-strong: rgba(30, 55, 140, .22);
  --accent: #2d5bff;
  --accent-2: #4d7cff;
  --accent-text: #2349d6;
  --accent-glow: rgba(45, 91, 255, .22);
  --accent-wash: rgba(45, 91, 255, .08);
  --accent-grad: linear-gradient(135deg, #2448e8 0%, #3d6bff 60%, #6b98ff 100%);
  --gold: #8f5e00;
  --gold-1: #c98a1e;
  --gold-2: #f1c45e;
  --gold-wash: rgba(201, 138, 30, .10);
  --s1: #2d63e6; --s2: #e07410; --s3: #0f9e78; --s4: #7b4ce0;
  --pos: #0a8ea8; --neg: #d93d4c; --mid: #dfe5f4;
  --pos-text: #055e72; --neg-text: #a52231; --warn-text: #8a5a00;
  --accent-strong: #2448e8; --flash-up: var(--ink); --flash-down: var(--ink); --warn-icon: #a87200;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232349d6' stroke-width='1.8'/%3E%3C/svg%3E");
  --good: #139a47; --warning: #e8a317; --serious: #e2692d; --critical: #d42f45;
  --shadow: 0 1px 0 var(--glass-hi) inset, 0 18px 40px -28px rgba(20, 40, 120, .35);
  --glow-edge: 0 0 0 1px rgba(45, 91, 255, .35), 0 10px 26px -12px rgba(45, 91, 255, .35);
  --header-bg: rgba(244, 247, 255, .8);
  --tip-bg: rgba(255, 255, 255, .98);
  --backdrop-opacity: .22;
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --page: #e9eefb; --page-2: #f3f6fe; --surface: #f8faff; --surface-2: #eef3ff; --surface-3: #e2e9fb;
    --glass: linear-gradient(180deg, rgba(255, 255, 255, .92) 0%, rgba(246, 249, 255, .9) 100%);
    --glass-hi: rgba(255, 255, 255, .9);
    --ink: #0b1433; --ink-2: #3c4870; --muted: #525e86; --grid: #e1e7f6; --axis: #8f9cc4;
    --line: rgba(30, 55, 140, .12); --line-strong: rgba(30, 55, 140, .22);
    --accent: #2d5bff; --accent-2: #4d7cff; --accent-text: #2349d6;
    --accent-glow: rgba(45, 91, 255, .22); --accent-wash: rgba(45, 91, 255, .08);
    --accent-grad: linear-gradient(135deg, #2448e8 0%, #3d6bff 60%, #6b98ff 100%);
    --gold: #8f5e00; --gold-1: #c98a1e; --gold-2: #f1c45e; --gold-wash: rgba(201, 138, 30, .10);
    --s1: #2d63e6; --s2: #e07410; --s3: #0f9e78; --s4: #7b4ce0;
    --pos: #0a8ea8; --neg: #d93d4c; --mid: #dfe5f4;
    --pos-text: #055e72; --neg-text: #a52231; --warn-text: #8a5a00;
    --accent-strong: #2448e8; --flash-up: var(--ink); --flash-down: var(--ink); --warn-icon: #a87200;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232349d6' stroke-width='1.8'/%3E%3C/svg%3E");
    --good: #139a47; --warning: #e8a317; --serious: #e2692d; --critical: #d42f45;
    --shadow: 0 1px 0 var(--glass-hi) inset, 0 18px 40px -28px rgba(20, 40, 120, .35);
    --glow-edge: 0 0 0 1px rgba(45, 91, 255, .35), 0 10px 26px -12px rgba(45, 91, 255, .35);
    --header-bg: rgba(244, 247, 255, .8);
    --tip-bg: rgba(255, 255, 255, .98);
    --backdrop-opacity: .22;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 124px; background: var(--page); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 50% -10%, var(--page-2), var(--page) 70%) fixed, var(--page);
  font: 500 14px/1.5 var(--f-sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body > * { position: relative; z-index: 1; }
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: var(--backdrop-opacity); }
.backdrop svg { width: 100%; height: 100%; display: block; }
.backdrop .bd-base { fill: transparent; }
.bd-flare { opacity: .55; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: 100%; max-width: 1380px; margin: 0 auto; padding: 0 28px; }
a { color: inherit; }
button, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.ico { width: 16px; height: 16px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--f-mono); }
.pos { color: var(--pos-text); }
.neg { color: var(--neg-text); }
.zero { color: var(--ink-2); }
.muted { color: var(--muted); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-glow); }

.eyebrow {
  font: 600 10.5px/1.2 var(--f-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 6px;
}
h2 { font: 600 19px/1.2 var(--f-display); letter-spacing: -.01em; }
.subhead { font: 600 10.5px/1.2 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .14em; margin: 20px 0 10px; }
.count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px;
  padding: 2px 8px; margin-left: 8px; vertical-align: 2px; border-radius: 999px;
  font: 600 11.5px/1.3 var(--f-mono); color: var(--accent-text);
  background: var(--accent-wash); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.count:empty { display: none; }

/* ------------------------------------------------------------------ header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {  /* thin light edge under the bar, like the reference's lit borders */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent-glow) 30%, var(--accent-2) 50%, var(--accent-glow) 70%, transparent);
  opacity: .7;
}
.topbar__inner { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand__emblem { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 0 12px var(--accent-glow)); }
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__title {
  font: 700 19px/1.05 var(--f-display); letter-spacing: -.02em; white-space: nowrap; color: var(--ink);
}
.brand__sub { font: 500 10.5px/1.3 var(--f-mono); letter-spacing: .12em; color: var(--muted); text-transform: uppercase; margin-top: 4px; }

.ticker {
  display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; margin: 0 auto;
  font-family: var(--f-mono); font-variant-numeric: tabular-nums;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.ticker__sym {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 12px var(--f-display); letter-spacing: .04em; color: var(--ink);
}
.ticker__sym::before {  /* coin-style token mark, as in the references' asset chips */
  content: "Au"; content: "Au" / ""; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font: 700 9.5px var(--f-display); color: #3a2503;
  background: radial-gradient(circle at 35% 30%, #fff1c2, #f2c464 45%, #b57a14);
  box-shadow: 0 0 12px -2px rgba(242, 196, 100, .6);
}
.ticker__q { display: inline-flex; align-items: baseline; gap: 6px; }
.ticker__k { font-size: 10.5px; letter-spacing: .12em; color: var(--muted); text-transform: uppercase; }
.ticker__v { font-size: 14.5px; font-weight: 600; border-radius: 5px; padding: 0 3px; transition: background-color .6s, color .6s; }
.ticker__v.up { background: color-mix(in srgb, var(--pos) 28%, transparent); color: var(--flash-up); }
.ticker__v.down { background: color-mix(in srgb, var(--neg) 26%, transparent); color: var(--flash-down); }
.ticker__spread .ticker__v { font-size: 12px; color: var(--ink-2); }

.subbar { display: flex; align-items: center; gap: 10px 18px; padding-bottom: 10px; }
.topbar__status { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-width: 0; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 10px; border-radius: 999px;
  font: 700 12px var(--f-sans); letter-spacing: .02em;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2);
}
.live-pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); position: relative; flex: none; }
.live-pill[data-state="ok"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--good) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--good) 55%, transparent);
}
.live-pill[data-state="ok"] .live-pill__dot { background: var(--good); box-shadow: 0 0 10px var(--good); }
.live-pill[data-state="ok"] .live-pill__dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--good); opacity: 0; animation: pulse 2s ease-out infinite;
}
.live-pill[data-state="bad"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--critical) 16%, var(--surface));
  border-color: var(--critical);
}
.live-pill[data-state="bad"] .live-pill__dot { background: var(--critical); box-shadow: 0 0 10px var(--critical); }
@keyframes pulse { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.9); opacity: 0; } }
.versions { font: 400 11px/1.3 var(--f-mono); color: var(--muted); }
.versions b { font-weight: 600; color: var(--ink-2); }

.topbar__right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.refreshed { font: 400 11.5px var(--f-mono); color: var(--muted); white-space: nowrap; }
.theme-btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-size: 12.5px; font-weight: 600;
}
.theme-btn:hover { border-color: var(--accent); box-shadow: 0 0 16px -4px var(--accent-glow); }
.theme-btn .ico { color: var(--accent-text); }

.subnav { position: relative; flex: 1 1 auto; min-width: 0; }
.subnav__inner {
  display: flex; justify-content: flex-end; gap: 4px; overflow-x: auto; scrollbar-width: none;
}
.subnav__inner::-webkit-scrollbar { display: none; }
.subnav a {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 8px 15px; border-radius: 10px; white-space: nowrap; border: 1px solid transparent;
  transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s;
}
.subnav a .ico { width: 15px; height: 15px; color: var(--accent-text); opacity: .85; }
.subnav a:hover { color: var(--ink); background: var(--accent-wash); }
.subnav a[aria-current="true"] {
  color: var(--ink);
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border-color: var(--line-strong);
  box-shadow: 0 1px 0 var(--glass-hi) inset, 0 8px 22px -12px var(--accent-glow);
}
.subnav a[aria-current="true"] .ico { opacity: 1; }

/* ------------------------------------------------------------------ banner */
.banner { margin-top: 18px; display: grid; gap: 8px; }
.banner__msg {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--critical) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--critical) 50%, transparent);
  font-weight: 600;
}
.banner__msg[data-level="warning"] {
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 55%, transparent);
}
.banner__msg .ico { width: 18px; height: 18px; margin-top: 1px; }

/* ------------------------------------------------------------------ layout + cards */
main { display: grid; gap: 22px; padding-top: 24px; padding-bottom: 44px; }
.panel, .acct, .trade {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel { padding: 0 24px 24px; min-width: 0; }
.panel::before, .acct::before, .trade::before {  /* lit top edge */
  content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  opacity: .45;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 -24px 18px; padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.panel__head .eyebrow { margin-bottom: 4px; }
.panel__note { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.block { min-width: 0; }
.block__head { margin: 8px 2px 14px; display: flex; flex-direction: column; }
.block__head h2 { font-size: 22px; }
.grid-2 { display: grid; gap: 22px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2 > * { min-width: 0; }
.grid-2--wide { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

/* ------------------------------------------------------------------ hero + KPI */
.hero {
  position: relative;
  border-radius: 22px;
  padding: 30px 30px 26px;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(520px 260px at 88% 10%, var(--accent-wash), transparent 70%),
    radial-gradient(420px 220px at 0% 0%, var(--gold-wash), transparent 70%),
    var(--glass);
  box-shadow: var(--shadow), 0 0 60px -30px var(--accent-glow);
  overflow: hidden;
  isolation: isolate;
}
.orbit {  /* AIBots-style segmented ring, purely decorative */
  position: absolute; right: -70px; top: -236px; width: 380px; height: 380px; z-index: -1; pointer-events: none;
  opacity: .75;
}
.orbit__ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 20deg,
    var(--accent) 0 58deg, transparent 58deg 66deg,
    var(--accent-2) 66deg 150deg, transparent 150deg 158deg,
    color-mix(in srgb, var(--accent) 55%, transparent) 158deg 250deg, transparent 250deg 258deg,
    var(--gold-1) 258deg 300deg, transparent 300deg 308deg,
    color-mix(in srgb, var(--accent-2) 70%, transparent) 308deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  filter: drop-shadow(0 0 10px var(--accent-glow));
}
.orbit__ring--inner {
  inset: 46px; opacity: .45;
  background: conic-gradient(from 200deg, var(--accent-2) 0 120deg, transparent 120deg 132deg, var(--accent) 132deg 280deg, transparent 280deg 292deg, var(--gold-1) 292deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
}
.orbit__gem { position: absolute; width: 16px; height: 16px; border-radius: 50%; box-shadow: 0 0 14px var(--accent-glow); }
.orbit__gem--a { left: 17px; top: 277px; background: radial-gradient(circle at 35% 30%, #d9e5ff, var(--accent)); }
.orbit__gem--b { left: 149px; top: 364px; width: 14px; height: 14px; background: radial-gradient(circle at 35% 30%, #fff1c2, var(--gold-1)); }
.hero__intro { position: relative; max-width: 700px; margin-bottom: 24px; }
.hero__title { font: 700 clamp(30px, 4vw, 44px)/1.05 var(--f-display); letter-spacing: -.03em; }
.hero__title em {
  font-style: normal; color: var(--gold);
  text-shadow: 0 0 28px color-mix(in srgb, var(--gold-1) 45%, transparent);
}
.hero__lede { color: var(--ink-2); margin-top: 10px; max-width: 60ch; font-weight: 500; }
.kpis { position: relative; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpi {
  position: relative; display: flex; flex-direction: column; gap: 5px;
  padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line);
  min-width: 0;
}
.kpi--lead { box-shadow: var(--glow-edge); border-color: transparent; }
.kpi--lead::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--accent-grad); opacity: .9;
}
.kpi__label { font: 600 12px var(--f-sans); color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi__value { font: 700 32px/1.08 var(--f-display); letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi__unit { font: 600 13px var(--f-sans); color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.kpi__sub { color: var(--ink-2); font-size: 12px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.kpi__sub b { font-weight: 700; color: var(--ink); }
.kpi--skeleton .kpi__value { color: var(--axis); }
.wl { display: flex; gap: 2px; height: 5px; margin-top: 10px; border-radius: 3px; overflow: hidden; background: var(--mid); }
.wl__w { background: var(--pos); }
.wl__l { background: var(--neg); }
.wl__legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ------------------------------------------------------------------ filters */
.filterbar {
  display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  margin: 0 -24px; padding: 16px 24px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--accent-wash), transparent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.filterbar + .panel__head { margin-top: 0; }
.filterbar__label { font: 600 10.5px var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.filterbar__hint { font-size: 12px; color: var(--muted); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--page); border: 1px solid var(--line); }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: color .2s, background-color .2s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: linear-gradient(135deg, color-mix(in srgb, var(--accent-strong) 82%, #000), var(--accent-strong)); color: #fff; box-shadow: 0 6px 18px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 6px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2);
}
.ghost-btn .ico { color: var(--accent-text); }
.ghost-btn:hover { color: var(--ink); border-color: var(--accent); }
.ghost-btn[aria-pressed="true"] { background: var(--accent-wash); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 16px -6px var(--accent-glow); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 14px; }
.filters label { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding: 7px 32px 7px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--surface-2) var(--chevron) no-repeat right 11px center / 11px 8px;
  border: 1px solid var(--line-strong); max-width: 220px;
}
select:hover { border-color: var(--accent); }
select option { background: var(--surface); color: var(--ink); }

/* ------------------------------------------------------------------ charts */
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-bottom: 10px; font-size: 13px; }
.legend__item { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.legend__item b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.key-line { width: 18px; height: 3px; border-radius: 2px; flex: none; }
.key-rect { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.bg-s1 { background: var(--s1); } .bg-s2 { background: var(--s2); } .bg-s3 { background: var(--s3); } .bg-s4 { background: var(--s4); }
.bg-pos { background: var(--pos); } .bg-neg { background: var(--neg); }
.chart {
  position: relative; min-height: 120px; transition: opacity .3s;
  border-radius: 12px; padding: 10px 0 2px;
  background:
    radial-gradient(600px 180px at 50% 0%, var(--accent-wash), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 60%, transparent), color-mix(in srgb, var(--page) 40%, transparent));
  border: 1px solid var(--line);
}
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart svg:focus-visible { outline-offset: 4px; }
.empty { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); padding: 34px 12px; text-align: center; font-size: 13px; font-weight: 600; }
.empty svg { width: 56px; height: 36px; color: var(--axis); flex: none; }
.ch-grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.ch-zero { stroke: var(--axis); stroke-width: 1.5; }
.ch-tick { fill: var(--muted); font: 500 11px var(--f-mono); font-variant-numeric: tabular-nums; }
.ch-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.st-s1 { stroke: var(--s1); } .st-s2 { stroke: var(--s2); } .st-s3 { stroke: var(--s3); } .st-s4 { stroke: var(--s4); }
.fi-s1 { fill: var(--s1); } .fi-s2 { fill: var(--s2); } .fi-s3 { fill: var(--s3); } .fi-s4 { fill: var(--s4); }
.ch-line.st-s1 { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--s1) 55%, transparent)); }
.ch-line.st-s2 { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--s2) 50%, transparent)); }
.ch-area { opacity: .14; }
.ch-dot { stroke: var(--surface); stroke-width: 2; }
.ch-leader { stroke: var(--axis); stroke-width: 1; fill: none; }
.ch-label { fill: var(--ink); font: 700 12px var(--f-sans); font-variant-numeric: tabular-nums; }
.ch-label-2 { fill: var(--muted); font: 600 11px var(--f-sans); }
.ch-cross { stroke: var(--accent-2); stroke-width: 1; stroke-dasharray: 3 3; shape-rendering: crispEdges; }
.ch-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.bar-pos { fill: var(--pos); } .bar-neg { fill: var(--neg); }
.bar-band { fill: transparent; }
.bar-group.is-hot .bar-band { fill: var(--accent-wash); }
.bar-group.is-hot path { filter: brightness(1.18) drop-shadow(0 0 6px var(--accent-glow)); }
.bar-group:focus { outline: none; }
.bar-group:focus-visible .bar-band { stroke: var(--accent-2); stroke-width: 1.5; }
.is-stale .chart, .is-stale .trades, .is-stale .accounts { opacity: .55; }

/* tooltip */
.tip {
  position: fixed; z-index: 40; pointer-events: none;
  width: max-content; min-width: 170px; max-width: min(280px, calc(100vw - 32px));
  background: var(--tip-bg); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7), 0 0 24px -10px var(--accent-glow);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 10px 12px; font-size: 12.5px;
}
.tip__title { font: 600 10.5px var(--f-mono); color: var(--accent-text); margin-bottom: 6px; letter-spacing: .06em; text-transform: uppercase; }
.tip__row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip__row b { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.tip__row span { color: var(--ink-2); }
.tip__note { color: var(--ink-2); margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; }

/* horizontal diverging bars (breakdowns) */
.bars { display: grid; gap: 4px; }
.hbar { display: grid; grid-template-columns: minmax(84px, 118px) minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 0; }
.hbar__name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.hbar__name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__track { position: relative; height: 18px; border-radius: 6px; background: color-mix(in srgb, var(--surface-3) 45%, transparent); }
.hbar__track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--axis); }
.hbar__fill { position: absolute; top: 3px; height: 12px; }
.hbar__fill.bg-pos { border-radius: 0 4px 4px 0; box-shadow: 0 0 12px -3px var(--pos); }
.hbar__fill.bg-neg { border-radius: 4px 0 0 4px; box-shadow: 0 0 12px -3px var(--neg); }
.hbar__val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; font-family: var(--f-mono); }
.hbar__val b { font-weight: 600; }
.hbar__val small { color: var(--muted); font-size: 11px; margin-left: 6px; }

/* ------------------------------------------------------------------ badges and chips */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font: 700 10.5px/1.4 var(--f-sans); letter-spacing: .05em; text-transform: uppercase;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.badge .ico { width: 11px; height: 11px; }
.badge--pos { background: color-mix(in srgb, var(--pos) 18%, transparent); color: var(--pos-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pos) 40%, transparent); }
.badge--neg { background: color-mix(in srgb, var(--neg) 16%, transparent); color: var(--neg-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 40%, transparent); }
.badge--gold { background: var(--gold-wash); color: var(--gold); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold-1) 45%, transparent); }
.badge--warn { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warn-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 40%, transparent); }
.badge--line { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.side { display: inline-flex; align-items: center; gap: 3px; font: 700 12px var(--f-mono); letter-spacing: .04em; }
.side .ico { width: 12px; height: 12px; color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px 4px 7px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip .ico { width: 15px; height: 15px; }
.chip__what { color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.chip__what .ico { width: 13px; height: 13px; color: var(--muted); }
.st-good { color: var(--good); } .st-warning { color: var(--warn-icon); } .st-serious { color: var(--serious); } .st-critical { color: var(--critical); } .st-unknown { color: var(--muted); }
.legchip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); margin: 1px 3px 1px 0; }
.legchip--pending { background: var(--gold-wash); color: var(--gold); }
.legchip--filled { background: color-mix(in srgb, var(--s1) 20%, transparent); color: var(--ink); }
.legchip--rejected { background: color-mix(in srgb, var(--neg) 16%, transparent); color: var(--neg-text); }
.acct-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ------------------------------------------------------------------ accounts */
.accounts { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.panel.acct { padding: 0; overflow: hidden; }
.acct__head {
  display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--accent-wash), transparent 65%);
}
.acct__key { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 3px var(--surface), 0 0 12px currentColor; }
.acct__name { font: 700 20px/1 var(--f-display); letter-spacing: -.02em; }
.acct__name small { font: 600 10px var(--f-mono); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; display: block; margin-bottom: 5px; }
.acct__server { margin-left: auto; font: 400 11px var(--f-mono); color: var(--muted); text-align: right; }
.acct__body { padding: 18px 22px 20px; display: grid; gap: 18px; }
.acct__money { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 200px); gap: 16px; align-items: end; }
.acct__eq-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.acct__eq { font: 700 34px/1.05 var(--f-display); letter-spacing: -.03em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.acct__eq small { font: 600 13px var(--f-sans); color: var(--muted); margin-left: 5px; letter-spacing: 0; }
.acct__bal { color: var(--ink-2); font-size: 12.5px; margin-top: 5px; }
.acct__bal b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.spark { text-align: right; }
.spark svg { width: 100%; height: 54px; display: block; overflow: visible; }
.spark__cap { font-size: 11px; color: var(--muted); }
.spark__cap b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.metric { background: color-mix(in srgb, var(--surface) 92%, transparent); padding: 11px 13px; min-width: 0; }
.metric__k { font-size: 11px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.metric__k .ico { width: 13px; height: 13px; color: var(--accent-text); }
.metric__v { font-weight: 700; font-size: 14.5px; font-variant-numeric: tabular-nums; margin-top: 3px; overflow-wrap: anywhere; }
.metric__v small { font-weight: 500; color: var(--muted); font-size: 11px; margin-left: 4px; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.slot { width: 12px; height: 7px; border-radius: 2px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.slot--used { background: var(--accent-grad); box-shadow: 0 0 8px -1px var(--accent-glow); }
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.alert .ico { width: 16px; height: 16px; margin-top: 1px; }
.alert b { font-weight: 700; }
details.more { border-top: 1px dashed var(--line-strong); padding-top: 10px; }
details.more summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--accent-text); }
details.more summary:hover { color: var(--ink); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin-top: 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ active trades */
.trades { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.panel.trade { padding: 16px 18px; display: grid; gap: 14px; overflow: hidden; }
.trade__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trade__kind { font: 700 16px/1 var(--f-display); letter-spacing: -.01em; }
.trade__ticket { margin-left: auto; font: 400 11px var(--f-mono); color: var(--muted); }
.trade__pl { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.trade__usd { font: 700 24px/1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.trade__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--ink-2); }
.countdown { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px var(--f-mono); font-variant-numeric: tabular-nums; }
.countdown .ico { color: var(--accent-text); }
.gauge { position: relative; padding: 24px 0 0; }
.gauge__track { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--neg) 45%, var(--surface-3)), var(--surface-3) 40%, var(--surface-3) 60%, color-mix(in srgb, var(--pos) 45%, var(--surface-3))); }
.gauge__fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.gauge__tick { position: absolute; top: -5px; width: 2px; height: 18px; background: var(--ink); transform: translateX(-1px); border-radius: 1px; }
.gauge__caps { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font: 400 11px var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge__caps b { color: var(--ink-2); font-weight: 600; }
.gauge__price { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.gauge__price span { font: 700 10.5px var(--f-mono); background: var(--accent-strong); color: #fff; padding: 1px 6px; border-radius: 5px; white-space: nowrap; box-shadow: 0 0 12px -2px var(--accent-glow); }
.gauge__price i { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--accent-strong); }
.gauge__price--edge span::after { content: " …"; }

/* ------------------------------------------------------------------ tables */
.table-wrap {
  overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 420px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  scrollbar-color: var(--axis) transparent; scrollbar-width: thin;
}
.table-wrap--tall { max-height: 560px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { padding: 10px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  font: 600 10.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text);
}
tbody tr { transition: background-color .15s; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
tbody tr:hover td { background: var(--accent-wash); }
tbody tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
td.wrap-cell { white-space: normal; min-width: 170px; max-width: 320px; overflow-wrap: anywhere; font-size: 12px; color: var(--ink-2); }
td .mono { font-size: 12px; }
td:has(.legchip) { white-space: normal; min-width: 150px; max-width: 200px; }
.table-sum { font-weight: 700; }
.table-sum td { background: var(--surface-2); border-top: 1px solid var(--line-strong); }

/* ------------------------------------------------------------------ uptime */
.ministats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.ministat {
  padding: 13px 14px; border-radius: 12px; min-width: 0;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line);
}
.ministat__k { font-size: 11px; color: var(--muted); font-weight: 600; }
.ministat__v { font: 700 18px/1.2 var(--f-display); margin-top: 3px; white-space: nowrap; display: flex; align-items: center; gap: 6px; letter-spacing: -.01em; }
.ministat__v .ico { width: 15px; height: 15px; }
.ministat__s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.timeline { margin-bottom: 8px; }
.tl { position: relative; height: 30px; border-radius: 8px; background: var(--surface-3); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.tl__seg { position: absolute; top: 0; bottom: 0; }
.tl__seg--ok { background: linear-gradient(180deg, color-mix(in srgb, var(--good) 55%, var(--surface-3)), color-mix(in srgb, var(--good) 30%, var(--surface-3))); }
.tl__seg--off { background: var(--surface-3); }
.tl__seg--out { background: var(--critical); min-width: 3px; box-shadow: 0 0 0 1px var(--surface), 0 0 10px var(--critical); }
.tl__seg--out:hover, .tl__seg--out:focus-visible { filter: brightness(1.2); }
.tl__now { position: absolute; top: -3px; bottom: -3px; right: 0; width: 2px; background: var(--ink); box-shadow: 0 0 8px var(--accent-2); }
.tl__axis { position: relative; height: 18px; margin-top: 4px; }
.tl__axis span { position: absolute; transform: translateX(-50%); font: 400 10.5px var(--f-mono); color: var(--muted); white-space: nowrap; }
.tl__axis span:first-child { transform: none; }
.tl__axis span:last-child { transform: translateX(-100%); }
.tl__legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); margin: 6px 0 4px; }
.tl__legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl__legend i { width: 12px; height: 10px; border-radius: 3px; display: inline-block; box-shadow: inset 0 0 0 1px var(--line-strong); }
.outage-list { display: grid; gap: 8px; }
.outage {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--critical) 28%, var(--line));
  background: color-mix(in srgb, var(--critical) 7%, var(--surface-2));
}
.outage .ico { width: 16px; height: 16px; }
.outage__cause { font-weight: 600; overflow-wrap: anywhere; }
.outage__when { font: 400 11px var(--f-mono); color: var(--muted); }
.outage__dur { font: 700 12.5px var(--f-mono); font-variant-numeric: tabular-nums; }
.okline { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; }
.okline .ico { width: 16px; height: 16px; }

/* channels */
.channels { display: grid; gap: 12px; }
.chan {
  padding: 14px 16px; border-radius: 14px; display: grid; gap: 10px; min-width: 0;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line);
}
.chan__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chan__id { font: 600 12px var(--f-mono); overflow-wrap: anywhere; min-width: 0; }
.chan__id .ico { width: 14px; height: 14px; color: var(--accent-text); vertical-align: -2px; margin-right: 4px; }
.chan__name { font: 700 14px var(--f-display); color: var(--ink); margin-right: 8px; letter-spacing: -.01em; }
.chan__num { font-size: 11px; color: var(--muted); }
.chan__num--solo { font-size: inherit; color: inherit; }
.chan__top .chip { margin-left: auto; }
.chan__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.chan__stat b { display: block; font: 700 16px var(--f-display); font-variant-numeric: tabular-nums; }
.chan__stat span { font-size: 11px; color: var(--muted); }
.chan__drops { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11.5px; color: var(--ink-2); }

/* ------------------------------------------------------------------ footer */
.footer { border-top: 1px solid var(--line); background: var(--header-bg); }
.footer__inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 22px; color: var(--muted); font: 400 11.5px var(--f-mono); }
.footer__emblem { width: 26px; height: 26px; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.footer__mode { margin-left: auto; }

/* ------------------------------------------------------------------ load animation */
.reveal { animation: rise .75s cubic-bezier(.2, .7, .2, 1) both; }
.d1 { animation-delay: 40ms; } .d2 { animation-delay: 120ms; } .d3 { animation-delay: 200ms; }
.d4 { animation-delay: 260ms; } .d5 { animation-delay: 330ms; } .d6 { animation-delay: 400ms; }
.d7 { animation-delay: 460ms; } .d8 { animation-delay: 520ms; } .d9 { animation-delay: 580ms; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.draw { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.1s .35s cubic-bezier(.4, 0, .2, 1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .draw { stroke-dasharray: none; stroke-dashoffset: 0; }
}

@media (forced-colors: active) {
  .backdrop, .orbit { display: none; }
  .ch-line, .ch-zero { stroke: CanvasText; }
  .bar-pos, .bar-neg { fill: CanvasText; }
  .seg button[aria-pressed="true"], .subnav a[aria-current="true"] { outline: 2px solid Highlight; }
  .slot { border: 1px solid CanvasText; }
  .slot--used { forced-color-adjust: none; background: CanvasText; }
}

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .topbar { position: relative; }
  html { scroll-padding-top: 12px; }
  .subnav__inner { justify-content: flex-start; }
}
@media (max-width: 1080px) {
  .grid-2, .grid-2--wide { grid-template-columns: minmax(0, 1fr); }
  .orbit { width: 240px; height: 240px; right: -80px; top: -150px; opacity: .5; }
  .orbit__gem { display: none; }
  .ticker { order: 4; width: 100%; justify-content: center; }
}
@media (max-width: 900px) {
  .orbit { display: none; }
}
@media (max-width: 760px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .subnav { display: none; }
  .topbar__inner { gap: 10px 12px; padding-bottom: 12px; }
  .brand__emblem { width: 36px; height: 36px; }
  .brand__title { font-size: 17px; }
  .topbar__status { order: 3; width: 100%; }
  .ticker { order: 4; width: 100%; justify-content: space-between; padding: 6px 12px 6px 8px; gap: 4px 10px; border-radius: 14px; }
  .topbar__right { margin-left: auto; }
  .refreshed { display: none; }
  .theme-btn__label { display: none; }
  .theme-btn { padding: 8px; }
  .versions { font-size: 10.5px; }
  .hero { padding: 22px 16px 18px; border-radius: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi__value { font-size: 23px; }
  .kpi__unit { font-size: 11.5px; }
  .panel { padding: 0 14px 18px; border-radius: 14px; }
  .panel.trade { padding: 14px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ministat__v { font-size: 16px; }
  .filters { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center; }
  .filters label { display: contents; }
  .filters select { max-width: none; width: 100%; }
  .panel__head { margin: 0 -14px 14px; padding: 14px 14px 12px; }
  .filterbar { margin: 0 -14px; padding: 12px 14px; }
  h2 { font-size: 17px; }
  .block__head h2 { font-size: 19px; }
  .acct__head, .acct__body { padding-left: 16px; padding-right: 16px; }
  .acct__money { grid-template-columns: minmax(0, 1fr); }
  .acct__eq { font-size: 28px; }
  .acct__server { margin-left: 0; text-align: left; width: 100%; }
  .hbar { grid-template-columns: 76px minmax(0, 1fr); }
  .hbar__val { grid-column: 1 / -1; text-align: left; padding-left: 88px; margin-top: -4px; }
  .filterbar__hint { display: none; }
  .footer__mode { margin-left: 0; }
}
@media (max-width: 400px) {
  .kpi__value { font-size: 20px; }
  .seg button { padding: 6px 11px; }
}

/* ------------------------------------------------------------------ live XAUUSD chart (chart.js)
   The canvas reads its colours from the tokens above (--pos/--neg candles, --accent BUY, --neg SELL,
   --s4 SMA, --gold pending orders, --grid/--axis/--muted axes), so both themes follow automatically. */
.xc__controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.xc__zoom { display: inline-flex; gap: 4px; }
.xc__btn { justify-content: center; min-width: 34px; padding: 6px 10px; font: 600 13px/1.1 var(--f-mono); }
.xc__bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin: -4px 0 12px; font-size: 12px; color: var(--ink-2); }
.xc__live {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font: 700 11.5px var(--f-sans); letter-spacing: .02em; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line-strong);
}
.xc__dot { position: relative; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.xc__live[data-state="live"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--good) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--good) 55%, transparent);
}
.xc__live[data-state="live"] .xc__dot { background: var(--good); box-shadow: 0 0 8px var(--good); }
.xc__live[data-state="live"] .xc__dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--good); opacity: 0; animation: pulse 2s ease-out infinite;
}
.xc__live[data-state="closed"] { color: var(--ink); background: var(--gold-wash); border-color: color-mix(in srgb, var(--gold-1) 50%, transparent); }
.xc__live[data-state="closed"] .xc__dot { background: var(--gold-1); }
.xc__live[data-state="stale"], .xc__live[data-state="retry"] {
  color: var(--ink);
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--warning) 55%, transparent);
}
.xc__live[data-state="stale"] .xc__dot, .xc__live[data-state="retry"] .xc__dot { background: var(--warning); }
.xc__meta { font: 500 11.5px var(--f-mono); color: var(--muted); }
.xc__offset { color: var(--ink-2); cursor: help; }
.xc__legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-left: auto; font-size: 11.5px; color: var(--ink-2); }
.xc__lg { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.xc__sw { display: inline-block; flex: none; }
.xc__sw--buy { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid var(--accent); }
.xc__sw--sell { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid var(--neg); }
.xc__sw--exit { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--pos); border-right-color: var(--neg); border-bottom-color: var(--neg); }
.xc__sw--sma { width: 16px; height: 2px; border-radius: 1px; background: var(--s4); }
.xc__sw--lvl { width: 16px; height: 0; border-top: 2px dashed var(--accent); }
.xc__box {
  position: relative; height: clamp(360px, 58vh, 600px); overflow: hidden;
  border-radius: 12px; border: 1px solid var(--line);
  background:
    radial-gradient(600px 200px at 50% 0%, var(--accent-wash), transparent 70%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), color-mix(in srgb, var(--page) 45%, transparent));
}
.xc__canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  cursor: crosshair; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.xc__canvas.is-dragging { cursor: grabbing; }
.xc__canvas:focus { outline: none; }
.xc__canvas:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; border-radius: 12px; }
.xc__ohlc {
  position: absolute; left: 10px; top: 5px; right: 92px; z-index: 1;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; pointer-events: none;
  font: 500 11.5px/1.6 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.xc__ohlc[hidden] { display: none; }
.xc__ro { white-space: nowrap; }
.xc__ro i { font-style: normal; color: var(--muted); margin-right: 4px; }
.xc__ro b { font-weight: 600; color: var(--ink); }
.xc__ro-t { color: var(--accent-text); font-weight: 600; white-space: nowrap; }
.xc__ro-chg { font-weight: 600; white-space: nowrap; }
.xc__ro-sma i { color: var(--s4); }
.xc__tip {
  position: absolute; z-index: 3; pointer-events: none;
  width: max-content; min-width: 200px; max-width: min(330px, calc(100% - 12px));
  background: var(--tip-bg); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .7), 0 0 24px -10px var(--accent-glow);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  padding: 10px 12px; font-size: 12px;
}
.xc__tip[hidden] { display: none; }
.xc__tip-title { font: 600 10.5px var(--f-mono); color: var(--accent-text); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 5px; }
.xc__tip-title ~ .xc__tip-title { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.xc__tip-row + .xc__tip-row { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.xc__tip-head { display: flex; align-items: baseline; gap: 8px; }
.xc__tip-head b { margin-left: auto; font-variant-numeric: tabular-nums; }
.xc__tip-acc { color: var(--ink-2); white-space: nowrap; }
.xc__tip-res { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.xc__tip-sub { margin-top: 2px; color: var(--muted); font: 500 11px/1.45 var(--f-mono); font-variant-numeric: tabular-nums; }
.xc__side, .xc__lvl { font: 700 11.5px var(--f-mono); letter-spacing: .03em; white-space: nowrap; }
.xc__side--buy, .xc__lvl--entry { color: var(--accent-text); }
.xc__side--sell, .xc__lvl--sl { color: var(--neg-text); }
.xc__lvl--order { color: var(--gold); }
.xc__lvl--tp { color: var(--pos-text); }
.xc__msg {
  position: absolute; inset: 0; margin: 0; padding: 24px; pointer-events: none;
  display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.xc__msg[hidden] { display: none; }
.xc__hint {
  position: absolute; left: 50%; bottom: 36px; z-index: 2; transform: translateX(-50%); margin: 0; pointer-events: none;
  padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  background: var(--tip-bg); color: var(--ink); border: 1px solid var(--line-strong);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); font-size: 12px; font-weight: 600;
}
.xc__hint[hidden] { display: none; }
.xc__note { margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.xc__sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 760px) {
  .xc__controls { width: 100%; justify-content: space-between; }
  .xc__legend { margin-left: 0; }
  .xc__box { height: 380px; }
  .xc__ohlc { right: 74px; font-size: 10.5px; gap: 0 8px; }
}
@media (max-width: 400px) {
  .xc__ro-sma { display: none; }
}
@media (forced-colors: active) {
  .xc__canvas, .xc__sw, .xc__dot { forced-color-adjust: none; }
}
