/* atlas.css: the Atlas brand kit (https://at.market/brand/components). The tokens are the
   app's own; put this inline in a page and give <body> the class `at`. */
:root {
  /* Surfaces */
  --color-bg-base: #0a0d10;
  --color-bg-panel: #0f1318;
  --color-bg-elevated: #13181f;
  --color-bg-inset: #070a0d;
  /* Focus depths */
  --color-focus-floor: #030405;
  --color-focus-keyline: #000000;
  --color-focus-slab-top: #10151b;
  --color-focus-slab-edge: #161c23;
  --color-focus-slab-lit: #222a33;
  --color-focus-raised: #121820;
  --color-focus-raised-edge: #1b222b;
  --color-focus-raised-lit: #2a3440;
  --color-focus-well: #06080a;
  --color-focus-well-edge: #0d1115;
  --color-focus-well-lip: #1a2129;
  /* Surfaces */
  --color-surface-overlay: #151b23;
  --color-surface-overlay-header: #1e2731;
  /* Lines */
  --color-border-overlay: #323e4c;
  --color-border-hairline: #1f262e;
  --color-border-subtle: #141a21;
  --color-border-active: #00e5ff;
  /* Text */
  --color-text-primary: #e5e9ee;
  --color-text-secondary: #8b95a3;
  --color-text-tertiary: #586270;
  --color-text-inverse: #0a0d10;
  /* Accent and metal */
  --color-accent-cyan: #00e5ff;
  --color-accent-cyan-dim: #007a8c;
  --color-accent-cyan-fill: #0e3a44;
  --color-accent-gold: #d9b24c;
  --color-accent-metal: #b4bdc7;
  --color-accent-metal-dim: #6e7682;
  /* Status */
  --color-status-ok: #35b274;
  --color-status-warn: #dea138;
  --color-status-crit: #e04e4c;
  --color-status-predict: #8b5cf6;
  --color-status-info: #5185e2;
  /* Long and short */
  --color-long-fill: #1c7449;
  --color-short-fill: #a62d2d;
  --color-long-fill-deep: #145838;
  --color-short-fill-deep: #822323;
  --color-long-tint: #0d1a14;
  --color-long-edge: #1b4d34;
  --color-short-tint: #1b0e10;
  --color-short-edge: #512022;
  --color-bid-bar: #122d20;
  --color-bid-bar-strong: #194f34;
  --color-ask-bar: #321517;
  --color-ask-bar-strong: #512022;
  --color-warn-tint: #2f2411;
  --color-warn-text: #e8b952;
  --color-sweep-fill: #1b4d34;
  --color-sweep-text: #d8f3e4;
  --color-pull-fill: #613e16;
  --color-pull-text: #f6eac5;
  /* Rows */
  --color-row: #12151b;
  --color-row-alt: #14171d;
  --color-row-selected: #1a1f27;
  --color-row-hover: #1c2029;
  /* Type */
  --font-display: "Inter", system-ui, sans-serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-tight: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  /* Radii */
  --radius-none: 0;
  --radius-input: 2px;
  --radius-panel: 4px;
  --radius-button: 4px;
  --radius-container: 6px;
  /* Spacing */
  --spacing-0_5: 2px;
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-12: 48px;
  --spacing-16: 64px;
  --spacing-24: 96px;
}

/* The Atlas kit's components, for pages made outside the app: reports, dashboards, slides and
   cards. Every class starts with `at-`; the colours, type and radii come from the tokens above,
   which `cargo xtask brand` takes from the app's own styles (apps/web/styles/app.css). Put the
   class `at` on the page's root (or on <body>) and build inside it. */

/* ---- the root ---------------------------------------------------------------------------- */
.at {
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font: 400 13px/1.45 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  color-scheme: dark;
}
.at *,
.at *::before,
.at *::after { box-sizing: border-box; }
.at a { color: var(--color-accent-cyan); text-decoration: none; }
.at a:hover { text-decoration: underline; text-underline-offset: 3px; }
.at ::selection { background: var(--color-accent-cyan-fill); color: var(--color-text-primary); }
.at :focus-visible { outline: 1px solid var(--color-accent-cyan); outline-offset: 2px; }

/* ---- layout ------------------------------------------------------------------------------ */
/* a page's width: 1280 px for interfaces, 720 px for reading */
.at-wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.at-read { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.at-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.at-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.at-stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.at-rule { height: 1px; border: 0; background: var(--color-border-hairline); margin: 24px 0; }

/* ---- type -------------------------------------------------------------------------------- */
/* brand pages (reports, guides, slides): Inter Tight headings, Inter text */
.at-display { font: 600 72px/1 var(--font-tight); letter-spacing: -0.04em; color: var(--color-text-primary); margin: 0; }
.at-h1 { font: 600 44px/52px var(--font-tight); letter-spacing: -0.03em; color: var(--color-text-primary); margin: 0; }
.at-h2 { font: 600 22px/28px var(--font-tight); letter-spacing: -0.015em; color: var(--color-text-primary); margin: 0; }
.at-h3 { font: 600 15px/20px var(--font-tight); letter-spacing: -0.01em; color: var(--color-text-primary); margin: 0; }
.at-lead { font: 400 18px/28px var(--font-sans); color: var(--color-text-secondary); margin: 0; }
.at-body { font: 400 16px/26px var(--font-sans); color: var(--color-text-primary); margin: 0; }
.at-small { font: 400 14px/22px var(--font-sans); color: var(--color-text-secondary); margin: 0; }
.at-help { font: 400 12px/18px var(--font-sans); color: var(--color-text-tertiary); margin: 0; }
/* interface: figures and labels in IBM Plex Mono with tabular digits */
.at-fig { font: 500 12px/16px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-primary); }
.at-fig-lg { font: 500 24px/28px var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--color-text-primary); }
.at-label { font: 600 11px/16px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-tertiary); }
.at-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.at-t2 { color: var(--color-text-secondary); }
.at-t3 { color: var(--color-text-tertiary); }

/* direction and profit or loss: the only use of green and red */
.at-up, .at .at-up { color: var(--color-status-ok); }
.at-down, .at .at-down { color: var(--color-status-crit); }
.at-flat, .at .at-flat { color: var(--color-text-tertiary); }

/* ---- the wordmark, set in type where the logo file cannot be used ------------------------ */
.at-wordmark { font: 700 13px/13px var(--font-tight); letter-spacing: 0.22em; text-transform: uppercase; color: var(--color-text-primary); }
.at-logo { display: inline-flex; align-items: center; height: 24px; }
.at-logo svg { height: 100%; width: auto; display: block; }

/* ---- panels ------------------------------------------------------------------------------ */
/* flat: one dark value, a hairline edge and a raised header with the panel's name; no shadow */
.at-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--color-bg-panel); border: 1px solid var(--color-border-hairline); border-radius: var(--radius-panel); overflow: hidden; }
.at-panel-head { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; flex-shrink: 0; background: var(--color-bg-elevated); border-bottom: 1px solid var(--color-border-hairline); }
.at-panel-title { font: 600 11px/1 var(--font-tight); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-secondary); }
.at-panel-tool { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.at-panel-body { padding: 12px; min-width: 0; }
.at-panel-body.flush { padding: 0; }
/* a sunken well inside a panel: fields, charts */
.at-well { background: var(--color-bg-inset); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-input); padding: 10px 12px; }

/* ---- figures ----------------------------------------------------------------------------- */
.at-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px; background: var(--color-bg-panel); border: 1px solid var(--color-border-hairline); border-radius: var(--radius-panel); }
.at-stat .at-fig-lg { white-space: nowrap; }
.at-stat-foot { display: flex; align-items: baseline; gap: 8px; font: 500 11px/16px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-tertiary); }

/* the market bar: a market, its price and its numbers in one line */
.at-ticker { display: flex; align-items: center; gap: 20px; height: 40px; padding: 0 12px; overflow-x: auto; scrollbar-width: none; background: var(--color-bg-panel); border: 1px solid var(--color-border-hairline); border-radius: var(--radius-panel); white-space: nowrap; }
.at-ticker::-webkit-scrollbar { display: none; }
.at-ticker-sym { font: 600 13px/1 var(--font-mono); color: var(--color-text-primary); }
.at-ticker-px { font: 500 15px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-primary); }
.at-kv { display: flex; flex-direction: column; gap: 3px; }
.at-kv > span:first-child { font: 600 9px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-tertiary); }
.at-kv > span:last-child { font: 500 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-primary); }

/* ---- tables ------------------------------------------------------------------------------ */
.at-table { width: 100%; border-collapse: collapse; font: 400 12px/16px var(--font-sans); }
.at-table th { height: 28px; padding: 0 12px; text-align: left; font: 600 10px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-tertiary); border-bottom: 1px solid var(--color-border-hairline); white-space: nowrap; }
.at-table td { height: 32px; padding: 0 12px; color: var(--color-text-primary); border-bottom: 1px solid var(--color-border-subtle); white-space: nowrap; }
.at-table tbody tr:hover td { background: var(--color-row-hover); }
.at-table tr.on td { background: var(--color-row-selected); }
.at-table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.at-table th.num { text-align: right; }

/* ---- buttons ----------------------------------------------------------------------------- */
.at-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-button); border: 1px solid var(--color-border-hairline); background: var(--color-bg-elevated); color: var(--color-text-primary); font: 500 12px/1 var(--font-sans); white-space: nowrap; cursor: pointer; text-decoration: none; }
.at-btn:hover { background: var(--color-row-hover); text-decoration: none; }
.at-btn:disabled, .at-btn[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.at-btn-primary { background: var(--color-accent-cyan); border-color: var(--color-accent-cyan); color: var(--color-text-inverse); font: 600 12px/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; }
.at-btn-primary:hover { background: rgb(0 229 255 / 0.85); }
.at-btn-long { background: var(--color-long-fill); border-color: var(--color-long-fill); color: var(--color-text-primary); font: 700 13px/1 var(--font-mono); text-transform: uppercase; }
.at-btn-long:hover { background: var(--color-long-fill-deep); }
.at-btn-short { background: var(--color-short-fill); border-color: var(--color-short-fill); color: var(--color-text-primary); font: 700 13px/1 var(--font-mono); text-transform: uppercase; }
.at-btn-short:hover { background: var(--color-short-fill-deep); }
.at-btn-ghost { background: transparent; border-color: transparent; color: var(--color-text-secondary); }
.at-btn-ghost:hover { background: rgb(255 255 255 / 0.05); color: var(--color-text-primary); }
.at-btn-sm { height: 24px; padding: 0 8px; font-size: 11px; }

/* ---- chips, tabs, fields ----------------------------------------------------------------- */
.at-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 6px; border-radius: var(--radius-input); background: rgb(255 255 255 / 0.05); color: var(--color-text-secondary); font: 500 10px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.at-chip.ok { background: rgb(53 178 116 / 0.12); color: var(--color-status-ok); }
.at-chip.warn { background: rgb(222 161 56 / 0.12); color: var(--color-status-warn); }
.at-chip.crit { background: rgb(224 78 76 / 0.12); color: var(--color-status-crit); }
.at-chip.info { background: rgb(81 133 226 / 0.14); color: var(--color-status-info); }
.at-chip.live { background: var(--color-accent-cyan-fill); color: var(--color-accent-cyan); }

.at-tabs { display: flex; gap: 16px; height: 32px; border-bottom: 1px solid var(--color-border-hairline); }
.at-tab { position: relative; display: flex; align-items: center; padding: 0; border: 0; background: none; cursor: pointer; font: 500 11px/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-tertiary); }
.at-tab:hover { color: var(--color-text-secondary); }
.at-tab.on, .at-tab[aria-selected="true"] { color: var(--color-text-primary); }
.at-tab.on::after, .at-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--color-accent-cyan); }

.at-field { display: flex; flex-direction: column; gap: 4px; }
.at-input { height: 32px; width: 100%; padding: 0 10px; border-radius: var(--radius-input); border: 1px solid var(--color-border-overlay); background: var(--color-bg-inset); color: var(--color-text-primary); font: 500 12px/1 var(--font-mono); font-variant-numeric: tabular-nums; outline: none; }
.at-input:focus { border-color: var(--color-accent-cyan); }
.at-input::placeholder { color: var(--color-text-tertiary); }

/* ---- live and alerts --------------------------------------------------------------------- */
/* the live dot: the one thing that moves without a change */
.at-live { position: relative; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent-cyan); flex-shrink: 0; }
.at-live::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: at-live 2s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes at-live { 75%, 100% { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .at-live::after { animation: none; } }

/* an alert from the world: its severity, what happened, where and when */
.at-alerts { display: flex; flex-direction: column; }
.at-alert { display: grid; grid-template-columns: 3px 1fr auto; gap: 0 10px; align-items: start; padding: 9px 12px; border-bottom: 1px solid var(--color-border-subtle); }
.at-alert:last-child { border-bottom: 0; }
.at-alert::before { content: ""; grid-row: span 2; align-self: stretch; border-radius: 1px; background: var(--color-text-tertiary); }
.at-alert.crit::before { background: var(--color-status-crit); }
.at-alert.warn::before { background: var(--color-status-warn); }
.at-alert.info::before { background: var(--color-status-info); }
.at-alert-title { font: 500 13px/18px var(--font-sans); color: var(--color-text-primary); min-width: 0; }
.at-alert-time { font: 500 11px/18px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-tertiary); }
.at-alert-meta { grid-column: 2 / 4; font: 400 11px/16px var(--font-sans); color: var(--color-text-tertiary); }

/* a note beside the content: a cyan hairline on its left */
.at-note { padding: 10px 12px; border-left: 1px solid var(--color-accent-cyan); background: rgb(0 229 255 / 0.04); font: 400 13px/20px var(--font-sans); color: var(--color-text-secondary); }
.at-note.warn { border-left-color: var(--color-status-warn); background: rgb(222 161 56 / 0.05); }

/* ---- bars and charts --------------------------------------------------------------------- */
/* horizontal bars: a share of something, one row each */
.at-bars { display: flex; flex-direction: column; gap: 8px; }
.at-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.at-bar-name { font: 400 12px/16px var(--font-sans); color: var(--color-text-primary); }
.at-bar-val { font: 500 12px/16px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--color-text-secondary); }
.at-bar-track { grid-column: 1 / 3; height: 4px; background: var(--color-bg-inset); border-radius: 1px; overflow: hidden; }
.at-bar-fill { height: 100%; background: var(--color-accent-cyan-dim); }
.at-bar-fill.up { background: var(--color-status-ok); }
.at-bar-fill.down { background: var(--color-status-crit); }

/* charts drawn as inline SVG: a hairline grid, mono axis text, one cyan series */
.at-chart { display: block; width: 100%; height: auto; overflow: visible; }
.at-chart .grid { stroke: var(--color-border-subtle); stroke-width: 1; shape-rendering: crispEdges; }
.at-chart .axis { fill: var(--color-text-tertiary); font: 500 10px var(--font-mono); font-variant-numeric: tabular-nums; }
.at-chart .line { fill: none; stroke: var(--color-accent-cyan); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.at-chart .line.metal { stroke: var(--color-accent-metal); }
.at-chart .line.dim { stroke: var(--color-text-tertiary); stroke-dasharray: 3 3; }
.at-chart .area { fill: url(#at-area); stroke: none; }
.at-chart .bar { fill: var(--color-accent-cyan-dim); }
.at-chart .bar.up { fill: var(--color-status-ok); }
.at-chart .bar.down { fill: var(--color-status-crit); }
.at-chart .dot { fill: var(--color-accent-cyan); }
.at-chart .now { stroke: var(--color-accent-cyan); stroke-width: 1; stroke-dasharray: 2 3; }
