/* ─────────────────────────────────────────────────────────────────
   Liberland dApp — extends the marketing design system with the
   patterns the governance app needs: sidebar shell, address pills,
   balance displays, vote bars, status badges, data tables.
   Loads colors_and_type.css from project root.
   ──────────────────────────────────────────────────────────────── */
@import url("colors_and_type.css");

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ll-surface-2);
  color: var(--ll-slate);
  font-family: var(--font-sans);
  min-height: 100vh;
}

/* ── Top yellow stripe (Liberland signature) ─────────────────── */
.dapp-stripe {
  height: 4px;
  background: var(--ll-yellow-gradient);
  width: 100%;
  position: sticky; top: 0; z-index: 50;
}

/* ── Shell layout ────────────────────────────────────────────── */
.dapp-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: calc(100vh - 4px);
}
.dapp-sidebar {
  background: #fff;
  border-right: 1px solid var(--ll-border);
  padding: 24px 0 32px;
  position: sticky; top: 4px;
  height: calc(100vh - 4px);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.dapp-sidebar > * { flex-shrink: 0; }
/* Grid items default to min-width:auto, which lets intrinsic content
   widen the 1fr track and cause horizontal overflow on mobile. */
.dapp-main-wrap { min-width: 0; }
.dapp-main { min-width: 0; }

/* ── Sidebar brand ───────────────────────────────────────────── */
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px 24px;
  text-decoration: none;
  border-bottom: 1px solid var(--ll-border);
  margin-bottom: 22px;
}
.sb-brand img { width: 32px; height: 42px; }
.sb-brand .wmk {
  font-family: var(--font-display); font-weight: 700;
  font-size: 18px; color: var(--ll-ink); letter-spacing: 1px;
}
.sb-brand .wmk .sub {
  display: block; font-family: var(--font-sans); font-weight: 600;
  font-size: 10px; letter-spacing: 2.5px; color: var(--ll-slate-2);
  margin-top: 2px;
}

/* ── Sidebar account pod ─────────────────────────────────────── */
.sb-account {
  margin: 0 16px 24px;
  padding: 14px 14px 16px;
  background: linear-gradient(135deg, #1F3651 0%, #243F5F 100%);
  border-radius: var(--radius-xl);
  color: #fff;
  position: relative; overflow: hidden;
}
.sb-account::before {
  content: ""; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(241,200,35,.28) 0%, rgba(241,200,35,0) 60%);
  pointer-events: none;
}
.sb-account .row { display: flex; align-items: center; gap: 10px; position: relative; }
.sb-account .av {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--ll-yellow-gradient);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
  color: var(--ll-ink); font-size: 15px;
  border: 2px solid rgba(255,255,255,.2);
}
.sb-account .nm { font-family: var(--font-sans); font-weight: 700; font-size: 14px; }
.sb-account .addr {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; color: rgba(255,255,255,.7); margin-top: 2px;
}
.sb-account .bal-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-top: 14px; position: relative;
}
.sb-account .bal-row .bal {
  padding: 8px 10px; border-radius: var(--radius-md);
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
}
.sb-account .bal .u {
  font-family: var(--font-sans); font-weight: 700; font-size: 9px;
  letter-spacing: 1.6px; color: rgba(255,255,255,.65);
}
.sb-account .bal .v {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  color: #fff; margin-top: 2px; line-height: 1;
}

/* ── Sidebar nav ─────────────────────────────────────────────── */
.sb-section {
  padding: 18px 22px 6px;
  font-family: var(--font-sans); font-weight: 700;
  font-size: 10px; letter-spacing: 2.6px;
  color: var(--ll-slate-3); text-transform: uppercase;
}
.sb-nav { display: flex; flex-direction: column; padding: 0 12px; gap: 1px; }
.sb-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-md);
  font-family: var(--font-sans); font-weight: 600; font-size: 14px;
  color: var(--ll-slate); text-decoration: none;
  position: relative;
}
.sb-nav a:hover { background: var(--ll-surface-4); color: var(--ll-ink); text-decoration: none; }
.sb-nav a.active {
  background: var(--ll-ink); color: #fff;
}
.sb-nav a.active .ico { color: var(--ll-yellow); }
.sb-nav .ico {
  width: 18px; height: 18px; display: inline-flex;
  color: var(--ll-blue-icon); flex-shrink: 0;
}
.sb-nav .badge {
  margin-left: auto;
  background: var(--ll-yellow); color: var(--ll-ink);
  font-family: var(--font-sans); font-weight: 700; font-size: 10px;
  padding: 2px 7px; border-radius: 999px; letter-spacing: .3px;
}
.sb-nav a.active .badge { background: var(--ll-yellow); color: var(--ll-ink); }

.sb-foot {
  margin-top: auto; padding: 18px 22px 0;
  font-family: var(--font-sans); font-style: italic;
  font-size: 12px; color: var(--ll-slate-3);
}
.sb-foot .net {
  display: inline-flex; align-items: center; gap: 6px;
  font-style: normal; font-weight: 700; font-size: 11px;
  letter-spacing: 1.8px; color: var(--ll-slate);
  margin-bottom: 8px;
}
.sb-foot .net .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ll-green); }

/* ── Top bar (in main column) ────────────────────────────────── */
.dapp-top {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 40px;
  background: #fff;
  border-bottom: 1px solid var(--ll-border);
  position: sticky; top: 4px; z-index: 40;
}
.dapp-top .crumb {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 11px; letter-spacing: 2.6px;
  color: var(--ll-slate-3); text-transform: uppercase;
}
.dapp-top .crumb b { color: var(--ll-slate); }
.dapp-top .search {
  flex: 1; max-width: 460px;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--ll-surface-4);
  border: 1px solid var(--ll-border);
  border-radius: var(--radius-pill);
  font-family: var(--font-sans); font-size: 13px;
  color: var(--ll-slate-3);
  margin-left: auto;
}
.dapp-top .wallet-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 8px 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--ll-surface-4);
  border: 1px solid var(--ll-border);
  font-family: var(--font-sans); font-weight: 700; font-size: 13px;
  color: var(--ll-ink);
}
.dapp-top .wallet-pill .addr {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 600; font-size: 12px;
  color: var(--ll-slate);
}
.dapp-top .wallet-pill .av {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ll-yellow-gradient);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: var(--ll-ink);
}
.dapp-top .net-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: rgba(121,191,46,.10);
  font-family: var(--font-sans); font-weight: 700;
  font-size: 11px; letter-spacing: 1.4px;
  color: #4a8a14; text-transform: uppercase;
}
.dapp-top .net-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: #79BF2E;
  box-shadow: 0 0 0 3px rgba(121,191,46,.18);
}

/* ── Page wrapper ────────────────────────────────────────────── */
.dapp-page {
  padding: 40px 40px 80px;
  max-width: 1320px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 32px; margin-bottom: 40px;
}
.page-head h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 44px; line-height: 1.1; color: var(--ll-ink);
  margin: 0; position: relative; padding-bottom: 20px;
  letter-spacing: -0.01em;
}
.page-head h1::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 96px; height: 3px; background: var(--ll-yellow);
}
.page-head .sub {
  font-family: var(--font-sans); font-size: 15px; line-height: 22px;
  color: var(--ll-slate); opacity: .8;
  max-width: 560px; margin-top: 14px;
}
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* eyebrow line above page title */
.eyebrow {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 11px; letter-spacing: 2.6px;
  color: var(--ll-slate-2); text-transform: uppercase;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow .bar { width: 24px; height: 2px; background: var(--ll-yellow); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-weight: 700; font-size: 14px;
  letter-spacing: .3px; cursor: pointer; border: 0; text-decoration: none;
  white-space: nowrap;
  transition: transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--ll-yellow-gradient);
  color: var(--ll-ink);
  box-shadow: var(--shadow-btn);
  font-style: italic;
}
.btn-secondary {
  background: #fff; color: var(--ll-blue);
  border: 2px solid var(--ll-blue);
  border-radius: var(--radius-md);
  padding: 9px 20px;
}
.btn-ghost {
  background: transparent; color: var(--ll-slate);
  border: 1px solid var(--ll-border-strong);
  border-radius: var(--radius-md);
  padding: 9px 18px;
  font-weight: 600;
}
.btn-dark {
  background: var(--ll-ink); color: #fff;
}
.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--ll-border);
  border-radius: var(--radius-md); color: var(--ll-slate); cursor: pointer;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 28px;
}
.card-tight { padding: 22px; }
.card-flat { box-shadow: none; border: 1px solid var(--ll-border); }
.card-dark {
  background: linear-gradient(135deg, #1F3651 0%, #243F5F 100%);
  color: #fff;
}
.card-dark p { color: rgba(255,255,255,.78); }

.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.card-head h3 {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; line-height: 1.2; color: var(--ll-ink);
  margin: 0;
}
.card-head .more {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 11px; letter-spacing: 2px;
  color: var(--ll-blue); text-decoration: none;
}

/* Section title — Playfair + yellow underline (compact for dapp) */
.sec-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 26px; color: var(--ll-ink);
  position: relative; padding-bottom: 14px;
  display: inline-block; margin: 0;
}
.sec-title::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 64px; height: 3px; background: var(--ll-yellow);
}

.label {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 10px; letter-spacing: 2.2px;
  color: var(--ll-slate-3); text-transform: uppercase;
}
.muted { color: var(--ll-slate-2); }

/* ── Grids ───────────────────────────────────────────────────── */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.grid-12 > * { min-width: 0; }
.col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; } .col-12 { grid-column: span 12; }
.col-3 { grid-column: span 3; } .col-9 { grid-column: span 9; }

.row { display: flex; gap: 16px; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }

/* ── Balance display ─────────────────────────────────────────── */
.bal-display {
  display: flex; align-items: baseline; gap: 10px;
}
.bal-display .n {
  font-family: var(--font-display); font-weight: 700;
  font-size: 56px; line-height: 1; letter-spacing: -.02em;
  color: var(--ll-ink);
}
.bal-display .u {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 14px; letter-spacing: 2.4px;
  color: var(--ll-slate); text-transform: uppercase;
}
.bal-display .d {
  font-family: var(--font-sans); font-size: 13px;
  color: var(--ll-slate-2); margin-left: 8px;
}
.bal-display.sm .n { font-size: 36px; }
.bal-display.lg .n { font-size: 76px; }
.bal-display.dark .n { color: #fff; }
.bal-display.dark .u { color: rgba(255,255,255,.7); }

/* ── Address pill / mono ─────────────────────────────────────── */
.addr-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--ll-surface-4);
  border: 1px solid var(--ll-border);
  border-radius: var(--radius-md);
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px; color: var(--ll-slate);
}
.addr-pill .copy {
  width: 14px; height: 14px; color: var(--ll-slate-3);
  cursor: pointer;
}
.mono { font-family: ui-monospace, Menlo, monospace; }

/* ── Status badges ───────────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px;
  font-family: var(--font-sans); font-weight: 700;
  font-size: 11px; letter-spacing: .4px;
}
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-green { background: rgba(121,191,46,.14); color: #4a8a14; }
.tag-amber { background: rgba(241,200,35,.20); color: #8a6b0a; }
.tag-blue  { background: rgba(0,117,240,.12); color: #1857a8; }
.tag-red   { background: rgba(240,57,54,.12); color: #b14a47; }
.tag-slate { background: rgba(47,90,109,.12); color: var(--ll-slate); }
.tag-navy  { background: var(--ll-navy); color: #fff; }
.tag-yellow { background: var(--ll-yellow); color: var(--ll-ink); }

/* ── Vote bar (aye / nay split with quorum) ──────────────────── */
.vote-bar {
  display: flex; height: 10px; border-radius: 999px; overflow: hidden;
  background: rgba(47,90,109,.08);
  position: relative;
}
.vote-bar .aye { background: var(--ll-green); }
.vote-bar .nay { background: var(--ll-red); }
.vote-bar .abs { background: var(--ll-slate-3); }
.vote-bar.thick { height: 14px; }
.vote-bar .threshold {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--ll-ink);
}
.vote-meta {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 14px; margin-top: 12px;
}
.vote-meta .cell .l {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 10px; letter-spacing: 1.8px;
  text-transform: uppercase; color: var(--ll-slate-3);
}
.vote-meta .cell .v {
  font-family: var(--font-display); font-weight: 700;
  font-size: 20px; color: var(--ll-ink); margin-top: 3px;
}
.vote-meta .cell.aye .v { color: #4a8a14; }
.vote-meta .cell.nay .v { color: #b14a47; }

/* ── Tables ──────────────────────────────────────────────────── */
.tbl {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-sans); font-size: 14px;
}
.tbl thead th {
  text-align: left;
  font-weight: 700; font-size: 10px; letter-spacing: 2.2px;
  color: var(--ll-slate-3); text-transform: uppercase;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ll-border);
  background: var(--ll-surface-4);
  white-space: nowrap;
}
.tbl thead th:first-child { border-top-left-radius: 8px; }
.tbl thead th:last-child { border-top-right-radius: 8px; text-align: right; }
.tbl tbody td {
  padding: 16px;
  border-bottom: 1px solid rgba(47,90,109,.06);
  color: var(--ll-slate);
  vertical-align: middle;
}
.tbl tbody td:last-child { text-align: right; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: rgba(241,200,35,.05); }
.tbl .num { font-family: ui-monospace, Menlo, monospace; color: var(--ll-ink); font-weight: 600; font-size: 13px; }
.tbl .strong { color: var(--ll-ink); font-weight: 700; }
.tbl .id-cell { display: flex; align-items: center; gap: 12px; }
.tbl .id-cell .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ll-navy), var(--ll-slate));
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  color: #fff; flex-shrink: 0;
}
.tbl .id-cell .av.y { background: var(--ll-yellow-gradient); color: var(--ll-ink); }
.tbl .id-cell .nm { font-family: var(--font-sans); font-weight: 700; color: var(--ll-ink); font-size: 14px; }
.tbl .id-cell .sub { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--ll-slate-3); margin-top: 1px; }

/* ── Stat tiles ──────────────────────────────────────────────── */
.stat {
  padding: 22px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}
.stat .l {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 10px; letter-spacing: 2.2px;
  text-transform: uppercase; color: var(--ll-slate-3);
}
.stat .v {
  font-family: var(--font-display); font-weight: 700;
  font-size: 34px; color: var(--ll-ink);
  line-height: 1.05; margin-top: 8px; letter-spacing: -.01em;
}
.stat .v .u {
  font-family: var(--font-sans); font-size: 14px; font-weight: 700;
  color: var(--ll-slate-2); letter-spacing: 2px; margin-left: 6px;
}
.stat .d {
  font-family: var(--font-sans); font-size: 13px;
  color: var(--ll-slate-2); margin-top: 8px;
}
.stat .d .up { color: #4a8a14; font-weight: 700; }
.stat .d .down { color: #b14a47; font-weight: 700; }

/* ── Progress bar (yellow) ───────────────────────────────────── */
.prog {
  height: 6px; background: rgba(47,90,109,.10);
  border-radius: 999px; overflow: hidden;
}
.prog > div {
  height: 100%; background: var(--ll-yellow-gradient);
  border-radius: 999px;
}
.prog.green > div { background: var(--ll-green); }

/* ── Form controls ───────────────────────────────────────────── */
.input {
  display: block; width: 100%;
  padding: 12px 14px;
  background: var(--ll-surface-input);
  border: 1px solid var(--ll-border-strong);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans); font-size: 15px;
  color: var(--ll-ink);
}
.input::placeholder { color: var(--ll-slate-3); }
.input:focus { outline: 2px solid var(--ll-yellow); outline-offset: 0; border-color: var(--ll-yellow); }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row .lbl {
  font-family: var(--font-sans); font-weight: 700;
  font-size: 10px; letter-spacing: 2.2px;
  text-transform: uppercase; color: var(--ll-slate-3);
}
.field-row .hint {
  font-family: var(--font-sans); font-size: 12px; color: var(--ll-slate-2);
}

/* ── Filter chips ────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--ll-border);
  background: #fff; cursor: pointer;
  font-family: var(--font-sans); font-weight: 600; font-size: 12px;
  color: var(--ll-slate);
  letter-spacing: .2px;
}
.chip.active { background: var(--ll-ink); color: #fff; border-color: var(--ll-ink); }
.chip .ct { color: var(--ll-slate-3); margin-left: 6px; font-weight: 600; }
.chip.active .ct { color: rgba(255,255,255,.5); }

/* ── List rows (proposals, txns) ─────────────────────────────── */
.list-row {
  display: grid; gap: 18px;
  padding: 18px 4px;
  border-bottom: 1px solid rgba(47,90,109,.07);
  align-items: center;
}
.list-row:last-child { border-bottom: 0; }
.list-row .title {
  font-family: var(--font-sans); font-weight: 700; font-size: 15px;
  color: var(--ll-ink); line-height: 1.3;
}
.list-row .meta {
  font-family: var(--font-sans); font-size: 12px;
  color: var(--ll-slate-2); margin-top: 4px;
}

/* ── Mini chart placeholder (sparkline / area) ───────────────── */
.spark { height: 60px; width: 100%; display: block; }
.chart-area { height: 220px; width: 100%; display: block; }

/* ── Sigil / number circle ───────────────────────────────────── */
.sigil {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ll-surface-4);
  border: 1px solid var(--ll-border);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--ll-ink);
}
.sigil-y { background: var(--ll-yellow-gradient); border: 0; }
.sigil-d { background: linear-gradient(135deg, #1F3651, #243F5F); color: #fff; border: 0; }

/* ── Divider ─────────────────────────────────────────────────── */
.div {
  height: 1px; background: rgba(47,90,109,.10); margin: 24px 0;
}

/* ── Helper text styles ──────────────────────────────────────── */
.t-display { font-family: var(--font-display); }
.t-sans    { font-family: var(--font-sans); }
.t-ink     { color: var(--ll-ink); }
.t-slate   { color: var(--ll-slate); }
.t-muted   { color: var(--ll-slate-2); }
.t-blue    { color: var(--ll-blue); }
.t-yellow  { color: var(--ll-yellow); }
.t-12 { font-size: 12px; } .t-13 { font-size: 13px; }
.t-14 { font-size: 14px; } .t-16 { font-size: 16px; }
.t-18 { font-size: 18px; } .t-22 { font-size: 22px; }
.t-bold { font-weight: 700; } .t-medium { font-weight: 600; }
.t-italic { font-style: italic; }
.uppercase { text-transform: uppercase; letter-spacing: 1.6px; }

/* ── Quote block (Playfair italic) ───────────────────────────── */
.quote {
  font-family: var(--font-display); font-style: italic;
  font-weight: 400; font-size: 22px; line-height: 1.35;
  color: var(--ll-ink); border-left: 3px solid var(--ll-yellow);
  padding: 6px 0 6px 20px;
}

/* ── Mobile nav drawer mechanics ─────────────────────────────── */
/* Hamburger lives in the top bar; hidden on desktop, shown ≤1100px */
.nav-toggle {
  display: none;
  width: 36px; height: 36px; padding: 0;
  align-items: center; justify-content: center;
  background: var(--ll-surface-4); border: 1px solid var(--ll-border);
  border-radius: var(--radius-pill); color: var(--ll-slate);
  cursor: pointer; flex-shrink: 0;
}
.nav-toggle:hover { color: var(--ll-ink); }
.nav-toggle svg { width: 18px; height: 18px; }
.dapp-scrim { display: none; }
body.nav-open { overflow: hidden; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .dapp-shell { grid-template-columns: 1fr; }

  /* Sidebar becomes an off-canvas drawer (full nav preserved) */
  .dapp-sidebar {
    position: fixed; top: 0; left: 0;
    width: 280px; max-width: 86vw;
    height: 100vh; height: 100dvh;
    z-index: 120;
    border-right: 1px solid var(--ll-border); border-bottom: 0;
    padding: 22px 0 28px;
    transform: translateX(-100%);
    transition: transform .26s ease;
    box-shadow: 0 0 40px rgba(0,0,0,.20);
    will-change: transform;
  }
  .dapp-sidebar.open { transform: translateX(0); }

  /* Dim/scrim layer behind the drawer */
  .dapp-scrim {
    display: block;
    position: fixed; inset: 0; z-index: 110;
    background: rgba(8,14,24,.55);
    opacity: 0; pointer-events: none;
    transition: opacity .26s ease;
  }
  .dapp-scrim.open { opacity: 1; pointer-events: auto; }

  .nav-toggle { display: inline-flex; }

  .dapp-top { padding: 12px 20px; gap: 12px; }
  .dapp-page { padding: 28px 20px 60px; }
  .grid-12 { grid-template-columns: repeat(6, 1fr); }
  .col-3, .col-4 { grid-column: span 3; }
  .col-5, .col-6 { grid-column: span 6; }
  .col-7, .col-8, .col-9 { grid-column: span 6; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head h1 { font-size: 36px; }
}
@media (max-width: 640px) {
  /* Top bar — keep only the essentials, push controls right */
  .dapp-top { padding: 10px 16px; gap: 10px; }
  .dapp-top .crumb { font-size: 10px; letter-spacing: 1.6px; margin-right: auto; }
  .dapp-top .search { display: none; }
  .dapp-top .net-pill { display: none; }
  .dapp-top .wallet-pill { padding: 6px; gap: 0; }
  .dapp-top .wallet-pill .addr,
  .dapp-top .wallet-pill > svg { display: none; }

  .dapp-page { padding: 22px 16px 56px; }
  .page-head { gap: 18px; margin-bottom: 28px; }
  .page-head h1 { font-size: 28px; padding-bottom: 16px; }
  .page-head h1::after { width: 72px; }
  .page-head .sub { font-size: 14px; margin-top: 10px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 auto; }

  .sec-title { font-size: 21px; }
  .card { padding: 20px; }
  .card-tight { padding: 16px; }
  .card-head { gap: 12px; }
  .card-head h3 { font-size: 19px; }

  .grid-12 { grid-template-columns: 1fr; }
  .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9 { grid-column: 1 / -1; }

  .bal-display .n { font-size: 40px; }
  .bal-display.lg .n { font-size: 46px; }
  .bal-display.sm .n { font-size: 30px; }
  .stat { padding: 18px; }
  .stat .v { font-size: 26px; }
  .vote-meta { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Tables collapse to stacked rows */
  .tbl thead { display: none; }
  .tbl tbody tr { display: block; padding: 14px 0; border-bottom: 1px solid var(--ll-border); }
  .tbl tbody td { display: block; padding: 4px 0; border: 0; text-align: left; }
  .tbl tbody td:last-child { text-align: left; }
}

/* ─────────────────────────────────────────────────────────────────
   DARK MODE — toggle by setting data-theme="dark" on <html>.
   Re-defines surface, border, and text tokens; then overrides
   the specific hard-coded #fff / surface-4 surfaces used in dapp.css
   and inline page styles.
   ──────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  /* Tokens — surfaces */
  --ll-surface:        #162033;   /* card */
  --ll-surface-2:      #0B1220;   /* page */
  --ll-surface-3:      #162033;
  --ll-surface-4:      #1F2C42;   /* fill, chip bg, table head */
  --ll-surface-input:  #1F2C42;
  --ll-border:         rgba(255,255,255,0.08);
  --ll-border-strong:  rgba(255,255,255,0.16);
  --ll-overlay:        rgba(11,18,32,0.92);

  /* Tokens — text */
  --ll-ink:    #F4F6F8;
  --ll-slate:  #C2D0DA;
  --ll-slate-2:#7E94A4;
  --ll-slate-3:#5C7080;
  --ll-slate-4:#7E94A4;

  /* Brighter colors that need to read on dark */
  --ll-blue:       #4FA0FF;
  --ll-blue-icon:  #6BB3FF;

  /* Semantic */
  --bg:        var(--ll-surface-2);
  --bg-card:   var(--ll-surface);
  --fg-1:      var(--ll-ink);
  --fg-2:      var(--ll-slate);
  --fg-3:      var(--ll-slate-2);
  --fg-muted:  var(--ll-slate-3);

  /* Card shadow softer / glow */
  --shadow-card: 0 0 0 1px rgba(255,255,255,0.04), 0 12px 32px rgba(0,0,0,0.35);
  --shadow-btn:  0 2px 4px rgba(0,0,0,0.4);
  --shadow-soft: 0 4px 14px rgba(0,0,0,0.4);
  --shadow-pop:  0 16px 38px rgba(0,0,0,0.55);
}

/* Body */
:root[data-theme="dark"] body { background: var(--ll-surface-2); color: var(--ll-slate); }

/* Surfaces with hard-coded #fff in dapp.css */
:root[data-theme="dark"] .dapp-sidebar,
:root[data-theme="dark"] .dapp-top,
:root[data-theme="dark"] .card,
:root[data-theme="dark"] .stat,
:root[data-theme="dark"] .qa,
:root[data-theme="dark"] .benefit,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .btn-icon,
:root[data-theme="dark"] .ext,
:root[data-theme="dark"] .ast,
:root[data-theme="dark"] .xfer,
:root[data-theme="dark"] .bnt,
:root[data-theme="dark"] .acc-row,
:root[data-theme="dark"] .ref-card,
:root[data-theme="dark"] .pcard,
:root[data-theme="dark"] .ref-hero,
:root[data-theme="dark"] .ref-hero .left,
:root[data-theme="dark"] .id-hero,
:root[data-theme="dark"] .id-hero .left,
:root[data-theme="dark"] .id-card,
:root[data-theme="dark"] .id-card .right,
:root[data-theme="dark"] .pipeline .stage,
:root[data-theme="dark"] .nominate-side,
:root[data-theme="dark"] .mp,
:root[data-theme="dark"] .sen {
  background: var(--bg-card);
}

/* Page bg variants */
:root[data-theme="dark"] .hero-bal,
:root[data-theme="dark"] .id-hero .left,
:root[data-theme="dark"] .ref-hero .left { background: var(--bg-card); }

/* Borders */
:root[data-theme="dark"] .dapp-sidebar { border-right-color: var(--ll-border); }
:root[data-theme="dark"] .dapp-top { border-bottom-color: var(--ll-border); }
:root[data-theme="dark"] .sb-brand { border-bottom-color: var(--ll-border); }
:root[data-theme="dark"] .acc-row,
:root[data-theme="dark"] .ext,
:root[data-theme="dark"] .qa,
:root[data-theme="dark"] .benefit,
:root[data-theme="dark"] .chip { border-color: var(--ll-border); }
:root[data-theme="dark"] .acc-row.primary { box-shadow: 0 0 0 3px rgba(241,200,35,.22); }
:root[data-theme="dark"] .ext.connected { box-shadow: 0 0 0 3px rgba(241,200,35,.14); }
:root[data-theme="dark"] .step .bub { background: var(--ll-surface-4); border-color: rgba(255,255,255,0.18); color: var(--ll-slate); }
:root[data-theme="dark"] .step.current .bub { background: var(--ll-surface); }

/* Inline `background: #fff` rescue — common inline-style targets in pages */
:root[data-theme="dark"] [style*="background: #fff"],
:root[data-theme="dark"] [style*="background:#fff"],
:root[data-theme="dark"] [style*="background-color: #fff"],
:root[data-theme="dark"] [style*="background-color:#fff"] {
  background: var(--bg-card) !important;
}
/* Avatar / sigil exceptions that intentionally use a white face */
:root[data-theme="dark"] .av.l { background: var(--ll-surface-4) !important; color: var(--ll-ink) !important; }

/* Top bar pills (surface-4 already maps, but they have inline borders) */
:root[data-theme="dark"] .dapp-top .search,
:root[data-theme="dark"] .dapp-top .wallet-pill {
  background: var(--ll-surface-4);
  border-color: var(--ll-border);
  color: var(--ll-slate);
}
:root[data-theme="dark"] .dapp-top .wallet-pill { color: var(--ll-ink); }
:root[data-theme="dark"] .dapp-top .wallet-pill .addr { color: var(--ll-slate); }

/* Table head */
:root[data-theme="dark"] .tbl thead th {
  background: var(--ll-surface-4);
  color: var(--ll-slate-2);
  border-bottom-color: var(--ll-border);
}
:root[data-theme="dark"] .tbl tbody td { border-bottom-color: rgba(255,255,255,0.04); }
:root[data-theme="dark"] .tbl tbody tr:hover td { background: rgba(241,200,35,0.06); }

/* Inputs */
:root[data-theme="dark"] .input {
  background: var(--ll-surface-4);
  border-color: var(--ll-border-strong);
  color: var(--ll-ink);
}

/* Buttons */
:root[data-theme="dark"] .btn-secondary { background: transparent; color: var(--ll-blue); border-color: var(--ll-blue); }
:root[data-theme="dark"] .btn-ghost { color: var(--ll-slate); border-color: var(--ll-border-strong); background: transparent; }
:root[data-theme="dark"] .btn-icon { background: var(--ll-surface-4); border-color: var(--ll-border); color: var(--ll-slate); }

/* Status tags — keep yellow strong; soften slate tag bg */
:root[data-theme="dark"] .tag-slate { background: rgba(255,255,255,0.06); color: var(--ll-slate); }
:root[data-theme="dark"] .tag-green { background: rgba(121,191,46,0.16); color: #b3df66; }
:root[data-theme="dark"] .tag-amber { background: rgba(241,200,35,0.18); color: #f1d169; }
:root[data-theme="dark"] .tag-blue  { background: rgba(79,160,255,0.16); color: #8cc1ff; }
:root[data-theme="dark"] .tag-red   { background: rgba(240,57,54,0.18); color: #f08a87; }

/* Sparkline / chart fill backgrounds: SVG strokes stay, just tints */
:root[data-theme="dark"] .vote-bar { background: rgba(255,255,255,0.06); }
:root[data-theme="dark"] .prog { background: rgba(255,255,255,0.08); }

/* Sidebar nav active state — already dark; keep yellow icon */
:root[data-theme="dark"] .sb-nav a { color: var(--ll-slate); }
:root[data-theme="dark"] .sb-nav a:hover { background: var(--ll-surface-4); color: var(--ll-ink); }
:root[data-theme="dark"] .sb-nav a.active { background: var(--ll-yellow); color: var(--ll-ink); }
:root[data-theme="dark"] .sb-nav a.active .ico { color: var(--ll-ink); }

/* Filter chips: surface-4 + brighter active */
:root[data-theme="dark"] .chip { background: var(--ll-surface-4); color: var(--ll-slate); }
:root[data-theme="dark"] .chip.active { background: var(--ll-yellow); color: var(--ll-ink); border-color: transparent; }
:root[data-theme="dark"] .chip .ct { color: var(--ll-slate-3); }
:root[data-theme="dark"] .chip.active .ct { color: rgba(0,0,0,0.45); }

/* Address pill */
:root[data-theme="dark"] .addr-pill { background: var(--ll-surface-4); border-color: var(--ll-border); color: var(--ll-slate); }
:root[data-theme="dark"] .addr-pill .copy { color: var(--ll-slate-3); }

/* Generic rgba(47,90,109,.x) dividers in inline styles → invert to light tint */
:root[data-theme="dark"] [style*="rgba(47,90,109"] { border-color: rgba(255,255,255,0.06) !important; }

/* Theme toggle button in topbar */
.theme-toggle {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ll-surface-4); border: 1px solid var(--ll-border);
  border-radius: var(--radius-pill); color: var(--ll-slate); cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--ll-ink); }
.theme-toggle .sun, .theme-toggle .moon { width: 16px; height: 16px; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .sun { display: none; }
:root:not([data-theme="dark"]) .theme-toggle .moon { display: block; }

/* Cosmetic touches for dark — slightly stronger yellow stripe glow */
:root[data-theme="dark"] .dapp-stripe { box-shadow: 0 0 18px rgba(241,200,35,0.45); }

/* Index page hero in dark */
:root[data-theme="dark"] .pcard .preview { background: var(--ll-surface-4); border-bottom-color: var(--ll-border); }
:root[data-theme="dark"] .pcard .preview .frame,
:root[data-theme="dark"] .pcard .preview [class*="panel"] { background: var(--ll-surface); }
:root[data-theme="dark"] .pcard .preview .line { background: rgba(255,255,255,0.10); }
:root[data-theme="dark"] .pcard .preview .bar-top { background: var(--ll-surface); }
:root[data-theme="dark"] .mini h4 { color: var(--ll-ink); }
:root[data-theme="dark"] .mini .balance { color: var(--ll-ink); }
:root[data-theme="dark"] .pcard .preview .mp-mini { background: var(--ll-surface); }
:root[data-theme="dark"] .pcard .preview .ast-mini { background: var(--ll-surface); }
:root[data-theme="dark"] .pcard .preview .rpc-mini { background: var(--ll-surface-4); }
:root[data-theme="dark"] .pcard .preview .rpc-mini.cur { background: var(--ll-surface); border-color: var(--ll-yellow); }
:root[data-theme="dark"] .pcard .preview .rung-mini { background: var(--ll-surface-4); color: var(--ll-ink); }
:root[data-theme="dark"] .pcard .preview .rung-mini.cur { background: var(--ll-ink); color: var(--ll-surface); }
:root[data-theme="dark"] .pcard .preview .stepper-mini { background: var(--ll-surface); }

/* Citizenship right card (subtle pattern) */
:root[data-theme="dark"] .id-card .right {
  background:
    radial-gradient(circle at 100% 0%, rgba(241,200,35,.10) 0%, rgba(241,200,35,0) 50%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 2px, transparent 2px 8px),
    var(--bg-card);
}
:root[data-theme="dark"] .id-card .right .grid .v { color: var(--ll-ink); }
:root[data-theme="dark"] .id-card .right .grid .l { color: var(--ll-slate-3); }
:root[data-theme="dark"] .id-card .qr { border-color: var(--ll-surface); background-color: var(--ll-surface-4); filter: invert(1) hue-rotate(180deg); }

/* Identity hero left panel typography on dark */
:root[data-theme="dark"] .id-hero .left { background: var(--bg-card); }
:root[data-theme="dark"] .id-hero .left .nm { color: var(--ll-ink); }
:root[data-theme="dark"] .id-hero .left .handle { color: var(--ll-slate-2); }
:root[data-theme="dark"] .quote { color: var(--ll-ink); }

/* Hero balance card (home) */
:root[data-theme="dark"] .hero-bal {
  background:
    radial-gradient(circle at 100% 0%, rgba(241,200,35,.10) 0%, rgba(241,200,35,0) 50%),
    var(--bg-card);
}
:root[data-theme="dark"] .hero-bal .row-tabs .t { color: var(--ll-slate-3); }
:root[data-theme="dark"] .hero-bal .row-tabs .t.active { color: var(--ll-ink); }

/* Index page wrap */
:root[data-theme="dark"] body { /* override base inline gradient on index */ }

/* Toggle switches */
:root[data-theme="dark"] .toggle { background: rgba(255,255,255,0.12); }
:root[data-theme="dark"] .toggle::after { background: #f4f6f8; }

/* Fix selectors that use `background: var(--ll-ink)` for active state —
   in dark mode --ll-ink is near-white, producing white-on-white. */
:root[data-theme="dark"] .set-nav a.active {
  background: var(--ll-yellow); color: var(--ll-ink);
}
:root[data-theme="dark"] .rpc-row.active {
  background: var(--ll-surface-4); border-color: var(--ll-yellow);
}
:root[data-theme="dark"] .ladder .rung.achieved {
  background: var(--ll-surface-4); border-color: var(--ll-yellow);
}
:root[data-theme="dark"] .ladder .rung.current {
  background: var(--ll-surface);
  border-color: var(--ll-yellow);
  box-shadow: 0 0 0 3px rgba(241,200,35,.22);
  color: var(--ll-ink);
}
:root[data-theme="dark"] .ladder .rung.current .lbl { color: var(--ll-slate-2); }
:root[data-theme="dark"] .ladder .rung.current .d { color: var(--ll-slate-2); }
:root[data-theme="dark"] .pcard .preview .rung-mini.cur {
  background: var(--ll-yellow); color: var(--ll-ink);
}
:root[data-theme="dark"] .pcard .preview .rung-mini.cur .y { color: var(--ll-ink); }

