/* Vector Hub's shared kit: the Vector app's widescreen grammar on the web. Rubik, the settings
   nav with its anchor timeline, headed blocks in one column, neutral-grey dialogs, and the
   controls every Hub page shares. The account dashboard and the control panel both build on it. */

@font-face {
  font-family: 'Rubik';
  src: url('/fonts/Rubik.woff2') format('woff2-variations'), url('/fonts/Rubik.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #030303;
  --pane: #050505;
  --nav: #0b0b0b;
  --seam: #171717;
  --line: #262626;
  --edge: #2c2e2f;
  --card: #101010;
  --tile: #0c0c0c;
  --tile-line: #1e1e1e;
  --field: #111111;
  --raise: #151515;
  --active: #1b1b1b;
  --chip: #1a1a1a;
  --text: #ffffff;
  --text-2: #b2b2b2;
  --text-3: #9a9a9a;
  --text-4: #7a7a7a;
  --text-5: #5b6060;
  --dim: #474747;
  --green: #59fcb3;
  --green-2: #33db98;
  --green-3: #2b976c;
  --yellow: #fce459;
  --orange: #fca559;
  --danger: #fc595c;
  --volt-a: #d266f2;
  --volt-b: #9a60f0;
  --volt: linear-gradient(160deg, var(--volt-a), var(--volt-b));
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --soft: cubic-bezier(0.4, 0, 0.2, 1);
  --nav-h: 61px;
  --gutter: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body {
  font-family: Rubik, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
::selection { background-color: rgba(255, 255, 255, 0.225); color: #fff; }
button { font-family: inherit; color: inherit; }
a { color: inherit; }
img { display: block; }
.vh-icon { display: inline-flex; width: 16px; height: 16px; flex-shrink: 0; }
.vh-icon svg { width: 100%; height: 100%; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

::-webkit-scrollbar { width: 10px; height: 10px; background-color: transparent; }
::-webkit-scrollbar-track { background-color: transparent; }
::-webkit-scrollbar-thumb { background-color: #474747; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(180, 180, 180, 0.8); }
* { scrollbar-width: thin; scrollbar-color: #474747 transparent; }

/* ── Site nav ───────────────────────────────────────────────────────────────── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  background: rgba(3, 3, 3, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--seam);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 100%;
  padding: 0 18px 0 22px;
}
.nav-brand { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.nav-logo-icon { width: 38px; height: auto; display: block; }
.nav-logo-text { width: 100px; height: auto; display: block; }
.nav-links { display: flex; align-items: center; gap: 0.25rem; margin-right: auto; }
.nav-link {
  color: #9a9a9a;
  text-decoration: none;
  font-size: 14px;
  padding: 0.45rem 0.8rem;
  border-radius: 9px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-account { display: flex; align-items: center; min-width: 0; }

.acct-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 260px;
  padding: 5px 10px 5px 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.acct-chip:hover, .acct-chip[aria-expanded="true"] { background: rgba(255, 255, 255, 0.09); }
.acct-chip .av { width: 30px; height: 30px; }
.acct-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
}
.acct-caret {
  flex: none;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(255, 255, 255, 0.4);
  transition: transform 0.16s ease, border-top-color 0.12s ease;
}
.acct-chip:hover .acct-caret { border-top-color: rgba(255, 255, 255, 0.75); }
.acct-chip[aria-expanded="true"] .acct-caret { transform: rotate(180deg); }

.menu {
  position: fixed;
  z-index: 80;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  transform-origin: top right;
  animation: menu-in 0.16s var(--ease);
}
.menu.closing { animation: menu-out 0.12s ease-in forwards; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.97); } }
@keyframes menu-out { to { opacity: 0; transform: translateY(-4px) scale(0.97); } }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head .av { width: 36px; height: 36px; }
.menu-head-name { font-weight: 700; font-size: 14px; }
.menu-head-npub { color: var(--text-4); font-size: 12px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.menu-item:hover { background: var(--raise); color: #fff; }
.menu-item .vh-icon { color: var(--text-5); transition: color 0.12s ease; }
.menu-item:hover .vh-icon { color: #fff; }
.menu-item.danger, .menu-item.danger .vh-icon { color: var(--danger); }

/* ── Boot ───────────────────────────────────────────────────────────────────── */

.boot {
  position: fixed;
  inset: var(--nav-h) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  animation: fade-in 0.4s ease 0.35s forwards;
}
.boot span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.2s ease-in-out infinite; }
.boot span:nth-child(2) { animation-delay: 0.15s; }
.boot span:nth-child(3) { animation-delay: 0.3s; }
@keyframes fade-in { to { opacity: 1; } }
@keyframes pulse { 0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); } 40% { opacity: 0.9; transform: scale(1); } }
.noscript { text-align: center; color: var(--text-3); margin-top: 20vh; }

/* ── Avatars ────────────────────────────────────────────────────────────────── */

.av {
  position: relative;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #161616;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0a;
  font-weight: 700;
  background: linear-gradient(160deg, var(--green), var(--green-3));
}

/* ── Confirmation ring and shake ────────────────────────────────────────────── */

@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}
.done-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(89, 252, 179, 0.1);
  box-shadow: 0 0 0 1.5px rgba(89, 252, 179, 0.5);
  color: var(--green);
  animation: pop 0.42s var(--ease);
}
.done-ring svg { width: 34px; height: 34px; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 0.42s var(--ease) 0.12s forwards; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ── The dashboard shell: the settings layout ───────────────────────────────── */

.dash {
  display: flex;
  height: calc(100dvh - var(--nav-h));
}
.dash-nav {
  display: flex;
  flex-direction: column;
  width: 260px;
  flex-shrink: 0;
  background: var(--nav);
  border-right: 1px solid var(--seam);
  user-select: none;
}
.dash-nav-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 10px 18px; }
.nav-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 16px;
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--line);
}
.nav-head .av { width: 38px; height: 38px; border-radius: 11px; }
.nav-head-text { min-width: 0; }
.nav-head-name { font-size: 14px; line-height: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-head-npub {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-4);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.12s ease;
}
.nav-head-npub:hover { color: #fff; }
.nav-head-npub .vh-icon { width: 12px; height: 12px; }

.ns-section {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  padding: 0 9px;
  margin: 0 0 1px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 19px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.ns-section { text-decoration: none; }
.ns-section:hover { background: var(--raise); color: #fff; }
.ns-section.active { background: var(--active); color: #fff; }
.ns-section .vh-icon { color: var(--text-5); transition: color 0.12s ease; }
.ns-section:hover .vh-icon, .ns-section.active .vh-icon { color: #fff; }
.ns-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 17px;
  text-align: center;
}
.ns-section.active .ns-count { background: #262626; color: #fff; }
.ns-section.volt-row.active .vh-icon, .ns-section.volt-row:hover .vh-icon { color: var(--volt-a); }

.ns-anchors-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s var(--ease); }
.ns-anchors-wrap.open { grid-template-rows: 1fr; }
.ns-anchors {
  position: relative;
  min-height: 0;
  overflow: hidden;
  padding: 0 0 0 38px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.2s ease, transform 0.28s var(--ease), padding 0.28s var(--ease);
}
.ns-anchors-wrap.open > .ns-anchors { padding-top: 1px; padding-bottom: 16px; opacity: 1; transform: none; }
.ns-anchor {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 26px;
  padding: 0 8px 0 2px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: color 0.15s ease;
}
.ns-anchor::after { content: ''; position: absolute; left: 4.5px; top: 0; bottom: 0; width: 2px; background: #444; }
.ns-anchor.first::after { top: 50%; }
.ns-anchor.last::after { bottom: 50%; }
.ns-anchor.first.last::after { display: none; }
.ns-anchor:hover { color: #e6e6e6; }
.ns-anchor.active { color: #fff; }
.ns-dot {
  position: relative;
  z-index: 1;
  width: 7px;
  height: 7px;
  margin-right: 2px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #444;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.ns-anchor.active .ns-dot { background: #e6e6e6; transform: scale(1.12); }
.ns-anchor-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-foot { padding: 12px 10px 16px; border-top: 1px solid var(--seam); }
.nav-foot .ns-section { font-size: 14px; height: 34px; }
.nav-foot .ns-section.danger, .nav-foot .ns-section.danger .vh-icon { color: var(--danger); }
.nav-foot .ns-section.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.dash-main { position: relative; display: flex; flex-direction: column; flex: 1; min-width: 0; background: var(--pane); }
.dash-top {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 18px 0 28px;
  border-bottom: 1px solid var(--seam);
  flex-shrink: 0;
}
.dash-top-title { flex: 1; min-width: 0; margin: 0; font-size: 16px; line-height: 19px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-top-actions { display: flex; align-items: center; gap: 8px; }
.dash-scroll { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.dash-content { max-width: 700px; margin: 0 auto; padding: 8px 36px 120px; }
.enter { animation: rise 0.34s var(--ease); }
/* Entrances fill backwards only: a forwards fill keeps owning transform, so hover transitions never run. */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Headed blocks, as in Settings. */
.block { padding: 30px 0 34px; scroll-margin-top: 12px; }
.block + .block { border-top: 1px solid var(--line); }
.block-head { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.heading { margin: 0; font-size: 24px; line-height: 28px; font-weight: 700; }
.block-head .heading { flex: 1; min-width: 0; }
.lede { margin: -6px 0 18px; color: var(--text-3); font-size: 14px; line-height: 1.55; }
.group-label { margin: 18px 0 8px; color: var(--dim); font-size: 14px; line-height: 17px; }
.muted { color: var(--text-4); }
.note { margin: 12px 0 0; color: var(--text-4); font-size: 12.5px; line-height: 1.5; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, opacity 0.12s ease, filter 0.12s ease, transform 0.12s ease;
}
.btn .vh-icon { width: 15px; height: 15px; color: rgba(255, 255, 255, 0.75); }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.24); }
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { border-color: var(--green-2); background: var(--green-2); color: var(--bg); }
.btn.primary .vh-icon { color: var(--bg); }
.btn.primary:hover:not(:disabled) { background: var(--green-2); border-color: var(--green-2); filter: brightness(1.08); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger .vh-icon { color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 24%, transparent); border-color: color-mix(in srgb, var(--danger) 65%, transparent); }
.btn.volt { border-color: transparent; background: var(--volt); color: #fff; box-shadow: 0 6px 22px rgba(176, 98, 240, 0.28); }
.btn.volt .vh-icon { color: #fff; }
.btn.volt .bolt { width: 13px; height: 16px; }
.btn.volt .bolt path { fill: #fff; }
.btn.volt:hover:not(:disabled) { border-color: transparent; background: var(--volt); filter: brightness(1.1); }
.btn.volt:disabled { opacity: 0.35; box-shadow: none; }
.btn.ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--raise); border-color: transparent; color: #fff; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn.busy { pointer-events: none; }
.btn.busy > * { opacity: 0; }
.btn.busy::after {
  content: '';
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { padding: 0; border: none; background: none; color: var(--green-2); font-size: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ── Pills ──────────────────────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--dim);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill.listed, .pill.good { color: var(--green); border-color: rgba(89, 252, 179, 0.3); background: rgba(89, 252, 179, 0.06); }
.pill.listed .dot, .pill.good .dot { box-shadow: 0 0 6px rgba(89, 252, 179, 0.7); }
.pill.review, .pill.warn { color: var(--yellow); border-color: rgba(252, 228, 89, 0.28); background: rgba(252, 228, 89, 0.05); }
.pill.review .dot { animation: breathe 1.8s ease-in-out infinite; }
.pill.hidden, .pill.caution { color: var(--orange); border-color: rgba(252, 165, 89, 0.3); background: rgba(252, 165, 89, 0.06); }
.pill.delisted { color: var(--text-2); }
.pill.removed, .pill.rejected, .pill.bad { color: var(--danger); border-color: rgba(252, 89, 92, 0.3); background: rgba(252, 89, 92, 0.06); }
.pill.volt { color: #e7c6ff; border-color: rgba(210, 102, 242, 0.45); background: rgba(154, 96, 240, 0.08); }
.pill.sm { height: 20px; padding: 0 8px; font-size: 11px; gap: 5px; }
.pill.tag { color: var(--text-2); border-color: var(--dim); background: none; }
.pill.official { color: var(--green); border-color: rgba(89, 252, 179, 0.3); }
.pill.premium {
  border: none;
  color: #fff;
  background: var(--volt);
  box-shadow: 0 4px 18px rgba(176, 98, 240, 0.28);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.pill.partial { color: #e7c6ff; border-color: rgba(210, 102, 242, 0.45); background: rgba(154, 96, 240, 0.08); font-weight: 500; }
.pill.free { color: var(--text-2); }
@keyframes breathe { 50% { opacity: 0.35; } }

.bolt { display: inline-block; flex-shrink: 0; }
.volt-text {
  background: linear-gradient(170deg, #f0c4ff, var(--volt-a) 40%, var(--volt-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── Stat tiles ─────────────────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px 13px;
  border: 1px solid var(--tile-line);
  border-radius: 14px;
  background: var(--tile);
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.2s var(--ease);
  animation: rise 0.5s var(--ease) backwards;
}
.stat:nth-child(2) { animation-delay: 0.06s; }
.stat:nth-child(3) { animation-delay: 0.12s; }
.stat:hover { background: #121212; border-color: #2a2a2a; transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; width: 100%; color: var(--text-4); font-size: 12px; }
.stat-top .vh-icon { width: 14px; height: 14px; color: var(--text-5); transition: transform 0.2s var(--ease), color 0.15s ease; }
.stat:hover .stat-top .vh-icon { transform: translateX(2px); color: #fff; }
.stat-num { font-size: 26px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-4); font-size: 12px; }

.ledger { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--tile); }
.entry {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  animation: rise 0.4s var(--ease) backwards;
}
.entry + .entry { border-top: 1px solid #1a1a1a; }
.entry-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(154, 96, 240, 0.14); }
.entry-icon .bolt { width: 13px; height: 16px; }
.entry.out .entry-icon { background: var(--chip); }
.entry-memo { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-when { color: var(--text-4); font-size: 12px; }
.entry-amt { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.entry.in .entry-amt { color: #e7c2ff; }
.entry.out .entry-amt { color: var(--text-2); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 24px 40px;
  border: 1px dashed #2a2a2a;
  border-radius: 18px;
  text-align: center;
  animation: rise 0.45s var(--ease) backwards;
}
.empty-art { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.9; }
.empty h3 { margin: 0; font-size: 18px; font-weight: 700; }
.empty p { max-width: 360px; margin: 8px 0 20px; color: var(--text-3); font-size: 14px; line-height: 1.55; }

/* ── Dialogs: the app's neutral-grey card ───────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.18s ease both;
  opacity: 0;
}
.modal-overlay.closing { animation: fade-out 0.15s ease-out forwards; pointer-events: none; }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
.modal {
  display: flex;
  flex-direction: column;
  width: min(100%, 460px);
  max-height: calc(100dvh - 40px);
  border: 1px solid var(--edge);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  animation: card-pop 0.16s ease-out;
}
.modal.wide { width: min(100%, 540px); }
.modal-overlay.closing .modal { animation: card-pop-out 0.15s ease-out forwards; }
@keyframes card-pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes card-pop-out { from { transform: scale(1); opacity: 1; } to { transform: scale(0.92); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid rgba(57, 57, 57, 0.5); }
.modal-label { flex: 1; min-width: 0; margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.45); }
.modal-x {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1.5px solid #3a3a3a;
  border-radius: 50%;
  background: none;
  color: #9a9a9a;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}
.modal-x:hover { border-color: #9a9a9a; color: #fff; }
.modal-x .vh-icon { width: 14px; height: 14px; }
.modal-inner { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-inner > div { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { flex: none; }
.modal-title { margin: 0 0 6px; font-size: 20px; line-height: 25px; font-weight: 700; }
.modal-text { margin: 0; color: var(--text-3); font-size: 14px; line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 16px 16px; border-top: 1px solid rgba(57, 57, 57, 0.5); }
.modal-section + .modal-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.modal-section h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.modal-section .hint { margin: 0 0 12px; color: var(--text-4); font-size: 12.5px; line-height: 1.5; }

.field-label { display: block; margin-bottom: 8px; color: #cfcfcf; font-size: 13px; font-weight: 500; }
.input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  background: var(--field);
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}
.input::placeholder { color: #6f6f6f; }
.input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(89, 252, 179, 0.1); }
.input.err { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
.row { display: flex; gap: 8px; align-items: center; }
.row .input { flex: 1; min-width: 0; }
.form-msg { min-height: 0; margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.form-msg:empty { display: none; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: var(--green); }
.skel { border-radius: 8px; background: linear-gradient(90deg, #141414 25%, #1d1d1d 50%, #141414 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 4px;
  text-align: center;
}
.result .done-ring { margin-bottom: 16px; }

/* vselect inside dialogs */
.modal .vselect { width: 100%; }
.modal .vselect-btn { height: 44px; border-radius: 10px; background: var(--field); border-color: #2c2c2c; font-size: 14.5px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px 11px 14px;
  border: 1px solid #1d1d1d;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 14px;
  transform: translate(-50%, 8px);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.3s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .vh-icon { color: var(--green); }
.toast.err .vh-icon { color: var(--danger); }

/* ── Shared controls ────────────────────────────────────────────────────────── */

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.quiet { margin: 0; padding: 16px; color: var(--text-4); font-size: 13px; line-height: 1.5; }

/* A bordered stack of rows: ledgers, devices, people, cards. */
.list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--tile); }
.list > * + * { border-top: 1px solid #1a1a1a; }

/* A note set into a page or a card. */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 11px;
  background: rgba(252, 165, 89, 0.06);
  border: 1px solid rgba(252, 165, 89, 0.2);
  color: #f7d3b2;
  font-size: 13px;
  line-height: 1.45;
}
.notice .vh-icon { margin-top: 1px; color: var(--orange); }
.notice.info { background: rgba(255, 255, 255, 0.03); border-color: var(--line); color: var(--text-2); }
.notice.info .vh-icon { color: var(--text-4); }
.notice.bad { background: rgba(252, 89, 92, 0.06); border-color: rgba(252, 89, 92, 0.22); color: #f7b9ba; }
.notice.bad .vh-icon { color: var(--danger); }
.notice.ok { background: rgba(89, 252, 179, 0.05); border-color: rgba(89, 252, 179, 0.18); color: #b5f3d6; }
.notice.ok .vh-icon { color: var(--green); }
.notice + .notice { margin-top: 8px; }

/* Segmented control: a few views of one thing. */
.seg { display: inline-flex; gap: 2px; max-width: 100%; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #0b0b0b; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg button:hover { color: #fff; }
.seg button.on { background: #222; color: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset; }
.seg button .n { margin-left: 6px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.seg button.on .n { color: var(--text-2); }

/* Search and sorting above a list. */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.toolbar .spacer { flex: 1; }
.search { position: relative; flex: 1 1 220px; min-width: 0; }
.search .vh-icon { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--text-5); pointer-events: none; }
.search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid #2c2c2c;
  border-radius: 10px;
  background: var(--field);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.2s ease;
}
.search input::placeholder { color: #6f6f6f; }
.search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(89, 252, 179, 0.1); }
.toolbar .vselect { width: auto; min-width: 170px; flex: 0 0 auto; }
.toolbar .vselect-btn { height: 36px; min-height: 0; border-radius: 10px; background: var(--field); border-color: #2c2c2c; font-size: 13px; }

/* Form fields. */
.field + .field { margin-top: 18px; }
.field-hint { margin: 7px 0 0; color: var(--text-4); font-size: 12px; line-height: 1.5; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field .vselect { width: 100%; }
.field .vselect-btn { height: 44px; border-radius: 10px; background: var(--field); border-color: #2c2c2c; font-size: 14.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  height: 28px;
  padding: 0 11px;
  border: 1px solid #2c2c2c;
  border-radius: 999px;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}
.chip:hover { border-color: #474747; color: #fff; }
.chip.on { border-color: rgba(89, 252, 179, 0.45); color: var(--green); background: rgba(89, 252, 179, 0.06); }

/* On/off, with what it means beside it. */
.switch { position: relative; display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch-track { position: relative; flex: none; width: 38px; height: 22px; margin-top: 1px; border-radius: 999px; background: #2a2a2a; transition: background-color 0.18s ease; }
.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #9a9a9a;
  transition: transform 0.22s var(--ease), background-color 0.18s ease;
}
.switch input:checked + .switch-track { background: var(--green-2); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid rgba(89, 252, 179, 0.7); outline-offset: 2px; }
.switch-text b { display: block; font-size: 14px; font-weight: 500; }
.switch-text span { display: block; margin-top: 2px; color: var(--text-4); font-size: 12.5px; line-height: 1.45; }

/* One of a few options, each with a line on what it does. */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { position: relative; display: block; padding: 12px 14px; border: 1px solid #2c2c2c; border-radius: 12px; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease; }
.choice:hover { background: rgba(255, 255, 255, 0.025); }
.choice.on { border-color: rgba(89, 252, 179, 0.5); background: rgba(89, 252, 179, 0.05); }
.choice input[type="radio"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice-title { font-size: 14px; font-weight: 600; }
.choice-text { margin-top: 2px; color: var(--text-3); font-size: 12.5px; line-height: 1.45; }
.choice textarea { margin-top: 10px; }

/* Stat tiles that only report. */
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat.static { cursor: default; }
.stat.static:hover { transform: none; background: var(--tile); border-color: var(--tile-line); }
.stat.warn { border-color: rgba(252, 228, 89, 0.32); }
.stat-sub.up { color: var(--green); }
.stat-sub.down { color: var(--orange); }

/* ── Small screens: the nav becomes a strip of tabs ─────────────────────────── */

@media (max-width: 899px) {
  :root { --nav-h: 57px; }
  .nav-inner { gap: 0.75rem; padding: 0 12px 0 14px; }
  .acct-chip-name { display: none; }
  .acct-chip { padding: 4px 8px 4px 4px; }
  .dash { display: block; height: auto; }
  .dash-nav {
    position: sticky;
    top: var(--nav-h);
    z-index: 40;
    width: auto;
    border-right: none;
    border-bottom: 1px solid var(--seam);
    background: rgba(11, 11, 11, 0.92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .dash-nav-scroll {
    display: flex;
    gap: 6px;
    padding: 9px var(--gutter);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .dash-nav-scroll::-webkit-scrollbar { display: none; }
  .nav-head, .ns-anchors-wrap, .nav-foot { display: none; }
  .ns-section { width: auto; height: 34px; padding: 0 12px; margin: 0; flex-shrink: 0; font-size: 14px; border-radius: 999px; border: 1px solid #222; }
  .ns-section.active { border-color: #333; }
  .ns-count { margin-left: 2px; }
  .dash-main { background: var(--bg); }
  .dash-top { display: none; }
  .dash-scroll { overflow: visible; }
  .dash-content { padding: 0 var(--gutter) 90px; }
  .block { padding: 26px 0 28px; }
  .heading { font-size: 22px; }
  .stats { gap: 8px; }
  .stats.four { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 12px 12px 11px; }
  .stat-num { font-size: 22px; line-height: 28px; }
  .field-row { grid-template-columns: 1fr; }
}
@media (min-width: 900px) { .mobile-only { display: none !important; } }
@media (max-width: 480px) {
  .nav-logo-text { display: none; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stat-top .vh-icon { display: none; }
  .stat-top { font-size: 11.5px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; border-bottom: none; }
  .modal-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; height: 42px; }
  @keyframes card-pop { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes card-pop-out { from { transform: none; opacity: 1; } to { transform: translateY(24px); opacity: 0; } }
}

@media (hover: none) {
  .stat:hover { transform: none; }
}

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

/* A refresh redraws in place; only opening a section plays its entrance. */
.settled .stat, .settled .entry, .settled .empty { animation: none; }

/* Keyboard focus, in Vector green. */
.btn:focus-visible, .ns-section:focus-visible, .ns-anchor:focus-visible, .stat:focus-visible, .acct-chip:focus-visible,
.menu-item:focus-visible, .modal-x:focus-visible, .link-btn:focus-visible, .nav-head-npub:focus-visible,
.seg button:focus-visible, .chip:focus-visible, .choice:focus-within {
  outline: 2px solid rgba(89, 252, 179, 0.7);
  outline-offset: 2px;
}
.btn:focus:not(:focus-visible) { outline: none; }

.dash { animation: appear 0.32s ease both; }
@keyframes appear { from { opacity: 0; } }

/* ── Sign-in stage: the app's login, on the web ──────────────────────────────── */

.signin {
  position: relative;
  min-height: calc(100dvh - var(--nav-h));
  display: grid;
  grid-template-rows: minmax(max-content, 1fr) auto minmax(max-content, 1.2fr);
  justify-items: center;
  padding: 0 var(--gutter);
  text-align: center;
  overflow: hidden;
}
.signin-glow {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 760px;
  height: 760px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(51, 219, 152, 0.07), transparent 70%);
  pointer-events: none;
}
.signin-head { align-self: end; padding: 48px 0 28px; }
.signin-lockup { width: min(330px, calc(100vw - 48px)); height: auto; margin: 0 auto; }
.signin-sub {
  margin: 14px 0 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 3.2px;
  text-transform: uppercase;
}
.signin-stage { position: relative; width: 100%; max-width: 420px; display: grid; }
.signin-step {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.28s ease, transform 0.36s var(--ease), visibility 0s linear 0.36s;
}
.signin-step.out { opacity: 0; transform: translateY(10px); visibility: hidden; pointer-events: none; }
.signin-step.out.back { transform: translateY(-10px); }
.signin-step:not(.out) { transition-delay: 0.06s, 0.06s, 0s; }
.lg-title { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.lg-title img { width: 20px; height: auto; }
.lg-title h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 1.6px; }
.lg-lede { margin: -10px 0 22px; max-width: 330px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.lg-lede b { color: #fff; font-weight: 500; }
.lg-msg {
  min-height: 18px;
  margin: 12px 0 0;
  max-width: 330px;
  color: var(--text-3);
  font-size: 12.5px;
  line-height: 1.45;
  transition: color 0.15s ease;
}
.lg-msg.err { color: var(--danger); }
.lg-msg.ok { color: var(--green); }
.lg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 270px;
  max-width: calc(100vw - 40px);
  height: 50px;
  padding: 0 16px;
  border: 1px solid #393b3c;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 18px;
  font-weight: 400;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.lg-btn:hover:not(:disabled) { border-color: var(--text-5); }
.lg-btn.primary { border-color: var(--green-2); background: var(--green-2); color: var(--bg); font-weight: 500; }
.lg-btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.lg-btn:disabled { opacity: 0.5; cursor: default; }
.lg-back { margin: 24px 0 0; color: var(--text-2); font-size: 11px; letter-spacing: 1.1px; }
.lg-back button, .lg-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--green-2);
  font-size: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.lg-back button:hover, .lg-link:hover:not(:disabled) { text-decoration: underline; }
.lg-link { margin-top: 16px; font-size: 11px; letter-spacing: 1.1px; }
.lg-back a { color: var(--green-2); text-decoration: none; }
.lg-back a:hover { text-decoration: underline; }
.lg-btn .vh-icon { width: 18px; height: 18px; }
.lg-link:disabled { color: var(--text-4); cursor: default; text-decoration: none; }
.signin-foot { align-self: start; padding: 36px 0 40px; color: var(--text-5); font-size: 11.5px; line-height: 1.6; max-width: 360px; }

@media (max-width: 480px) {
  .signin-head { padding-top: 34px; }
}
.lg-btn:focus-visible { outline: 2px solid rgba(89, 252, 179, 0.7); outline-offset: 2px; }
.lg-btn:focus:not(:focus-visible) { outline: none; }
.signin { transition: opacity 0.26s ease, transform 0.26s var(--ease); }
.signin.leaving { opacity: 0; transform: scale(0.985); }

/* ── The Volts gift card ────────────────────────────────────────────────────── */
/* Sized by its width (container units), so the same face prints at 85.6 × 54 mm and shows on
   screen at any size. */

.gcard {
  position: relative;
  width: 340px;
  aspect-ratio: 1.586;
  border-radius: 18px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(210, 102, 242, 0.42), transparent 55%),
    radial-gradient(90% 100% at 0% 100%, rgba(154, 96, 240, 0.3), transparent 60%),
    linear-gradient(150deg, #1c1224 0%, #110c16 55%, #0b0a0d 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 24px 60px rgba(0, 0, 0, 0.45);
  container-type: inline-size;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  user-select: none;
}
.gcard::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(240, 184, 255, 0.7), rgba(255, 255, 255, 0.05) 38%, rgba(255, 255, 255, 0.03) 62%, rgba(154, 96, 240, 0.6));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.gcard-mark { position: absolute; right: -9cqw; top: 50%; width: 52cqw; transform: translateY(-50%) rotate(-10deg); opacity: 0.1; pointer-events: none; }
.gcard-mark .bolt { width: 100%; height: auto; }
.gcard-body { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 6.4cqw 7cqw 6cqw; }
.gcard-top { display: flex; align-items: center; justify-content: space-between; gap: 3cqw; }
.gcard-brand { display: flex; align-items: center; gap: 2.2cqw; font-size: 3.1cqw; font-weight: 700; letter-spacing: 0.75cqw; color: rgba(255, 255, 255, 0.82); }
.gcard-brand svg { width: 5.6cqw; height: auto; }
.gcard-kind { font-size: 2.7cqw; font-weight: 700; letter-spacing: 0.7cqw; text-transform: uppercase; background: linear-gradient(90deg, #f0b8ff, #d266f2 50%, #9a60f0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gcard-mid { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.gcard-amount { display: flex; align-items: center; gap: 2.4cqw; font-size: 13.5cqw; line-height: 1; font-weight: 800; letter-spacing: -0.3cqw; font-variant-numeric: tabular-nums; }
.gcard-amount .bolt { width: 7.6cqw; height: auto; filter: drop-shadow(0 1cqw 3cqw rgba(176, 98, 240, 0.55)); }
.gcard-unit { margin-top: 1.4cqw; font-size: 2.9cqw; font-weight: 700; letter-spacing: 0.9cqw; color: rgba(255, 255, 255, 0.58); }
.gcard-msg { margin-top: 2.2cqw; max-width: 64cqw; font-size: 3.3cqw; line-height: 1.35; font-style: italic; color: rgba(255, 255, 255, 0.72); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gcard-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 3cqw; }
.gcard-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 4.3cqw; font-weight: 600; letter-spacing: 0.35cqw; color: #fff; white-space: nowrap; }
.gcard-where { margin-top: 1cqw; font-size: 2.4cqw; letter-spacing: 0.2cqw; color: rgba(255, 255, 255, 0.5); }
.gcard-qr { position: absolute; right: 6cqw; bottom: 6cqw; display: flex; flex-direction: column; align-items: center; gap: 1.2cqw; }
.gcard-qr-tile { width: 25cqw; padding: 1.4cqw; border-radius: 2.4cqw; background: #fff; }
.gcard-qr-tile svg { display: block; width: 100%; height: auto; }
.gcard-qr span { font-size: 2cqw; font-weight: 700; letter-spacing: 0.5cqw; color: rgba(255, 255, 255, 0.6); }
.gcard.has-qr .gcard-msg { max-width: 56cqw; }

/* Ink saver: the same card on white. */
.gcard.light { color: #111; background: #fff; box-shadow: inset 0 0 0 0.3mm #d0d0d0; }
.gcard.light::before { padding: 0; background: linear-gradient(90deg, #d266f2, #9a60f0); height: 2.2cqw; inset: 0 0 auto 0; -webkit-mask: none; mask: none; border-radius: 0; }
.gcard.light .gcard-mark { opacity: 0.08; }
.gcard.light .gcard-brand { color: #222; }
.gcard.light .gcard-unit, .gcard.light .gcard-where, .gcard.light .gcard-qr span { color: #666; }
.gcard.light .gcard-msg { color: #444; }
.gcard.light .gcard-code { color: #111; }
.gcard.light .gcard-qr-tile { box-shadow: inset 0 0 0 0.25mm #ddd; }

/* ── The QR scanner ─────────────────────────────────────────────────────────── */

.scan-sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(3, 3, 3, 0.86);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: appear 0.2s ease;
}
.scan-sheet.closing { animation: fade-out 0.18s ease-out forwards; pointer-events: none; }
.scan-box { display: flex; flex-direction: column; align-items: stretch; gap: 16px; width: min(100%, 380px); animation: card-pop 0.22s var(--ease); }
.scan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.scan-head b { font-size: 17px; font-weight: 700; }
.scan-view {
  position: relative;
  aspect-ratio: 1;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(70% 70% at 50% 50%, rgba(154, 96, 240, 0.16), transparent 70%),
    #0b0a0d;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 90px rgba(176, 98, 240, 0.12);
}
.scan-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.35s ease, filter 0.3s ease; }
.scan-view.mirror .scan-video { transform: scaleX(-1); }
.scan-view.live .scan-video { opacity: 1; }
.scan-frame {
  position: absolute;
  inset: 11%;
  color: #fff;
  filter: drop-shadow(0 0 6px rgba(210, 102, 242, 0.85)) drop-shadow(0 0 18px rgba(154, 96, 240, 0.5));
  animation: scan-breathe 2.4s ease-in-out infinite;
  transition: color 0.2s ease, filter 0.2s ease, transform 0.35s var(--ease);
}
.scan-frame svg { display: block; width: 100%; height: 100%; }
@keyframes scan-breathe { 50% { transform: scale(0.97); } }
.scan-beam {
  position: absolute;
  left: 15%;
  right: 15%;
  top: 15%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, #f0b8ff 30%, #d266f2 50%, #f0b8ff 70%, transparent);
  box-shadow: 0 0 14px 2px rgba(210, 102, 242, 0.55);
  opacity: 0;
  animation: scan-sweep 2.2s ease-in-out infinite alternate;
}
.scan-view.live .scan-beam { opacity: 1; transition: opacity 0.4s ease; }
@keyframes scan-sweep { to { top: 85%; } }
.scan-got {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: var(--green);
  color: #062b1b;
  box-shadow: 0 0 0 10px rgba(89, 252, 179, 0.16), 0 0 50px rgba(89, 252, 179, 0.5);
  opacity: 0;
  transform: scale(0.4);
}
.scan-got svg { position: absolute; inset: 22%; width: 56%; height: 56%; }
.scan-got path { stroke-dasharray: 24; stroke-dashoffset: 24; }
.scan-view.found .scan-video { filter: brightness(0.45) saturate(0.6); }
.scan-view.found .scan-beam { display: none; }
.scan-view.found .scan-frame { color: var(--green); filter: drop-shadow(0 0 8px rgba(89, 252, 179, 0.9)); transform: scale(0.9); animation: none; }
.scan-view.found .scan-got { opacity: 1; transform: none; transition: opacity 0.18s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.scan-view.found .scan-got path { animation: draw 0.32s 0.12s ease-out forwards; }
.scan-hint { min-height: 22px; margin: 0; text-align: center; font-size: 14px; line-height: 22px; color: var(--text-3); transition: color 0.2s ease; }
.scan-hint.err { color: var(--orange); }
.scan-hint.ok { color: var(--green); font-weight: 600; }
.scan-fail { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); text-align: center; }
.scan-fail .vh-icon { width: 26px; height: 26px; color: var(--text-4); }
.scan-fail b { font-size: 16px; }
.scan-fail p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) {
  .scan-frame { animation: none; }
}
