/* ============================================================
   PIVX Tasks — Crystalline Design System
   Tokens live in brand.css. This file: base + components + layout.
   ============================================================ */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100dvh;
  position: relative;
}
img, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--purple-light); text-decoration: none; }
a:hover { color: #c4b5fd; }
ul, ol { list-style: none; }
::selection { background: var(--purple); color: var(--text-bright); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── Atmospheric backgrounds ── */
/* Hex grid pattern overlay — fixed, behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cpath d='M30 0 L60 15 L60 37 L30 52 L0 37 L0 15 Z' fill='none' stroke='%237C3AED' stroke-width='0.5' opacity='0.15'/%3E%3C/svg%3E");
  background-size: 60px 52px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse at center top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0.1) 100%);
  -webkit-mask-image: radial-gradient(ellipse at center top, rgba(0,0,0,1) 0%, rgba(0,0,0,0.4) 70%, rgba(0,0,0,0.1) 100%);
}
/* Ambient purple glow — anchored top-right so it stays clear of left-aligned hero copy */
body::after {
  content: '';
  position: fixed;
  top: -260px;
  right: -260px;
  width: 1000px;
  height: 700px;
  background: radial-gradient(ellipse at center, rgba(124, 58, 237, 0.22) 0%, rgba(124, 58, 237, 0.06) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  filter: blur(40px);
}

/* Stack everything above the bg layer */
.nav, main, .toast-root, .modal-root { position: relative; z-index: 1; }


/* ============================================================
   ANIMATIONS
   ============================================================ */

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes meshDrift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes crystalPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.15), 0 0 60px rgba(124, 58, 237, 0.05); }
  50% { box-shadow: 0 0 30px rgba(124, 58, 237, 0.35), 0 0 80px rgba(124, 58, 237, 0.12); }
}
@keyframes progressGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, -16px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0) scale(1); }
  to { opacity: 0; transform: translate(-50%, -12px) scale(0.96); }
}
/* Mobile variants — left/right edge-anchored, no horizontal translate */
@keyframes toastInMobile {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOutMobile {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-12px) scale(0.96); }
}
@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(40px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* Cascade: children animate in 60ms apart */
.stagger > * {
  animation: slideUp var(--duration-slow) var(--ease-out) both;
}
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 100ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 200ms; }
.stagger > *:nth-child(6) { animation-delay: 250ms; }
.stagger > *:nth-child(7) { animation-delay: 300ms; }
.stagger > *:nth-child(8) { animation-delay: 350ms; }
.stagger > *:nth-child(9) { animation-delay: 400ms; }
.stagger > *:nth-child(10) { animation-delay: 450ms; }
.stagger > *:nth-child(n+11) { animation-delay: 500ms; }

.view-enter { animation: slideUp var(--duration-slow) var(--ease-out) both; }


/* ============================================================
   TYPOGRAPHY UTILITIES
   ============================================================ */
.font-mono { font-family: var(--font-mono); }
.font-brand { font-family: var(--font-brand); letter-spacing: 0.1em; text-transform: uppercase; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-bright { color: var(--text-bright); }
.text-purple { color: var(--purple-light); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue { color: var(--blue); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.section-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-family: var(--font-brand);
}


/* ============================================================
   TOP NAV BAR
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(8, 8, 15, 0.65);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-inner {
  max-width: var(--content-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-bright);
  text-decoration: none;
}
.brand-mark:hover { color: var(--text-bright); }
/* Official PIVX horizontal lockup (shield + wordmark, white). The SVG
   ships at 1029.74×348.79 — we constrain by height and let the width
   auto-scale to the ~3:1 aspect ratio. */
.brand-logo {
  display: block;
  height: 26px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.45));
  transition: filter var(--duration-fast) var(--ease-out);
}
.brand-mark:hover .brand-logo {
  filter: drop-shadow(0 0 18px rgba(124, 58, 237, 0.7));
}
.brand-sub {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--purple-light);
  text-transform: uppercase;
  line-height: 1;
}
.brand-mark:hover .brand-sub { color: #c4b5fd; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--space-md);
}
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
  text-decoration: none;
}
.nav-link:hover { color: var(--text-primary); background: rgba(124, 58, 237, 0.06); }
.nav-link.active {
  color: var(--text-bright);
  background: var(--purple-glow);
  box-shadow: inset 0 0 0 1px var(--border-default);
}

.nav-spacer { flex: 1; }


/* ============================================================
   WALLET BAR (in-nav)
   ============================================================ */
.wallet-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
}
.wallet-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  background: var(--purple);
  color: var(--text-bright);
  box-shadow: var(--shadow-button);
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
}
.wallet-cta:hover { background: #8B47FF; box-shadow: var(--shadow-button-hover); transform: translateY(-1px); }
.wallet-cta-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  box-shadow: none;
}
.wallet-cta-secondary:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-strong);
  transform: none;
}

.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.wallet-pill:hover { border-color: var(--border-strong); background: var(--bg-card-hover); }
.wallet-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}
.wallet-pill-addr {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.wallet-pill-chev {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
}

/* Notifications bell — sits to the right of the wallet pill */
.bell-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}
.bell-btn:hover {
  color: var(--purple-light);
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}
.bell-btn svg { width: 16px; height: 16px; }
.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--red);
  color: var(--text-bright);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-deep);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: scaleIn 200ms var(--ease-out) both;
}
/* The `display: flex` above outranks the browser's default
   `[hidden] { display: none }` rule via specificity, so the badge would
   otherwise stay visible even when the JS sets `.hidden = true`. */
.bell-badge[hidden] { display: none; }
/* Bell-specific deltas only — border, radius, and shadow now live on the
   shared `.wallet-menu` rule via popup tokens. The selector chain stays
   `.wallet-menu.bell-menu` (specificity 0,2,0) so these win over any
   future plain `.wallet-menu` tweaks regardless of source order. */
.wallet-menu.bell-menu {
  width: 360px;
  max-width: calc(100vw - 16px);
  padding: 0;
  overflow: hidden;
}
.bell-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}
.bell-menu-list {
  max-height: 70vh;
  overflow-y: auto;
}
.bell-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
}
.bell-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px var(--space-md);
  border-top: 1px solid var(--border-subtle);
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  position: relative;
}
.bell-item:first-child { border-top: none; }
.bell-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.bell-item.unread { background: rgba(124, 58, 237, 0.06); }
.bell-item.unread:hover { background: rgba(124, 58, 237, 0.10); }
/* Read items dim slightly so unread ones pop. Hover restores full
   opacity so the row stays legible while you're acting on it. */
.bell-item:not(.unread) { opacity: 0.55; }
.bell-item:not(.unread):hover { opacity: 1; }
.bell-item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--purple-glow);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--purple-light);
}
.bell-item-icon svg { width: 14px; height: 14px; }
.bell-item-body { flex: 1; min-width: 0; }
.bell-item-text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
  word-wrap: break-word;
}
.bell-item-text strong { color: var(--text-bright); font-weight: 700; }
.bell-item-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.bell-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 6px var(--purple);
  flex-shrink: 0;
  margin-top: 8px;
}
/* Dismiss X — always visible at low opacity so it's discoverable,
   brightens on row hover, fully solid + bordered on the X itself.
   Sits inside the anchor; the JS handler peels its clicks off the
   navigate path. */
.bell-item-dismiss {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.bell-item-dismiss svg { width: 12px; height: 12px; }
.bell-item:hover .bell-item-dismiss { opacity: 0.8; }
.bell-item-dismiss:hover {
  opacity: 1;
  color: var(--text-primary);
  border-color: var(--border-default);
  background: var(--bg-card);
}

/* Wallet dropdown panel */
.wallet-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 320px;
  background: var(--bg-base);
  border: 1px solid var(--border-popup);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popup);
  padding: var(--space-md);
  z-index: 200;
  animation: scaleIn 200ms var(--ease-out) both;
  transform-origin: top right;
}
.wallet-menu-section + .wallet-menu-section {
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
}
.wallet-menu-label {
  font-family: var(--font-brand);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.wallet-menu-addr {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.wallet-menu-addr:hover { border-color: var(--border-default); }
/* Reputation badge under the handle in the wallet menu — shows the
   user's net rep at a glance, fetched lazily on menu open. Echoes the
   profile rep card's purple-bloom + glowing-number treatment, scaled
   down for the dropdown context. */
.wallet-menu-rep {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: radial-gradient(140% 200% at 100% 50%, rgba(124, 58, 237, 0.18), transparent 55%),
              var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}
.wallet-menu-rep-label {
  font-family: var(--font-brand);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  text-transform: uppercase;
}
.wallet-menu-rep-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  text-shadow: 0 0 14px rgba(167, 139, 250, 0.5),
               0 0 32px rgba(124, 58, 237, 0.18);
}
.wallet-menu-action {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: left;
}
.wallet-menu-action:hover { background: var(--bg-card); color: var(--text-primary); border-color: var(--border-subtle); }
.wallet-menu-action.danger:hover { color: var(--red); border-color: rgba(239, 68, 68, 0.2); background: rgba(239, 68, 68, 0.05); }
.wallet-menu-action svg { width: 16px; height: 16px; flex-shrink: 0; }


/* ============================================================
   MAIN LAYOUT
   ============================================================ */
main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg) var(--space-3xl);
  min-height: calc(100dvh - var(--nav-height));
}
main.reading { max-width: var(--reading-max); }
main.form { max-width: var(--form-max); }

.page-header {
  margin-bottom: var(--space-xl);
}
.page-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-bright);
  margin-bottom: 4px;
}
.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
}

.section { margin-bottom: var(--space-2xl); }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--purple);
  color: var(--text-bright);
  box-shadow: var(--shadow-button);
}
.btn-primary:hover {
  background: #8B47FF;
  box-shadow: var(--shadow-button-hover);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.25);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}
.btn-xl {
  padding: 20px 40px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-full { width: 100%; }


/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.hover-lift { cursor: pointer; }
.hover-lift:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.hover-lift:active { transform: translateY(0); }


/* ============================================================
   INPUTS / FORMS
   ============================================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-family: var(--font-brand);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.field-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.field-error {
  font-size: 12px;
  color: var(--red);
}
.input,
.textarea,
.select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-default); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--purple);
  background: var(--bg-base);
  box-shadow: 0 0 0 3px var(--purple-glow);
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input-mono { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.02em; }
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238B8BA0' stroke-width='2' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; padding-right: 40px; }
.input-error { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-dim); }


/* ============================================================
   PILLS / BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--font-brand);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-purple { background: var(--purple-glow); color: var(--purple-light); border-color: var(--border-default); }
.badge-green { background: var(--green-dim); color: var(--green); border-color: rgba(34, 197, 94, 0.25); }
.badge-red { background: var(--red-dim); color: var(--red); border-color: rgba(239, 68, 68, 0.25); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(234, 179, 8, 0.25); }
.badge-blue { background: var(--blue-dim); color: var(--blue); border-color: rgba(59, 130, 246, 0.25); }
.badge-muted { background: rgba(255, 255, 255, 0.04); color: var(--text-secondary); border-color: var(--border-subtle); }

.badge-dot::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* Status pill — derives color from data attribute */
.status[data-status="open"] { background: var(--purple-glow); color: var(--purple-light); border-color: var(--border-default); }
.status[data-status="in_progress"] { background: var(--yellow-dim); color: var(--yellow); border-color: rgba(234, 179, 8, 0.25); }
.status[data-status="submitted"] { background: var(--blue-dim); color: var(--blue); border-color: rgba(59, 130, 246, 0.25); }
.status[data-status="paid"] { background: var(--green-dim); color: var(--green); border-color: rgba(34, 197, 94, 0.25); }
.status[data-status="abandoned"] { background: var(--red-dim); color: var(--red); border-color: rgba(239, 68, 68, 0.25); }
.status[data-status="cancelled"] { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); border-color: var(--border-subtle); }

/* Pill toggle (segmented) */
.pill-toggle {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px;
  gap: 2px;
}
.pill-option {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  border: none;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}
.pill-option:hover:not(.active) { color: var(--text-secondary); }
.pill-option.active {
  background: var(--purple);
  color: var(--text-bright);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}


/* ============================================================
   ADDRESS / MONO DISPLAY
   ============================================================ */
.addr {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-all;
}
.addr-trunc {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}
.addr-link {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
.addr-link:hover { color: var(--purple-light); }

.copyable {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}
.copyable:hover { border-color: var(--border-default); background: var(--bg-card-hover); }
.copyable.copied { border-color: var(--green); color: var(--green); }
.copyable svg { width: 12px; height: 12px; opacity: 0.6; }


/* ============================================================
   MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: backdropIn 200ms ease both;
}
.modal-panel {
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  background: var(--bg-base);
  border: 1px solid var(--border-popup);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-popup);
  overflow-y: auto;
  animation: modalIn 300ms var(--ease-out) both;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-lg) var(--space-md);
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 1;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}
.modal-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
}
.modal-close svg { width: 14px; height: 14px; }
.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-strong);
}
.modal-body { padding: var(--space-lg); }
/* Stack form fields inside modals with breathing room between them
   so labels never kiss the control above. Scoped to modal bodies so
   non-modal forms (which often have their own layout) aren't shifted. */
.modal-body .field + .field { margin-top: var(--space-lg); }
.modal-actions {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}


/* ============================================================
   SEED PHRASE GRID (recovery / export modals)
   ============================================================ */
.seed-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: var(--space-md);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}
.seed-grid[data-count="21"],
.seed-grid[data-count="24"] { grid-template-columns: repeat(4, 1fr); }

.seed-word {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  min-width: 0;
}
.seed-word-i {
  font-size: 10px;
  color: var(--text-muted);
  min-width: 18px;
  flex-shrink: 0;
}
.seed-word-text {
  color: var(--text-primary);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 0;
}


/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  top: calc(var(--nav-height) + var(--space-md));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  font-size: 14px;
  font-weight: 500;
  max-width: calc(100vw - 32px);
  cursor: pointer;
  animation: toastIn 250ms var(--ease-out) both;
}
.toast.success { border-color: rgba(34, 197, 94, 0.3); }
.toast.success .toast-icon { color: var(--green); }
.toast.error { border-color: rgba(239, 68, 68, 0.3); }
.toast.error .toast-icon { color: var(--red); }
.toast.info .toast-icon { color: var(--purple-light); }
.toast.warning { border-color: rgba(234, 179, 8, 0.3); }
.toast.warning .toast-icon { color: var(--yellow); }
.toast-icon { display: flex; align-items: center; }
.toast-icon svg { width: 16px; height: 16px; }
.toast.fade-out { animation: toastOut 200ms ease forwards; }


/* ============================================================
   SPINNER
   ============================================================ */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  /* Align with the surrounding text baseline so it sits centered next to
     the "Broadcasting…" / "Verifying…" / etc. status copy instead of
     riding the top of the line like a superscript. */
  vertical-align: middle;
  /* Compensate for the slight visual heaviness of the bordered ring so
     the optical center matches the text x-height center. */
  margin-top: -2px;
}
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }


/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--text-muted);
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--space-md);
  opacity: 0.3;
  color: var(--purple-light);
}
.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.empty-state-text {
  font-size: 14px;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}


/* ============================================================
   SHIMMER LOADER
   ============================================================ */
.shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    var(--bg-card-hover) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-md);
}
.shimmer-line { height: 14px; margin: 6px 0; border-radius: 4px; }
.shimmer-line.thick { height: 20px; }
.shimmer-line.thin { height: 10px; }


/* ============================================================
   UTILITY
   ============================================================ */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }


/* ============================================================
   RESPONSIVE — three tiers
     ≤ 768px : tablet / wide phone landscape
     ≤ 540px : phone portrait (most phones, including S10's 360px)
     ≤ 380px : ultra-narrow (older / smaller phones)
   ============================================================ */
@media (max-width: 768px) {
  .nav-inner { padding: 0 var(--space-md); gap: var(--space-sm); }
  .nav-links { gap: 0; margin-left: 0; }
  .nav-link { padding: 6px 10px; font-size: 13px; }
  main { padding: var(--space-lg) var(--space-md) var(--space-2xl); }
  .page-title { font-size: 26px; }
}

@media (max-width: 540px) {
  /* Nav: drop the secondary nav links for breathing room — brand-mark
     stays a tap target back to home, wallet bar handles the rest.
     Stack logo + sub-mark vertically so we keep both pieces of brand
     identity (parent PIVX shield up top, "TASKS" below) without
     eating horizontal room from the wallet bar. */
  .nav-inner { padding: 0 var(--space-md); gap: var(--space-sm); }
  .brand-mark {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .brand-logo { height: 18px; }
  .brand-sub {
    font-size: 11px;
    color: var(--text-bright);
    letter-spacing: 0.24em;
    text-shadow: 0 0 14px rgba(124, 58, 237, 0.5);
  }
  .nav-links { display: none; }
  /* nav-spacer (flex: 1) stays — it's what keeps the wallet bar pinned right */
  .wallet-cta { padding: 7px 12px; font-size: 12px; }
  .wallet-cta-secondary { padding: 7px 10px; }
  .wallet-pill { padding: 4px 4px 4px 10px; gap: 6px; }
  .wallet-pill-addr { font-size: 11px; }
  .wallet-pill-chev { width: 24px; height: 24px; }

  /* Modal & toast: align to viewport edges so 360px-class phones fit */
  .modal-panel { max-width: calc(100vw - 16px); }
  .modal-header { padding: var(--space-md) var(--space-md) var(--space-sm); }
  .modal-body { padding: var(--space-md); }
  .modal-actions { padding: var(--space-sm) var(--space-md) var(--space-md); flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .toast {
    left: 8px;
    right: 8px;
    max-width: none;
    transform: none;
    animation: toastInMobile var(--duration-normal) var(--ease-out) both;
  }
  .toast.fade-out { animation: toastOutMobile 200ms ease forwards; }

  /* Wallet dropdown: anchor right but stay within viewport */
  .wallet-menu {
    right: 0;
    min-width: 0;
    width: calc(100vw - 16px);
    max-width: 320px;
  }

  .page-title { font-size: 22px; }
  .page-subtitle { font-size: 14px; }

  /* Address rendering on mobile: always break long mono strings */
  .addr, .addr-trunc, .copyable { word-break: break-all; }

  /* Seed grid: 2 cols at mobile (longest BIP39 word is 8 chars; 3 cols
     overflow on 360px screens). The [data-count] attribute selector
     matches the desktop specificity so this wins by source order. */
  .seed-grid[data-count] {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: var(--space-sm);
  }
  .seed-word { padding: 5px 8px; font-size: 12px; }
  .seed-word-i { font-size: 9px; min-width: 16px; }
}

@media (max-width: 380px) {
  /* Galaxy S10 territory — squeeze the wallet CTAs further */
  .wallet-cta-secondary { padding: 6px 8px; }
  .wallet-cta { padding: 6px 10px; }
}
