/* Vultify shared UI layer ("vx") — the single source of truth for page chrome
 * on all non-divergent pages. Loaded AFTER styles.css:
 *   <link rel="stylesheet" href="/static/styles.css?v=...">
 *   <link rel="stylesheet" href="/static/ui.css?v=1">
 * It reuses the :root tokens from styles.css (--bg0..--bg2, --line, --text,
 * --muted, --accent, --accent2, --ok, --warn, --danger, fonts) and defines the
 * canonical versions of the component classes the pages already share
 * (header/.brand/nav, .grid, .card, .row, .pill, .btn, inputs, tables...),
 * so pages can delete their local copies. Page-specific extras stay in the
 * page's own <style>. Divergent pages (index/trading/ecosystem/status) do not
 * include this file and are unaffected.
 */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg0); color: var(--text);
  font-family: var(--font-display, system-ui, sans-serif);
  -webkit-text-size-adjust: 100%;
}

/* ---- topbar ------------------------------------------------------------- */
header.vx {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 16px; flex-wrap: wrap;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg0);
  position: sticky; top: 0; z-index: 50;
}
header.vx .brand { font-weight: 700; font-size: 1rem; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
header.vx .brand a { color: inherit; text-decoration: none; }
header.vx .brand span { color: var(--accent2); }
/* undo styles.css's full-height sidebar treatment of bare <nav> */
header.vx nav {
  position: static; height: auto; width: auto; border: none; background: transparent; padding: 0;
  display: flex; align-items: center; gap: 2px 14px; flex-wrap: wrap;
}
header.vx nav a {
  color: var(--muted); text-decoration: none; font-size: 0.85rem;
  padding: 4px 2px; margin: 0; border-radius: 6px; white-space: nowrap;
}
header.vx nav a:hover { color: var(--text); }
header.vx nav a.active { color: var(--accent); font-weight: 600; }

/* ---- layout ------------------------------------------------------------- */
main.vx { max-width: 960px; margin: 0 auto; padding: 24px 20px 64px; }
main.vx.wide { max-width: 1180px; }
h1 { font-size: 1.35rem; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 30px 0 8px; }
p.sub { color: var(--muted); font-size: 0.88rem; margin: 0 0 16px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card { border: 1px solid var(--line); background: var(--bg2); border-radius: 12px; padding: 18px; min-width: 0; }
.card.hero { background: linear-gradient(135deg, rgba(192,132,252,0.08), rgba(52,211,153,0.06)); }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.row:last-child { border-bottom: none; }

/* ---- text bits ---------------------------------------------------------- */
.label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.muted { color: var(--muted); font-size: 0.85rem; }
.mono { font-family: var(--font-mono, monospace); }
.ok-text { color: var(--ok); } .warn-text { color: var(--warn); } .danger-text { color: var(--danger); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.off { background: var(--muted); } .dot.warn { background: var(--danger); }

.pill { display: inline-block; font-size: 0.68rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); background: var(--bg1); color: var(--muted); }
.pill.live { background: var(--danger); color: #2a0505; border-color: transparent; }
.pill.on { color: var(--ok); }
.pill.paper, .pill.testnet { color: var(--muted); }
.pill.accent { color: var(--accent2); }

/* ---- controls ----------------------------------------------------------- */
.btn {
  background: var(--accent); border: none; color: #1a1200; border-radius: 8px;
  padding: 9px 14px; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  font-family: inherit; min-height: 36px;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--bg1); color: var(--text); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn.armed, .btn.danger { background: var(--danger); color: #fff; }

input.vx, select.vx, textarea.vx,
.field input, .field select, .field textarea, .tp-field input, .tp-field select {
  background: var(--bg0); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); padding: 8px 10px; font-size: 0.88rem; font-family: inherit;
  width: 100%; min-height: 36px;
}
.field, .tp-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.78rem; color: var(--muted); min-width: 0; }

/* ---- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.vx { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
table.vx th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.vx td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.vx tr:last-child td { border-bottom: none; }

/* ---- states ------------------------------------------------------------- */
#login-note, .login-note, .empty-note { color: var(--muted); text-align: center; padding: 40px 0; }
.spinner { color: var(--muted); font-size: 0.85rem; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .grid.g3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  header.vx { padding: 10px 14px; }
  header.vx nav { gap: 0 10px; overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: none; }
  header.vx nav::-webkit-scrollbar { display: none; }
  header.vx nav a { font-size: 0.8rem; padding: 6px 2px; }
  main.vx { padding: 16px 14px 56px; }
  .grid, .grid.g3 { grid-template-columns: 1fr; }
  .big { font-size: 1.6rem; }
  .row { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  h1 { font-size: 1.15rem; }
  .btn { width: 100%; }
  .btn.inline { width: auto; }
}
