/* ========================================================
   Room Expense Manager - Premium Modern Design System
   Tailored for Hostinger PHP/MySQL Deployment
   Clean, Professional, Mobile-First
   ======================================================== */

:root {
  /* Color Palette */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfdfe;
  --bg-subtle: #f1f5f9;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  /* Brand / Action Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  
  /* Fixed Roommate Colors */
  --member-balaji: #2563eb;     /* Blue */
  --member-balaji-bg: #eff6ff;
  --member-balaji-border: #bfdbfe;
  --member-balaji-text: #1d4ed8;
  
  --member-praveen: #16a34a;    /* Green */
  --member-praveen-bg: #f0fdf4;
  --member-praveen-border: #bbf7d0;
  --member-praveen-text: #15803d;
  
  --member-vicknesh: #ea580c;   /* Orange */
  --member-vicknesh-bg: #fff7ed;
  --member-vicknesh-border: #fed7aa;
  --member-vicknesh-text: #c2410c;
  
  /* Status Colors */
  --status-normal: #10b981;
  --status-normal-bg: #ecfdf5;
  --status-warning: #f59e0b;
  --status-warning-bg: #fffbeb;
  --status-critical: #ef4444;
  --status-critical-bg: #fef2f2;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); /* Safe space for mobile bottom nav */
}

@media (min-width: 1024px) {
  body {
    padding-bottom: 24px;
  }
}

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

button, input, select, textarea {
  font-family: inherit;
}

/* Containers */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .container {
    padding: 0 12px;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }
}

/* Top App Header */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  width: 100%;
  max-width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .header-inner {
    height: 56px;
    gap: 6px;
  }
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Month Selector */
.month-selector-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.month-select {
  appearance: none;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 34px 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.month-select:hover, .month-select:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  outline: none;
}

.month-selector-arrow {
  position: absolute;
  right: 11px;
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* Desktop-only Add Expense button in Header */
@media (max-width: 767px) {
  .header-desktop-add-btn {
    display: none !important;
  }
}

/* User & Action Buttons in Header */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

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

/* Mobile Header Optimizations (< 640px) */
@media (max-width: 640px) {
  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
  }
  .brand-title {
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .brand-subtitle {
    display: none;
  }
  .header-controls {
    gap: 6px;
  }
  .month-select {
    padding: 6px 26px 6px 8px;
    font-size: 0.775rem;
  }
  .month-selector-arrow {
    right: 8px;
    font-size: 0.65rem;
  }
  .user-badge {
    padding: 5px 8px;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .user-badge-name {
    display: none;
  }
  .brand-title {
    font-size: 0.9rem;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.25);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
  border-color: #cbd5e1;
}

.btn-icon.spinning i {
  animation: spin 0.8s linear infinite;
}

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

/* Desktop Navigation Bar */
.desktop-nav {
  display: none;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
}

@media (min-width: 1024px) {
  .desktop-nav {
    display: block;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  height: 48px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.nav-link.active {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--primary-light);
}

/* Page Hero / Status Bar */
.page-top-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 14px;
}

@media (min-width: 640px) {
  .page-top-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0 16px;
  }
}

.dashboard-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 640px) {
  .dashboard-top-actions {
    width: 100%;
    gap: 8px;
  }
  .dashboard-top-actions .btn {
    flex: 1;
    font-size: 0.825rem;
    padding: 8px 12px;
    justify-content: center;
  }
}

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

@media (max-width: 640px) {
  .page-title {
    font-size: 1.15rem;
  }
}

.update-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Dashboard Summary Cards Grid (5 Cards) */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 768px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
  }
}

@media (min-width: 1024px) {
  .summary-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.summary-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.summary-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.summary-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.summary-card-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-purple { background: #f5f3ff; color: #7c3aed; }
.icon-teal { background: #f0fdfa; color: #0d9488; }
.icon-amber { background: #fffbeb; color: #d97706; }
.icon-emerald { background: #ecfdf5; color: #059669; }

.summary-card-value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.1;
  margin-bottom: 3px;
}

.summary-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Card 5 (Remaining) Highlights */
.summary-card.highlight-remaining {
  border-left: 4px solid var(--primary);
}

.summary-card.status-critical {
  border-left: 4px solid var(--status-critical);
}

/* Mobile full-width prominence for Remaining Card */
@media (max-width: 767px) {
  .summary-card {
    padding: 12px 14px;
  }
  .summary-card-value {
    font-size: 1.25rem;
  }
  .summary-card.highlight-remaining {
    grid-column: span 2;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    border: 1.5px solid #86efac;
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.08);
  }
  .summary-card.highlight-remaining.status-critical {
    background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
    border: 1.5px solid #fca5a5;
  }
  .summary-card.highlight-remaining .summary-card-value {
    font-size: 1.45rem;
  }
}

/* Budget Progress Bar Card */
.progress-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 640px) {
  .progress-card {
    padding: 14px;
  }
  .progress-title {
    font-size: 0.875rem !important;
  }
  .progress-metrics {
    font-size: 0.8rem !important;
  }
  .progress-footer {
    font-size: 0.72rem !important;
  }
}

.progress-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

@media (min-width: 640px) {
  .progress-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.progress-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.progress-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-normal {
  background: var(--status-normal-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background: var(--status-warning-bg);
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-critical {
  background: var(--status-critical-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.badge-exceeded {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  animation: pulse-danger 1.5s infinite;
}

@keyframes pulse-danger {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.progress-metrics {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.progress-metrics span.muted {
  color: var(--text-muted);
  font-weight: 400;
}

.progress-track {
  width: 100%;
  height: 12px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.5s ease-in-out;
  background-color: var(--primary);
}

.progress-fill.fill-normal { background: linear-gradient(90deg, #10b981 0%, #059669 100%); }
.progress-fill.fill-warning { background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%); }
.progress-fill.fill-critical { background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%); }
.progress-fill.fill-exceeded { background: linear-gradient(90deg, #dc2626 0%, #991b1b 100%); }

.progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* Alert Banner (Budget Exceeded) */
.alert-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.875rem;
  font-weight: 500;
}

.alert-danger {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

/* Member Spending Section */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .member-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.member-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: var(--transition);
}

.member-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.member-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.member-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.avatar-vmbalaji { background: var(--member-balaji); }
.avatar-praveen { background: var(--member-praveen); }
.avatar-vicknesh { background: var(--member-vicknesh); }

.member-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.member-info p {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.member-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.member-total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.member-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 600;
}

.badge-vmbalaji {
  background: var(--member-balaji-bg);
  border: 1px solid var(--member-balaji-border);
  color: var(--member-balaji-text);
}

.badge-praveen {
  background: var(--member-praveen-bg);
  border: 1px solid var(--member-praveen-border);
  color: var(--member-praveen-text);
}

.badge-vicknesh {
  background: var(--member-vicknesh-bg);
  border: 1px solid var(--member-vicknesh-border);
  color: var(--member-vicknesh-text);
}

/* Charts Section */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (min-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

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

.chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-canvas-wrap {
  position: relative;
  height: 250px;
  width: 100%;
}

/* Settlement Section */
.settlement-card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.transfers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.transfer-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

@media (min-width: 640px) {
  .transfer-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.transfer-flow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.transfer-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.transfer-amount {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Expenses Table and Filter Bar */
.filter-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 768px) {
  .filter-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px; /* 16px prevents iOS Safari / Android auto zoom */
  background-color: var(--bg-subtle);
  transition: var(--transition);
  min-height: 44px;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
}

.filter-selects-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .filter-selects-group {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    width: 100%;
  }
}

.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background-color: var(--bg-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  min-height: 42px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
}

/* Table Style for Desktop */
.table-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.desktop-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  display: none;
}

@media (min-width: 768px) {
  .desktop-table {
    display: table;
  }
}

.desktop-table th {
  background-color: var(--bg-subtle);
  padding: 12px 18px;
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.desktop-table td {
  padding: 14px 18px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.desktop-table tr:last-child td {
  border-bottom: none;
}

.desktop-table tr:hover td {
  background-color: var(--bg-card-hover);
}

/* Mobile Expense Cards */
.mobile-expense-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

@media (min-width: 768px) {
  .mobile-expense-cards {
    display: none;
  }
}

.expense-card-item {
  background-color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.expense-card-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.expense-item-desc {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.expense-item-amt {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.expense-card-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
  border-top: 1px dashed var(--border-color);
  font-size: 0.775rem;
  color: var(--text-muted);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.action-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-action-edit, .btn-action-delete {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: var(--transition);
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 640px) {
  .btn-action-edit, .btn-action-delete {
    padding: 8px 14px;
    font-size: 0.825rem;
    min-height: 38px;
    border-radius: 8px;
  }
}

.btn-action-edit:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--member-balaji-border);
}

.btn-action-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background-color: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-drag-indicator {
  display: none;
}

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  min-height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px; /* Prevents iOS Safari auto-zoom */
  color: var(--text-main);
  background-color: var(--bg-card);
  transition: var(--transition);
  min-height: 44px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.input-symbol {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1rem;
}

.input-with-symbol input {
  padding-left: 32px;
}

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

.paid-by-option {
  position: relative;
}

.paid-by-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.paid-by-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 600;
  transition: var(--transition);
  text-align: center;
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
}

.paid-by-option input[type="radio"]:checked + .paid-by-label.label-vmbalaji {
  border-color: var(--member-balaji);
  background-color: var(--member-balaji-bg);
  color: var(--member-balaji-text);
}

.paid-by-option input[type="radio"]:checked + .paid-by-label.label-praveen {
  border-color: var(--member-praveen);
  background-color: var(--member-praveen-bg);
  color: var(--member-praveen-text);
}

.paid-by-option input[type="radio"]:checked + .paid-by-label.label-vicknesh {
  border-color: var(--member-vicknesh);
  background-color: var(--member-vicknesh-bg);
  color: var(--member-vicknesh-text);
}

.modal-footer {
  padding: 16px 20px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Bottom Sheet Modal on Mobile (< 640px) */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-container {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
  }
  .modal-overlay.active .modal-container {
    transform: translateY(0);
  }
  .modal-drag-indicator {
    display: block;
    width: 40px;
    height: 4px;
    background-color: #cbd5e1;
    border-radius: 9999px;
    margin: 10px auto 2px;
  }
  .modal-header {
    padding: 12px 18px;
  }
  .modal-title {
    font-size: 1.05rem;
  }
  .modal-body {
    padding: 16px 18px;
    gap: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .modal-footer {
    padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 10px;
  }
  .modal-footer .btn {
    flex: 1;
    min-height: 44px;
    font-size: 0.9rem;
  }
}

/* Mobile Bottom Navigation Bar */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(62px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: #ffffff;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.06);
}

@media (min-width: 1024px) {
  .mobile-nav-bar {
    display: none;
  }
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
  min-height: 44px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
  font-size: 1.15rem;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-add-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  margin-top: -20px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-add-btn:active {
  transform: scale(0.92);
  background-color: var(--primary-hover);
}

/* Toast Notifications on Mobile */
@media (max-width: 640px) {
  .toast-container {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px;
    right: 12px;
  }
  .toast {
    max-width: 100%;
    width: 100%;
    font-size: 0.85rem;
    padding: 10px 14px;
  }
}

/* Empty State */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2.5rem;
  color: #cbd5e1;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 6px;
}
