/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Domaine Color Palette - Light Mode with Gold Accents */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --primary: hsl(43, 80%, 48%);
  --primary-hover: hsl(43, 80%, 35%);
  --primary-glow: rgba(184, 134, 11, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.1);
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.1);
  
  --border-color: #e2e8f0;
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.6);
  --blur: 16px;
  
  --sidebar-width: 260px;
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-display: 'Outfit', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --watermark-img: url('assets/logo_light.png');
}

[data-theme="dark"] {
  /* Domaine Color Palette - Night Gold Theme */
  --bg-primary: hsl(220, 20%, 7%);
  --bg-secondary: hsl(220, 20%, 11%);
  --bg-tertiary: hsl(220, 20%, 16%);
  --text-primary: hsl(210, 15%, 95%);
  --text-secondary: hsl(215, 12%, 75%);
  --text-muted: hsl(215, 10%, 58%);
  
  --primary: hsl(43, 80%, 48%);
  --primary-hover: hsl(43, 80%, 35%);
  --primary-glow: rgba(184, 134, 11, 0.2);
  
  --success: #34d399;
  --success-glow: rgba(52, 211, 153, 0.15);
  --warning: #fbbf24;
  --warning-glow: rgba(251, 191, 36, 0.15);
  --danger: #fb7185;
  --danger-glow: rgba(251, 113, 133, 0.15);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.6);
  --glass-bg: rgba(22, 26, 35, 0.6);
  --glass-border: rgba(255, 255, 255, 0.04);
  --watermark-img: url('assets/logo_dark.png');
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 50%;
  left: calc(50% + var(--sidebar-width) / 2);
  transform: translate(-50%, -50%);
  width: 450px;
  height: 450px;
  background-image: var(--watermark-img);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.025; /* ultra subtle watermark */
  pointer-events: none;
  z-index: 0;
  transition: background-image 0.3s;
}

@media (max-width: 768px) {
  body::before {
    left: 50%;
    width: 320px;
    height: 320px;
  }
}

/* App Container */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px;
  z-index: 100;
  transition: var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  text-decoration: none;
}

.brand-logo {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-light {
  display: block;
}
.logo-dark {
  display: none;
}

[data-theme="dark"] .logo-light {
  display: none;
}
[data-theme="dark"] .logo-dark {
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  border-radius: var(--border-radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.nav-item a i {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

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

.nav-item.active a {
  font-weight: 600;
}

/* Sidebar Footer / Theme Toggle */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background-color: var(--border-color);
}

.theme-toggle-btn i {
  font-size: 16px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-glow);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  border: 2px solid var(--border-color);
}

.user-info .user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.user-info .user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-height: 100vh;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: calc(100vw - var(--sidebar-width));
  transition: var(--transition);
}

/* Header & Controls */
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-title h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.header-title p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

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

/* Mobile Header */
.mobile-header {
  display: none;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 99;
  justify-content: space-between;
  align-items: center;
}

.mobile-menu-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-primary);
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  font-family: var(--font-body);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

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

.btn-secondary:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 12px var(--danger-glow);
}

.btn-danger:hover {
  background-color: #e11d48;
  transform: translateY(-1px);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards & Layout Panels */
.view-panel {
  display: none;
  flex-direction: column;
  gap: 32px;
  animation: fadeIn 0.4s ease-out;
}

.view-panel.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur));
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--card-accent, var(--primary));
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.08);
}

.stat-card.wide {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* Dashboard Tab Switcher styling */
.dashboard-switcher {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.btn-tab {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-tab:hover {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-tab.active {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  box-shadow: 0 4px 15px var(--primary-glow);
}

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

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.stat-change {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.stat-change.up { color: var(--danger); }
.stat-change.down { color: var(--success); }

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--border-radius-md);
  background-color: var(--card-accent-glow, var(--primary-glow));
  color: var(--card-accent, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

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

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

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

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

.chart-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-container {
  min-height: 250px;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
}

/* Custom SVG / CSS Bar Chart */
.bar-chart-visual {
  width: 100%;
  height: 250px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 10px 30px 10px;
  position: relative;
  border-bottom: 2px solid var(--border-color);
}

.bar-column {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.bar-rect {
  width: 45%;
  background: linear-gradient(to top, var(--primary), var(--primary-hover));
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  position: relative;
  transition: height 1s ease-out;
  cursor: pointer;
}

.bar-rect:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 15px var(--primary-glow);
}

.bar-rect::before {
  content: attr(data-value);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-primary);
  color: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.bar-rect:hover::before {
  opacity: 1;
  top: -34px;
}

.bar-label {
  position: absolute;
  bottom: -28px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Donut Chart Visual */
.donut-chart-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 20px;
}

.donut-svg-container {
  position: relative;
  width: 180px;
  height: 180px;
}

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

.donut-segment {
  fill: none;
  stroke-width: 16;
  transition: stroke-dasharray 1s ease-in-out;
  cursor: pointer;
}

.donut-segment:hover {
  stroke-width: 20;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-display);
}

.donut-center-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.donut-legend {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

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

/* Dashboard Bottom Grid */
.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .dashboard-bottom-grid {
    grid-template-columns: 1fr;
  }
}

/* Recent Transactions */
.transactions-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Alerts Center */
.alerts-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-size: 13px;
  line-height: 1.4;
  border-left: 4px solid transparent;
}

.alert-card.warning {
  background-color: var(--warning-glow);
  border-left-color: var(--warning);
  color: #854d0e;
}
[data-theme="dark"] .alert-card.warning {
  color: #fef08a;
}

.alert-card.danger {
  background-color: var(--danger-glow);
  border-left-color: var(--danger);
  color: #991b1b;
}
[data-theme="dark"] .alert-card.danger {
  color: #fecdd3;
}

.alert-card i {
  font-size: 16px;
  margin-top: 2px;
}

.alert-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-desc {
  opacity: 0.9;
}

.alert-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  gap: 10px;
  text-align: center;
}

.alert-empty i {
  font-size: 32px;
  color: var(--success);
}

/* Expenses Table and Controls */
.expense-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-color);
}

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

.search-input-wrapper {
  position: relative;
  min-width: 250px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  background-color: var(--bg-secondary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-filter {
  padding: 10px 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

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

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

.date-input {
  padding: 8px 12px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition);
}

.date-input:focus {
  border-color: var(--primary);
  outline: none;
}

/* Expenses Table Styling */
.table-wrapper {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  overflow-x: auto;
  position: relative;
}

.expense-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.expense-table th, .expense-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.expense-table td:nth-child(1),
.expense-table td:nth-child(4) {
  white-space: nowrap !important;
  font-size: 12px !important;
}

.expense-table th:nth-child(1),
.expense-table th:nth-child(4) {
  white-space: nowrap !important;
}

.expense-table th {
  background-color: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  cursor: pointer;
}

.expense-table th:hover {
  color: var(--primary);
}

.expense-table th i {
  font-size: 12px;
  margin-left: 6px;
}

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

.expense-table tbody tr:hover {
  background-color: var(--bg-tertiary);
}

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

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-pending {
  background-color: var(--warning-glow);
  color: var(--warning);
}

.badge-approved {
  background-color: var(--primary-glow);
  color: var(--primary);
}

.badge-reimbursed {
  background-color: var(--success-glow);
  color: var(--success);
}

/* Categories List */
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-secondary);
}

.category-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 11px;
}

/* Action Buttons in Table */
.table-actions {
  display: flex;
  gap: 8px;
}

.btn-table {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
}

.btn-table:hover {
  background-color: var(--bg-tertiary);
}

.btn-table.edit:hover {
  color: var(--primary);
}

.btn-table.delete:hover {
  color: var(--danger);
}

.btn-table.receipt:hover {
  color: var(--success);
}

.no-records {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.no-records i {
  font-size: 48px;
  color: var(--border-color);
}

/* Budgets View Layout */
.budgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.budget-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: var(--transition);
}

.budget-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -10px rgba(0,0,0,0.1);
}

.budget-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.budget-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.budget-details {
  display: flex;
  flex-direction: column;
}

.budget-cat-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

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

.budget-amounts {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-display);
}

.budget-spent {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.budget-cap {
  font-size: 14px;
  color: var(--text-muted);
}

/* Progress Bars */
.progress-bar-container {
  height: 8px;
  width: 100%;
  background-color: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background-color: var(--primary);
  border-radius: 10px;
  transition: width 1s ease-out;
  width: 0;
}

.progress-bar-fill.normal {
  background-color: var(--success);
}

.progress-bar-fill.warning {
  background-color: var(--warning);
}

.progress-bar-fill.danger {
  background-color: var(--danger);
}

.budget-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.budget-percent {
  font-weight: 700;
}

.budget-percent.warning { color: var(--warning); }
.budget-percent.danger { color: var(--danger); }
.budget-percent.normal { color: var(--success); }

.budget-remaining {
  color: var(--text-muted);
}

/* Reports View Layout */
.reports-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .reports-layout {
    grid-template-columns: 1fr;
  }
}

.report-controls-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 24px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: fit-content;
}

.report-viewer-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: 500px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  padding: 10px 14px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  background-color: var(--bg-secondary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Report Sheet Styling */
.report-sheet {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.report-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 20px;
}

.report-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.report-meta {
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-meta span {
  font-weight: 600;
  color: var(--text-primary);
}

.report-summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background-color: var(--bg-tertiary);
  padding: 20px;
  border-radius: var(--border-radius-md);
}

.report-stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.report-stat-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.report-stat-val {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-display);
}

.report-section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.report-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-color);
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.report-table th, .report-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.report-table th {
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
}

/* Modals styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.wide {
  max-width: 700px;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.btn-close-modal:hover {
  color: var(--text-primary);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-tertiary);
}

/* File Upload Layout */
.file-upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
}

.file-upload-zone:hover {
  border-color: var(--primary);
  background-color: var(--primary-glow);
}

.file-upload-zone i {
  font-size: 32px;
  color: var(--text-muted);
}

.file-upload-zone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-glow);
}

.preview-thumbnail-container {
  display: none;
  position: relative;
  width: 100%;
  border-radius: var(--border-radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-top: 8px;
}

.preview-thumbnail {
  width: 100%;
  max-height: 200px;
  object-fit: contain;
  background-color: #000;
}

.btn-remove-file {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: rgba(0,0,0,0.6);
  color: white;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

/* Receipt Modal Layout */
.receipt-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.receipt-image-display {
  max-width: 100%;
  max-height: 450px;
  object-fit: contain;
  border-radius: var(--border-radius-md);
  box-shadow: var(--card-shadow);
}

/* Responsive styles — replaced by full mobile CSS below */

/* Printing styles */
@media print {
  body {
    background-color: white !important;
    color: black !important;
  }
  .sidebar, .mobile-header, .header-actions, .report-controls-card, .btn, .modal-overlay, .expense-controls, .table-actions {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .view-panel {
    display: none !important;
  }
  .view-panel#reports {
    display: block !important;
  }
  .report-viewer-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--border-radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-action-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.sidebar-action-btn.active {
  background-color: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.sidebar-action-btn i {
  font-size: 16px;
}

/* Collapsible Sidebar Styles */
body.sidebar-collapsed {
  --sidebar-width: 76px;
}

body.sidebar-collapsed .brand-name {
  display: none !important;
}

body.sidebar-collapsed .sidebar-brand-container {
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px !important;
  justify-content: center !important;
}

body.sidebar-collapsed .sidebar-nav span {
  display: none !important;
}

body.sidebar-collapsed .sidebar {
  padding: 24px 10px;
  align-items: center;
}

body.sidebar-collapsed .sidebar-nav {
  align-items: center;
  width: 100%;
}

body.sidebar-collapsed .sidebar-nav li {
  width: 100%;
  display: flex;
  justify-content: center;
}

body.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 12px;
  width: 48px;
  height: 48px;
  border-radius: var(--border-radius-md);
}

body.sidebar-collapsed #theme-label,
body.sidebar-collapsed #customize-label,
body.sidebar-collapsed #settings-label,
body.sidebar-collapsed #lock-label {
  display: none !important;
}

body.sidebar-collapsed .theme-toggle-btn,
body.sidebar-collapsed .sidebar-action-btn {
  justify-content: center !important;
  padding: 12px !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: var(--border-radius-md) !important;
}

body.sidebar-collapsed .user-profile .user-info {
  display: none !important;
}

body.sidebar-collapsed .user-profile {
  justify-content: center !important;
  padding: 0 !important;
}

.btn-sidebar-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: -12px;
  width: 24px;
  height: 24px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 105;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  padding: 0;
}

.btn-sidebar-toggle:hover {
  color: var(--text-primary) !important;
  background-color: var(--border-color) !important;
  transform: translateY(-50%) scale(1.1);
}

.btn-sidebar-toggle i {
  font-size: 10px;
}

/* Login Screen Animations */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
  20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.shake {
  animation: shake 0.4s ease;
}


.lock-overlay {
  background-image: linear-gradient(rgba(11, 15, 23, 0.82), rgba(11, 15, 23, 0.82)), url('assets/lock_bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* User Profile click to lock micro-interactions */
.user-profile {
  transition: all 0.2s ease !important;
}

.user-profile:hover {
  background-color: var(--bg-tertiary) !important;
}

.user-profile:hover .avatar {
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.user-profile .avatar {
  transition: all 0.2s ease;
}

/* Clear All Modal — pulsing danger icon */
@keyframes pulse-danger {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ============================================================
   MOBILE RESPONSIVE — S23 Ultra & all phones (max-width 768px)
   ============================================================ */
@media (max-width: 768px) {

  /* ── Global overflow clamp ─────────────────────────────── */
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* ── Body & root layout ───────────────────────────────── */
  body {
    flex-direction: column;
    overflow-x: hidden;
  }

  /* ── Mobile top header bar ────────────────────────────── */
  .mobile-header {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 200;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  }

  .mobile-header .brand-name {
    font-size: 15px !important;
    font-weight: 700;
    color: var(--text-primary);
  }

  .mobile-menu-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* ── Sidebar — slide-out drawer ───────────────────────── */
  .sidebar {
    position: fixed !important;
    left: -280px !important;
    top: 60px !important;
    height: calc(100vh - 60px) !important;
    width: 260px !important;
    z-index: 300 !important;
    border-right: 1px solid var(--border-color) !important;
    border-top: none !important;
    transition: left 0.3s ease !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    overflow-y: auto;
    padding: 20px 16px !important;
  }

  .sidebar.active {
    left: 0 !important;
  }

  /* Hide the desktop collapse toggle on mobile */
  .btn-sidebar-toggle {
    display: none !important;
  }

  /* ── Mobile sidebar overlay backdrop ─────────────────── */
  #mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100vw;
    height: calc(100vh - 60px);
    background: rgba(0,0,0,0.55);
    z-index: 250;
    backdrop-filter: blur(2px);
  }

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

  /* ── Main content — full width under header ───────────── */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    padding: 76px 12px 24px 12px !important;
    gap: 16px !important;
    overflow-x: hidden !important;
  }

  /* ── Content header — stack vertically ───────────────── */
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
  }

  .content-header h1 {
    font-size: 20px !important;
  }

  .content-header p {
    font-size: 13px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 120px;
    font-size: 12px;
    padding: 9px 10px;
    justify-content: center;
  }

  /* ── Stat cards — 2-column grid on mobile ─────────────── */
  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    width: 100% !important;
  }

  .stat-card {
    padding: 14px 12px !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .stat-card.wide {
    grid-column: span 2 !important;
  }

  .stat-value {
    font-size: 18px !important;
    word-break: break-all;
  }

  .stat-label {
    font-size: 11px !important;
  }

  .stat-icon-wrapper {
    width: 36px !important;
    height: 36px !important;
    font-size: 15px !important;
    flex-shrink: 0;
  }

  .stat-info {
    min-width: 0;
    overflow: hidden;
  }

  /* ── Charts — single column, constrained ─────────────── */
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .chart-card {
    padding: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  #weeklyChart, #donutChart {
    max-height: 200px !important;
    width: 100% !important;
  }

  /* ── Dashboard bottom grid — single column ────────────── */
  .dashboard-bottom-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  /* ── Recent Transactions panel ─────────────────────────── */
  .transactions-panel {
    padding: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  /* Make the recent transactions list NOT use overflow-x scroll */
  #recent-transactions-list {
    overflow-x: visible !important;
  }

  /* Hide the standard table inside recent transactions on mobile */
  #recent-transactions-list .expense-table {
    display: none !important;
  }

  /* Show mobile transaction cards */
  .mobile-tx-card {
    display: flex !important;
  }

  /* ── Budget alerts panel ───────────────────────────────── */
  .alerts-panel {
    padding: 16px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* ── Expense controls toolbar ─────────────────────────── */
  .expense-controls {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  .expense-controls > * {
    width: 100% !important;
    min-width: 0 !important;
  }

  .select-filter, .input-search {
    width: 100% !important;
    font-size: 14px !important;
  }

  .table-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* ── Transaction table — horizontal scroll ────────────── */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--border-radius-md);
    max-width: 100%;
  }

  .expense-table {
    font-size: 12px !important;
    min-width: 560px;
  }

  .expense-table th, .expense-table td {
    padding: 9px 8px !important;
  }

  /* Hide less important columns on mobile — Payment Method */
  .expense-table th:nth-child(5),
  .expense-table td:nth-child(5) {
    display: none;
  }

  /* ── Modals — bottom sheet on mobile ──────────────────── */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .modal-card, .modal-card.wide {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 93vh !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto;
  }

  .modal-body {
    padding: 16px !important;
  }

  /* ── Forms — single column, prevent iOS zoom ──────────── */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Force 2-column grid in Add Financial modal back to 1 col */
  [style*="grid-template-columns: 3fr 2fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  .form-control, .form-group input, .form-group select, .form-group textarea {
    font-size: 16px !important; /* prevents iOS zoom */
    padding: 11px 12px !important;
    width: 100% !important;
  }

  /* ── Reports page ─────────────────────────────────────── */
  .report-controls-card {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .report-controls-card .btn,
  .report-controls-card select {
    width: 100% !important;
  }

  /* ── Lock screen — mobile friendly ───────────────────── */
  .lock-overlay {
    padding: 16px !important;
  }

  .lock-card {
    width: 100% !important;
    max-width: 100% !important;
    padding: 28px 20px !important;
  }

  /* ── Sidebar nav items — bigger touch targets ────────── */
  .sidebar-nav li a {
    padding: 14px 12px !important;
    font-size: 15px !important;
  }

  .sidebar-nav li a i {
    font-size: 18px !important;
  }

  /* ── Bottom nav bar hint ──────────────────────────────── */
  .sidebar-footer {
    padding-bottom: 20px;
  }

  .theme-toggle-btn, .sidebar-action-btn {
    font-size: 13px !important;
    padding: 11px 14px !important;
  }

  /* ── Mobile transaction cards (hidden on desktop) ─────── */
  .mobile-tx-card {
    display: none;
  }

}

/* Extra small screens (older/smaller phones) */
@media (max-width: 380px) {
  .content-header h1 {
    font-size: 18px !important;
  }

  .stat-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-card.wide {
    grid-column: span 1 !important;
  }

  .stat-value {
    font-size: 18px !important;
  }

  .expense-table {
    font-size: 11px !important;
  }
}

/* 6-Digit PIN Screen Styles */
.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background-color: transparent;
  transition: all 0.15s ease;
}
.pin-dot.filled {
  background-color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}
.btn-num {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  outline: none;
}
.btn-num:hover, .btn-num:active {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: var(--primary);
  transform: scale(1.05);
}


