/* Shared styles for every page.
   Look: a dark trading terminal. Slate-blue ground, a warm brass accent for the brand and primary
   actions, green/red kept strictly for price direction and rule status. Display: Bricolage Grotesque.
   Body: Figtree. Numbers: JetBrains Mono with tabular figures. */

:root {
  --bg: #0b0f15;
  --panel: #121821;
  --panel-2: #18202b;
  --line: #222c39;
  --line-2: #2c3848;
  --ink: #e6ebf2;
  --muted: #8c99ab;
  --faint: #5d6a7c;
  --brass: #e7b65a;
  --brass-ink: #1a1306;
  --brass-soft: rgba(231, 182, 90, 0.12);
  --up: #3ecf8e;
  --up-soft: rgba(62, 207, 142, 0.12);
  --down: #ff6b6b;
  --down-soft: rgba(255, 107, 107, 0.12);
  --warn: #f0a640;
  --warn-soft: rgba(240, 166, 64, 0.12);
  --info: #6aa8ff;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.up { color: var(--up); }
.down { color: var(--down); }
[hidden] { display: none !important; }

/* Page width, small print, footer */
.wrap { max-width: 1120px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.small { font-size: 12.5px; }
.footer { padding-block: 32px 48px; border-top: 1px solid var(--line); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; padding: 9px 14px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 38px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.buy { background: var(--up); border-color: var(--up); color: #04150d; }
.btn.danger { color: var(--down); border-color: rgba(255, 107, 107, 0.4); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 30px; padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .label { font-size: 12px; color: var(--muted); }
.input { width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 9px 11px; min-width: 0; }
.input:focus { border-color: var(--brass); outline: none; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { margin-top: 3px; accent-color: var(--brass); }

/* Chips and pills */
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; font-weight: 500; }
.chip.ok { background: var(--up-soft); color: var(--up); }
.chip.bad { background: var(--down-soft); color: var(--down); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.brass { background: var(--brass-soft); color: var(--brass); }
.chip.info { background: rgba(106, 168, 255, 0.12); color: var(--info); }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-title { font-family: var(--display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; margin: 0; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: rgba(11, 15, 21, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: var(--brass); display: grid; place-items: center; color: var(--brass-ink); font-size: 13px; font-weight: 800; }
.topbar .spacer { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.r, table.t th.r { text-align: right; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(4, 6, 10, 0.7); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-family: var(--display); font-size: 21px; letter-spacing: -0.02em; }

/* Toasts */
#toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--info); border-radius: 8px; padding: 10px 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.toast.ok { border-left-color: var(--up); }
.toast.bad { border-left-color: var(--down); }
.toast.warn { border-left-color: var(--warn); }

.err-text { color: var(--down); font-size: 13px; }
.token-img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--panel-2); flex: none; }
.token-img.sm { width: 24px; height: 24px; border-radius: 6px; }
.token-fallback { display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.chip.live { background: var(--down-soft); color: var(--down); font-weight: 600; }
