/* ============================================================
   Bolsillos — Obsidian Glass + Apple Wallet Stacked Deck Theme
   ============================================================ */

:root,
[data-theme="dark"] {
  --bg: #070A0F;
  --bg-elevated: #0E1420;
  --glass-bg: rgba(255, 255, 255, 0.052);
  --glass-bg-strong: rgba(255, 255, 255, 0.085);
  --glass-subtle: rgba(255, 255, 255, 0.032);
  --glass-border: rgba(255, 255, 255, 0.11);
  --glass-border-bright: rgba(255, 255, 255, 0.22);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.16);

  --sheet-bg: #101623;
  --nav-bg: rgba(15, 21, 34, 0.84);
  --header-bg: rgba(7, 10, 15, 0.78);
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-focus-bg: rgba(255, 255, 255, 0.09);

  --text: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --emerald: #10B981;
  --emerald-bright: #34D399;
  --emerald-soft: rgba(16, 185, 129, 0.16);
  --indigo: #818CF8;
  --indigo-soft: rgba(99, 102, 241, 0.18);
  --amber: #FBBF24;
  --amber-soft: rgba(245, 158, 11, 0.18);
  --red: #F87171;
  --red-soft: rgba(239, 68, 68, 0.18);
  --sky: #38BDF8;
  --sky-soft: rgba(56, 189, 248, 0.16);

  --track-bg: rgba(255, 255, 255, 0.11);
  --shadow-glass: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-wallet: 0 -10px 28px rgba(0, 0, 0, 0.52);
  --shadow-fab: 0 10px 26px rgba(16, 185, 129, 0.42);
  --wallet-base: #0E1525;
  --wallet-mix-top: 26%;
  --wallet-mix-bot: 11%;
  --wallet-text: #F8FAFC;
  --wallet-muted: rgba(226, 232, 240, 0.78);
  --wallet-sub-bg: rgba(7, 10, 15, 0.56);
  --checking-card-bg: linear-gradient(140deg, #0D2E28 0%, #0F172A 54%, #1A1F42 100%);
  --checking-text: #FFFFFF;
  --checking-muted: rgba(226, 232, 240, 0.76);
  --segmented-bg: rgba(255, 255, 255, 0.06);
  --seg-active-bg: rgba(255, 255, 255, 0.14);

  --aurora-1: radial-gradient(circle at 12% 8%, rgba(16, 185, 129, 0.22) 0%, transparent 45%);
  --aurora-2: radial-gradient(circle at 88% 16%, rgba(99, 102, 241, 0.22) 0%, transparent 46%);
  --aurora-3: radial-gradient(circle at 50% 82%, rgba(14, 165, 233, 0.12) 0%, transparent 50%);
}

[data-theme="light"] {
  --bg: #EEF2F8;
  --bg-elevated: #FFFFFF;
  --glass-bg: rgba(255, 255, 255, 0.80);
  --glass-bg-strong: rgba(255, 255, 255, 0.94);
  --glass-subtle: rgba(248, 250, 252, 0.78);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-border-bright: rgba(15, 23, 42, 0.14);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.9);

  --sheet-bg: #FFFFFF;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --header-bg: rgba(238, 242, 248, 0.82);
  --input-bg: #FFFFFF;
  --input-focus-bg: #FFFFFF;

  --text: #0F172A;
  --text-secondary: #334155;
  --text-muted: #64748B;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);

  --emerald: #059669;
  --emerald-bright: #059669;
  --emerald-soft: #DCFCE7;
  --indigo: #4F46E5;
  --indigo-soft: #E0E7FF;
  --amber: #D97706;
  --amber-soft: #FEF3C7;
  --red: #DC2626;
  --red-soft: #FEE2E2;
  --sky: #0284C7;
  --sky-soft: #E0F2FE;

  --track-bg: rgba(15, 23, 42, 0.09);
  --shadow-glass: 0 8px 24px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-wallet: 0 -8px 22px rgba(15, 23, 42, 0.10);
  --shadow-fab: 0 10px 24px rgba(5, 150, 105, 0.34);
  --wallet-base: #FFFFFF;
  --wallet-mix-top: 17%;
  --wallet-mix-bot: 6%;
  --wallet-text: #0F172A;
  --wallet-muted: #475569;
  --wallet-sub-bg: rgba(255, 255, 255, 0.72);
  --checking-card-bg: linear-gradient(140deg, #0F172A 0%, #134E4A 60%, #1E1B4B 100%);
  --checking-text: #FFFFFF;
  --checking-muted: rgba(226, 232, 240, 0.80);
  --segmented-bg: rgba(15, 23, 42, 0.07);
  --seg-active-bg: #FFFFFF;

  --aurora-1: radial-gradient(circle at 12% 8%, rgba(16, 185, 129, 0.15) 0%, transparent 46%);
  --aurora-2: radial-gradient(circle at 88% 16%, rgba(99, 102, 241, 0.14) 0%, transparent 46%);
  --aurora-3: radial-gradient(circle at 50% 82%, rgba(14, 165, 233, 0.09) 0%, transparent 50%);
}

:root {
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 76px;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--aurora-1), var(--aurora-2), var(--aurora-3);
}

.num,
.money-val {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* App Shell */
.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* Top Sticky Glass Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 10px) 14px 10px;
  background: var(--header-bg);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-shrink: 0;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(135deg, #10B981, #4F46E5);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.32);
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.025em;
}

.month-switcher {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight);
  border-radius: 999px;
  padding: 2px;
  min-width: 0;
}

.month-pill {
  border: none;
  background: transparent;
  padding: 0 6px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

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

.icon-btn,
.icon-btn-sm {
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  box-shadow: var(--glass-highlight);
  color: var(--text);
  min-width: 40px;
  min-height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.icon-btn-sm {
  min-width: 34px;
  min-height: 36px;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 999px;
}

.icon-btn:active,
.icon-btn-sm:active,
.month-pill:active {
  transform: scale(0.94);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 14px 14px calc(var(--nav-height) + var(--safe-bottom) + 34px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

/* 1. Checking Account Virtual Hero Card (Cuenta Principal) */
.checking-hero-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 18px;
  background: var(--checking-card-bg);
  color: var(--checking-text);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checking-hero-card::after {
  content: "";
  position: absolute;
  top: -55px;
  right: -45px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.28) 0%, transparent 70%);
  pointer-events: none;
}

.checking-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.checking-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6EE7B7;
}

.checking-amount {
  font-size: 33px;
  font-weight: 800;
  line-height: 1.08;
  margin-top: 5px;
  color: #FFFFFF;
}

.checking-subnote {
  font-size: 12px;
  color: var(--checking-muted);
  margin-top: 3px;
}

.hero-chip {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.checking-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  position: relative;
  z-index: 1;
}

.checking-sub-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #E2E8F0;
}

.checking-sub-pill strong {
  color: #FFFFFF;
  font-weight: 700;
}

.checking-footer-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
  z-index: 1;
}

.checking-foot-label {
  font-size: 11px;
  color: var(--checking-muted);
}

.checking-foot-val {
  font-size: 15px;
  font-weight: 700;
  color: #FFFFFF;
  margin-top: 1px;
}

/* 2. Bento Glass KPI Strip */
.bento-strip {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.bento-ring-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-highlight);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.bento-ring-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bento-right-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.bento-mini-card {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-highlight);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.kpi-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-value.accent-indigo { color: var(--indigo); }
.kpi-value.accent-emerald { color: var(--emerald-bright); }
.kpi-value.accent-warn { color: var(--amber); }
.kpi-value.accent-red { color: var(--red); }

/* Quick Action Pill Row */
.quick-actions-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-pill-btn {
  min-height: 46px;
  border-radius: 15px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glass), var(--glass-highlight);
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.quick-pill-btn.expense-pill {
  border-color: rgba(248, 113, 113, 0.25);
}

.quick-pill-btn.income-pill {
  border-color: rgba(16, 185, 129, 0.28);
}

.quick-pill-dot {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
}

.quick-pill-dot.exp {
  background: var(--red-soft);
  color: var(--red);
}

.quick-pill-dot.inc {
  background: var(--emerald-soft);
  color: var(--emerald-bright);
}

.quick-pill-btn:active {
  transform: scale(0.97);
}

/* Section Headers */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

/* ============================================================
   3. APPLE WALLET STACKED DECK (Bolsillos en Abanico)
   ============================================================ */
.wallet-stack {
  display: flex;
  flex-direction: column;
  padding-top: 2px;
}

.wallet-card {
  --cat-color: #10B981;
  position: relative;
  border-radius: 22px;
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--cat-color) var(--wallet-mix-top), var(--wallet-base)) 0%,
    color-mix(in srgb, var(--cat-color) var(--wallet-mix-bot), var(--wallet-base)) 100%
  );
  border: 1px solid color-mix(in srgb, var(--cat-color) 32%, var(--glass-border-bright));
  box-shadow: var(--shadow-wallet), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: var(--wallet-text);
  overflow: hidden;
  transition: margin 0.24s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s ease, box-shadow 0.24s ease;
}

.wallet-card:not(:first-child) {
  margin-top: -42px;
}

.wallet-card:not(:last-child):not(.is-expanded) {
  padding-bottom: 44px;
}

.wallet-card.is-expanded {
  margin-bottom: 14px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.wallet-card.is-expanded + .wallet-card {
  margin-top: 0;
}

/* Flat expanded view toggle */
.wallet-stack.is-flat .wallet-card {
  margin-top: 0 !important;
  margin-bottom: 12px;
  padding-bottom: 0 !important;
}

.wallet-stack.is-flat .wallet-card:last-child {
  margin-bottom: 0;
}

.wallet-card.alert-warn {
  border-color: rgba(251, 191, 36, 0.6);
}

.wallet-card.alert-over {
  border-color: rgba(248, 113, 113, 0.68);
}

.wallet-face-btn {
  width: 100%;
  border: none;
  background: transparent;
  padding: 14px 16px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: inherit;
  min-height: 76px;
}

.wallet-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.wallet-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.wallet-icon-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--cat-color) 28%, rgba(255, 255, 255, 0.14));
  border: 1px solid color-mix(in srgb, var(--cat-color) 42%, rgba(255, 255, 255, 0.2));
  color: var(--wallet-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wallet-title-group {
  min-width: 0;
  flex: 1;
}

.wallet-name {
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-subline {
  font-size: 11.5px;
  color: var(--wallet-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wallet-balance-col {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.wallet-remaining {
  font-weight: 800;
  font-size: 15.5px;
  color: var(--wallet-text);
}

.wallet-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.wallet-pct-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--wallet-muted);
  flex-shrink: 0;
  min-width: 30px;
  text-align: right;
}

/* Subcategory Drawer inside Expanded Wallet Card */
.wallet-drawer {
  margin: 0 10px 10px;
  border-radius: 15px;
  background: var(--wallet-sub-bg);
  border: 1px solid var(--border);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subcat-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--border);
}

.subcat-row:last-of-type {
  padding-bottom: 0;
  border-bottom: none;
}

.subcat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subcat-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.subcat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.subcat-nums {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* Progress Bars */
.progress-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--track-bg);
  overflow: hidden;
  flex: 1;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--emerald);
  transition: width 0.25s ease;
}

.progress-fill.warn {
  background: var(--amber);
}

.progress-fill.over {
  background: var(--red);
}

/* Standard Glass Cards */
.card,
.chart-card {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-highlight);
  padding: 14px;
}

.chart-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-pocket {
  background: var(--indigo-soft);
  color: var(--indigo);
}

.badge-checking {
  background: var(--emerald-soft);
  color: var(--emerald-bright);
}

.badge-cumulative {
  background: var(--sky-soft);
  color: var(--sky);
}

.badge-monthly {
  background: var(--glass-bg-strong);
  color: var(--text-muted);
}

.badge-warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge-over {
  background: var(--red-soft);
  color: var(--red);
}

.badge-muted {
  background: var(--glass-bg-strong);
  color: var(--text-muted);
}

/* Segmented Control & Filters */
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--segmented-bg);
  padding: 3px;
  border-radius: 13px;
  gap: 3px;
  border: 1px solid var(--border);
}

.segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.seg-btn {
  border: none;
  background: transparent;
  min-height: 38px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn.active {
  background: var(--seg-active-bg);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

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

.select-pill {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

.select-pill option,
.select option {
  background: var(--sheet-bg);
  color: var(--text);
}

/* Transaction List */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tx-item {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass), var(--glass-highlight);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.tx-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.tx-icon.expense {
  background: var(--red-soft);
  color: var(--red);
}

.tx-icon.income {
  background: var(--emerald-soft);
  color: var(--emerald-bright);
}

.tx-info {
  min-width: 0;
  flex: 1;
}

.tx-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.tx-amount {
  font-weight: 800;
  font-size: 14.5px;
}

.tx-amount.expense {
  color: var(--text);
}

.tx-amount.income {
  color: var(--emerald-bright);
}

.tx-actions {
  display: flex;
  gap: 4px;
}

.mini-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-subtle);
  color: var(--text-secondary);
  border-radius: 9px;
  min-height: 32px;
  min-width: 32px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.mini-btn.danger {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.3);
  background: var(--red-soft);
}

/* Management / Stacks / Buttons */
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-name-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.cat-color-dot {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex-shrink: 0;
}

.btn {
  min-height: 44px;
  border-radius: 13px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.28);
}

.btn-emerald {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.28);
}

.btn-secondary {
  background: var(--glass-bg-strong);
  border-color: var(--glass-border-bright);
  color: var(--text);
}

.btn-danger {
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--red);
}

.btn-sm {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 11px;
}

.btn-block {
  width: 100%;
}

/* Forms inside Bottom Sheets */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.input,
.select {
  width: 100%;
  min-height: 46px;
  border-radius: 13px;
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  padding: 0 12px;
  font-size: 15px;
  outline: none;
}

.input:focus,
.select:focus {
  background: var(--input-focus-bg);
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.money-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.money-prefix {
  position: absolute;
  left: 14px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.input-money-lg {
  padding-left: 34px;
  min-height: 58px;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.input-money-sm {
  padding-left: 28px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.money-prefix-sm {
  position: absolute;
  left: 11px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-btn {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--glass-bg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.active {
  background: linear-gradient(135deg, #10B981, #059669);
  border-color: transparent;
  color: #FFFFFF;
}

/* ============================================================
   FLOATING GLASS PILL BOTTOM NAVIGATION
   ============================================================ */
.bottom-nav {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 406px;
  z-index: 40;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border-bright);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36), var(--glass-highlight);
  border-radius: 28px;
  padding: 5px 6px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
}

.nav-item {
  border: none;
  background: transparent;
  min-height: 48px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-item.active {
  color: var(--emerald-bright);
  background: var(--emerald-soft);
}

.nav-fab-slot {
  display: flex;
  justify-content: center;
  align-items: center;
}

.nav-fab {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #34D399 0%, #059669 100%);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  cursor: pointer;
}

.nav-fab:active {
  transform: scale(0.93);
}

/* ============================================================
   BOTTOM SHEET MODAL (Opaque solid background, zero bleed)
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(3, 6, 12, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
}

.sheet-backdrop.hidden {
  display: none;
  opacity: 0;
}

.sheet-container {
  width: 100%;
  max-width: 430px;
  max-height: 88dvh;
  background: var(--sheet-bg);
  color: var(--text);
  border-top: 1px solid var(--glass-border-bright);
  position: relative;
  z-index: 65;
  border-radius: 26px 26px 0 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--safe-bottom) + 16px);
  box-shadow: 0 -14px 40px rgba(0, 0, 0, 0.45);
  animation: sheetSlideUp 0.22s ease-out;
}

@keyframes sheetSlideUp {
  from {
    transform: translateY(24px);
    opacity: 0.7;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.sheet-handle-bar {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
}

.sheet-header {
  padding: 6px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
}

.sheet-body {
  padding: 14px 16px 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Empty State & Notices */
.empty-box {
  background: var(--glass-bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.notice-box {
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid transparent;
}

.notice-info {
  background: var(--indigo-soft);
  border-color: rgba(129, 140, 248, 0.28);
  color: var(--text);
}

.notice-warn {
  background: var(--amber-soft);
  border-color: rgba(251, 191, 36, 0.35);
  color: var(--text);
}

.notice-success {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.35);
  color: var(--text);
}

/* Toast positioned cleanly above floating pill nav */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: calc(100% - 28px);
  max-width: 400px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--sheet-bg);
  color: var(--text);
  border: 1px solid var(--glass-border-bright);
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.toast.error {
  background: #991B1B;
  color: #FFFFFF;
  border-color: rgba(248, 113, 113, 0.5);
}

.muted-text {
  color: var(--text-muted);
  font-size: 12px;
}

.inactive-row {
  opacity: 0.55;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--glass-bg);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
