/* Tokens, reset, and the handful of utilities the whole app shares.
 *
 * The palette is the family's, value for value — same product family, same
 * surface, and a person moving between the two should not feel a seam. Only
 * `--amber*`, `--hairline` and `--mono` are additions, and they exist because
 * a trading surface has states a chat product does not.
 *
 * Everything that used to live below the tokens here — the three-rail shell,
 * the cards, the badges, the pills — went with the shell it styled. See
 * surface.css for the language that replaced it.
 */

:root {
  color-scheme: dark;

  --page: #000000;
  --rail: #030508;
  --panel: #0d1118;
  --panel-soft: #070a10;
  --line: rgba(224, 232, 242, 0.075);
  --hairline: rgba(224, 232, 242, 0.10);
  --line-strong: rgba(171, 186, 205, 0.30);
  --text: #f0f4fa;
  --muted: #aeb8c6;
  --dim: #667181;
  --accent: #d7dee8;

  --electric-blue: #74a9ff;
  --electric-blue-soft: rgba(116, 169, 255, 0.12);
  --electric-blue-line: rgba(116, 169, 255, 0.46);
  --electric-green: #8deaa5;
  --electric-green-soft: rgba(141, 234, 165, 0.10);
  --electric-green-line: rgba(141, 234, 165, 0.42);
  --danger: #f28799;
  --danger-soft: rgba(242, 135, 153, 0.12);
  --danger-line: rgba(242, 135, 153, 0.42);
  --amber: #f5c15d;
  --amber-soft: rgba(245, 193, 93, 0.12);
  --amber-line: rgba(245, 193, 93, 0.42);

  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* Environment theming (FR-UI-06). The distinction is a token override rather
 * than a badge, so PAPER and LIVE differ everywhere at once — a live session
 * cannot end up looking like paper because one component forgot to check. */
:root[data-environment="paper"] {
  --env: var(--electric-blue);
  --env-soft: var(--electric-blue-soft);
  --env-line: var(--electric-blue-line);
  --env-label: "PAPER";
}

:root[data-environment="live"] {
  --env: var(--amber);
  --env-soft: var(--amber-soft);
  --env-line: rgba(245, 193, 93, 0.5);
  --env-label: "LIVE";
}

/* ---- reset + base -------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* The page scrolls now. The previous shell pinned the body at 100dvh with
   * `overflow: hidden` and scrolled three inner rails independently, which is
   * why nothing could be linked to or scrolled past. */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* `display: grid` on a component beats the [hidden] attribute, which silently
 * leaves hidden surfaces occupying a grid column. Restore the attribute's
 * meaning globally rather than per-component. */
[hidden] {
  display: none !important;
}

/* A focus ring that is visible without being loud. Keyboard only — a mouse
 * user clicking a row should not get an outline. */
:focus-visible {
  outline: 1px solid var(--muted);
  outline-offset: 3px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ---- shared utilities ----------------------------------------------------
 * Everything here is used by more than one stylesheet. Anything used by one
 * belongs in that one. */

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.pos, .up { color: var(--electric-green); }
.neg, .down { color: var(--danger); }
.warn { color: var(--amber); }
.bad { color: var(--danger); }
.ok { color: var(--electric-green); }
.dim { color: var(--dim); }

@media (max-width: 640px) {
  body { font-size: 13px; }
}
