:root {
  --bg-obsidian: #fbf6ec;
  --bg-surface: #fffdf8;
  --bg-card: #fffdf8;
  --bg-card-alt: #f2e9d8;
  --ink-black: #141218;
  --ink-border: #141218;
  --cream: #141218;
  --text-primary: #141218;
  --text-muted: #5a5166;

  --saffron: #ffd13b;
  --mint: #a3e635;
  --mint-ink: #15803d;
  --coral: #ff4d2e;
  --coral-ink: #c8230a;
  --violet: #1d4ed8;
  --orchid: #9333ea;
  --magenta: #ec4899;
  --cobalt: #1d4ed8;

  --shadow-pop: 4px 4px 0px #141218;
  --shadow-pop-sm: 2.5px 2.5px 0px #141218;
  --shadow-saffron: 4px 4px 0px #1d4ed8;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: "Bricolage Grotesque", system-ui, -apple-system, sans-serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --nav-height: 74px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ==================== DESKTOP AMBIENT + MOBILE SHELL ==================== */
.ambient-bg {
  display: none;
}

.app-shell {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 10% 8%, rgba(255, 209, 59, 0.28), transparent 36%),
    radial-gradient(circle at 92% 16%, rgba(29, 78, 216, 0.14), transparent 38%),
    radial-gradient(circle at 82% 88%, rgba(163, 230, 53, 0.24), transparent 36%),
    radial-gradient(rgba(20, 18, 24, 0.1) 1px, transparent 1px),
    var(--bg-obsidian);
  background-size: 100% 100%, 100% 100%, 100% 100%, 20px 20px, auto;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

@media (min-width: 540px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #efe5d1;
  }

  .ambient-bg {
    display: block;
    position: fixed;
    inset: 0;
    background:
      radial-gradient(circle at 18% 22%, rgba(255, 77, 46, 0.2), transparent 44%),
      radial-gradient(circle at 82% 72%, rgba(29, 78, 216, 0.18), transparent 46%),
      radial-gradient(circle at 50% 50%, rgba(163, 230, 53, 0.2), transparent 60%);
    pointer-events: none;
    z-index: 0;
  }

  .app-shell {
    position: relative;
    z-index: 1;
    max-width: 440px;
    height: min(880px, calc(100dvh - 32px));
    min-height: 600px;
    border-radius: 34px;
    border: 3px solid var(--ink-black);
    box-shadow: 10px 10px 0px #141218, 0 28px 60px rgba(20, 18, 24, 0.2);
  }
}

/* ==================== TYPOGRAPHY & BADGES ==================== */
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

.stamp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  border: 1.5px solid var(--ink-black);
  background: var(--saffron);
  color: var(--ink-black);
  box-shadow: 2px 2px 0 var(--ink-black);
}

.stamp-mint { background: var(--mint); color: var(--ink-black); }
.stamp-coral { background: var(--coral); color: #ffffff; }
.stamp-violet { background: var(--cobalt); color: #ffffff; }
.stamp-saffron { background: var(--saffron); color: var(--ink-black); }
.stamp-dark { background: var(--ink-black); color: var(--saffron); border-color: var(--ink-black); }

/* ==================== BUTTONS & INPUTS ==================== */
button {
  font-family: var(--font-body);
  cursor: pointer;
  touch-action: manipulation;
}

.btn-pop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  border: 2.5px solid var(--ink-black);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  color: var(--ink-black);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-pop:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink-black);
}

.btn-pop:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-saffron { background: var(--saffron); }
.btn-mint { background: var(--mint); }
.btn-coral { background: var(--coral); color: #ffffff; }
.btn-violet { background: var(--cobalt); color: #ffffff; }
.btn-cream { background: #ffffff; color: var(--ink-black); }

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop-sm);
}

.btn-block {
  width: 100%;
}

.btn-outline-sm {
  padding: 6px 12px;
  min-height: 34px;
  border-radius: 999px;
  border: 2px solid var(--ink-black);
  background: var(--bg-surface);
  color: var(--ink-black);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink-black);
}

.btn-outline-sm:active {
  transform: translate(1.5px, 1.5px);
  box-shadow: none;
  background: var(--saffron);
}

.btn-icon-ghost,
.btn-icon-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--ink-black);
  background: var(--bg-card-alt);
  color: var(--ink-black);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 var(--ink-black);
}

.link-btn {
  background: none;
  border: none;
  color: var(--cobalt);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field-group label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-black);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--ink-black);
  background: #ffffff;
  color: var(--ink-black);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder {
  color: #8c8299;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cobalt);
  box-shadow: 3px 3px 0 var(--cobalt);
}

.input-with-action {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-action input {
  padding-right: 46px;
}

.toggle-pass-btn {
  position: absolute;
  right: 8px;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--ink-black);
  border-radius: 8px;
  background: var(--bg-card-alt);
  color: var(--ink-black);
  font-size: 14px;
}

/* ==================== TOAST STACK ==================== */
.toast-stack {
  position: absolute;
  top: calc(10px + var(--safe-top));
  left: 12px;
  right: 12px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--ink-black);
  box-shadow: var(--shadow-pop);
  color: var(--ink-black);
  background: #ffffff;
  animation: toastIn 0.24s cubic-bezier(0.2, 1.2, 0.3, 1);
}

.toast.toast-success { background: var(--mint); }
.toast.toast-error { background: var(--coral); color: #ffffff; }
.toast.toast-info { background: var(--saffron); }
.toast.toast-warning { background: #fde047; }

.toast-icon {
  font-size: 18px;
  line-height: 1.2;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-body strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.toast-body span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.94;
  word-break: break-word;
}

.toast-close {
  border: 1.5px solid rgba(20, 18, 24, 0.3);
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-weight: 800;
}

.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3.5px;
  width: 100%;
  background: rgba(20, 18, 24, 0.45);
  transform-origin: left;
  animation: toastProgress 3.6s linear forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

/* ==================== INSTALL BANNER ==================== */
.install-banner {
  margin: calc(8px + var(--safe-top)) 12px 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--ink-black);
  background: linear-gradient(135deg, #dbeafe, #fef3c7);
  color: var(--ink-black);
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 40;
}

.install-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.install-banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--ink-black);
  flex-shrink: 0;
}

.install-banner-copy strong {
  display: block;
  font-size: 13px;
  margin-top: 2px;
}

.install-banner-copy small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==================== AUTH VIEW ==================== */
.auth-view {
  flex: 1;
  overflow-y: auto;
  padding: calc(14px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-hero-card {
  position: relative;
  border-radius: var(--radius-xl);
  border: 2.5px solid var(--ink-black);
  overflow: hidden;
  min-height: 190px;
  box-shadow: var(--shadow-pop);
  background: #141218;
}

.auth-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
}

.auth-hero-overlay {
  position: relative;
  z-index: 1;
  padding: 18px;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: linear-gradient(180deg, rgba(20, 18, 24, 0.2) 0%, rgba(20, 18, 24, 0.9) 88%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 2.5px solid #ffd13b;
  box-shadow: var(--shadow-pop-sm);
}

.brand-lockup h1 {
  font-size: clamp(26px, 6vw, 32px);
  font-weight: 800;
  color: #fffdf8;
  line-height: 1.05;
  margin-top: 4px;
}

.auth-tagline {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #f3ead8;
  font-weight: 600;
}

.auth-card {
  background: var(--bg-card);
  border: 2.5px solid var(--ink-black);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-pop);
}

.segmented-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 5px;
  border-radius: var(--radius-md);
  background: var(--bg-card-alt);
  border: 2px solid var(--ink-black);
  margin-bottom: 16px;
}

.seg-tab {
  min-height: 40px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.seg-tab.active {
  background: var(--saffron);
  color: var(--ink-black);
  border-color: var(--ink-black);
  box-shadow: 2px 2px 0 var(--ink-black);
}

.server-config-bar {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed #d8ceb8;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* ==================== MAIN APP SHELL ==================== */
.main-app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.top-bar {
  padding: calc(10px + var(--safe-top)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(251, 246, 236, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 2.5px solid var(--ink-black);
  z-index: 20;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--ink-black);
  background: linear-gradient(135deg, var(--saffron), var(--coral));
  color: var(--ink-black);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-pop-sm);
  flex-shrink: 0;
}

.user-meta {
  min-width: 0;
}

.user-greeting {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--cobalt);
}

.user-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-pill-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px solid var(--ink-black);
  background: var(--bg-surface);
  color: var(--ink-black);
  font-size: 16px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink-black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-pill-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
  background: var(--saffron);
}

/* ==================== TAB VIEWPORT ==================== */
.tab-viewport {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px calc(var(--nav-height) + var(--safe-bottom) + 22px);
  scroll-behavior: smooth;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.tab-panel.active {
  display: flex;
  animation: fadeSlideUp 0.2s ease;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== HERO BALANCE CARD ==================== */
.hero-balance-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 3px solid var(--ink-black);
  background: linear-gradient(135deg, #1d4ed8 0%, #5b21b6 55%, #ff4d2e 100%);
  color: #ffffff;
  box-shadow: var(--shadow-pop);
}

.hero-card-pattern {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.08) 0px,
      rgba(255, 255, 255, 0.08) 6px,
      transparent 6px,
      transparent 16px
    );
  pointer-events: none;
}

.hero-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chip-action-btn {
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink-black);
  background: #fffdf8;
  color: var(--ink-black);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink-black);
}

.hero-amount {
  position: relative;
  z-index: 1;
  margin: 14px 0 16px;
  font-size: clamp(28px, 8vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fffdf8;
  text-shadow: 3px 3px 0 #141218;
}

.hero-quick-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.hero-pill-btn {
  min-height: 40px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 2px solid var(--ink-black);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 2.5px 2.5px 0 var(--ink-black);
  color: var(--ink-black);
}

.hero-pill-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.hero-pill-mint { background: var(--mint); }
.hero-pill-coral { background: #fffdf8; }
.hero-pill-violet { background: var(--saffron); }

/* ==================== SECTION HEADERS ==================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.section-header h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink-black);
}

.section-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ==================== ACCOUNTS CAROUSEL ==================== */
.accounts-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 6px;
  scrollbar-width: none;
}

.accounts-carousel::-webkit-scrollbar {
  display: none;
}

.account-card {
  flex: 0 0 min(215px, 74vw);
  scroll-snap-align: start;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--ink-black);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  overflow: hidden;
  color: var(--ink-black);
}

.account-card.source-cash {
  background: linear-gradient(155deg, #ecfccb, #d9f99d);
}

.account-card.source-bank {
  background: linear-gradient(155deg, #dbeafe, #ede9fe);
}

.account-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.account-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--ink-black);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-balance {
  font-size: 21px;
  font-weight: 800;
  color: var(--ink-black);
}

.account-card-actions {
  display: flex;
  gap: 6px;
}

.account-mini-btn {
  flex: 1;
  min-height: 32px;
  border-radius: 9px;
  border: 2px solid var(--ink-black);
  background: #fffdf8;
  color: var(--ink-black);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 1.5px 1.5px 0 var(--ink-black);
}

.account-mini-btn.accent {
  background: var(--saffron);
  color: var(--ink-black);
}

/* ==================== BENTO METRICS ==================== */
.pill-filter-group {
  display: flex;
  gap: 4px;
  background: var(--bg-card-alt);
  padding: 4px;
  border-radius: 999px;
  border: 2px solid var(--ink-black);
}

.mini-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
}

.mini-pill.active {
  background: var(--saffron);
  color: var(--ink-black);
  border-color: var(--ink-black);
}

.bento-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-card {
  padding: 13px;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--ink-black);
  box-shadow: var(--shadow-pop-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink-black);
}

.metric-coral { background: #ff6b52; color: #ffffff; }
.metric-mint { background: #bef264; }
.metric-saffron { background: #ffd13b; }
.metric-violet { background: #bfdbfe; }

.metric-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: clamp(17px, 4.5vw, 21px);
  font-weight: 800;
}

.metric-card small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
}

/* ==================== EDITORIAL CARDS & CHARTS ==================== */
.editorial-card {
  padding: 16px;
  border-radius: var(--radius-xl);
  border: 2.5px solid var(--ink-black);
  background: var(--bg-card);
  box-shadow: var(--shadow-pop);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title-row h3 {
  font-size: 17px;
  margin-top: 4px;
}

.badge-count {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--saffron);
  border: 1.5px solid var(--ink-black);
  color: var(--ink-black);
}

.donut-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.donut-svg-box {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.donut-center span {
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.donut-center strong {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink-black);
}

.cat-bars-list,
.method-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 190px;
}

.bar-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 5px;
}

.bar-track {
  height: 11px;
  border-radius: 999px;
  background: var(--bg-card-alt);
  border: 1.5px solid var(--ink-black);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ==================== FILTER PANEL & CARD LIST ==================== */
.filter-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-lg);
  background: var(--bg-card-alt);
  border: 2px solid var(--ink-black);
  box-shadow: var(--shadow-pop-sm);
}

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-row select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 13px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.txn-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--ink-black);
  background: var(--bg-card);
  box-shadow: var(--shadow-pop-sm);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.txn-card:active {
  transform: translate(2px, 2px);
}

.txn-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  border: 2px solid var(--ink-black);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 2px 2px 0 var(--ink-black);
}

.txn-main {
  flex: 1;
  min-width: 0;
}

.txn-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.txn-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.micro-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1.5px solid var(--ink-black);
  background: var(--bg-card-alt);
  color: var(--ink-black);
}

.txn-right {
  text-align: right;
  flex-shrink: 0;
}

.txn-amount {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
}

.amt-credit { color: var(--mint-ink); }
.amt-debit { color: var(--coral-ink); }
.amt-neutral { color: var(--cobalt); }

/* ==================== BORROW-LEND CARDS ==================== */
.loan-hero-strip,
.ledger-totals-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.loan-stat,
.ledger-total-pill {
  padding: 11px 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--ink-black);
  box-shadow: var(--shadow-pop-sm);
  text-align: center;
  color: var(--ink-black);
}

.loan-stat span,
.ledger-total-pill span {
  display: block;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.loan-stat strong,
.ledger-total-pill strong {
  display: block;
  font-size: 14px;
  margin-top: 4px;
}

.loan-stat-lend,
.pill-credit { background: #dcfce7; }

.loan-stat-borrow,
.pill-debit { background: #fee2e2; }

.loan-stat-net,
.pill-net { background: #fef08a; }

.person-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--ink-black);
  background: var(--bg-card);
  box-shadow: var(--shadow-pop-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.person-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.person-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 2px solid var(--ink-black);
  background: var(--cobalt);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  box-shadow: 2px 2px 0 var(--ink-black);
}

.person-identity h4 {
  font-size: 16px;
  text-transform: capitalize;
  margin-bottom: 3px;
}

.person-split-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.person-split-box {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-card-alt);
  border: 1.5px solid var(--ink-black);
  font-size: 11px;
}

.person-split-box strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  margin-top: 2px;
  color: var(--ink-black);
}

.person-card-foot {
  display: flex;
  gap: 8px;
}

/* ==================== BOTTOM NAVIGATION BAR ==================== */
.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding: 6px 10px calc(8px + var(--safe-bottom));
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(12px);
  border-top: 2.5px solid var(--ink-black);
  box-shadow: 0 -6px 20px rgba(20, 18, 24, 0.08);
  display: grid;
  grid-template-columns: 1fr 1fr 64px 1fr 1fr;
  align-items: center;
  gap: 4px;
  z-index: 30;
}

.nav-item {
  height: 50px;
  border: 2px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.15s ease;
}

.nav-item.active {
  background: var(--saffron);
  color: var(--ink-black);
  border-color: var(--ink-black);
  box-shadow: 2.5px 2.5px 0 var(--ink-black);
}

.nav-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
}

.nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.nav-fab {
  width: 56px;
  height: 56px;
  margin: -22px auto 0;
  border-radius: 18px;
  border: 3px solid var(--ink-black);
  background: linear-gradient(135deg, var(--coral), var(--saffron));
  color: var(--ink-black);
  font-size: 28px;
  font-weight: 800;
  box-shadow: var(--shadow-pop);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.14s ease;
}

.nav-fab:active {
  transform: scale(0.94) translateY(2px);
}

/* ==================== MODAL / BOTTOM SHEET ==================== */
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: rgba(20, 18, 24, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.16s ease;
}

.modal-sheet {
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-obsidian);
  border-top: 3px solid var(--ink-black);
  border-left: 2px solid var(--ink-black);
  border-right: 2px solid var(--ink-black);
  border-radius: 26px 26px 0 0;
  padding: 10px 16px calc(22px + var(--safe-bottom));
  box-shadow: 0 -10px 36px rgba(20, 18, 24, 0.25);
  animation: sheetUp 0.22s cubic-bezier(0.2, 1.1, 0.3, 1);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #cfc3ab;
  margin: 0 auto 12px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #d8ceb8;
}

.modal-header h3 {
  font-size: 20px;
  margin-top: 5px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetUp {
  from { transform: translateY(40px); opacity: 0.4; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==================== QUICK ACTION GRID & CHIPS ==================== */
.quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-tile {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 2.5px solid var(--ink-black);
  box-shadow: var(--shadow-pop-sm);
  text-align: left;
  color: var(--ink-black);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.action-tile:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.action-tile-icon {
  font-size: 24px;
}

.action-tile strong {
  font-family: var(--font-display);
  font-size: 15px;
}

.action-tile small {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.88;
}

.quick-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip-select-btn {
  padding: 6px 11px;
  border-radius: 999px;
  border: 2px solid var(--ink-black);
  background: var(--bg-surface);
  color: var(--ink-black);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 1.5px 1.5px 0 var(--ink-black);
}

.chip-select-btn.active,
.chip-select-btn:active {
  background: var(--saffron);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  max-height: 210px;
  overflow-y: auto;
  padding: 2px;
}

.cat-chip-btn {
  padding: 8px 6px;
  border-radius: 11px;
  border: 2px solid var(--ink-black);
  background: var(--bg-surface);
  color: var(--ink-black);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.cat-chip-btn.active {
  background: var(--mint);
  color: var(--ink-black);
  box-shadow: 2px 2px 0 var(--ink-black);
}

.method-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.method-pill-btn {
  min-height: 42px;
  border-radius: 12px;
  border: 2px solid var(--ink-black);
  background: var(--bg-surface);
  color: var(--ink-black);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
}

.method-pill-btn.active {
  background: var(--saffron);
  color: var(--ink-black);
  box-shadow: 2.5px 2.5px 0 var(--ink-black);
}

.method-pill-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==================== PAGINATION & EMPTY STATES ==================== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 2px;
}

.empty-state {
  padding: 28px 18px;
  border-radius: var(--radius-xl);
  border: 2px dashed var(--ink-black);
  background: var(--bg-surface);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state-emoji {
  font-size: 32px;
}

.empty-state strong {
  font-family: var(--font-display);
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.detail-kv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-surface);
  border: 1.5px solid var(--ink-black);
  font-size: 13px;
}

.detail-kv span {
  color: var(--text-muted);
  font-weight: 700;
}

.detail-kv strong {
  text-align: right;
  word-break: break-word;
}

@media (max-width: 360px) {
  .bento-metrics-grid,
  .quick-action-grid {
    gap: 8px;
  }

  .hero-quick-row {
    gap: 6px;
  }

  .hero-pill-btn {
    font-size: 11px;
  }

  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
