/* wwwroot/css/app.css */
/* ============================================================
   INVOICE SAAS — Design System
   Font: Plus Jakarta Sans (headings) + JetBrains Mono (code/numbers)
   Aesthetic: Clean SaaS — precise grid, refined spacing, sharp data
   ============================================================ */

:root {
  /* Brand */
  --primary: #2962ff;
  --primary-light: #448aff;
  --primary-dark: #0039cb;
  --primary-subtle: #e8eeff;

  /* Status */
  --success: #00c853;
  --success-subtle: #e6fff0;
  --warning: #ff9100;
  --warning-subtle: #fff5e6;
  --danger: #ff3d3d;
  --danger-subtle: #fff0f0;
  --info: #00b0ff;
  --info-subtle: #e6f7ff;

  /* Neutral */
  --white: #ffffff;
  --gray-50: #f8f9fc;
  --gray-100: #f0f2f7;
  --gray-200: #e2e6ef;
  --gray-300: #c8cedd;
  --gray-400: #9aa5bc;
  --gray-500: #6b7591;
  --gray-600: #4a5270;
  --gray-700: #2d3354;
  --gray-800: #1a1f38;
  --gray-900: #0d1024;

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 68px;
  --topbar-height: 60px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;

  /* Surfaces */
  --bg-body: #f0f2f7;
  --bg-card: #ffffff;
  --bg-sidebar: #0d1024;
  --bg-sidebar-hover: rgba(255,255,255,0.07);
  --bg-sidebar-active: rgba(41,98,255,0.25);
  --border-color: #e2e6ef;

  /* Text */
  --text-primary: #1a1f38;
  --text-secondary: #6b7591;
  --text-muted: #9aa5bc;
  --text-sidebar: rgba(255,255,255,0.75);
  --text-sidebar-active: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --shadow-primary: 0 4px 14px rgba(41,98,255,0.35);
}

/* ── DARK MODE ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-body: #0d1024;
  --bg-card: #161b35;
  --bg-sidebar: #090c1a;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --border-color: rgba(255,255,255,0.08);
  --text-primary: #e8ecf5;
  --text-secondary: #8a94b0;
  --text-muted: #5a6278;
  --gray-50: #161b35;
  --gray-100: #1e2444;
  --gray-200: #252b4a;
  --primary-subtle: rgba(41,98,255,0.15);
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
  display: flex;
  transition: background 0.2s, color 0.2s;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-dark); }

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--bg-sidebar);
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: var(--topbar-height);
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}

.sidebar.collapsed .brand-name { opacity: 0; width: 0; }

.sidebar-toggle-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-toggle-btn:hover { background: var(--bg-sidebar-hover); color: #fff; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.3);
  padding: 12px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.2s;
}
.sidebar.collapsed .nav-section-title { opacity: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text-sidebar);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
  white-space: nowrap;
  margin-bottom: 2px;
}

.nav-item i {
  font-size: 16px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.nav-item span {
  transition: opacity 0.2s;
  overflow: hidden;
}

.sidebar.collapsed .nav-item span { opacity: 0; width: 0; overflow: hidden; }

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: #fff;
}

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

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.badge-count {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.trial-badge {
  background: rgba(255, 145, 0, 0.15);
  border: 1px solid rgba(255, 145, 0, 0.3);
  color: var(--warning);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .trial-badge span { display: none; }

/* ── MAIN LAYOUT ───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed); }

/* ── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-toggle, .topbar-toggle { display: none; }

.topbar-breadcrumb { flex: 1; }

#desktopSidebarToggle {
  display: inline-flex;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--gray-100); color: var(--text-primary); }

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* Notification panel */
.notification-wrapper { position: relative; }

.notification-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 200;
}

.notification-panel.open { display: block; }

.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.btn-link-sm {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.notif-list { max-height: 320px; overflow-y: auto; }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.notif-item-msg { font-size: 12px; color: var(--text-secondary); }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* User menu */
.user-menu-wrapper { position: relative; }

.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 5px 10px 5px 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-avatar-btn:hover { background: var(--gray-100); }

.avatar-circle {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 200;
}
.user-dropdown.open { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-divider { border: none; border-top: 1px solid var(--border-color); margin: 6px 0; }

/* ── PAGE CONTENT ──────────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

/* ── SUBSCRIPTION BANNER ───────────────────────────────────── */
.subscription-banner {
  background: linear-gradient(135deg, var(--warning), #ff6d00);
  color: #fff;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  font-size: 13.5px;
  font-weight: 500;
  gap: 8px;
}

/* ── CARDS ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-color);
  background: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.card-body { padding: 20px; }

/* ── STAT CARDS ────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: var(--primary-subtle); color: var(--primary); }
.stat-icon.green { background: var(--success-subtle); color: var(--success); }
.stat-icon.orange { background: var(--warning-subtle); color: var(--warning); }
.stat-icon.red { background: var(--danger-subtle); color: var(--danger); }

.stat-content { flex: 1; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; font-family: 'JetBrains Mono', monospace; }
.stat-trend { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ── TABLE ─────────────────────────────────────────────────── */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.table thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--gray-50); }

/* ── BADGES ────────────────────────────────────────────────── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  display: inline-block;
  letter-spacing: 0.02em;
}
.badge-paid    { background: var(--success-subtle); color: var(--success); }
.badge-unpaid  { background: var(--warning-subtle); color: var(--warning); }
.badge-overdue { background: var(--danger-subtle); color: var(--danger); }
.badge-draft   { background: var(--gray-100); color: var(--gray-500); }
.badge-pending { background: var(--info-subtle); color: var(--info); }
.badge-active  { background: var(--success-subtle); color: var(--success); }
.badge-trial   { background: rgba(41,98,255,0.1); color: var(--primary); }
.badge-expired { background: var(--danger-subtle); color: var(--danger); }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: 10px; }
.btn-icon { padding: 7px; width: 34px; height: 34px; justify-content: center; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(41,98,255,0.12);
}

.form-control.is-invalid { border-color: var(--danger); }
.field-validation-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; display: block; }

textarea.form-control { min-height: 90px; resize: vertical; }

/* ── PAGE HEADER ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

/* ── GRID ──────────────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; }
.grid-5-7 { display: grid; grid-template-columns: 5fr 7fr; gap: 20px; }

/* ── PAGINATION ────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
  padding: 0 10px;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-subtle); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── AUTH PAGES ────────────────────────────────────────────── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 50%, #1a0048 100%);
}

.auth-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #fff;
}

.auth-right {
  width: 480px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 44px;
  min-height: 100vh;
}

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

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.auth-brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
}

/* ── INVOICE BUILDER ───────────────────────────────────────── */
.invoice-builder {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}

.invoice-items-table {
  width: 100%;
  border-collapse: collapse;
}
.invoice-items-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  padding: 8px 10px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--border-color);
}
.invoice-items-table td {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.invoice-items-table .form-control { padding: 6px 8px; font-size: 13px; }

.invoice-totals { margin-top: 12px; }
.total-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.total-row.grand-total {
  border-top: 2px solid var(--border-color);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}

/* ── SUBSCRIPTION PLANS ────────────────────────────────────── */
.plan-card {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 28px 24px;
  text-align: center;
  transition: all 0.2s;
  background: var(--bg-card);
  position: relative;
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.plan-card.featured {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-subtle), var(--bg-card));
}
.plan-badge-featured {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 14px;
  border-radius: 20px;
  white-space: nowrap;
}
.plan-price {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-family: 'JetBrains Mono', monospace;
  color: var(--primary);
  line-height: 1;
}
.plan-price-sub { font-size: 13px; color: var(--text-muted); }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .main-wrapper { margin-left: 0 !important; }

  .topbar-toggle { display: flex !important; }

  #desktopSidebarToggle { display: none !important; }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2, .grid-5-7 { grid-template-columns: 1fr; }

  .invoice-builder { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { width: 100%; }

  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}

/* ── UTILITIES ─────────────────────────────────────────────── */
.text-primary-color { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-secondary-color { color: var(--text-secondary) !important; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mono { font-family: 'JetBrains Mono', monospace; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ms-auto { margin-left: auto; }
.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
.w-100 { width: 100%; }
.overflow-hidden { overflow: hidden; }

/* ── LOADING SPINNER ───────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CHART CONTAINER ───────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 260px;
}

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h4 { font-size: 16px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── SEARCH BAR ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}
.search-input-wrapper i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}
.search-input-wrapper .form-control { padding-left: 32px; }

/* ── TOAST NOTIFICATIONS ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 76px;
  right: 18px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}

.app-toast {
  pointer-events: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 12px 12px 12px 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  color: var(--text-primary);
  animation: toast-in 0.22s ease-out;
}

.app-toast i { margin-top: 1px; font-size: 16px; }
.app-toast span { font-size: 13px; line-height: 1.35; }

.app-toast.success { border-left-color: var(--success); }
.app-toast.success > i { color: var(--success); }

.app-toast.danger { border-left-color: var(--danger); }
.app-toast.danger > i { color: var(--danger); }

.app-toast.info { border-left-color: var(--info); }
.app-toast.info > i { color: var(--info); }

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.toast-close:hover { background: var(--gray-100); color: var(--text-primary); }

.app-toast.hiding {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 16px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}
