/* ── DEFAULT (DARK) THEME ── */
:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1c1c27;
  --surface3: #242434;
  --border: rgba(255,255,255,0.07);
  --text: #f0f0f8;
  --text-muted: #7878a0;
  --text-dim: #4a4a6a;
  --gaurav: #f97316;
  --gaurav-glow: rgba(249,115,22,0.25);
  --gaurav-dim: rgba(249,115,22,0.08);
  --shubham: #818cf8;
  --shubham-glow: rgba(129,140,248,0.25);
  --shubham-dim: rgba(129,140,248,0.08);
  --green: #4ade80;
  --green-dim: rgba(74,222,128,0.1);
  --red: #f87171;
  --red-dim: rgba(248,113,113,0.1);
  --accent: #818cf8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --surface3: #e2e8f0;
  --border: rgba(0,0,0,0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --shadow: 0 10px 40px rgba(0,0,0,0.08);
}

/* ── MIDNIGHT (BLUE) THEME ── */
[data-theme="midnight"] {
  --bg: #020617;
  --surface: #0f172a;
  --surface2: #1e293b;
  --surface3: #334155;
  --border: rgba(255,255,255,0.05);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --shadow: 0 20px 60px rgba(0,0,0,0.6);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ── PAGES ───────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* ── LOGIN PAGE ──────────────────────────── */
#login-page {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}

.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 50%, rgba(249,115,22,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 50%, rgba(129,140,248,0.08) 0%, transparent 60%);
}

.login-bg-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 40%, transparent 100%);
}

[data-theme="light"] .login-bg-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
}

.login-logo {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  position: relative;
}

.login-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 12px;
  position: relative;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 300;
  margin-bottom: 64px;
  position: relative;
}

.user-cards {
  display: flex;
  gap: 40px;
  position: relative;
  flex-wrap: wrap;
  justify-content: center;
}

.user-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.user-card:hover { transform: translateY(-6px) scale(1.02); }

.user-card-ring {
  position: relative;
  width: 180px;
  height: 180px;
}

.user-card-ring svg {
  position: absolute; inset: 0;
  animation: spin 8s linear infinite;
}

.user-card-ring svg.reverse { animation-direction: reverse; animation-duration: 12s; }

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

.user-card-inner {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
  overflow: hidden;
  background: var(--surface);
}

.user-card[data-user="gaurav"] .user-card-inner {
  border: 1px solid rgba(249,115,22,0.2);
  box-shadow: inset 0 0 40px rgba(249,115,22,0.05), 0 0 40px rgba(249,115,22,0.15);
}

.user-card[data-user="shubham"] .user-card-inner {
  border: 1px solid rgba(129,140,248,0.2);
  box-shadow: inset 0 0 40px rgba(129,140,248,0.05), 0 0 40px rgba(129,140,248,0.15);
}

.user-card:hover .user-card-inner { transform: scale(1.03); }

.user-emoji { font-size: 44px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2)); }

.user-card-name {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 700;
}

.user-card[data-user="gaurav"] .user-card-name { color: var(--gaurav); }
.user-card[data-user="shubham"] .user-card-name { color: var(--shubham); }

.user-card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-align: center;
}

/* ── KEY MODAL ───────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 40px;
  width: 90%;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px;
  background: var(--surface2);
  border: none; border-radius: 8px;
  color: var(--text-muted); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover { background: var(--surface3); color: var(--text); }

.modal-icon {
  width: 56px; height: 56px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 20px;
}

.modal-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 700;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 14px; color: var(--text-muted);
  margin-bottom: 28px;
}

.input-group { margin-bottom: 20px; }

.input-label {
  display: block;
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}

.input-field {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  letter-spacing: 0.15em;
}

.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-dim); letter-spacing: 0; }

.btn {
  width: 100%;
  padding: 14px 24px;
  border: none; border-radius: var(--radius-sm);
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.05em;
}

.btn-gaurav {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: white;
  box-shadow: 0 4px 20px rgba(249,115,22,0.35);
}

.btn-gaurav:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(249,115,22,0.5);
}

.btn-shubham {
  background: linear-gradient(135deg, #818cf8, #a5b4fc);
  color: white;
  box-shadow: 0 4px 20px rgba(129,140,248,0.35);
}

.btn-shubham:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(129,140,248,0.5);
}

.error-msg {
  color: var(--red); font-size: 13px;
  margin-top: 8px; display: none;
}

/* ── APP LAYOUT ──────────────────────────── */
#app-page {
  flex-direction: row;
  min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 28px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 8px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #f97316, #818cf8);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px; font-weight: 700;
  color: var(--text);
}

.sidebar-user-card {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 10px;
}

.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.sidebar-user-info { flex: 1; }
.sidebar-user-name {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 700;
}

.sidebar-user-role {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}

.sidebar-nav { flex: 1; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 4px;
  border: 1px solid transparent;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--border);
}

.nav-icon { width: 20px; text-align: center; font-size: 16px; }

/* ── THEME PICKER ── */
.sidebar-theme-picker {
  margin-top: auto;
  margin-bottom: 12px;
  padding: 0 14px;
}

.theme-options {
  display: flex; gap: 4px;
  background: var(--surface2);
  padding: 4px; border-radius: var(--radius-sm);
}

.theme-btn {
  flex: 1; padding: 8px 0; border: none; border-radius: 6px;
  background: transparent; cursor: pointer; color: var(--text-muted);
  transition: all 0.2s; font-size: 14px;
}

.theme-btn:hover { background: var(--surface3); }
.theme-btn.active { 
  background: var(--surface); 
  color: var(--text); 
  box-shadow: 0 1px 4px rgba(0,0,0,0.1); 
}

.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
  transition: all 0.2s;
  border: none; background: none;
  width: 100%;
}

.sidebar-logout:hover { color: var(--red); }

/* ── MAIN CONTENT ────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 36px 40px;
  max-width: 900px;
}

.view { display: none; }
.view.active { display: block; }

/* ── DASHBOARD VIEW ──────────────────────── */
.dash-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap; gap: 16px;
}

.dash-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
}

.dash-date {
  font-size: 13px; color: var(--text-muted);
  margin-top: 4px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}

.stat-value {
  font-family: 'Syne', sans-serif;
  font-size: 26px; font-weight: 800;
}

.stat-sub {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}

/* ── FAB ADD BUTTON ──────────────────────── */
.fab-wrap {
  position: fixed;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}

.fab {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 28px;
  border: none; border-radius: 100px;
  background: linear-gradient(135deg, #f97316, #818cf8);
  color: white;
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(129,140,248,0.35), 0 2px 8px rgba(0,0,0,0.4);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  letter-spacing: 0.05em;
}

.fab:hover {
  transform: scale(1.06) translateY(-2px);
  box-shadow: 0 12px 40px rgba(129,140,248,0.5);
}

.fab-icon { font-size: 20px; font-weight: 300; }

/* ── DATE GROUP ──────────────────────────── */
.date-group { margin-bottom: 28px; }

.date-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}

.date-label::after {
  content: '';
  flex: 1; height: 1px;
  background: var(--border);
}

.date-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.expense-row {
  display: flex; align-items: center;
  padding: 14px 18px; gap: 14px;
  border-bottom: 1px solid var(--border);
  transition: all 0.25s ease;
}

.expense-row:last-child { border-bottom: none; }

.expense-row:hover { 
  background: var(--surface2); 
  transform: translateX(4px); 
  border-left: 2px solid var(--accent);
  padding-left: 16px;
}

.expense-type-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

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

.expense-name {
  font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.expense-meta {
  font-size: 12px; color: var(--text-muted);
  margin-top: 2px;
  display: flex; align-items: center; gap: 6px;
}

.expense-amount {
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700;
  flex-shrink: 0;
}

.expense-split {
  text-align: right;
  flex-shrink: 0;
  min-width: 90px;
}

.split-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.05em;
}

.split-pill.paid { background: var(--green-dim); color: var(--green); }
.split-pill.owed { background: var(--red-dim); color: var(--red); }

.split-my-share {
  font-size: 11px; color: var(--text-dim);
  margin-top: 3px;
}

.empty-state {
  text-align: center; padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--text); margin-bottom: 8px;
}

.empty-state-text { font-size: 14px; }

/* ── EDIT & DELETE BUTTONS ── */
.expense-actions {
  display: flex; gap: 8px; margin-left: 12px;
}

.icon-btn {
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 14px;
}

.icon-btn:hover {
  background: rgba(129,140,248,0.1);
  border-color: rgba(129,140,248,0.3);
  color: var(--accent);
  transform: translateY(-2px);
}

.icon-btn.delete-btn:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: var(--red);
}

/* ── SUMMARY VIEW ────────────────────────── */
.summary-header { margin-bottom: 32px; }

.summary-title {
  font-family: 'Syne', sans-serif;
  font-size: 28px; font-weight: 800;
}

.summary-sub {
  font-size: 13px; color: var(--text-muted); margin-top: 4px;
}

.balance-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 36px;
}

.balance-card {
  border-radius: var(--radius);
  padding: 28px;
  position: relative; overflow: hidden;
}

.balance-card.pay {
  background: linear-gradient(135deg, rgba(248,113,113,0.12), rgba(248,113,113,0.05));
  border: 1px solid rgba(248,113,113,0.2);
}

.balance-card.get {
  background: linear-gradient(135deg, rgba(74,222,128,0.12), rgba(74,222,128,0.05));
  border: 1px solid rgba(74,222,128,0.2);
}

.balance-card-glow {
  position: absolute; width: 120px; height: 120px;
  border-radius: 50%; top: -20px; right: -20px;
  opacity: 0.15; pointer-events: none;
}

.balance-card.pay .balance-card-glow { background: var(--red); }
.balance-card.get .balance-card-glow { background: var(--green); }

.balance-card-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 12px;
}

.balance-card.pay .balance-card-label { color: var(--red); }
.balance-card.get .balance-card-label { color: var(--green); }

.balance-card-amount {
  font-family: 'Syne', sans-serif;
  font-size: 36px; font-weight: 800;
  line-height: 1;
  margin-bottom: 8px;
}

.balance-card.pay .balance-card-amount { color: var(--red); }
.balance-card.get .balance-card-amount { color: var(--green); }

.balance-card-desc { font-size: 13px; color: var(--text-muted); }

.summary-breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.breakdown-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px; font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.breakdown-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.breakdown-row:last-child { border-bottom: none; }
.breakdown-key { color: var(--text-muted); }
.breakdown-val { font-weight: 600; }

/* ── ADD EXPENSE MODAL ───────────────────── */
#add-modal .modal { max-width: 500px; }

.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.type-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 12px 8px;
  background: var(--surface2);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s;
  color: var(--text-muted);
}

.type-btn:hover { border-color: var(--border); color: var(--text); }
.type-btn.selected { border-color: var(--accent); color: var(--text); background: rgba(129,140,248,0.08); }
.type-btn-icon { font-size: 20px; }
.type-btn-label { font-size: 10px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }

.toggle-row {
  display: flex; background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 4px; gap: 4px;
  margin-bottom: 4px;
}

.toggle-opt {
  flex: 1; padding: 9px 12px;
  border: none; border-radius: 8px;
  background: none; color: var(--text-muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}

.toggle-opt.active {
  background: var(--surface3);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.manual-fields {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px; margin-top: 12px;
}

.manual-fields.show { display: grid; }

.btn-primary {
  background: linear-gradient(135deg, #f97316, #818cf8);
  color: white;
  box-shadow: 0 4px 20px rgba(129,140,248,0.25);
  margin-top: 4px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(129,140,248,0.4);
}

/* Loading spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.loading .spinner { display: inline-block; }
.loading .btn-text { display: none; }

/* Toast */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--surface3); border: 1px solid var(--border);
  border-radius: 100px; padding: 10px 20px;
  font-size: 13px; z-index: 2000;
  box-shadow: var(--shadow);
  opacity: 0; transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show { opacity: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* ── TYPE COLORS ─────────────────────────── */
.type-travel { background: rgba(251,191,36,0.12); }
.type-food { background: rgba(249,115,22,0.12); }
.type-vegetables { background: rgba(74,222,128,0.12); }
.type-home { background: rgba(129,140,248,0.12); }
.type-other { background: rgba(148,163,184,0.12); }

@media (max-width: 720px) {
  .sidebar { width: 200px; min-width: 200px; padding: 20px 12px; }
  .main-content { padding: 24px 20px; }
  .balance-cards { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  #app-page { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; position: relative; padding: 16px; gap: 8px; }
  .sidebar-brand { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .sidebar-nav { display: flex; gap: 4px; }
  .sidebar-user-card { margin-bottom: 0; }
  
  .sidebar-theme-picker { margin: 0 auto 0 0; padding: 0; }
  
  .expense-row { padding: 12px; flex-wrap: wrap; }
  .expense-actions { margin-left: 0; width: 100%; justify-content: flex-end; margin-top: 8px; }
  .expense-split { text-align: left; margin-top: 8px; }
}; }

@media (max-width: 720px) {
  .sidebar { width: 200px; min-width: 200px; padding: 20px 12px; }
  .main-content { padding: 24px 20px; }
  .balance-cards { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  #app-page { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; position: relative; padding: 16px; gap: 8px; }
  .sidebar-brand { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
  .sidebar-nav { display: flex; gap: 4px; }
  .sidebar-user-card { margin-bottom: 0; }
  
  .sidebar-theme-picker { margin: 0 auto 0 0; padding: 0; }
  
  .expense-row { padding: 12px; flex-wrap: wrap; }
  .expense-actions { margin-left: 0; width: 100%; justify-content: flex-end; margin-top: 8px; }
  .expense-split { text-align: left; margin-top: 8px; }
}