/* ========================================
   YENE KIS - Expense Manager
   Modern Mobile-First Design System
   ======================================== */

/* ---------- CSS Variables ---------- */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #34d399;
  --primary-50: #ecfdf5;
  --primary-100: #d1fae5;
  --primary-200: #a7f3d0;
  --primary-900: #064e3b;

  --surface: #ffffff;
  --surface-dim: #f8fafc;
  --surface-card: #ffffff;
  --bg: #f0fdf4;
  --bg-alt: #f1f5f9;

  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --success: #10b981;
  --success-light: #ecfdf5;
  --info: #3b82f6;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

  --nav-height: 72px;
  --topbar-height: 56px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-height) + 16px);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- Utilities ---------- */
.container {
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  padding: 16px;
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.35s var(--bounce);
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Top Bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar h1, .topbar .title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.topbar .icon {
  font-size: 20px;
}
.topbar-back {
  position: absolute;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

/* ---------- Tabs / Segmented Control ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 16px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  max-width: 508px;
  margin-left: auto;
  margin-right: auto;
}
.tabs a {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  text-decoration: none;
}
.tabs a.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ---------- Hero Number ---------- */
.hero-stat {
  text-align: center;
  padding: 28px 20px 20px;
}
.hero-stat .label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.hero-stat h1 {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.hero-stat .sub {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}
.hero-stat .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

/* ---------- List Items ---------- */
.list-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}
.list-item:last-child { border-bottom: none; }
.list-item .rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.list-item .info { flex: 1; min-width: 0; }
.list-item .info .name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item .info .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.list-item .amount {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

/* ---------- Expense Row ---------- */
.expense-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  transition: var(--transition);
}
.expense-card:active { transform: scale(0.98); }
.expense-card .icon-circle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.expense-card .details { flex: 1; min-width: 0; }
.expense-card .details .item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.expense-card .details .item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.expense-card .right-col {
  text-align: right;
  flex-shrink: 0;
}
.expense-card .right-col .amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.expense-card .right-col .date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.expense-card .actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.expense-card .actions a {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
  transition: var(--transition);
}
.expense-card .actions .edit-btn {
  background: var(--primary-50);
  color: var(--primary);
}
.expense-card .actions .delete-btn {
  background: var(--danger-light);
  color: var(--danger);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-dim);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
  background: var(--surface);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-danger {
  background: var(--danger);
  color: var(--text-inverse);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--nav-height) + 16px);
  width: 56px;
  height: 56px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--text-inverse);
  box-shadow: 0 4px 20px rgba(5,150,105,0.35);
  transition: var(--bounce);
  z-index: 40;
  text-decoration: none;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }

/* ---------- Bottom Nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}
.bottom-nav a .nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.bottom-nav a.active {
  color: var(--primary);
}
.bottom-nav a.active .nav-icon {
  background: var(--primary-50);
  border-radius: var(--radius-full);
  width: 48px;
  height: 28px;
}
.bottom-nav a.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--success-light); color: var(--primary); border: 1px solid var(--primary-200); }
.alert-error { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }

/* ---------- Search Dropdown ---------- */
.search-wrapper { position: relative; }
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
  display: none;
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}
.search-dropdown div {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-light);
}
.search-dropdown div:last-child { border-bottom: none; }
.search-dropdown div:hover { background: var(--primary-50); }
.search-dropdown .category-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ---------- Auth Pages ---------- */
/* =========================================
   Auth Page
   ========================================= */

.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--surface-dim);
}

.auth-container {
  width: 100%;
  max-width: 380px;
}

/* Header */

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header .logo {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  background: var(--primary);
  border-radius: 10px;
}

.auth-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.02em;
}

.auth-header p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Card */

.auth-card {
  background: var(--surface);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Form */

.form-group {
  margin-bottom: 18px;
}

.form-group label,
.password-label label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-group input[type="email"],
.form-group input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.08);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Password row */

.password-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.password-label label {
  margin-bottom: 7px;
}

.password-label a {
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.password-label a:hover {
  text-decoration: underline;
}

/* Remember */

.remember {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 20px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.remember input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
}

/* Primary button */

.auth-card .btn-primary {
  width: 100%;
  height: 44px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 650;
}

/* Divider */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

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

/* Google */

.google-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  border: 1px solid var(--border);
  border-radius: 7px;

  background: var(--surface);
  color: var(--text);

  font-size: 14px;
  font-weight: 600;
  text-decoration: none;

  transition: background 0.15s ease, border-color 0.15s ease;
}

.google-btn:hover {
  background: var(--surface-dim);
  border-color: var(--text-muted);
}

.google-btn img {
  width: 17px;
  height: 17px;
}

/* Register link */

.auth-link {
  margin: 22px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-link a {
  margin-left: 3px;
  color: var(--primary);
  font-weight: 650;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* Footer */

.auth-footer {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Alerts */

.auth-card .alert {
  margin-bottom: 18px;
  font-size: 13px;
  border-radius: 7px;
}


/* =========================================
   Mobile
   ========================================= */

@media (max-width: 480px) {
  .auth-page {
    align-items: flex-start;
    padding-top: 60px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .auth-header {
    margin-bottom: 20px;
  }
}


/* ---------- Profile ---------- */
.profile-section { text-align: center; margin-bottom: 20px; }
.profile-img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin: 0 auto 12px;
  border: 3px solid var(--primary-100);
}

/* ---------- Shopping List ---------- */
.shopping-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}
.shopping-item:last-child { border-bottom: none; }
.shopping-item.bought .item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}
.shopping-item .check-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  color: transparent;
}
.shopping-item.bought .check-icon {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.shopping-item .info { flex: 1; }
.shopping-item .info .item-name { font-size: 14px; font-weight: 600; }
.shopping-item .info .item-meta { font-size: 12px; color: var(--text-muted); }

/* ---------- Category Accordion ---------- */
.category-group {
  margin-bottom: 8px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-light);
  background: var(--surface);
}
.category-header {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}
.category-header:hover { background: var(--surface-dim); }
.category-header .arrow {
  transition: transform var(--transition);
  font-size: 12px;
  color: var(--text-muted);
}
.category-header.open .arrow { transform: rotate(180deg); }
.item-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 12px 12px;
}
.item-grid.show { display: grid; }
.item-card {
  text-align: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.item-card:hover { background: var(--surface-dim); }
.item-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.item-card .name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* ---------- Budget ---------- */
.budget-bar {
  margin-bottom: 16px;
}
.budget-bar .bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.budget-bar .bar-track {
  height: 8px;
  background: var(--bg-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.budget-bar .bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary);
  transition: width 0.6s ease;
}
.budget-bar .bar-fill.over { background: var(--danger); }

/* ---------- Image Modal ---------- */
.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.9);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.image-modal.show { display: flex; }
.image-modal img {
  max-width: 90%;
  max-height: 85vh;
  border-radius: var(--radius);
  object-fit: contain;
}
.image-modal .close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 20px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Install Banner ---------- */
.install-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--nav-height) + 8px);
  left: 16px;
  right: 16px;
  max-width: 508px;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--primary-900);
  color: var(--text-inverse);
  border-radius: var(--radius);
  z-index: 90;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.4s var(--bounce);
}
.install-banner .install-text { flex: 1; }
.install-banner .install-text strong { font-size: 14px; }
.install-banner .install-text small { font-size: 12px; opacity: 0.8; display: block; margin-top: 2px; }
.install-banner .install-action {
  padding: 8px 16px;
  background: var(--text-inverse);
  color: var(--primary-900);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.install-banner .install-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ---------- Admin Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--surface-dim);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table .item-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* ---------- Countdown ---------- */
.countdown {
  text-align: center;
  padding: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}
.countdown #timer {
  font-weight: 700;
  color: var(--primary);
  font-size: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 380px) {
  .hero-stat h1 { font-size: 32px; }
  .auth-card { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .item-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .container { max-width: 600px; }
  .item-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ========== DARK MODE (Manual Toggle) ========== */
.dark-mode {
  --surface: #1e293b;
  --surface-dim: #0f172a;
  --surface-card: #1e293b;
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  --border: #334155;
  --border-light: #1e293b;
  --primary-50: rgba(5,150,105,0.12);
  --primary-100: rgba(5,150,105,0.2);
  --danger-light: rgba(239,68,68,0.12);
  --success-light: rgba(16,185,129,0.12);
  --warning-light: rgba(245,158,11,0.12);
}
.dark-mode .auth-page {
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #064e3b 100%);
}
.dark-mode .auth-card { border-color: var(--border); }
.dark-mode .divider span { background: var(--surface); }
.dark-mode .google-btn { background: var(--surface-dim); color: var(--text); }
.dark-mode .btn-primary { color: #ffffff; }

/* Theme Toggle Button */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--surface-dim);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  justify-content: center;
}
.theme-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-50);
}

/* ========== LOAN DETAILS ========== */
details summary {
  list-style: none;
}
details summary::-webkit-details-marker {
  display: none;
}
details[open] summary {
  margin-bottom: 4px;
}

/* ========== Toggle Switch (Pure CSS) ========== */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}
.toggle-switch {
  width: 52px;
  height: 30px;
  background: var(--border);
  border-radius: 15px;
  position: relative;
  transition: background 0.3s ease;
  flex-shrink: 0;
}
.toggle-switch.active {
  background: var(--primary);
}
.toggle-knob {
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.active .toggle-knob {
  transform: translateX(22px);
}

/* ========== Item Suggestion Modal ========== */
.suggestion-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.suggestion-overlay.show {
  display: flex;
}
.suggestion-modal {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}
.suggestion-modal h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--text);
}
.suggestion-modal .form-group {
  margin-bottom: 12px;
}

/* ========== Budget Alert Banner ========== */
.budget-alert-banner {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 8px 16px 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: fadeIn 0.4s ease-out;
}
.budget-alert-banner .alert-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.budget-alert-banner .alert-content {
  flex: 1;
}
.budget-alert-banner .alert-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--danger);
  margin-bottom: 4px;
}
.budget-alert-banner .alert-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}
.budget-alert-banner .alert-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
}
