:root {
  --bg-dark: #0f172a;
  /* Slate 900 */
  --bg-card: rgba(30, 41, 59, 0.7);
  /* Slate 800 */
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --primary: #6366f1;
  /* Indigo */
  --primary-hover: #4f46e5;

  --color-balance: #3b82f6;
  /* Blue */
  --color-investment: #8b5cf6;
  /* Violet */
  --color-income: #10b981;
  /* Emerald */
  --color-expense: #ef4444;
  /* Red */

  --border-light: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Auth Login Styling */
.auth-body {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
}

.background-effects {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 1;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary);
  top: -100px;
  left: -100px;
  animation: float 10s infinite ease-in-out alternate;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--color-investment);
  bottom: -50px;
  right: -50px;
  animation: float 12s infinite ease-in-out alternate-reverse;
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
  }

  100% {
    transform: translateY(30px) scale(1.1);
  }
}

.auth-card {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: var(--glass-shadow);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(20px);
}

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

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

.logo-placeholder {
  width: 64px;
  height: 64px;
  margin: 0 auto 15px;
  background: linear-gradient(135deg, var(--primary), var(--color-investment));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.auth-header h2 {
  font-size: 28px;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Dashboard Layout */
.dashboard-body {
  display: flex;
}

.sidebar {
  width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-light);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.sidebar.collapsed {
  width: 80px;
  padding: 30px 15px;
}

.sidebar.collapsed .sidebar-logo h2,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .online-section,
.sidebar.collapsed .logout-btn span {
  display: none;
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding-left: 0;
  margin-bottom: 30px;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .menu-item svg {
  margin: 0;
}

.sidebar.collapsed .logout-btn {
  justify-content: center;
  padding: 12px;
}

.sidebar-toggle {
  position: absolute;
  top: 30px;
  right: -15px;
  width: 30px;
  height: 30px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border: 4px solid var(--bg-main);
  transition: transform 0.3s ease;
  z-index: 101;
}

.sidebar-toggle:hover {
  transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

@media (max-width: 992px) {
  .sidebar-toggle {
    display: none;
  }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding-left: 10px;
  transition: padding 0.3s ease;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--color-investment));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
}

.sidebar-logo h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.5px;
  white-space: normal;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.online-section {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  transition: opacity 0.3s ease;
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 15px;
  font-weight: 600;
}

.online-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--color-income);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-income);
}

.status-dot.offline {
  background-color: var(--color-expense);
  box-shadow: 0 0 8px var(--color-expense);
}

.user-name {
  color: var(--text-main);
  text-transform: capitalize;
  white-space: nowrap;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 12px;
  transition: var(--transition);
  font-weight: 500;
  white-space: nowrap;
}

.menu-item span {
  transition: opacity 0.3s ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.menu-item.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.logout-btn {
  margin-top: auto;
  color: #fca5a5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 600;
  border-radius: 12px;
  transition: var(--transition);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-expense);
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 30px 40px;
  max-width: 1400px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-content.expanded {
  margin-left: 80px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.greeting h1 {
  font-size: 32px;
  letter-spacing: -1px;
  margin-bottom: 5px;
}

.greeting p {
  color: var(--text-muted);
}

.highlight {
  color: var(--primary);
  font-weight: 600;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.2);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}

.balance-card .stat-icon {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-balance);
}

.investment-card .stat-icon {
  background: rgba(139, 92, 246, 0.2);
  color: var(--color-investment);
}

.income-card .stat-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-income);
}

.expense-card .stat-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-expense);
}

.stat-info p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 5px;
  font-weight: 500;
}

.stat-info h3 {
  font-size: 24px;
  letter-spacing: -0.5px;
}

/* Content Grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(10px);
}

.card h3 {
  font-size: 20px;
  margin-bottom: 20px;
  font-weight: 600;
}

.chart-container {
  height: 300px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Table styling */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr {
  transition: var(--transition);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  display: inline-block;
}

.badge-income {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-income);
}

.badge-expense {
  background: rgba(239, 68, 68, 0.15);
  color: var(--color-expense);
}

.badge-investment {
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-investment);
}

/* Forms & Inputs */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition);
}

select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 16px !important;
  padding-right: 40px !important;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

select option {
  background: var(--bg-dark);
  color: white;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Grid Layout Control Buttons */
/* Grid Layout Control Buttons */
.btn-edit-layout {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-edit-layout:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.btn-save-layout {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.btn-save-layout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-reset-layout {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-reset-layout:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}

.w-100 {
  width: 100%;
}

.btn-icon-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-expense);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon-danger:hover {
  background: var(--color-expense);
  color: white;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

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

.modal {
  width: 100%;
  max-width: 480px;
  transform: scale(0.95);
  transition: var(--transition);
}

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

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

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}

.close-modal:hover {
  color: white;
}

.error-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  text-align: center;
}

/* Hamburger & Topbar Structural Fixes */
.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 5px;
  align-items: center;
  justify-content: center;
}

.close-sidebar {
  display: none;
}

.topbar-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

/* Fix Chart.js Grid expansion issue */
.card {
  min-width: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hamburger-btn {
    display: flex;
  }

  .close-sidebar {
    display: flex;
    margin-left: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 250px;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  }

  .sidebar.active {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 20px 15px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn-primary,
  .topbar-actions .export-btn {
    flex: 1;
    justify-content: center;
    padding: 12px 10px;
    font-size: 14px;
  }

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

  .stat-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 15px;
    gap: 10px;
  }

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

  .table-container {
    overflow-x: auto;
  }

  .data-table th,
  .data-table td {
    white-space: nowrap;
    padding: 12px 10px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

/* Notes & Tasks Widget Styles */
.notes-tabs-container {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 4px;
}

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

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active-tab {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.note-input-field {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.note-input-field:focus {
  border-color: var(--primary);
}

.note-select-field {
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  padding: 0 10px;
  color: var(--text-main);
  font-size: 13px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

.note-item {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  padding: 12px 15px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: 12px !important;
  margin-bottom: 10px !important;
  transition: all 0.2s ease-in-out !important;
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.note-item input[type='radio'] {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  max-width: 12px !important;
  min-height: 12px !important;
  max-height: 12px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border: 2px solid var(--color-income) !important;
  border-radius: 50% !important;
  outline: none !important;
  cursor: pointer !important;
  background: transparent !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.note-item input[type='radio']:hover {
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6) !important;
  transform: scale(1.4) !important;
}

@keyframes fadeOutTask {
  0% {
    opacity: 1;
    transform: translateX(0);
  }

  100% {
    opacity: 0;
    transform: translateX(30px);
  }
}

@keyframes fadeInTask {
  0% {
    opacity: 0;
    transform: translateX(-30px);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.note-item-fade-out {
  animation: fadeOutTask 0.35s ease forwards !important;
}

.note-item-fade-in {
  animation: fadeInTask 0.35s ease forwards !important;
}

.note-item input[type='radio']:checked {
  background: var(--color-income) !important;
  border-color: var(--color-income) !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5) !important;
}

.note-item input[type='radio']:checked::after {
  display: none !important;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== MOBILE RESPONSIVE ===== */

/* Tablet & small laptop */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    width: 260px;
    transition: left 0.3s ease;
    z-index: 1000;
  }

  .sidebar.active {
    left: 0;
  }

  .sidebar-toggle {
    display: none;
  }

  .hamburger-btn {
    display: flex;
  }

  .close-sidebar {
    display: flex;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 20px 15px !important;
    width: 100% !important;
  }

  .greeting h1 {
    font-size: 24px;
  }

  .greeting {
    margin-bottom: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 16px;
    border-radius: 16px;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
  }

  .stat-info p {
    font-size: 12px;
  }

  .stat-info h3 {
    font-size: 18px;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .card h3 {
    font-size: 16px;
    margin-bottom: 14px;
  }

  .topbar {
    padding: 12px 15px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  /* GridStack mobile: single column */
  .grid-stack>.grid-stack-item {
    width: 100% !important;
    position: relative !important;
    left: 0 !important;
    top: auto !important;
  }

  .grid-stack {
    height: auto !important;
  }

  /* Modals fit on small screens */
  .modal-card {
    width: 95% !important;
    max-width: 95% !important;
    padding: 20px !important;
    border-radius: 14px !important;
    max-height: 85vh;
    overflow-y: auto;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 10px;
  }

  .btn-primary {
    padding: 10px 18px;
    font-size: 13px;
  }

  .btn-secondary {
    padding: 10px 18px;
    font-size: 13px;
  }

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

/* Phone */
@media (max-width: 576px) {
  .main-content {
    padding: 15px 10px !important;
  }

  .greeting h1 {
    font-size: 20px;
  }

  .greeting p {
    font-size: 12px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
    border-radius: 14px;
  }

  .stat-icon {
    width: 30px;
    height: 30px;
  }

  .stat-info p {
    font-size: 10px;
    margin-bottom: 2px;
  }

  .stat-info h3 {
    font-size: 16px;
  }

  .card {
    padding: 12px;
    border-radius: 14px;
  }

  .card h3 {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .chart-container {
    height: 150px !important;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar h1 {
    font-size: 16px;
  }

  .topbar-actions {
    gap: 6px;
  }

  /* Transaction rows tighter */
  .transaction-item {
    padding: 10px 8px;
    font-size: 12px;
  }

  .badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* Notes & recurring costs */
  .note-item {
    padding: 10px;
    font-size: 12px;
  }

  /* Buttons smaller */
  .btn-primary,
  .btn-secondary {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
  }

  .btn-save-layout,
  .btn-reset-layout {
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Form inputs smaller */
  input,
  select,
  textarea {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
  }

  .input-group label {
    font-size: 12px;
  }

  /* Online users */
  .user-item {
    padding: 8px;
    font-size: 12px;
  }
}

/* Extra small phone */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-card {
    flex-direction: row;
    gap: 12px;
    padding: 14px;
  }

  .greeting h1 {
    font-size: 18px;
  }
}

/* Mobile overlay when sidebar is open */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar-overlay.active {
  display: block;
}