/* ═══════════════════════════════════════════════════════
   QARZ v2 — Dark Indigo Fintech Theme
   Single-Page Premium Design
   ═══════════════════════════════════════════════════════ */

:root {
  --sb-w: 240px;
  --topbar-h: 56px;
  --panel-w: 420px;
  --radius: 14px;
  --radius-sm: 10px;
  --t: 0.25s ease;

  --bg: #060c18;
  --surface: #0c1424;
  --elevated: #111d35;
  --border: rgba(255, 255, 255, .06);
  --border2: rgba(255, 255, 255, .1);

  --primary: #818cf8;
  --primary-dk: #6366f1;
  --primary-glow: rgba(129, 140, 248, .12);
  --primary-btn: linear-gradient(135deg, #6366f1, #818cf8);
  --primary-hover: #4f46e5;
  --primary-solid: #6366f1;

  --gold: #fbbf24;
  --gold-bg: rgba(251, 191, 36, .08);
  --emerald: #34d399;
  --emerald-bg: rgba(52, 211, 153, .08);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, .08);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, .08);
  --danger-btn: #ef4444;
  --danger-hover: #dc2626;
  --warning: #fb923c;
  --warning-bg: rgba(251, 146, 60, .08);

  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #475569;

  --shadow: 0 8px 32px rgba(0, 0, 0, .5);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, .3);
  --shadow-glow: 0 0 30px rgba(99, 102, 241, .2);

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

/* ── Reset ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

html {
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-overflow-scrolling: touch;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
}

input,
textarea,
select {
  font-size: max(16px, 1rem);
  font: inherit;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 10px;
}

/* ── Scroll Progress Bar ───────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0;
  right: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-dk), var(--primary), var(--gold));
  z-index: 9999;
  transition: width 0.1s linear;
  border-radius: 0 0 0 2px;
}

/* ════════════════════════════════════════════════════════
   PARTICLE CANVAS
════════════════════════════════════════════════════════ */
#particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ════════════════════════════════════════════════════════
   GLASSMORPHISM
════════════════════════════════════════════════════════ */
.glass {
  background: rgba(12, 20, 36, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
}

/* ════════════════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════════════════ */
#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--sb-w);
  background: rgba(12, 20, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform var(--t);
}

.sb-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sb-logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, .3);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.15rem;
  flex-shrink: 0;
  animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {

  0%,
  100% {
    box-shadow: 0 0 8px rgba(99, 102, 241, .2);
  }

  50% {
    box-shadow: 0 0 20px rgba(99, 102, 241, .4);
  }
}

.sb-logo span {
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sb-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: .88rem;
  font-weight: 600;
  transition: all var(--t);
  width: 100%;
  text-align: right;
  min-height: 44px;
  position: relative;
  overflow: hidden;
}

.sb-link i {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sb-link:hover {
  background: rgba(255, 255, 255, .04);
  color: var(--text);
}

.sb-link.active {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(129, 140, 248, .15);
}

.sb-link.active i {
  color: var(--primary);
}

.sb-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sb-export:hover {
  background: rgba(99, 102, 241, .08);
  color: var(--primary);
}

.sb-logout:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

#sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 39;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ════════════════════════════════════════════════════════
   MAIN WRAPPER
════════════════════════════════════════════════════════ */
#main-wrap {
  margin-right: var(--sb-w);
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

#topbar {
  display: none;
  position: sticky;
  top: 0;
  height: var(--topbar-h);
  background: rgba(6, 12, 24, .85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 30;
}

.topbar-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 1.3rem;
  transition: all var(--t);
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.topbar-title {
  font-size: .95rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#page-content {
  padding: 28px;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* Flash */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 28px 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
}

.flash-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, .2);
}

.flash-err {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, .2);
}

/* ════════════════════════════════════════════════════════
   ENTRANCE ANIMATIONS
════════════════════════════════════════════════════════ */
.anim-in {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp .6s ease forwards;
}

.anim-in:nth-child(2) {
  animation-delay: .1s;
}

.anim-in:nth-child(3) {
  animation-delay: .2s;
}

.anim-in:nth-child(4) {
  animation-delay: .3s;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ════════════════════════════════════════════════════════
   HERO / GREETING
════════════════════════════════════════════════════════ */
.hero-section {
  margin-bottom: 24px;
}

.greeting-card {
  border-radius: var(--radius);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.greeting-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.12;
  z-index: 0;
}

.greeting-card.morning::before {
  background: linear-gradient(135deg, #f59e0b, #fbbf24, #f97316);
}

.greeting-card.afternoon::before {
  background: linear-gradient(135deg, #3b82f6, #60a5fa, #38bdf8);
}

.greeting-card.evening::before {
  background: linear-gradient(135deg, #8b5cf6, #a78bfa, #c084fc);
}

.greeting-card.night::before {
  background: linear-gradient(135deg, #1e3a5f, #312e81, #1e1b4b);
}

.greeting-card>* {
  position: relative;
  z-index: 1;
}

.greeting-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.greeting-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  flex-shrink: 0;
}

.greeting-card.morning .greeting-icon-wrap {
  color: #fbbf24;
}

.greeting-card.afternoon .greeting-icon-wrap {
  color: #60a5fa;
}

.greeting-card.evening .greeting-icon-wrap {
  color: #c084fc;
}

.greeting-card.night .greeting-icon-wrap {
  color: #818cf8;
}

.greeting-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 2px;
}

.greeting-sub {
  font-size: .82rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.greeting-dot {
  opacity: .4;
}

#live-clock {
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}

/* ════════════════════════════════════════════════════════
   STAT CARDS
════════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  border-color: var(--border2);
}

.stat-spark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--t);
}

.stat-card:hover .stat-spark {
  opacity: 1;
}

.stat-spark.indigo {
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.stat-spark.gold {
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.stat-spark.emerald {
  background: linear-gradient(90deg, transparent, var(--emerald), transparent);
}

.stat-spark.success {
  background: linear-gradient(90deg, transparent, var(--success), transparent);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.indigo {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, .2);
}

.stat-icon.gold {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, .2);
}

.stat-icon.emerald {
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid rgba(52, 211, 153, .2);
}

.stat-icon.success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, .2);
}

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

.stat-label {
  font-size: .72rem;
  color: var(--text3);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.stat-value-sm {
  font-size: 1.05rem;
}

.stat-sub {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
}

.stat-sub i {
  color: var(--success);
}

/* ════════════════════════════════════════════════════════
   CHARTS
════════════════════════════════════════════════════════ */
.charts-section {
  margin-bottom: 28px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.chart-card {
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--t), box-shadow var(--t);
}

.chart-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}

.chart-card-header {
  margin-bottom: 20px;
}

.chart-card-header h3 {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-card-header h3 i {
  color: var(--primary);
}

/* Donut */
.donut-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 20px;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-ring {
  stroke-dasharray: 0 439.82;
  transition: stroke-dasharray 1.5s cubic-bezier(.4, 0, .2, 1);
}

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

.donut-pct {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.donut-pct-sign {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text3);
}

.donut-label {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 4px;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  color: var(--text2);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Currency breakdown */
.currency-breakdown {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.currency-block {
  padding: 16px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.currency-header {
  margin-bottom: 12px;
}

.currency-name {
  font-size: .85rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.currency-name i {
  color: var(--primary);
}

.currency-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.currency-row.paid-row {
  border-top: 1px solid var(--border);
  margin-top: 4px;
  padding-top: 8px;
}

.currency-label {
  font-size: .78rem;
  color: var(--text3);
}

.currency-amount {
  font-size: .88rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.currency-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 10px;
  overflow: hidden;
}

.currency-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1.5s cubic-bezier(.4, 0, .2, 1);
}

.iqd-bar {
  background: linear-gradient(90deg, var(--primary-dk), var(--primary));
}

.usd-bar {
  background: linear-gradient(90deg, var(--emerald), #6ee7b7);
}

/* ════════════════════════════════════════════════════════
   DEBTORS SECTION
════════════════════════════════════════════════════════ */
.debtors-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--primary);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  transition: all var(--t);
  font-size: 1rem;
}

.btn-icon:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(99, 102, 241, .3);
}

/* Controls bar */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-wrap>i {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  font-size: .9rem;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 40px 10px 50px;
  font-size: .88rem;
  transition: all var(--t);
  outline: none;
  min-height: 44px;
}

.search-input:focus {
  border-color: rgba(99, 102, 241, .4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
  background: rgba(255, 255, 255, .05);
}

.search-input::placeholder {
  color: var(--text3);
}

.search-kbd {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: .68rem;
  color: var(--text3);
  pointer-events: none;
  font-family: monospace !important;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.filter-tab {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text3);
  transition: all var(--t);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  white-space: nowrap;
}

.filter-tab:hover {
  color: var(--text2);
  background: rgba(255, 255, 255, .04);
}

.filter-tab.active {
  background: var(--primary-solid);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.filter-count {
  background: rgba(255, 255, 255, .15);
  padding: 1px 7px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 800;
}

.filter-tab:not(.active) .filter-count {
  background: rgba(255, 255, 255, .06);
}

/* Sort */
.sort-wrap {
  position: relative;
  flex-shrink: 0;
}

.sort-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  padding: 10px 14px 10px 36px;
  font-size: .82rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  min-height: 44px;
  transition: all var(--t);
}

.sort-select:focus {
  border-color: rgba(99, 102, 241, .4);
}

.sort-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
  font-size: .9rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow: hidden;
}

/* Debtor rows */
#debtors-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.debtor-row {
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--t);
  animation: fadeIn .3s ease both;
}

.debtor-row:hover {
  background: rgba(255, 255, 255, .04);
  border-color: var(--border2);
  transform: translateY(-1px);
}

.debtor-row.paid {
  opacity: .55;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.debtor-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--primary-glow);
  border: 1px solid rgba(129, 140, 248, .2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all var(--t);
}

.debtor-row:hover .debtor-avatar {
  border-color: rgba(129, 140, 248, .4);
}

.debtor-row.paid .debtor-avatar {
  background: var(--success-bg);
  border-color: rgba(52, 211, 153, .2);
  color: var(--success);
}

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

.debtor-name {
  font-weight: 800;
  color: var(--text);
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.debtor-meta {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.debtor-meta i {
  font-size: .68rem;
}

.debtor-amount-col {
  text-align: left;
  flex-shrink: 0;
}

.debtor-amount {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  direction: ltr;
  display: block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.debtor-row.paid .debtor-amount {
  text-decoration: line-through;
  color: var(--text3);
}

/* Highlight in search */
mark.highlight {
  background: rgba(251, 191, 36, .25);
  color: var(--gold);
  border-radius: 3px;
  padding: 0 2px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .3px;
  white-space: nowrap;
}

.badge-iqd {
  background: rgba(99, 102, 241, .12);
  color: var(--primary);
}

.badge-usd {
  background: var(--success-bg);
  color: var(--success);
}

.badge-active {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-paid {
  background: var(--success-bg);
  color: var(--success);
}

/* Row actions */
.row-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.act-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  color: var(--text3);
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  transition: all var(--t);
}

.act-btn:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.act-btn.edit:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(99, 102, 241, .3);
}

.act-btn.toggle:hover {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(52, 211, 153, .3);
}

.act-btn.delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(248, 113, 113, .3);
}

/* Empty / Loading */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
}

.empty-state i {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  color: var(--border2);
}

.empty-state p {
  font-size: .88rem;
}

/* Skeleton loading */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, .02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--border);
  animation: shimmer 1.5s ease infinite;
  flex-shrink: 0;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: var(--border);
  animation: shimmer 1.5s ease infinite;
}

.skeleton-line.w80 {
  width: 80%;
}

.skeleton-line.w70 {
  width: 70%;
}

.skeleton-line.w60 {
  width: 60%;
}

.skeleton-line.w50 {
  width: 50%;
}

.skeleton-line.w40 {
  width: 40%;
}

.skeleton-line.w30 {
  width: 30%;
}

.skeleton-amount {
  width: 70px;
  height: 18px;
  border-radius: 6px;
  background: var(--border);
  animation: shimmer 1.5s ease infinite;
}

@keyframes shimmer {
  0% {
    opacity: 0.4;
  }

  50% {
    opacity: 0.8;
  }

  100% {
    opacity: 0.4;
  }
}

/* Summary bar */
.summary-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: .8rem;
}

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

.summary-item>i {
  color: var(--primary);
  font-size: .75rem;
}

.summary-label {
  color: var(--text3);
}

.summary-value {
  font-weight: 900;
  direction: ltr;
  font-variant-numeric: tabular-nums;
}

/* ════════════════════════════════════════════════════════
   BUTTONS
════════════════════════════════════════════════════════ */
.btn-glow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary-btn);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 800;
  transition: all var(--t);
  min-height: 44px;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(99, 102, 241, .25);
}

.btn-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, .4);
}

.btn-glow:active {
  transform: translateY(0);
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, .1) 50%, transparent 70%);
  transform: rotate(45deg) translateX(-100%);
  transition: transform .6s;
}

.btn-glow:hover::after {
  transform: rotate(45deg) translateX(100%);
}

.btn-sm {
  padding: 8px 16px;
  font-size: .82rem;
  min-height: 38px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--primary-btn);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 700;
  transition: all var(--t);
  min-height: 44px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, .3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, .04);
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  transition: all var(--t);
  min-height: 44px;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--text);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--danger-btn);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 700;
  transition: all var(--t);
  text-decoration: none;
  min-height: 44px;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* ════════════════════════════════════════════════════════
   SLIDE-OVER PANEL
════════════════════════════════════════════════════════ */
#panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--panel-w);
  max-width: 100vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 51;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
}

#panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.panel-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  transition: all var(--t);
}

.panel-close:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

#debtor-form {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-actions {
  display: flex;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.panel-actions .btn-primary {
  flex: 1;
  justify-content: center;
}

/* Form fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text2);
}

.field-label .req {
  color: var(--danger);
}

.field-input {
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 14px;
  font-size: max(16px, .9rem);
  outline: none;
  transition: all var(--t);
  width: 100%;
  min-height: 44px;
}

.field-input:focus {
  border-color: rgba(99, 102, 241, .4);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
}

.field-input::placeholder {
  color: var(--text3);
}

.field-textarea {
  resize: vertical;
  min-height: 80px;
}

.field-error {
  font-size: .78rem;
  color: var(--danger);
  min-height: 1em;
}

/* Currency toggle */
.currency-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.cur-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text3);
  transition: all var(--t);
  min-height: 40px;
}

.cur-btn:hover {
  color: var(--text2);
  background: rgba(255, 255, 255, .05);
}

.cur-btn.active {
  background: var(--primary-solid);
  color: #fff;
}

.cur-code {
  font-size: .75rem;
  opacity: .8;
}

.amount-wrap {
  position: relative;
}

.amount-prefix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .75rem;
  font-weight: 700;
  color: var(--primary);
  pointer-events: none;
}

.amount-input {
  padding-right: 52px !important;
}

/* ════════════════════════════════════════════════════════
   CONFIRM DIALOGS
════════════════════════════════════════════════════════ */
.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .15s ease;
}

.confirm-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, .2);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 16px;
}

.confirm-icon.danger {
  background: var(--danger-bg);
  border-color: rgba(248, 113, 113, .2);
  color: var(--danger);
}

.confirm-msg {
  font-size: .92rem;
  color: var(--text2);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  box-shadow: var(--shadow);
  animation: toastIn .3s ease;
  pointer-events: all;
  backdrop-filter: blur(16px);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.out {
  animation: toastOut .2s ease forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-8px) scale(.96);
  }
}

.toast-ok {
  border-color: rgba(52, 211, 153, .25);
  color: var(--success);
}

.toast-err {
  border-color: rgba(248, 113, 113, .25);
  color: var(--danger);
}

.toast-info {
  border-color: rgba(129, 140, 248, .25);
  color: var(--primary);
}

/* ════════════════════════════════════════════════════════
   SCROLL TO TOP
════════════════════════════════════════════════════════ */
#scroll-top {
  position: fixed;
  bottom: 28px;
  left: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.1rem;
  z-index: 35;
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
  transition: all var(--t);
  box-shadow: var(--shadow-sm);
}

#scroll-top.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: all;
}

#scroll-top:hover {
  background: var(--primary-glow);
  border-color: rgba(99, 102, 241, .3);
  transform: scale(1.05) translateY(-2px);
}

.scroll-progress-ring {
  position: absolute;
  inset: -2px;
  width: 52px;
  height: 52px;
  transform: rotate(-90deg);
}

.progress-ring-circle {
  stroke-dasharray: 113.1;
  stroke-dashoffset: 113.1;
  transition: stroke-dashoffset 0.1s linear;
}

/* ════════════════════════════════════════════════════════
   LOGIN PAGE
════════════════════════════════════════════════════════ */
.login-bg {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, .06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(251, 191, 36, .03) 0%, transparent 50%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--primary);
  margin: 0 auto 20px;
  animation: glow-pulse 3s ease-in-out infinite;
}

.login-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  font-size: .82rem;
  color: var(--text3);
  margin-bottom: 28px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border2);
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

.pin-dot.filled {
  background: var(--primary);
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(99, 102, 241, .4);
}

.login-error {
  background: var(--danger-bg);
  border: 1px solid rgba(248, 113, 113, .2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .85rem;
  text-align: center;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  #sidebar {
    transform: translateX(100%);
    width: 280px;
    max-width: 85vw;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #sb-overlay.open {
    display: block;
  }

  #main-wrap {
    margin-right: 0;
  }

  #topbar {
    display: flex;
    padding-top: var(--safe-top);
    height: calc(var(--topbar-h) + var(--safe-top));
  }

  #page-content {
    padding: 16px;
  }

  .flash {
    margin: 0 16px 12px;
  }

  #panel {
    width: 100%;
    max-width: 100vw;
    border-right: none;
  }

  .panel-header {
    padding-top: calc(16px + var(--safe-top));
  }

  #debtor-form {
    padding: 20px 16px;
    padding-bottom: calc(20px + var(--safe-bottom));
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    border-radius: 12px;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .stat-value-sm {
    font-size: .92rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .greeting-card {
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .greeting-card .btn-glow {
    width: 100%;
    justify-content: center;
  }

  .greeting-title {
    font-size: 1.2rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-wrap {
    min-width: 100%;
  }

  .filter-tabs {
    width: 100%;
  }

  .filter-tab {
    flex: 1;
    justify-content: center;
  }

  .sort-wrap {
    width: 100%;
  }

  .sort-select {
    width: 100%;
  }

  .debtor-row {
    flex-wrap: wrap;
    padding: 12px;
    gap: 10px;
  }

  .debtor-amount-col {
    order: 3;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .row-actions {
    order: 4;
    margin-right: auto;
  }

  .section-header {
    gap: 10px;
  }

  .section-title {
    font-size: 1rem;
  }

  .card {
    padding: 14px;
    border-radius: var(--radius-sm);
  }

  .confirm-inner {
    margin: 0 16px;
    padding: 24px 20px;
  }

  #toast-container {
    top: calc(12px + var(--safe-top));
    width: calc(100% - 24px);
  }

  .summary-bar {
    gap: 12px;
    font-size: .75rem;
  }

  .donut-wrap {
    width: 150px;
    height: 150px;
  }

  .donut-pct {
    font-size: 1.6rem;
  }

  .search-kbd {
    display: none;
  }

  .search-input {
    padding-left: 14px;
  }

  #scroll-top {
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
  }

  .scroll-progress-ring {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 480px) {
  #page-content {
    padding: 12px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    border-radius: 10px;
  }

  .stat-label {
    font-size: .65rem;
  }

  .stat-value {
    font-size: 1.1rem;
  }

  .stat-value-sm {
    font-size: .82rem;
  }

  .stat-sub {
    font-size: .65rem;
  }

  .greeting-icon-wrap {
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  .greeting-title {
    font-size: 1.05rem;
  }

  .debtor-row {
    padding: 10px;
  }

  .debtor-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .debtor-name {
    font-size: .85rem;
  }

  .debtor-meta {
    font-size: .68rem;
  }

  .act-btn {
    width: 32px;
    height: 32px;
    font-size: .78rem;
  }

  .btn-glow {
    padding: 10px 18px;
    font-size: .82rem;
  }

  .chart-card {
    padding: 16px;
  }

  .panel-actions {
    flex-direction: column;
    gap: 8px;
  }

  .panel-actions .btn-ghost,
  .panel-actions .btn-primary {
    width: 100%;
    justify-content: center;
  }

  .confirm-btns {
    flex-direction: column;
    gap: 8px;
  }

  .confirm-btns .btn-ghost,
  .confirm-btns .btn-danger {
    width: 100%;
    justify-content: center;
  }

  .summary-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    text-align: center;
  }

  .summary-item {
    justify-content: center;
  }

  .filter-tab {
    font-size: .75rem;
    padding: 6px 8px;
  }

  .filter-count {
    font-size: .6rem;
    padding: 1px 5px;
  }
}

@media (max-width: 360px) {
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    flex-direction: row;
    align-items: center;
  }

  .debtor-avatar {
    display: none;
  }
}

@media (hover: none) {
  .stat-card:hover {
    transform: none;
    box-shadow: none;
  }

  .debtor-row:hover {
    transform: none;
  }

  .btn-glow:hover {
    transform: none;
  }

  .act-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .anim-in {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@media print {

  #sidebar,
  #topbar,
  #sb-overlay,
  #panel,
  #panel-overlay,
  .confirm-dialog,
  #toast-container,
  .row-actions,
  #scroll-top,
  #particles,
  #confetti-canvas,
  #scroll-progress,
  .btn-glow,
  .btn-icon,
  .controls-bar {
    display: none !important;
  }

  #main-wrap {
    margin-right: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* Utility */
.spin {
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ════════════════════════════════════════════════════════
   DETAIL MODAL
════════════════════════════════════════════════════════ */
.detail-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.detail-header h2 {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
}

.detail-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.detail-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.detail-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.detail-amount {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--warning);
  font-family: 'IBM Plex Mono', monospace;
}

.detail-amount small {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text3);
}

.detail-amount-paid {
  color: var(--success);
}

.detail-fields {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text2);
  text-align: start;
}

.detail-field i {
  color: var(--primary);
  font-size: .9rem;
  flex-shrink: 0;
}

.detail-field span {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.detail-field-notes {
  align-items: flex-start;
}

.detail-copy {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--t);
  text-decoration: none;
  flex-shrink: 0;
}

.detail-copy:hover {
  background: rgba(255, 255, 255, .08);
  color: var(--primary);
}

.detail-timeago {
  font-size: .75rem;
  color: var(--text3);
  flex-shrink: 0;
}

.detail-actions {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.detail-actions .btn-ghost,
.detail-actions .btn-primary {
  flex: 1;
  justify-content: center;
  font-size: .82rem;
  padding: 8px 12px;
  min-height: 40px;
}

.btn-danger-sm {
  padding: 8px 14px !important;
  min-height: 40px;
  font-size: .82rem;
}

/* ════════════════════════════════════════════════════════
   SETTINGS PANEL
════════════════════════════════════════════════════════ */
.settings-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn .2s ease;
}

.settings-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-section-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-section-title i {
  color: var(--primary);
}

.settings-about {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-about-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--text2);
}

.settings-about-row span:first-child {
  color: var(--text3);
}

/* ════════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS MODAL
════════════════════════════════════════════════════════ */
.keyboard-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: modalIn .2s ease;
}

.keyboard-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text2);
}

.shortcut-row kbd {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  font-family: 'IBM Plex Mono', monospace;
  min-width: 36px;
  text-align: center;
}

/* ════════════════════════════════════════════════════════
   SIDEBAR DIVIDER
════════════════════════════════════════════════════════ */
.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

/* ════════════════════════════════════════════════════════
   CURRENCY FILTER TABS
════════════════════════════════════════════════════════ */
.currency-filter-tabs {
  border: none !important;
  background: none !important;
  padding: 0 !important;
  gap: 4px;
}

/* ════════════════════════════════════════════════════════
   EMPTY STATE IMPROVEMENTS
════════════════════════════════════════════════════════ */
.empty-hint {
  font-size: .78rem;
  color: var(--text3);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════════════
   SEARCH HIGHLIGHT
════════════════════════════════════════════════════════ */
mark.highlight {
  background: rgba(251, 191, 36, .25);
  color: var(--warning);
  border-radius: 2px;
  padding: 0 1px;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE ADDITIONS
════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  .detail-inner,
  .settings-inner,
  .keyboard-inner {
    margin: 0 12px;
    max-width: calc(100% - 24px);
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-actions .btn-ghost,
  .detail-actions .btn-primary,
  .detail-actions .btn-danger-sm {
    width: 100%;
    justify-content: center;
  }

  .currency-filter-tabs {
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════ */
[data-theme="light"] {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-light: #f8f9fa;
  --elevated: #ffffff;
  --border: rgba(0, 0, 0, .08);
  --border2: rgba(0, 0, 0, .12);

  --primary: #6366f1;
  --primary-dk: #4f46e5;
  --primary-glow: rgba(99, 102, 241, .08);
  --primary-btn: linear-gradient(135deg, #6366f1, #818cf8);
  --primary-hover: #4338ca;
  --primary-solid: #6366f1;

  --gold: #d97706;
  --gold-bg: rgba(217, 119, 6, .06);
  --emerald: #059669;
  --emerald-bg: rgba(5, 150, 105, .06);
  --success: #059669;
  --success-bg: rgba(5, 150, 105, .06);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, .06);
  --danger-btn: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #ea580c;
  --warning-bg: rgba(234, 88, 12, .06);

  --text: #1e293b;
  --text2: #475569;
  --text3: #94a3b8;

  --shadow: 0 4px 20px rgba(0, 0, 0, .08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .05);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, .1);
}

[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="light"] .glass {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

[data-theme="light"] .sidebar {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="light"] .topbar {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="light"] .debtor-row {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="light"] .debtor-row:hover {
  background: var(--surface-light, #f8f9fa);
}

[data-theme="light"] #particles {
  opacity: 0.3;
}

[data-theme="light"] .field-input {
  background: var(--surface-light, #f8f9fa);
  border-color: var(--border2);
  color: var(--text);
}

[data-theme="light"] .confirm-dialog>* {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="light"] .settings-inner,
[data-theme="light"] .detail-inner,
[data-theme="light"] .keyboard-inner {
  background: var(--surface);
}

[data-theme="light"] .debtor-avatar {
  background: var(--primary-glow);
  color: var(--primary);
}

[data-theme="light"] .panel {
  background: var(--surface);
}

/* ═══════════════════════════════════════════════════════
   NEW COMPONENT STYLES
   ═══════════════════════════════════════════════════════ */

/* Sidebar badge */
.sb-badge {
  background: var(--danger);
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-right: auto;
  margin-left: 4px;
}

.sb-badge:empty {
  display: none;
}

/* Overdue row glow */
.debtor-row.overdue {
  animation: overdue-pulse 2s ease-in-out infinite;
}

@keyframes overdue-pulse {

  0%,
  100% {
    box-shadow: none;
  }

  50% {
    box-shadow: inset 0 0 0 1px rgba(248, 113, 113, .15);
  }
}

/* Trend chart wrapper */
.trend-chart-wrap {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Top debtors list */
.top-debtors-list {
  min-height: 100px;
}

/* Spin animation for loading */
@keyframes spin-anim {
  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin-anim 1s linear infinite;
  display: inline-block;
}

/* Surface light fallback */
:root {
  --surface-light: rgba(255, 255, 255, .03);
}

/* ═══════════════════════════════════════════════════════
   COMMAND PALETTE
   ═══════════════════════════════════════════════════════ */
.cmd-palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(20vh, 140px);
  animation: cmd-fadein .15s ease;
}

@keyframes cmd-fadein {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.cmd-palette-inner {
  width: 92%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 60px rgba(99, 102, 241, .15);
  overflow: hidden;
  animation: cmd-slidein .2s ease;
}

@keyframes cmd-slidein {
  from {
    opacity: 0;
    transform: scale(.97) translateY(-10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.cmd-palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.cmd-palette-search i {
  font-size: 1.1rem;
  color: var(--text3);
}

.cmd-palette-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: .95rem;
  color: var(--text);
  font-family: inherit;
}

.cmd-palette-search input::placeholder {
  color: var(--text3);
}

.cmd-palette-search kbd {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: .7rem;
  color: var(--text3);
}

.cmd-palette-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
}

.cmd-section-label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 12px 4px;
  letter-spacing: .05em;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}

.cmd-item:hover,
.cmd-item.active {
  background: var(--primary-glow);
}

.cmd-item-label {
  flex: 1;
  font-size: .88rem;
  font-weight: 500;
}

.cmd-item-hint {
  color: var(--text3);
  font-size: .75rem;
}

.cmd-item-kbd {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: .65rem;
  color: var(--text3);
  font-family: monospace;
}

/* ═══════════════════════════════════════════════════════
   AI SUMMARY + HEALTH SCORE
   ═══════════════════════════════════════════════════════ */
.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 0 28px;
  margin-bottom: 8px;
}

@media (max-width: 767px) {
  .insights-grid {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
}

.insight-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color .3s, box-shadow .3s;
}

.insight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s;
  border-radius: inherit;
}

/* Urgency states */
.ai-summary-card.urgency-green {
  border-color: rgba(52, 211, 153, .2);
}

.ai-summary-card.urgency-green::before {
  background: linear-gradient(135deg, rgba(52, 211, 153, .05), transparent);
  opacity: 1;
}

.ai-summary-card.urgency-green .insight-icon {
  color: var(--success);
  background: var(--success-bg);
}

.ai-summary-card.urgency-amber {
  border-color: rgba(251, 191, 36, .2);
}

.ai-summary-card.urgency-amber::before {
  background: linear-gradient(135deg, rgba(251, 191, 36, .05), transparent);
  opacity: 1;
}

.ai-summary-card.urgency-amber .insight-icon {
  color: var(--gold);
  background: var(--gold-bg);
}

.ai-summary-card.urgency-red {
  border-color: rgba(248, 113, 113, .2);
}

.ai-summary-card.urgency-red::before {
  background: linear-gradient(135deg, rgba(248, 113, 113, .05), transparent);
  opacity: 1;
}

.ai-summary-card.urgency-red .insight-icon {
  color: var(--danger);
  background: var(--danger-bg);
}

.insight-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  font-size: 1.3rem;
  flex-shrink: 0;
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(129, 140, 248, .15);
  position: relative;
  z-index: 1;
}

.insight-body {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.insight-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}

.insight-text {
  font-size: .88rem;
  line-height: 1.5;
  color: var(--text);
}

/* Health Score Card */
.health-score-card {
  gap: 20px;
}

.health-gauge-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  flex-shrink: 0;
}

.health-gauge-svg {
  width: 100%;
  height: 100%;
}

.health-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.health-score-num {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
  color: var(--text);
}

.health-score-grade {
  font-size: .7rem;
  font-weight: 800;
  margin-top: 2px;
}

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

.health-detail {
  font-size: .82rem;
  color: var(--text2);
  margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════
   HEATMAP
   ═══════════════════════════════════════════════════════ */
.heatmap-wrap {
  padding: 10px;
  min-height: 140px;
}

.heatmap-wrap svg rect {
  transition: fill .2s;
}

.heatmap-wrap svg rect:hover {
  stroke: var(--primary);
  stroke-width: 1.5;
  filter: brightness(1.2);
}

/* ═══════════════════════════════════════════════════════
   BULK OPERATIONS
   ═══════════════════════════════════════════════════════ */
.bulk-check {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  position: relative;
  cursor: pointer;
}

.bulk-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.bulk-check-mark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border2);
  border-radius: 5px;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bulk-check-mark::after {
  content: '';
  display: none;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}

.bulk-check input:checked+.bulk-check-mark {
  background: var(--primary-solid);
  border-color: var(--primary-solid);
}

.bulk-check input:checked+.bulk-check-mark::after {
  display: block;
}

.debtor-row.bulk-selected {
  background: var(--primary-glow) !important;
  border-color: rgba(129, 140, 248, .25) !important;
}

/* Bulk floating bar */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: bulk-bar-in .3s ease;
  width: auto;
  max-width: 94%;
}

@keyframes bulk-bar-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%);
  }
}

.bulk-bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 60px;
  box-shadow: var(--shadow), 0 0 40px rgba(99, 102, 241, .15);
  backdrop-filter: blur(20px);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.bulk-bar-inner .btn-ghost,
.bulk-bar-inner .btn-danger-sm {
  padding: 6px 12px;
  font-size: .78rem;
}

.bulk-count {
  font-size: .82rem;
  font-weight: 700;
  color: var(--primary);
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

@media (max-width: 600px) {
  .bulk-bar {
    bottom: 12px;
    max-width: 96%;
  }

  .bulk-bar-inner {
    border-radius: 16px;
    padding: 8px 10px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .bulk-bar-inner::-webkit-scrollbar {
    display: none;
  }

  .bulk-bar-inner .btn-ghost,
  .bulk-bar-inner .btn-danger-sm {
    padding: 8px 10px;
    font-size: .72rem;
    flex-shrink: 0;
  }

  .bulk-bar-inner .btn-ghost span,
  .bulk-bar-inner .btn-danger-sm span {
    display: none;
  }

  .bulk-count {
    font-size: .75rem;
    flex-shrink: 0;
  }
}

/* ═══════════════════════════════════════════════════════
   PIN LOCK SCREEN
   ═══════════════════════════════════════════════════════ */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  backdrop-filter: blur(30px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pinlock-in .4s ease;
}

@keyframes pinlock-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.pin-lock-inner {
  text-align: center;
  padding: 40px;
  animation: pinlock-scale .3s ease;
}

@keyframes pinlock-scale {
  from {
    transform: scale(.9);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.pin-lock-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 16px;
  animation: pinlock-bounce 2s ease-in-out infinite;
}

@keyframes pinlock-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.pin-lock-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.pin-lock-sub {
  font-size: .85rem;
  color: var(--text3);
  margin-bottom: 28px;
}

.pin-dots {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 20px;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border2);
  background: transparent;
  transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(99, 102, 241, .4);
}

.pin-dots-wrap {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.pin-lock-hidden-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  z-index: 2;
  -webkit-text-security: disc;
}

.pin-lock-error {
  display: block;
  color: var(--danger);
  font-size: .82rem;
  font-weight: 600;
  min-height: 20px;
  margin-top: 8px;
}

/* Shake animation */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-6px);
  }

  20%,
  40%,
  60%,
  80% {
    transform: translateX(6px);
  }
}

.shake {
  animation: shake .5s ease;
}

/* ═══════════════════════════════════════════════════════
   KEYBOARD SHORTCUTS — add Ctrl+K
   ═══════════════════════════════════════════════════════ */

[data-theme="light"] .cmd-palette-overlay {
  background: rgba(0, 0, 0, .3);
}

[data-theme="light"] .cmd-palette-inner {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .cmd-palette-search input {
  color: #1a1a2e;
}

[data-theme="light"] .cmd-item.active,
[data-theme="light"] .cmd-item:hover {
  background: rgba(99, 102, 241, .06);
}

[data-theme="light"] .pin-lock-overlay {
  background: rgba(255, 255, 255, .95);
}

[data-theme="light"] .bulk-bar-inner {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}

[data-theme="light"] .insight-card {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .heatmap-wrap svg rect[data-count="0"] {
  fill: #f1f5f9;
}

/* ═══════════════════════════════════════════════════════
   BOTTOM TAB BAR
   ═══════════════════════════════════════════════════════ */
#bottom-tabs {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  animation: bottom-tabs-in .5s cubic-bezier(.4, 0, .2, 1) both;
  animation-delay: .6s;
}

@keyframes bottom-tabs-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.bottom-tabs-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: rgba(12, 20, 36, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 60px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .4), 0 0 60px rgba(99, 102, 241, .1);
  position: relative;
}

.tab-indicator {
  position: absolute;
  top: 6px;
  right: 6px;
  width: calc(50% - 6px);
  height: calc(100% - 12px);
  background: linear-gradient(135deg, #6366f1, #818cf8);
  border-radius: 54px;
  transition: right .35s cubic-bezier(.4, 0, .2, 1);
  z-index: 0;
  box-shadow: 0 4px 20px rgba(99, 102, 241, .35);
}

.tab-indicator.expenses {
  right: calc(50%);
}

.bottom-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 54px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--text3);
  position: relative;
  z-index: 1;
  transition: color .3s ease;
  min-height: 48px;
  white-space: nowrap;
}

.bottom-tab i {
  font-size: 1.1rem;
  transition: transform .3s ease;
}

.bottom-tab.active {
  color: #fff;
}

.bottom-tab.active i {
  transform: scale(1.15);
}

.bottom-tab:not(.active):hover {
  color: var(--text2);
}

/* ═══════════════════════════════════════════════════════
   VIEW TRANSITIONS
   ═══════════════════════════════════════════════════════ */
#view-debts,
#view-expenses {
  transition: opacity .35s ease, transform .35s ease;
}

#view-debts.fade-out,
#view-expenses.fade-out {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

#view-debts.fade-in,
#view-expenses.fade-in {
  opacity: 1;
  transform: translateY(0);
}


/* ═══════════════════════════════════════════════════════
   EXPENSES — HERO CARD
   ═══════════════════════════════════════════════════════ */
.exp-hero-card {
  position: relative;
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid rgba(192, 132, 252, .15);
  background: rgba(12, 20, 36, .65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.exp-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, .12), rgba(192, 132, 252, .08), rgba(99, 102, 241, .06));
  z-index: 0;
}

.exp-hero-content {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.exp-hero-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(192, 132, 252, .12);
  border: 1px solid rgba(192, 132, 252, .2);
  color: #c084fc;
  flex-shrink: 0;
  animation: glow-pulse 3s ease-in-out infinite;
}

.exp-hero-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
}

.exp-hero-sub {
  font-size: .82rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.exp-hero-dot {
  opacity: .4;
}

.exp-hero-add-btn {
  display: flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #8b5cf6, #a78bfa);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 800;
  transition: all var(--t);
  min-height: 44px;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(139, 92, 246, .3);
}

.exp-hero-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, .45);
}

.exp-hero-add-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, .1) 50%, transparent 70%);
  transform: rotate(45deg) translateX(-100%);
  transition: transform .6s;
}

.exp-hero-add-btn:hover::after {
  transform: rotate(45deg) translateX(100%);
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — DATE PICKER (Full Month)
   ═══════════════════════════════════════════════════════ */
.exp-date-picker-card {
  background: rgba(12, 20, 36, .5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 12px;
  margin-bottom: 4px;
}

.exp-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}

.exp-month-label {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .3px;
}

.exp-month-nav {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
  transition: all var(--t);
}

.exp-month-nav:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(99, 102, 241, .3);
}

.exp-date-strip-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}

.exp-date-nav {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border);
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  flex-shrink: 0;
  transition: all var(--t);
}

.exp-date-nav:hover {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(99, 102, 241, .3);
}

.exp-date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  padding: 4px 8px;
}

.exp-date-strip::-webkit-scrollbar {
  display: none;
}

.exp-date-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  min-width: 58px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid transparent;
  color: var(--text3);
  font-size: .75rem;
  font-weight: 600;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.exp-date-pill .exp-date-day {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text2);
  line-height: 1;
  transition: color .2s ease;
}

.exp-date-pill .exp-date-weekday {
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  opacity: .6;
}

.exp-date-pill:hover {
  background: rgba(255, 255, 255, .05);
  border-color: var(--border);
}

.exp-date-pill.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, .2), rgba(129, 140, 248, .12));
  border-color: rgba(99, 102, 241, .5);
  color: var(--primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, .12);
}

.exp-date-pill.active .exp-date-day {
  color: #fff;
}

.exp-date-pill.active .exp-date-weekday {
  opacity: 1;
  color: var(--primary);
}

.exp-date-pill.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — STATS ROW (v2)
   ═══════════════════════════════════════════════════════ */
.exp-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.exp-stat-card-v2 {
  border-radius: var(--radius);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.exp-stat-card-v2:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
  border-color: var(--border2);
}

.exp-stat-accent {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0;
  transition: opacity var(--t);
}

.exp-stat-card-v2:hover .exp-stat-accent {
  opacity: 1;
}

.exp-stat-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
  width: 100%;
}

.exp-stat-icon-v2 {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
  margin: 0 auto;
}

.exp-stat-badge {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.exp-stat-value-v2 {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

.exp-stat-label-v2 {
  font-size: .7rem;
  color: var(--text3);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — MAIN GRID (Chart + List) v2
   ═══════════════════════════════════════════════════════ */
.exp-main-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 16px;
}

.exp-chart-card-v2 {
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--t), box-shadow var(--t);
}

.exp-chart-card-v2:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}

.exp-chart-header-v2 {
  margin-bottom: 16px;
}

.exp-chart-title-v2 {
  font-size: .95rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.exp-chart-title-v2 i {
  color: var(--primary);
  font-size: 1rem;
}

.exp-list-card-v2 {
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--t), box-shadow var(--t);
}

.exp-list-card-v2:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}

.exp-list-header-v2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.exp-list-add-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #818cf8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: all var(--t);
  box-shadow: 0 2px 8px rgba(99, 102, 241, .25);
}

.exp-list-add-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, .4);
}

.exp-chart-card .chart-card-header {
  margin-bottom: 12px;
}

/* Donut */
.exp-donut-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
}

.exp-donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

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

.exp-donut-total {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.exp-donut-label {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 4px;
}

/* Legend */
.exp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.exp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--text2);
}

.exp-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — LIST
   ═══════════════════════════════════════════════════════ */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.exp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--t);
  animation: fadeIn .3s ease both;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.exp-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.exp-item:hover {
  background: rgba(255, 255, 255, .04);
  border-color: var(--border2);
  transform: translateY(-1px);
}

.exp-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

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

.exp-item-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-item-meta {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exp-item-amount {
  text-align: left;
  flex-shrink: 0;
}

.exp-item-amount-val {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  direction: ltr;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.exp-item-amount-cur {
  font-size: .68rem;
  color: var(--text3);
  display: block;
  text-align: left;
}

.exp-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — CATEGORY INPUT (autocomplete)
   ═══════════════════════════════════════════════════════ */
.exp-cat-input-wrap {
  position: relative;
}

.exp-cat-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow), 0 8px 30px rgba(0, 0, 0, .3);
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.exp-cat-sug-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text2);
  cursor: pointer;
  transition: background .15s ease;
  border-bottom: 1px solid var(--border);
}

.exp-cat-sug-item:last-child {
  border-bottom: none;
}

.exp-cat-sug-item:hover,
.exp-cat-sug-item.active {
  background: var(--primary-glow);
  color: var(--primary);
}

.exp-cat-sug-item i {
  font-size: .8rem;
  color: var(--text3);
}

.exp-cat-sug-new {
  color: var(--primary);
  font-weight: 700;
}

.exp-cat-sug-new i {
  color: var(--primary);
}

.exp-cat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.exp-cat-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.exp-cat-quick-pill:hover {
  background: rgba(255, 255, 255, .06);
  border-color: var(--border2);
  color: var(--text2);
}

.exp-cat-quick-pill.selected {
  background: var(--primary-glow);
  border-color: rgba(99, 102, 241, .4);
  color: var(--primary);
}

.exp-cat-quick-pill i {
  font-size: .65rem;
}

[data-theme="light"] .exp-cat-suggestions {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .1);
}

[data-theme="light"] .exp-cat-quick-pill {
  background: #fff;
  border-color: #e2e8f0;
}































font-variant-numeric: tabular-nums;
}

.exp-donut-label {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 4px;
}

/* Legend */
.exp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.exp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  color: var(--text2);
}

.exp-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — LIST
   ═══════════════════════════════════════════════════════ */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.exp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, .02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--t);
  animation: fadeIn .3s ease both;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.exp-item::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.exp-item[data-cat="food"]::before {
  background: #f97316;
}

.exp-item[data-cat="transport"]::before {
  background: #3b82f6;
}

.exp-item[data-cat="bills"]::before {
  background: #eab308;
}

.exp-item[data-cat="shopping"]::before {
  background: #ec4899;
}

.exp-item[data-cat="health"]::before {
  background: #22c55e;
}

.exp-item[data-cat="entertainment"]::before {
  background: #8b5cf6;
}

.exp-item[data-cat="other"]::before {
  background: #64748b;
}

.exp-item:hover {
  background: rgba(255, 255, 255, .04);
  border-color: var(--border2);
  transform: translateY(-1px);
}

.exp-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.exp-item-icon[data-cat="food"] {
  background: rgba(249, 115, 22, .1);
}

.exp-item-icon[data-cat="transport"] {
  background: rgba(59, 130, 246, .1);
}

.exp-item-icon[data-cat="bills"] {
  background: rgba(234, 179, 8, .1);
}

.exp-item-icon[data-cat="shopping"] {
  background: rgba(236, 72, 153, .1);
}

.exp-item-icon[data-cat="health"] {
  background: rgba(34, 197, 94, .1);
}

.exp-item-icon[data-cat="entertainment"] {
  background: rgba(139, 92, 246, .1);
}

.exp-item-icon[data-cat="other"] {
  background: rgba(100, 116, 139, .1);
}

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

.exp-item-title {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-item-meta {
  font-size: .72rem;
  color: var(--text3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.exp-item-amount {
  text-align: left;
  flex-shrink: 0;
}

.exp-item-amount-val {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  direction: ltr;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.exp-item-amount-cur {
  font-size: .68rem;
  color: var(--text3);
  display: block;
  text-align: left;
}

.exp-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — CATEGORY INPUT (autocomplete)
   ═══════════════════════════════════════════════════════ */
.exp-cat-input-wrap {
  position: relative;
}

.exp-cat-input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: .9rem;
  pointer-events: none;
  z-index: 1;
}

.exp-cat-text-input {
  padding-right: 40px !important;
}

.exp-cat-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow), 0 8px 30px rgba(0, 0, 0, .3);
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.exp-cat-sug-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text2);
  cursor: pointer;
  transition: background .15s ease;
  border-bottom: 1px solid var(--border);
}

.exp-cat-sug-item:last-child {
  border-bottom: none;
}

.exp-cat-sug-item:hover,
.exp-cat-sug-item.active {
  background: var(--primary-glow);
  color: var(--primary);
}

.exp-cat-sug-item i {
  font-size: .8rem;
  color: var(--text3);
}

.exp-cat-sug-new {
  color: var(--primary);
  font-weight: 700;
}

.exp-cat-sug-new i {
  color: var(--primary);
}

/* Quick-pick history pills */
.exp-cat-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.exp-cat-quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.exp-cat-quick-pill:hover {
  background: rgba(255, 255, 255, .06);
  border-color: var(--border2);
  color: var(--text2);
}

.exp-cat-quick-pill.selected {
  background: var(--primary-glow);
  border-color: rgba(99, 102, 241, .4);
  color: var(--primary);
}

.exp-cat-quick-pill i {
  font-size: .65rem;
}

[data-theme="light"] .exp-cat-suggestions {
  background: #fff;
  border-color: #e2e8f0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .1);
}

[data-theme="light"] .exp-cat-quick-pill {
  background: #fff;
  border-color: #e2e8f0;
}

/* ═══════════════════════════════════════════════════════
   EXPENSE PANEL (slide-over)
   ═══════════════════════════════════════════════════════ */
#exp-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

#exp-panel-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#exp-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--panel-w);
  max-width: 100vw;
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 51;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
}

#exp-panel.open {
  transform: translateX(0);
}

#expense-form {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .exp-main-grid {
    grid-template-columns: 1fr;
  }

  .exp-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
}

@media (max-width: 767px) {
  #bottom-tabs {
    bottom: 12px;
  }

  .bottom-tab {
    padding: 10px 20px;
    font-size: .82rem;
  }

  .bottom-tab i {
    font-size: 1rem;
  }

  .exp-stats-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .exp-stats-row .exp-stat-card-v2:first-child {
    grid-column: span 2;
    padding: 24px 20px;
  }

  .exp-stats-row .exp-stat-card-v2:first-child .exp-stat-top {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
  }

  .exp-stats-row .exp-stat-card-v2:first-child .exp-stat-icon-v2 {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
    margin: 0 auto;
  }

  .exp-stats-row .exp-stat-card-v2:first-child .exp-stat-value-v2 {
    font-size: 2rem;
    margin-bottom: 4px;
  }

  .exp-stats-row .exp-stat-card-v2:first-child .exp-stat-badge {
    font-size: .8rem;
  }

  .exp-stat-card-v2 {
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .exp-stat-card-v2 .exp-stat-top {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    width: 100%;
  }

  .exp-stat-card-v2 .exp-stat-icon-v2 {
    width: 38px;
    height: 38px;
    font-size: 1rem;
    margin: 0 auto;
  }

  .exp-stat-card-v2 .exp-stat-value-v2 {
    font-size: 1.15rem;
  }

  .exp-cat-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .exp-cat-pill {
    padding: 10px 6px;
    font-size: .68rem;
  }

  .exp-cat-emoji {
    font-size: 1.1rem;
  }

  /* Add bottom padding for tab bar */
  #page-content {
    padding-bottom: 90px;
  }

  .exp-list {
    max-height: none;
  }
}

@media (max-width: 480px) {
  .bottom-tab {
    padding: 10px 16px;
    font-size: .78rem;
    gap: 6px;
  }

  .exp-donut-wrap {
    width: 150px;
    height: 150px;
  }

  .exp-donut-total {
    font-size: 1.2rem;
  }

  .exp-item {
    padding: 12px;
    gap: 10px;
  }

  .exp-item-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

/* ═══════════════════════════════════════════════════════
   EXPENSES — LIGHT THEME
   ═══════════════════════════════════════════════════════ */
[data-theme="light"] .bottom-tabs-inner {
  background: rgba(255, 255, 255, .9);
  border-color: #e2e8f0;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .1);
}

[data-theme="light"] .bottom-tab {
  color: #94a3b8;
}

[data-theme="light"] .bottom-tab.active {
  color: #fff;
}

[data-theme="light"] .exp-date-pill {
  background: #fff;
  border-color: #e2e8f0;
  color: #64748b;
}

[data-theme="light"] .exp-date-pill .exp-date-day {
  color: #334155;
}

[data-theme="light"] .exp-date-pill.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, .1), rgba(129, 140, 248, .05));
  border-color: rgba(99, 102, 241, .3);
}

[data-theme="light"] .exp-date-nav {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .exp-item {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .exp-cat-pill {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] #exp-panel {
  background: #fff;
  border-color: #e2e8f0;
}

[data-theme="light"] .exp-stat-card {
  background: #fff;
  border-color: #e2e8f0;
}