/* DIRA Gents — vault redesign components */

/* ── Hero: a real fintech account card ─────────────── */
.vault-hero {
  background:
    radial-gradient(1100px 500px at 90% -40%, rgba(0,102,255,0.28), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(0,102,255,0.10), transparent 65%),
    linear-gradient(160deg, var(--ink-hi) 0%, var(--ink) 100%);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: dira-fade-in var(--motion-slow) var(--ease-out) both;
}
body.theme-light .vault-hero {
  background:
    radial-gradient(1100px 500px at 90% -40%, rgba(0,102,255,0.10), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, rgba(0,102,255,0.05), transparent 65%),
    linear-gradient(160deg, #ffffff 0%, #f8faff 100%);
  border-color: var(--border-soft);
}

.vault-hero-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: start;
}
@media (max-width: 767px) {
  .vault-hero { padding: 24px 22px; }
  .vault-hero-grid { grid-template-columns: 1fr; gap: 24px; }
}
/* Tighter hero padding on small phones — combined with the .container
 * 14px gutter at ≤520px we were burning 36px of horizontal space per
 * side. Dropping to 16px gives the hero numbers and sparkline ~12px
 * more room each side without making the card feel cramped. */
@media (max-width: 520px) {
  .vault-hero { padding: 22px 16px; }
}

.vault-hero-eyebrow {
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 700;
}

.vault-hero-amount {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 10px;
  position: relative;
}
/* "On track" highlight — when the user has paid the Finance monthly
 * minimum (KES 1,500) or fully cleared the Mombasa pool (KES 8,000),
 * we draw a faint green-grad bar under the hero number. It's purely a
 * visual cue: tells the user at a glance that they're current without
 * forcing them to read the M-Pesa cards below. */
.vault-hero-amount.is-on-track::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  height: 3px;
  width: 88px;
  border-radius: 999px;
  background: var(--green-grad);
  opacity: 0.55;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.22);
}
.vault-hero-currency {
  font-size: var(--text-md);
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.vault-hero-number {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  /* clamp(min, fluid, max). The previous floor of 48px was too rigid on
   * 320–360px phones — long KES totals + tabular-nums would butt
   * against the currency badge. 11vw scales smoothly with the
   * viewport while the 40px floor protects against absurd shrinking
   * on dev-tool weirdness. Desktop max stays 76px. */
  font-size: clamp(40px, 11vw, 76px);
  font-weight: 600;
  letter-spacing: -2.5px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
body.theme-light .vault-hero-number {
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.vault-hero-pools {
  display: flex;
  gap: 22px;
  margin-top: 16px;
  font-size: var(--text-sm);
  flex-wrap: wrap;
}
.vault-hero-pool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.vault-hero-pool .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}
.vault-hero-pool .dot.fin { background: var(--brand-300); }
/* Mombasa pool dot — orange so it visually pairs with the rest of the
 * orange "second brand" surfaces (vote alert, leadership badge). The
 * Finance pool dot stays blue so the two pools read as distinct. */
.vault-hero-pool .dot.msa { background: var(--orange-500); }
.vault-hero-pool-label { color: var(--text-dim); }
.vault-hero-pool-value {
  font-family: "JetBrains Mono", monospace;
  color: var(--text);
  font-weight: 600;
}

.vault-hero-spark {
  margin-top: 22px;
  display: block;
  width: 100%;
  height: 64px;
}
.vault-hero-spark-axis {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Side KPIs — pills on dark glass */
.vault-hero-side {
  display: grid;
  gap: 18px;
  min-width: 200px;
}
@media (max-width: 767px) {
  .vault-hero-side { min-width: 0; grid-auto-flow: column; grid-auto-columns: minmax(120px, 1fr); overflow-x: auto; gap: 12px; padding-bottom: 4px; scroll-snap-type: x mandatory; }
  .vault-hero-side > * { scroll-snap-align: start; }
}

.vault-kpi {
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.vault-kpi-eyebrow {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  font-weight: 700;
}
.vault-kpi-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-top: 4px;
  color: var(--text);
}
.vault-kpi-value.accent { color: var(--brand-300); }
.vault-kpi-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.vault-kpi--ring {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.vault-kpi--ring .vault-kpi-content { flex: 1; min-width: 0; }
.vault-kpi-ring { flex-shrink: 0; }

.vault-share-bar { /* container for charts.js */ }

/* Status pill row (small chip strip across the hero footer area) */
.vault-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.vault-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--glass-hi);
  border: 1px solid var(--glass-stroke);
  color: var(--text-dim);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
}
.vault-status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--brand-300);
}
.vault-status-pill.urgent {
  border-color: rgba(0,102,255,0.5);
  color: var(--text);
  background: rgba(0,102,255,0.12);
}
.vault-status-pill.urgent .dot {
  background: var(--brand-500);
  animation: dira-pulse-ring 1.6s var(--ease-out) infinite;
}
.vault-action-card {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--card);
  border: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
}
.vault-action-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.vault-action-tag {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.vault-action-cta {
  font-size: 12px;
  font-weight: 700;
  margin-top: 10px;
  color: var(--accent-hi);
}
.vault-mpesa-card {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  /* Token-aligned with --green-500 (#22c55e) so the M-Pesa card now
   * reads as deeper "money green" rather than the older mint
   * (#4ade80). --mpesa-bg-soft already follows this hue. */
  background: var(--mpesa-bg-soft);
  border: 1px solid var(--mpesa-border);
  position: relative;
  overflow: hidden;
}
.vault-mpesa-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--mpesa);
}
.vault-pool-sub {
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 10px 12px;
  flex: 1;
}
.vault-pool-sub.msa {
  border: 1px solid rgba(90,142,232,0.3);
}
.vault-pool-sub.fin {
  border: 1px solid var(--mpesa-border-hi);
}
.vault-stk-btn {
  width: 100%;
  padding: 7px 0;
  border-radius: 7px;
  border: none;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 8px;
  transition: opacity 120ms;
}
.vault-stk-btn:hover { opacity: 0.88; }
.vault-stk-btn.fin { background: var(--success); color: #022c0a; }
.vault-stk-btn.msa { background: var(--accent); color: #fff; }
.vault-quickpay {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--mpesa-bg);
  border: 1px solid var(--mpesa-border);
  margin-top: 18px;
}
.vault-quickpay-btn {
  padding: 9px 16px;
  border-radius: 8px;
  border: none;
  background: var(--success);
  color: #022c0a;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity 120ms;
}
.vault-quickpay-btn:hover { opacity: 0.88; }
.vault-quickpay-btn-sec {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--mpesa-border-hi);
  background: transparent;
  color: var(--mpesa);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 120ms;
}
.vault-sidebar {
  width: 64px;
}
.vault-nav-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid transparent;
  transition: color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out);
  color: var(--muted);
  background: transparent;
  position: relative;
}
.vault-nav-icon:hover {
  color: var(--text);
  background: var(--accent-bg2);
  transform: translateY(-1px);
}
.vault-nav-icon:active { transform: translateY(0) scale(0.96); }
.vault-nav-icon.active {
  color: #fff;
  background: var(--brand-grad);
  border-color: transparent;
  box-shadow: var(--brand-glow);
}
body.theme-light .vault-nav-icon.active { color: #fff; }
.vault-nav-icon:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.vault-nav-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 7px; height: 7px;
  border-radius: 999px;
}
.vault-greeting-h {
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: 500;
  letter-spacing: -0.5px;
}
.vault-chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--card);
}
.vault-attention-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) {
  .vault-attention-grid { grid-template-columns: 1fr; }
}
.vault-leaderboard-row {
  display: grid;
  grid-template-columns: 22px 28px 1fr 90px 110px;
  gap: 12px;
  padding: 9px 10px;
  align-items: center;
  border-radius: 8px;
  font-size: 13px;
  transition: background 120ms;
}
.vault-leaderboard-row:hover {
  background: var(--accent-bg2);
}
/* STK Modal overlay */
.vault-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 7, 26, 0.55);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  display: grid;
  place-items: center;
  z-index: 9999;
  animation: dira-fade-in var(--motion-base) var(--ease-out) both;
}
body.theme-light .vault-modal-overlay {
  background: rgba(244, 246, 251, 0.65);
}
.vault-modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px 28px 24px;
  width: min(440px, 90vw);
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: dira-scale-in var(--motion-base) var(--ease-spring) both;
}

/* Mobile: become a bottom-sheet */
@media (max-width: 767px) {
  .vault-modal-overlay { align-items: end; }
  .vault-modal-card {
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 22px 22px max(28px, env(safe-area-inset-bottom));
    animation: dira-sheet-up var(--motion-base) var(--ease-spring) both;
    position: relative;
  }
  /* Drag-handle pill at the top of the sheet */
  .vault-modal-card::before {
    content: "";
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: var(--border);
    margin: -6px auto 14px;
  }
}
.vault-modal-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  font-family: "JetBrains Mono", monospace;
  outline: none;
  transition: border-color 120ms;
}
.vault-modal-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
body.theme-light .vault-modal-input { background: rgba(0,0,0,0.04); }
/* spinner */
@keyframes vault-spin { to { transform: rotate(360deg); } }
.vault-spinner {
  width: 52px; height: 52px;
  border-radius: 999px;
  border: 3px solid var(--mpesa-bg-strong);
  border-top-color: var(--mpesa);
  animation: vault-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}

/* ── Quick-action grid (Pay / RSVP / Vote / Loan) ──── */
.vault-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.vault-quick-action {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-stroke);
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: transform var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-base) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.vault-quick-action:hover {
  transform: translateY(-2px);
  border-color: rgba(0,102,255,0.45);
  box-shadow: var(--brand-glow);
}
.vault-quick-action:active { transform: translateY(0) scale(0.98); }

.vault-quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--brand-grad);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,102,255,0.25);
}
/* The "Cast a vote" quick action — orange so it reads as "this matters"
 * rather than a generic warning yellow. */
.vault-quick-icon.orange {
  background: var(--orange-grad);
  box-shadow: 0 4px 14px rgba(255, 107, 53, 0.28);
}
/* Money-flavoured quick action (e.g. M-Pesa-style flows) — pulls from
 * the refined --green-500 token now so it stays consistent with the
 * rest of the "money" surfaces. */
.vault-quick-icon.green {
  background: var(--green-grad);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.28);
}

.vault-quick-title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.2px;
}
.vault-quick-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── End Vault additions ───────────────────────────── */
