/* Mercy: shared styles for the app screens (trade.html, vault.html).
   Style: True-black flat (seed 1600148096), brand palette and type kept (DIRECTION.md section 10).
   The move: elevation by lightness alone (ground, panel, nested), no borders or shadows on panels,
   the active nav item is its label brightening, the primary control is white with a black label.
   Type is the landing's Satoshi, self-hosted, with tabular figures on every number.
   Colour goes on data: candles, depth, the liquidation line (red) and money coming back (mint). Mint is
   also the one field of brand colour on each screen, where the rebate lives. */

@font-face { font-family: "Satoshi"; src: url(/fonts/satoshi-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url(/fonts/satoshi-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url(/fonts/satoshi-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Satoshi"; src: url(/fonts/satoshi-900.woff2) format("woff2"); font-weight: 900; font-display: swap; }

:root {
  --ground: #050706;  --surface: #0F1311;  --raised: #222A25;  --active: #222A25;
  --hover: #161C18;
  --border: #1A201C;  --rule: #151A17;     --control: #444C47;
  --text: #FFFFFF;    --muted: #C9CFCB;    --faint: #A4ACA7;
  --primary: #FFFFFF; --primary-ink: #050706;
  --accent: #3BE89B;  --positive: #3BE89B;
  --negative: #FF5A4E;
  --pill-positive-bg: #12291C; --pill-positive-ink: #3BE89B;
  --pill-negative-bg: #2C1A1C; --pill-negative-ink: #FF6B60;
  --pill-neutral-bg: #222A25;  --pill-neutral-ink: #FFFFFF;
  --chart-1: #3BE89B; --chart-2: #E6E6E6; --chart-3: #6B6B6B;
  --grid: #1C231F;    --axis-ink: #A4ACA7;
  --usdc: #2775CA;
  /* the brand field: mint, with dark green ink on it */
  --mint: #3BE89B; --on-mint: #04140C; --on-mint-2: #0C4129;

  --radius-card: 16px; --radius-nested: 10px; --radius-control: 10px; --radius-chip: 8px;
  --gap: 8px; --card-pad: 16px; --control-height: 36px;
  --font: "Satoshi", "Helvetica Neue", Arial, sans-serif;
  --brand-font: var(--font);
  --loss: #FF6A3D;
  --fs-title: 20px; --fs-section: 15px; --fs-kpi: 24px; --fs-body: 14px; --fs-small: 12.5px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text);
  font: 400 var(--fs-body)/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.num, td, .tnum { font-variant-numeric: tabular-nums lining-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
::selection { background: #1F5A3D; }

/* ---------- the brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); flex: none; min-width: 0; }
.brand svg { width: 19px; height: 22px; display: block; flex: none; }
.brand .wordmark { font: 700 20px/1 var(--font); letter-spacing: -0.035em; white-space: nowrap; }

/* ---------- the top bar (both screens) ---------- */
.topbar { display: flex; align-items: center; gap: 24px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.topnav { display: flex; gap: 4px; }
.topnav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; }
.topnav a:hover { color: var(--text); background: var(--hover); }
.topnav a[aria-current="page"] { color: var(--text); font-weight: 700; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; height: 100%; }
.tb-right .acct { display: inline-flex; align-items: center; gap: 8px; height: 100%; padding-left: 14px; border-left: 1px solid var(--border); color: var(--muted); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--raised); flex: none; }
/* the one notice that this is a prototype: quiet words, no fill */
.mock-note { color: var(--faint); font-size: var(--fs-small); white-space: nowrap; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; flex: none; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill-pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill-neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill img { width: 24px; height: 22px; object-fit: contain; margin-left: -4px; }
.tier-pill { height: 28px; font-weight: 700; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border-radius: var(--radius-card); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 var(--card-pad); }
.panel-head h2 { font-size: var(--fs-section); font-weight: 700; }
.panel-head .meta { margin-left: auto; color: var(--faint); font-size: var(--fs-small); white-space: nowrap; }

/* ---------- buttons: nearly square, as on the landing, and filled: a raised tint for the quiet ones, never an outline ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 16px; border-radius: var(--radius-control); border: 1px solid var(--raised); background: var(--raised); color: var(--text); font-weight: 700; text-decoration: none; white-space: nowrap; transition: background-color .15s ease-out, border-color .15s ease-out, transform .1s ease-out; }
.btn:hover { background: #2E3832; border-color: #2E3832; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn-primary:hover { background: #E4E9E6; border-color: #E4E9E6; }
.btn[disabled] { cursor: not-allowed; opacity: 1; background: transparent; border-color: var(--raised); color: var(--faint); transform: none; }
.btn-text { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 700; text-decoration: none; }
.btn-text:hover { color: var(--text); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }

/* ---------- underline tabs ---------- */
.tabs { display: flex; gap: 18px; align-self: stretch; }
.tabs button { position: relative; background: none; border: 0; padding: 0; color: var(--faint); font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 700; }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); }
.tabs .count { color: var(--faint); font-weight: 400; }

/* ---------- segmented ---------- */
.seg { display: inline-flex; background: var(--ground); border-radius: var(--radius-control); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--faint); height: 26px; padding: 0 10px; border-radius: 7px; font-weight: 500; font-size: 12.5px; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--raised); color: var(--text); font-weight: 700; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--faint); height: 32px; padding: 0 10px; white-space: nowrap; }
td { height: 40px; padding: 0 10px; border-top: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { padding-left: var(--card-pad); }
th:last-child, td:last-child { padding-right: var(--card-pad); }
th.num, td.num { text-align: right; }
tbody tr:hover td { background: var(--hover); }
.up { color: var(--positive); }
.down { color: var(--negative); }
.faint { color: var(--faint); }
.muted { color: var(--muted); }
.unit { color: var(--faint); font-size: .92em; }
.link { color: var(--text); text-decoration: underline; text-decoration-color: var(--control); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--text); }

/* ---------- chips and checks ---------- */
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-chip); background: var(--raised); color: var(--text); border: 0; font-size: 12.5px; font-weight: 700; }
button.chip:hover { background: #2C352F; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--text); }

/* ---------- empty and error states ---------- */
.empty { margin: 12px var(--card-pad); padding: 12px 14px; border: 1px dashed var(--control); border-radius: 8px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* ---------- the phone header, the same on both app screens: mark, name, tier, menu ---------- */
.menu-btn, .phone-menu, .mock-strip { display: none; }
@media (max-width: 760px) {
  .topbar { height: 52px; gap: 10px; padding: 0 12px 0 16px; }
  .topbar .topnav, .topbar .acct, .topbar .mock-note { display: none !important; }
  .tb-right { display: flex !important; min-width: 0; gap: 4px; }
  .topbar .tb-right .tier-pill { display: inline-flex; margin-left: auto; }
  .topbar .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -6px; background: none; border: 0; color: var(--text); border-radius: 10px; flex: none; }
  /* the prototype notice, said once, quietly, under the bar */
  body .mock-strip { display: block; padding: 8px 16px; color: var(--faint); font-size: 12.5px; border-bottom: 1px solid var(--border); }
  body .phone-menu:not([hidden]) { display: block; padding: 8px 16px 16px; border-bottom: 1px solid var(--border); }
  .phone-menu nav { display: flex; flex-direction: column; }
  .phone-menu nav a { display: flex; align-items: center; height: 44px; text-decoration: none; color: var(--muted); font-size: 15px; font-weight: 500; }
  .phone-menu nav a[aria-current="page"] { color: var(--text); font-weight: 700; }
  .phone-menu dl div { display: flex; justify-content: space-between; height: 36px; align-items: center; border-top: 1px solid var(--rule); }
  .phone-menu dt { color: var(--faint); }
}
@media (max-width: 400px) {
  .brand .wordmark { font-size: 16px; }
  .tier-pill .tp-name { display: none; }
}
/* thumbs: every control at least 44px tall on a touch screen */
@media (pointer: coarse) {
  .btn, .btn-sm, .seg button, .chip { min-height: 44px; }
  .btn-text { min-height: 44px; display: inline-flex; align-items: center; }
}
