/*
 * dashbord-offline.css — Premium Admin Dashboard (v4.0)
 * Full redesign — mobile-first, modern SaaS look
 */

/* =============================================================
   1. FONTS & VARIABLES
   ============================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  /* Colors */
  --blue: #3b82f6;
  --blue-dark: #2563eb;
  --blue-light: #eff6ff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --indigo: #6366f1;
  --indigo-light: #eef2ff;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;

  /* UI */
  --sidebar-bg: #0f172a;
  --sidebar-w: 260px;
  --header-h: 64px;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-1: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --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.07);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);

  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}

/* =============================================================
   2. NOTIFICATION TOAST
   ============================================================= */
.db-notification,
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: var(--text-1);
  box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
  max-width: min(320px, calc(100vw - 32px));
  font-family: var(--font);
}

.db-notification.show,
.notification.show {
  transform: translateX(0);
}

.db-notification.success,
.notification.success {
  background: var(--green);
}

.db-notification.error,
.notification.error {
  background: var(--red);
}

.db-notification.info,
.notification.info {
  background: var(--blue);
}

/* =============================================================
   3. LOGIN SCREEN
   ============================================================= */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
}

.login-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.4);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.login-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

#loginForm .form-group {
  margin-bottom: 1.25rem;
}

#loginForm .form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
}

#loginForm .form-group input {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: all var(--transition);
  outline: none;
}

#loginForm .form-group input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

#loginForm .form-group input:focus {
  border-color: var(--blue);
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-login {
  width: 100%;
  padding: 0.95rem;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5);
}

.btn-login:active {
  transform: scale(0.98);
}

/* =============================================================
   4. MAIN DASHBOARD LAYOUT
   ============================================================= */
#mainDashboard {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Overlay */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

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

/* =============================================================
   5. SIDEBAR
   ============================================================= */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: relative;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

#sidebar::-webkit-scrollbar {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.5rem 1.25rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-brand-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.sidebar-brand-role {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.25);
  padding: 0.75rem 0.75rem 0.4rem;
  margin-top: 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
}

.sidebar-link-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateX(4px);
}

.sidebar-link:hover .sidebar-link-icon {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.15));
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15), inset 0 0 20px rgba(99, 102, 241, 0.05);
  position: relative;
  overflow: hidden;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, #60a5fa, #8b5cf6);
  border-radius: 4px 0 0 4px;
  box-shadow: 0 0 10px #8b5cf6;
}

.sidebar-link.active .sidebar-link-icon {
  background: linear-gradient(135deg, var(--blue), var(--purple));
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.sidebar-link-accent {
  color: rgba(96, 165, 250, 0.8);
}

.sidebar-link-accent:hover {
  color: #93c5fd;
}

.sidebar-link-ai {
  color: rgba(251, 191, 36, 0.8);
}

.sidebar-link-ai:hover {
  color: #fcd34d;
}

.sidebar-link-ai.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

.sidebar-logout {
  margin: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1.5px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  color: #fca5a5;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.sidebar-logout:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* =============================================================
   6. MAIN CONTENT
   ============================================================= */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* =============================================================
   7. TOP HEADER
   ============================================================= */
.db-header {
  height: var(--header-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.db-hamburger {
  display: none;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.db-hamburger:hover {
  background: var(--blue-light);
  color: var(--blue);
  border-color: var(--blue);
}

.db-header-title {
  flex: 1;
  min-width: 0;
}

.db-header-title h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.date-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

.db-date-input {
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  outline: none;
  cursor: pointer;
  min-width: 110px;
}

.date-sep {
  color: var(--text-3);
  font-weight: 700;
  font-size: 0.85rem;
}

.btn-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-filter:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-filter:active {
  transform: scale(0.97);
}

/* =============================================================
   8. CONTENT AREA & SECTIONS
   ============================================================= */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page-section {
  display: block;
}

.page-section.hidden {
  display: none;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i {
  color: var(--blue);
}

/* =============================================================
   9. BUTTONS
   ============================================================= */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.btn-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-success {
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-purple {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

/* =============================================================
   10. KPI CARDS
   ============================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: default;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.kpi-card:hover .kpi-icon {
  transform: scale(1.08);
}

.kpi-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.55rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.02em;
}

.kpi-bg-icon {
  position: absolute;
  right: -8px;
  bottom: -8px;
  font-size: 5rem;
  opacity: 0.06;
  pointer-events: none;
}

/* Color variants */
.kpi-blue {
  border-color: rgba(59, 130, 246, 0.12);
}

.kpi-blue .kpi-icon {
  background: var(--blue-light);
  color: var(--blue);
}

.kpi-blue .kpi-value {
  color: var(--blue-dark);
}

.kpi-green {
  border-color: rgba(16, 185, 129, 0.12);
}

.kpi-green .kpi-icon {
  background: var(--green-light);
  color: var(--green);
}

.kpi-green .kpi-value {
  color: #059669;
}

.kpi-indigo {
  border-color: rgba(99, 102, 241, 0.12);
}

.kpi-indigo .kpi-icon {
  background: var(--indigo-light);
  color: var(--indigo);
}

.kpi-indigo .kpi-value {
  color: var(--indigo);
}

.kpi-red {
  border-color: rgba(239, 68, 68, 0.12);
}

.kpi-red .kpi-icon {
  background: var(--red-light);
  color: var(--red);
}

.kpi-red .kpi-value {
  color: var(--red);
}

.kpi-amber {
  border-color: rgba(245, 158, 11, 0.12);
}

.kpi-amber .kpi-icon {
  background: var(--amber-light);
  color: var(--amber);
}

.kpi-amber .kpi-value {
  color: #d97706;
}

/* =============================================================
   11. DB CARDS
   ============================================================= */
.db-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.db-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.db-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-card-title i {
  color: var(--blue);
}

.db-card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-card-body {
  padding: 1.25rem;
}

.db-card-toolbar {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.smart-filter {
  min-height: 42px;
  padding: 0 2.25rem 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.smart-filter:focus {
  outline: 3px solid rgba(37, 99, 235, 0.12);
  border-color: var(--brand-500);
}

.db-chart-card {
  margin-bottom: 0;
}

.db-chart-card .db-card-body {
  padding: 1.25rem;
}

/* Reports: consistent visual, table and export layout */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.reports-grid .db-card {
  margin-bottom: 0;
  min-width: 0;
}

.report-chart-body {
  position: relative;
  height: 290px;
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.report-range-select {
  min-height: 42px;
  padding: 0 2.25rem 0 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-1);
  font: 700 0.84rem var(--font);
}

.report-customer-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.report-stat {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.report-stat span {
  display: block;
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.report-stat strong {
  display: block;
  margin-top: 0.4rem;
  color: var(--text-1);
  font-size: 1.25rem;
}

.report-note {
  margin-top: 0.35rem;
  font-size: 0.78rem;
}

.report-control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.report-type-tabs,
.report-view-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.report-type-tab,
.report-view-tab {
  min-height: 40px;
  padding: 0.65rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  font: 700 0.82rem var(--font);
  cursor: pointer;
}

.report-type-tab i { margin-right: 0.35rem; }

.report-type-tab.active,
.report-view-tab.active {
  color: var(--blue);
  background: var(--blue-light);
  border-color: rgba(59, 130, 246, 0.2);
}

.report-view-tabs {
  padding: 0.25rem;
  border-radius: 12px;
  background: var(--bg);
}

.report-definition {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  color: var(--text-2);
  background: rgba(59, 130, 246, 0.07);
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.45;
}

.report-definition i { color: var(--blue); margin-top: 0.15rem; }
.report-panel, .report-view { display: none; }
.report-panel.active, .report-view.active { display: block; }

.report-empty-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  padding: 2rem;
  text-align: center;
  background: var(--card-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.report-empty-guide i { color: var(--blue); font-size: 1.7rem; margin-bottom: 0.75rem; }
.report-empty-guide strong { color: var(--text-1); }
.report-empty-guide span { max-width: 420px; margin-top: 0.35rem; color: var(--text-2); font-size: 0.82rem; }
.report-purpose { font-size: 1rem !important; }
.report-primary-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: #fff;
  background: var(--blue);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 800;
}

/* =============================================================
   12. SEARCH BOX
   ============================================================= */
.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

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

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.88rem;
  color: var(--text-1);
  outline: none;
  transition: all var(--transition);
}

.search-box input:focus {
  border-color: var(--blue);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

/* =============================================================
   13. TABLES
   ============================================================= */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 0.88rem;
}

.db-table thead tr {
  background: #f8fafc;
}

.db-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

.db-table th.text-right {
  text-align: right;
}

.db-table td {
  padding: 0.875rem 1rem;
  color: var(--text-1);
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  white-space: nowrap;
}

.db-table td.text-right {
  text-align: right;
}

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

.db-table tbody tr:hover {
  background: #f8fafc;
}

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

.table-empty {
  text-align: center;
  color: var(--text-3);
  padding: 3rem 1rem !important;
  font-size: 0.9rem;
  white-space: normal !important;
}

.table-empty i {
  display: block;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* =============================================================
   14. ICON ACTION BUTTON
   ============================================================= */
.icon-action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}

.icon-action-btn:hover {
  background: var(--blue-light);
  color: var(--blue);
  border-color: var(--blue);
}

/* =============================================================
   15. AI COMMAND CENTER
   ============================================================= */
.ai-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.25rem;
  align-items: flex-start;
}

/* Config form inside AI card */
.config-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.config-form .form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.config-form .form-group input,
.config-form .form-group select {
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-1);
  outline: none;
  transition: all var(--transition);
}

.config-form .form-group input:focus,
.config-form .form-group select:focus {
  border-color: var(--blue);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Toggle Cards */
.toggle-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1.5px solid;
}

.toggle-danger {
  background: var(--red-light);
  border-color: rgba(239, 68, 68, 0.2);
}

.toggle-info {
  background: var(--blue-light);
  border-color: rgba(59, 130, 246, 0.2);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 99px;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.toggle-danger input:checked+.toggle-switch {
  background: var(--red);
}

.toggle-info input:checked+.toggle-switch {
  background: var(--blue);
}

input:checked+.toggle-switch::after {
  transform: translateX(18px);
}

.toggle-text {
  font-size: 0.88rem;
  font-weight: 700;
}

.toggle-danger .toggle-text {
  color: var(--red);
}

.toggle-info .toggle-text {
  color: var(--blue-dark);
}

.toggle-hint {
  font-size: 0.75rem;
  margin-top: 6px;
  margin-left: 52px;
  font-weight: 500;
}

.toggle-danger .toggle-hint {
  color: #f87171;
}

.toggle-info .toggle-hint {
  color: #60a5fa;
}

.btn-save-config {
  width: 100%;
  padding: 0.875rem;
  background: var(--text-1);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 0.5rem;
}

.btn-save-config:hover {
  background: #334155;
  transform: translateY(-1px);
}

/* Risk Stats */
.risk-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.risk-stat-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid;
  position: relative;
  overflow: hidden;
}

.risk-stat-red {
  background: var(--red-light);
  border-color: rgba(239, 68, 68, 0.2);
}

.risk-stat-amber {
  background: var(--amber-light);
  border-color: rgba(245, 158, 11, 0.2);
}

.risk-stat-icon {
  font-size: 1.25rem;
  margin-bottom: 8px;
  display: block;
}

.risk-stat-red .risk-stat-icon {
  color: var(--red);
}

.risk-stat-amber .risk-stat-icon {
  color: var(--amber);
}

.risk-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 4px;
}

.risk-stat-red .risk-stat-label {
  color: #fb7185;
}

.risk-stat-amber .risk-stat-label {
  color: #fbbf24;
}

.risk-stat-value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
}

.risk-stat-red .risk-stat-value {
  color: var(--red);
}

.risk-stat-amber .risk-stat-value {
  color: #d97706;
}

.risk-table-wrap {
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

.btn-fire {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-fire:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

/* =============================================================
   16. MODAL
   ============================================================= */
.db-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 0.2s ease;
}

.db-modal-overlay.hidden {
  display: none;
}

.db-modal-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.db-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.db-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-1);
}

.db-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.db-modal-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.db-modal-body {
  padding: 1.5rem;
}

.dashboard-health-card { padding: 1.1rem 1.4rem; margin: 1.25rem 0; }
.dashboard-health-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.dashboard-health-heading h3 { margin: 0 0 .25rem; font-size: 1rem; }
.dashboard-health-heading p { margin: 0; }
.dashboard-health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.dashboard-health-item { min-width: 0; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: .8rem; background: var(--card-bg); border-left: 4px solid #94a3b8; }
.dashboard-health-item[data-health-state="ready"] { border-left-color: #16a34a; }
.dashboard-health-item[data-health-state="review"] { border-left-color: #d97706; }
.dashboard-health-item[data-health-state="error"] { border-left-color: #dc2626; }
.dashboard-health-item span, .dashboard-health-item strong, .dashboard-health-item small { display: block; }
.dashboard-health-item span { color: var(--text-2); font-size: .75rem; font-weight: 700; }
.dashboard-health-item strong { margin: .3rem 0; font-size: .93rem; overflow-wrap: anywhere; }
.dashboard-health-item small { color: var(--text-2); line-height: 1.45; }
.dashboard-health-link { padding: 0; border: 0; background: none; color: var(--brand-600); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.dashboard-health-link:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 3px; }
.sales-chart-status:not(:empty) { padding: 1.5rem; border: 1px dashed var(--border); border-radius: .8rem; text-align: center; }
#salesChart[hidden] { display: none !important; }
@media (max-width: 760px) { .dashboard-health-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .dashboard-health-heading { align-items: flex-start; flex-direction: column; } }
.customer-profile { display: grid; gap: 1rem; }
.customers-section-header { align-items: end; }
.customers-eyebrow { display: inline-block; margin-bottom: .35rem; color: var(--brand-600); font-size: .69rem; font-weight: 900; letter-spacing: .12em; }
.customers-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin: .1rem 0 1rem; }
.customers-overview-card { display: flex; align-items: flex-start; gap: .8rem; min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 16px; background: var(--card-bg); box-shadow: 0 8px 24px rgba(15, 23, 42, .045); }
.customers-overview-icon { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: #eaf1ff; color: #2458c9; }
.customers-overview-card.is-due .customers-overview-icon { background: #fff0ef; color: #b42318; }
.customers-overview-card.is-clear .customers-overview-icon { background: #e8f8ef; color: #13814c; }
.customers-overview-card.is-review .customers-overview-icon { background: #fff3de; color: #a05a00; }
.customers-overview-card > div { display: grid; gap: .15rem; min-width: 0; }
.customers-overview-card small { color: var(--text-2); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .035em; }
.customers-overview-card strong { color: var(--text-1); font-size: 1.55rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.customers-overview-card div > span { color: var(--text-2); font-size: .72rem; }
.customers-directory-card { overflow: hidden; }
.customers-directory-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem .9rem; }
.customers-directory-heading h3 { margin: 0; color: var(--text-1); font-size: 1.02rem; }
.customers-directory-heading p { margin: .25rem 0 0; font-size: .77rem; }
.customers-results-count { flex: 0 0 auto; padding: .4rem .65rem; border-radius: 999px; background: #eef4ff; color: #2458c9; font-size: .73rem; font-weight: 800; }
#users .customers-toolbar { gap: .7rem; padding-top: .8rem; }
#users .customers-toolbar .search-box { flex: 1 1 280px; min-width: 180px; }
#users .customers-toolbar .smart-filter { max-width: none; min-width: 145px; }
.customers-clear-filters { min-height: 42px; padding: 0 .6rem; border: 0; background: transparent; color: var(--brand-600); font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; }
.customers-clear-filters:hover { text-decoration: underline; }
.customers-clear-filters:focus-visible, .customer-profile-nav a:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }
#users .customers-smart-table td { vertical-align: middle; }
#users .customers-smart-table tbody tr { border-left: 3px solid transparent; }
#users .customers-smart-table tbody tr.has-due { border-left-color: #ef7771; }
#users .customers-smart-table tbody tr.needs-review { border-left-color: #e8ab4a; }
#users .customers-smart-table .db-avatar-sm { width: 42px; height: 42px; border-radius: 13px; font-size: .95rem; }
.customer-directory-name { color: var(--text-1); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.customer-directory-phone { color: var(--text-2); font-size: .77rem; margin-top: .15rem; }
.customer-id-cell { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .7rem; }
#users .row-actions .db-btn-link { min-height: 36px; border-radius: 8px; }
#users .row-actions .view-customer-profile { background: #edf3ff; color: #2458c9; font-weight: 800; }
.customers-empty { display: grid; justify-items: center; gap: .35rem; padding: 2.2rem 1rem; color: var(--text-2); text-align: center; }
.customers-empty i { font-size: 1.35rem; color: #5d83c9; }
.customers-empty strong { color: var(--text-1); }
.customer-profile-nav { display: flex; flex-wrap: wrap; gap: .45rem; padding: .25rem 0; }
.customer-profile-nav a { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .85rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card-bg); color: var(--text-1); font-size: .78rem; font-weight: 800; text-decoration: none; }
.customer-profile-nav a:hover { background: #edf3ff; border-color: #bad0ff; color: #2458c9; }
.customer-profile-panel { scroll-margin-top: 1rem; }
.customer-profile label { font-size: .8rem; font-weight: 700; color: var(--text-2); }
.customer-profile select { width: 100%; max-width: 220px; padding: .65rem; border: 1px solid var(--border); border-radius: .65rem; }
.customer-profile-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
.customer-profile-metrics article { padding: 1rem; border: 1px solid var(--border); border-radius: .8rem; background: #fff; }
.customer-profile-metrics small,.customer-profile-metrics strong { display: block; }
.customer-profile-metrics small { color: var(--text-2); }
.customer-profile-metrics strong { margin-top: .35rem; font-size: 1.1rem; }
.customer-profile-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.customer-profile-open .db-modal-card { max-width: 1060px; }
.customer-profile-open .db-modal-body { overflow-y: auto; }
.customer-profile h3, .customer-profile h4 { margin: 0; }
.customer-profile-hero { display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem; border-radius: var(--radius-md); background: linear-gradient(135deg, #eff6ff, #f8fafc); border: 1px solid #bfdbfe; }
.customer-profile-hero > div { min-width: 0; }
.customer-profile-hero small, .customer-profile-hero strong { display: block; overflow-wrap: anywhere; }
.customer-profile-hero small { color: var(--text-2); font-size: .7rem; font-weight: 800; letter-spacing: .04em; }
.customer-profile-hero h2 { margin: .25rem 0; font-size: 1.4rem; overflow-wrap: anywhere; }
.customer-profile-hero p { margin: .2rem 0 .6rem; color: var(--text-2); }
.customer-profile-hero > div:last-child { text-align: right; }
.customer-profile-hero > div:last-child strong { margin-top: .3rem; font-size: 1.3rem; }
.customer-profile-panel { display: grid; gap: .85rem; padding: 1.1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-bg); }
.customer-profile-panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; flex-wrap: wrap; }
.customer-profile-panel-heading span { color: var(--text-2); font-size: .8rem; }
.customer-profile-edit { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items: end; gap: .7rem; }
.customer-profile-edit label { display: grid; gap: .35rem; margin: 0; }
.customer-profile-edit input, .customer-statement-toolbar input { min-height: 42px; width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--card-bg); color: var(--text-1); font: inherit; }
.customer-profile-edit button { min-height: 42px; white-space: nowrap; }
.customer-profile-panel > p { margin: 0; line-height: 1.5; }
.customer-statement-toolbar { display: flex; align-items: end; gap: .6rem; flex-wrap: wrap; }
.customer-statement-toolbar label { display: grid; gap: .35rem; }
.customer-statement-toolbar button { min-height: 42px; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--card-bg); color: var(--brand-600); font: inherit; font-weight: 700; cursor: pointer; }
.customer-statement-toolbar button:disabled { opacity: .5; cursor: not-allowed; }
.customer-statement-status { padding: .7rem .85rem; border: 1px solid #bbf7d0; border-radius: .6rem; background: #f0fdf4; color: #166534; font-size: .8rem; }
.customer-statement-status.is-review { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.customer-statement-balances { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .65rem; }
.customer-statement-balances > div { min-width: 0; padding: .8rem; border: 1px solid var(--border); border-radius: .6rem; }
.customer-statement-balances small, .customer-statement-balances strong { display: block; overflow-wrap: anywhere; }
.customer-statement-balances small { color: var(--text-2); font-size: .7rem; }
.customer-statement-balances strong { margin-top: .3rem; font-size: .98rem; }
.customer-statement-table { min-width: 680px; }
.customer-statement-note { display: block; max-width: 280px; color: var(--text-2); font-size: .73rem; overflow-wrap: anywhere; }
@media (max-width: 780px) { .customer-profile-edit { grid-template-columns: repeat(2,minmax(0,1fr)); } .customer-profile-edit button { grid-column: 1 / -1; } .customer-statement-balances { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) { .customer-profile-hero { flex-direction: column; } .customer-profile-hero > div:last-child { text-align: left; } .customer-profile-edit { grid-template-columns: 1fr; } .customer-profile-edit button { grid-column: auto; } }

.stock-section-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stock-section-header .section-helper { margin: .3rem 0 0; }
.stock-list-status { margin: -.35rem 0 1rem; font-size: .8rem; }
.stock-workspace { display: grid; gap: .85rem; }
.inventory-choice-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; border: 0; }
.inventory-choice-tabs .inv-tab-btn { display: flex; align-items: center; gap: .9rem; padding: 1.1rem !important; min-height: 92px; border: 1px solid var(--border) !important; border-radius: var(--radius-md); background: var(--card-bg) !important; color: var(--text-1) !important; text-align: left; cursor: pointer; }
.inventory-choice-tabs .inv-tab-btn.active { border-color: var(--brand-500) !important; background: #eff6ff !important; box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.inventory-choice-tabs .inv-tab-btn:focus-visible, .stock-overview-card:focus-visible, .custom-product-action:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 2px; }
.inventory-choice-tabs .inv-tab-btn i { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 12px; background: #dbeafe; font-size: 1.2rem; color: var(--brand-600); }
.inventory-choice-tabs .inv-tab-btn span { display: grid; gap: .25rem; }
.inventory-choice-tabs .inv-tab-btn strong { font-size: 1rem; }
.inventory-choice-tabs .inv-tab-btn small { color: var(--text-2); font-size: .78rem; font-weight: 400; line-height: 1.35; }
.stock-plan-card { padding: .85rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-bg); }
.stock-plan-heading { display: flex; justify-content: space-between; gap: .75rem; margin-bottom: .55rem; font-size: .78rem; color: var(--text-2); }
.stock-plan-heading strong { color: var(--text-1); }
.stock-plan-track { height: 7px; border-radius: 999px; overflow: hidden; background: var(--border); }
#stock-plan-progress-bar { height: 100%; width: 0; background: var(--brand-500); transition: width .3s ease; }
.stock-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stock-overview-card { display: grid; gap: .2rem; min-width: 0; padding: .95rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card-bg); color: var(--text-1); text-align: left; cursor: pointer; }
.stock-overview-card:hover { border-color: var(--brand-500); }
.stock-overview-card small { color: var(--text-2); font-weight: 700; }
.stock-overview-card strong { font-size: 1.45rem; line-height: 1.15; }
.stock-overview-card span { color: var(--text-2); font-size: .72rem; }
.stock-overview-card.is-warning { border-left: 4px solid #d97706; }
.stock-overview-card.is-danger { border-left: 4px solid #dc2626; }
.stock-filter-toolbar { display: grid; grid-template-columns: minmax(220px, 1.7fr) repeat(3, minmax(130px, 1fr)) minmax(165px, 1.1fr) auto; gap: .65rem; }
#stock .stock-filter-toolbar .search-box { min-width: 0; width: 100%; }
#stock .stock-filter-toolbar .smart-filter { min-width: 0; width: 100%; max-width: none; }
.stock-clear-filters { border: 0; background: none; color: var(--brand-600); font: inherit; font-size: .8rem; font-weight: 800; cursor: pointer; white-space: nowrap; }
.stock-clear-filters:hover { text-decoration: underline; }
.stock-results-count { margin: 0; padding: .7rem 1.25rem; color: var(--text-2); font-size: .78rem; }
.stock-pagination { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; padding: .8rem 1.25rem; border-top: 1px solid var(--border); font-size: .8rem; }
.stock-pagination button { padding: .45rem .8rem; border: 1px solid var(--border); border-radius: .55rem; background: var(--card-bg); color: var(--text-1); cursor: pointer; }
.stock-pagination button:disabled { opacity: .45; cursor: not-allowed; }
.stock-create-card { margin-bottom: 1rem; border: 1px solid #bfdbfe; background: linear-gradient(135deg, #eff6ff, #fff); }
.stock-create-card-body { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.stock-create-card h3 { margin: .25rem 0; color: var(--text-1); font-size: 1.05rem; }
.stock-create-card p { margin: 0; color: var(--text-2); font-size: .84rem; }
.stock-create-eyebrow { color: var(--brand-600); font-size: .7rem; font-weight: 900; letter-spacing: .08em; }
.custom-product-action { display: inline-flex; justify-content: center; align-items: center; gap: .6rem; min-height: 48px; padding: .8rem 1.15rem; border: 1px solid #1d4ed8; border-radius: .8rem; background: #2563eb; color: #fff; font: inherit; font-weight: 800; box-shadow: 0 7px 18px rgba(37, 99, 235, .22); cursor: pointer; }
.custom-product-action:hover { background: #1d4ed8; }
@media (max-width: 1150px) { .stock-filter-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); } #stock .stock-filter-toolbar .search-box { grid-column: span 3; } }
@media (max-width: 700px) { .stock-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stock-section-header { align-items: flex-start; } }
@media (max-width: 600px) { .inventory-choice-tabs { grid-template-columns: 1fr; } .stock-filter-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); } #stock .stock-filter-toolbar .search-box { grid-column: span 2; } .custom-product-action { width: 100%; } }

.invoice-details-open .db-modal-card { max-width: 860px; }
.invoice-detail { display: grid; gap: 1.1rem; color: var(--text-1); }
.invoice-detail section { display: grid; gap: .65rem; }
.invoice-detail-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg); }
.invoice-detail-hero small, .invoice-detail-meta small { display: block; font-size: .72rem; font-weight: 800; letter-spacing: .08em; color: var(--text-2); }
.invoice-detail-hero h2 { margin: .3rem 0; font-size: 1.35rem; overflow-wrap: anywhere; }
.invoice-detail-hero span, .invoice-detail-meta span { color: var(--text-2); font-size: .86rem; }
.invoice-detail-status { padding: .4rem .7rem; border-radius: 999px; background: var(--blue-light); color: var(--blue) !important; font-weight: 800; white-space: nowrap; }
.invoice-detail-status.paid { background: #dcfce7; color: #166534 !important; }
.invoice-detail-status.partial { background: #fef3c7; color: #92400e !important; }
.invoice-detail-status.unpaid { background: #fee2e2; color: #991b1b !important; }
.invoice-detail-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.invoice-detail-facts > div { min-width: 0; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
.invoice-detail-facts small, .invoice-detail-facts strong { display: block; overflow-wrap: anywhere; }
.invoice-detail-facts small { margin-bottom: .3rem; color: var(--text-2); font-size: .68rem; font-weight: 800; letter-spacing: .06em; }
.invoice-detail-facts strong { font-size: .85rem; }
.invoice-detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.invoice-detail-meta > div { display: grid; gap: .25rem; min-width: 0; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
.invoice-detail-meta strong, .invoice-detail-meta span { overflow-wrap: anywhere; }
.invoice-detail h3 { margin: 0; font-size: 1rem; }
.invoice-detail-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.invoice-detail-table { width: 100%; border-collapse: collapse; min-width: 510px; }
.invoice-detail-table th, .invoice-detail-table td { padding: .75rem; border-bottom: 1px solid var(--border); text-align: left; }
.invoice-detail-table th { background: var(--bg); color: var(--text-2); font-size: .75rem; text-transform: uppercase; }
.invoice-detail-table tbody tr:last-child td { border-bottom: 0; }
.invoice-detail-table .text-right { text-align: right; }
.invoice-detail-totals, .invoice-detail-payments { padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-md); }
.invoice-detail-totals h3 { margin-bottom: .5rem; }
.invoice-detail-row { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; }
.invoice-detail-row span { overflow-wrap: anywhere; }
.invoice-detail-grand { margin-top: .35rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: 1.1rem; font-weight: 800; }
.invoice-detail-payment { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.invoice-detail-payment:first-child { padding-top: 0; }
.invoice-detail-payment:last-child { border-bottom: 0; padding-bottom: 0; }
.invoice-detail-payment > div { display: grid; gap: .15rem; min-width: 0; }
.invoice-detail-payment span, .invoice-detail-payment small { color: var(--text-2); overflow-wrap: anywhere; }
.invoice-detail-payment > strong { white-space: nowrap; }
.invoice-detail-note { margin: 0; font-size: .78rem; line-height: 1.5; }
@media (max-width: 560px) { .invoice-detail-meta, .invoice-detail-facts { grid-template-columns: 1fr; } .invoice-detail-hero { flex-wrap: wrap; } }

/* Product/Expense Form (inside modal) */
#productForm,
#expenseForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#productForm .grid,
#expenseForm .grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

#productForm label,
#expenseForm label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  margin-bottom: 6px;
}

#productForm input,
#productForm select,
#expenseForm input,
#expenseForm select,
#expenseForm textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-1);
  outline: none;
  transition: all var(--transition);
}

#productForm input:focus,
#productForm select:focus,
#expenseForm input:focus,
#expenseForm select:focus,
#expenseForm textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

#productForm button,
#expenseForm button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--blue), var(--indigo));
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

#productForm button:hover,
#expenseForm button:hover {
  transform: translateY(-2px);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(24px);
    opacity: 0;
  }

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

/* =============================================================
   17. TABLE ROW HELPERS & BADGES
   ============================================================= */

/* Muted secondary text in cells */
.db-muted {
  color: var(--text-2);
  font-size: 0.85rem;
}

/* Bill number pill */
.db-bill-no {
  font-family: monospace;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Customer avatar + name layout */
.db-customer-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Product cell */
.db-product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.db-product-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--blue-light);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.db-product-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.db-low-stock-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--red);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Stock badge */
.db-stock-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 800;
}

.db-stock-ok {
  background: var(--green-light);
  color: #059669;
}

.db-stock-low {
  background: var(--red-light);
  color: var(--red);
}

/* Danger row (low stock) */
.db-row-danger {
  background: #fff8f8 !important;
}

.db-row-danger:hover {
  background: #fff0f0 !important;
}

/* =============================================================
   18. PILLS / BADGES
   ============================================================= */
.db-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.db-badge-success {
  background: var(--green-light);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.2);
}

.db-badge-danger {
  background: var(--red-light);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.2);
  cursor: pointer;
}

.db-badge-info {
  background: var(--blue-light);
  color: var(--blue-dark);
  border-color: rgba(59, 130, 246, 0.2);
}

.db-badge-amber {
  background: var(--amber-light);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.2);
}

/* =============================================================
   19. LINK BUTTONS (in table cells)
   ============================================================= */
.db-btn-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--blue);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 6px;
}

.db-btn-link:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.db-btn-link-danger {
  color: var(--red);
}

.db-btn-link-danger:hover {
  background: var(--red-light);
  border-color: var(--red);
}

/* =============================================================
   20. STATUS DROPDOWN (Mark as Paid)
   ============================================================= */
.db-dropdown-wrap {
  position: relative;
  display: inline-block;
}

.db-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: none;
}

.db-dropdown-menu.open {
  display: block;
  animation: slide-up 0.15s ease;
}

.status-dropdown-menu.hidden {
  display: none;
}

.status-dropdown-menu:not(.hidden) {
  display: block;
  animation: slide-up 0.15s ease;
}

.db-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  text-decoration: none;
  transition: background var(--transition);
}

.db-dropdown-item:hover {
  background: var(--bg);
}

/* =============================================================
   21. UDHAR-STYLE MODAL INNER COMPONENTS
   ============================================================= */
.udhar-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 0 1.25rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.udhar-modal-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.udhar-modal-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-1);
}

.udhar-modal-sub {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 2px;
}

.udhar-total-due-card {
  background: linear-gradient(135deg, #fff5f5, #fef2f2);
  border: 1.5px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.udhar-total-due-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 6px;
}

.udhar-total-due-value {
  font-size: 2rem;
  font-weight: 900;
  color: var(--red);
  letter-spacing: -0.02em;
}

.udhar-bills-section {
  margin-top: 0.5rem;
}

.udhar-bills-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

.udhar-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-2);
}

.udhar-modal-body-loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

/* =============================================================
   22. UDHAR DASHBOARD TABS & PAY MODAL
   ============================================================= */
.udhar-dashboard-split {
  display: flex;
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-height: 500px;
}

.udhar-dash-left {
  width: 320px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: #fdfdfd;
}

.udhar-dash-search {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.udhar-dash-search input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.85rem;
}

.udhar-dash-search i {
  position: absolute;
  left: 1.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}

.udhar-dash-customers {
  flex: 1;
  overflow-y: auto;
}

.udhar-dash-card {
  padding: 12px 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition);
}

.udhar-dash-card:hover {
  background: var(--bg);
}

.udhar-dash-card.active {
  background: #eef2ff;
  border-left: 4px solid var(--blue);
  padding-left: calc(1rem - 4px);
}

.udhar-dash-c-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--indigo), var(--blue));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.udhar-dash-c-info h4 {
  font-size: 0.9rem;
  color: var(--text-1);
  margin: 0 0 2px 0;
}

.udhar-dash-c-info span {
  font-size: 0.75rem;
  color: var(--red);
  font-weight: 700;
}

.udhar-dash-right {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.udhar-modal-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}

.udhar-tab-btn {
  background: transparent;
  border: none;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-2);
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
}

.udhar-tab-btn:hover {
  color: var(--blue);
}

.udhar-tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.udhar-tab-content {
  display: none;
}

.udhar-tab-content.active {
  display: block;
  animation: fade-in 0.2s ease;
}

.udhar-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.udhar-score-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-width: 140px;
}

.udhar-pay-submodal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xl);
}

.udhar-pay-submodal-card {
  background: var(--card-bg);
  width: 400px;
  max-width: 90%;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border);
  animation: slide-up 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.udhar-pay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.udhar-pay-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-1);
  display: flex;
  gap: 8px;
  align-items: center;
}

.udhar-pay-summary {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
  display: flex;
  justify-content: space-between;
}

.udhar-pay-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--blue-dark);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  text-align: center;
}

.udhar-pay-input:focus {
  outline: none;
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.udhar-pay-mode-tabs {
  display: flex;
  gap: 8px;
}

.udhar-pm-tab {
  flex: 1;
  padding: 10px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
}

.udhar-pm-tab:hover {
  border-color: var(--blue-dark);
  color: var(--text-1);
}

.udhar-pm-tab.active {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-dark);
}

/* =============================================================
   23. RESPONSIVE — TABLET & MOBILE
   ============================================================= */

/* Tablet: 768px - 1023px */
@media (max-width: 1023px) {
  :root {
    --sidebar-w: 240px;
  }

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

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile + small tablet: <= 767px */
.mobile-date-filter {
  display: none;
}

/* hidden on desktop */
@media (max-width: 767px) {
  :root {
    --header-h: 58px;
  }

  /* Sidebar becomes off-canvas drawer */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
    z-index: 300;
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.3);
  }

  #sidebar.is-open {
    transform: translateX(0);
  }

  /* Show hamburger */
  .db-hamburger {
    display: flex;
  }

  .db-header {
    padding: 0 1rem;
    gap: 8px;
  }

  .db-header-title h1 {
    font-size: 1.1rem;
  }

  /* Header: compact on mobile — hide date filter from header, show inline in dashboard */
  .db-header {
    height: var(--header-h);
    padding: 0 1rem;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .db-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  /* Move date filter into dashboard section */
  .db-header-title h1 {
    font-size: 1.15rem;
    font-weight: 800;
  }

  .content-area {
    padding: 1rem;
    padding-bottom: calc(1rem + 68px);
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .kpi-card {
    padding: 1rem;
  }

  .kpi-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  .kpi-value {
    font-size: clamp(1rem, 4vw, 1.25rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .kpi-label {
    font-size: 0.7rem;
  }

  .kpi-bg-icon {
    font-size: 3.5rem;
  }

  .section-title {
    font-size: 1.05rem;
  }

  .section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .section-header .btn-action {
    width: 100%;
    justify-content: center;
  }

  .risk-stats-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Udhar split panel — vertical stack on mobile */
  .udhar-dashboard-split {
    flex-direction: column;
    min-height: auto;
  }

  .udhar-dash-left {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 280px;
  }

  .udhar-dash-right {
    min-height: 300px;
  }

  .form-row-2 {
    grid-template-columns: 1fr;
  }

  .search-box {
    max-width: 100%;
  }

  #productForm .grid,
  #expenseForm .grid {
    grid-template-columns: 1fr;
  }

  .db-modal-card {
    border-radius: var(--radius-lg);
  }

  /* Modal → Bottom Sheet pattern on mobile */
  .db-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .db-modal-overlay .db-modal-card {
    border-radius: 24px 24px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
    animation: bottomSheetSlide 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes bottomSheetSlide {
    from {
      transform: translateY(100%);
    }

    to {
      transform: translateY(0);
    }
  }

  .db-card-header {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .db-card-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Mobile date filter — shown inside dashboard section */
  .mobile-date-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }

  .mobile-date-filter .db-date-input {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
  }

  .mobile-date-filter .btn-filter {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  /* Tables: hide less important columns on mobile */
  .db-table .col-hide-mobile {
    display: none;
  }

  /* Touch-friendly table actions */
  .db-btn-link {
    padding: 8px 12px;
    font-size: 0.82rem;
    min-height: 36px;
  }

  #reports {
    width: 100%;
    min-width: 0;
  }

  .report-section-header {
    gap: 0.85rem;
  }

  .report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .report-control-card {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: column;
    align-items: stretch;
    padding: 0.55rem;
  }

  .report-type-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
  }

  .report-type-tab {
    padding: 0.55rem 0.2rem;
    font-size: 0.7rem;
  }

  .report-type-tab i {
    display: block;
    margin: 0 0 0.3rem;
    font-size: 1rem;
  }

  .report-view-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .report-view-tab {
    padding: 0.55rem 0.25rem;
    font-size: 0.74rem;
  }

  .report-actions .btn-action,
  .report-range-select {
    width: 100%;
    min-width: 0;
  }

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

  .report-chart-body {
    height: 240px;
    padding: 0.75rem;
  }

  .report-customer-summary {
    grid-template-columns: 1fr;
  }

  #reports .db-card {
    border-radius: 16px;
    margin-bottom: 1rem;
  }

  #reports .db-card-header {
    padding: 0.9rem 1rem;
  }

  #reports .report-table {
    min-width: 0;
    table-layout: fixed;
    font-size: 0.78rem;
  }

  #reports .report-table th,
  #reports .report-table td {
    padding: 0.75rem 0.6rem;
    overflow-wrap: anywhere;
  }

  #reports .report-table th:first-child,
  #reports .report-table td:first-child {
    width: 42%;
  }
}

/* =============================================================
   DASHBOARD VISUAL CONSISTENCY — shared polish
   ============================================================= */
.content-area {
  background:
    radial-gradient(circle at 100% 0, rgba(59, 130, 246, 0.055), transparent 28rem),
    var(--bg);
}

.page-content {
  width: min(100%, 1440px);
  margin-inline: auto;
}

.db-header {
  background: color-mix(in srgb, var(--card-bg) 94%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.db-header-title h1,
.section-title,
.db-card-title {
  letter-spacing: -0.02em;
}

.kpi-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
}

.kpi-card {
  min-height: 116px;
  align-items: flex-start;
  border-color: var(--border);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.055);
}

.kpi-card:hover {
  border-color: rgba(59, 130, 246, 0.2);
}

.kpi-body {
  min-width: 0;
  padding-top: 0.15rem;
}

.kpi-label {
  min-height: 2em;
  line-height: 1.25;
}

.kpi-value {
  line-height: 1.15;
}

.db-card {
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.05);
}

.db-chart-card {
  margin-bottom: 1.5rem;
}

.db-card-subtitle {
  margin-top: 0.3rem;
  font-size: 0.75rem;
}

.section-helper {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.mobile-row-meta {
  display: none;
}

.row-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.db-chart-card .db-card-body {
  min-height: 280px;
}

.db-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.db-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--bg) 52%, transparent);
}

.db-table tbody tr:hover {
  background: var(--blue-light);
}

.btn-action,
.btn-filter,
.db-btn-link,
.icon-action-btn {
  min-height: 40px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.24);
  outline-offset: 2px;
}

.btn-action:disabled,
.db-btn-link:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (max-width: 1199px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .content-area {
    padding: 0.9rem;
    padding-bottom: calc(1.25rem + 72px + env(safe-area-inset-bottom));
  }

  .page-content {
    max-width: 100%;
    overflow-x: clip;
  }

  .mobile-date-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.4rem;
    padding: 0.65rem;
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
  }

  .mobile-date-filter > i {
    display: none;
  }

  .mobile-date-filter .btn-filter {
    grid-column: 1 / -1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    margin-top: 0.15rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }

  .kpi-card {
    min-height: 108px;
    padding: 0.9rem;
    gap: 0.7rem;
    border-radius: 16px;
  }

  .kpi-grid .kpi-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    min-height: 88px;
    align-items: center;
  }

  .kpi-grid .kpi-card:last-child:nth-child(odd) .kpi-label {
    min-height: auto;
  }

  .kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .kpi-label {
    min-height: 2.4em;
    font-size: 0.64rem;
  }

  .kpi-value {
    font-size: clamp(1rem, 4.4vw, 1.28rem);
  }

  .db-card {
    border-radius: 16px;
    margin-bottom: 1rem;
  }

  .db-card-header,
  .db-card-body,
  .db-card-toolbar {
    padding: 0.9rem;
  }

  #orders .db-card-toolbar,
  #stock .db-card-toolbar,
  #users .db-card-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
  }

  #orders .search-box,
  #stock .search-box,
  #users .search-box {
    min-width: 0;
  }

  .smart-filter {
    max-width: 132px;
    min-height: 40px;
    padding-left: 0.65rem;
    font-size: 0.74rem;
  }

  .db-chart-card .db-card-body {
    min-height: 230px;
  }

  .section-header {
    margin-bottom: 0.9rem;
  }

  .section-title {
    font-size: 1.1rem;
  }

  .db-table {
    font-size: 0.8rem;
  }

  .bottom-nav {
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.1);
  }

  .mobile-row-meta {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-3);
    font-size: 0.66rem;
    line-height: 1.35;
  }

  .inventory-tabs {
    width: 100%;
    gap: 0.35rem !important;
    padding: 0.25rem;
    overflow: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border) !important;
    border-radius: 13px;
  }

  .inventory-tabs .inv-tab-btn {
    flex: 1;
    min-width: 0;
    padding: 0.7rem 0.4rem !important;
    border-radius: 10px;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    font-size: 0.75rem !important;
  }

  .subscription-progress-container {
    padding: 0.85rem !important;
    border-radius: 14px !important;
  }

  .smart-mobile-table,
  .smart-mobile-table tbody,
  .smart-mobile-table tr,
  .smart-mobile-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .smart-mobile-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .smart-mobile-table thead {
    display: none;
  }

  .smart-mobile-table tbody {
    padding: 0.7rem;
  }

  .smart-mobile-table tbody tr {
    margin-bottom: 0.75rem;
    padding: 0.85rem;
    background: var(--card-bg) !important;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.045);
  }

  .smart-mobile-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .smart-mobile-table td {
    padding: 0.4rem 0;
    border: 0;
  }

  .smart-mobile-table td.col-hide-mobile {
    display: none;
  }

  .orders-smart-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    align-items: center;
  }

  .orders-smart-table td:nth-child(2) { grid-column: 1; grid-row: 1 / span 2; }
  .orders-smart-table td:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  .orders-smart-table td:nth-child(5) { grid-column: 2; grid-row: 2; text-align: right; }
  .orders-smart-table td:nth-child(6) { grid-column: 1 / -1; grid-row: 3; }

  .customers-smart-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    align-items: center;
  }

  .customers-smart-table td:nth-child(2) { grid-column: 1; grid-row: 1; }
  .customers-smart-table td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; }
  .customers-smart-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 2; }

  .stock-smart-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    align-items: center;
  }

  .stock-smart-table td:nth-child(1) { grid-column: 1 / -1; grid-row: 1; }
  .stock-smart-table td:nth-child(3) { grid-column: 1; grid-row: 2; }
  .stock-smart-table td:nth-child(3)::before { content: 'Selling price'; display: block; color: var(--text-3); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; margin-bottom: 0.2rem; }
  .stock-smart-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
  .stock-smart-table td:nth-child(4)::before { content: 'In stock'; display: block; color: var(--text-3); font-size: 0.65rem; font-weight: 800; text-transform: uppercase; margin-bottom: 0.2rem; }
  .stock-smart-table td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; }

  .stock-smart-table .db-product-cell > div:last-child {
    min-width: 0;
  }

  .stock-smart-table .db-product-name {
    display: -webkit-box;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    line-height: 1.35;
  }

  .smart-mobile-table .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    padding-top: 0.7rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--border);
  }

  .smart-mobile-table .row-actions .db-btn-link {
    justify-content: center;
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .orders-smart-table .row-actions .db-btn-link:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }

  #stock .db-card,
  #orders .db-card,
  #users .db-card {
    overflow: visible;
  }

  #stock .table-scroll,
  #orders .table-scroll,
  #users .table-scroll {
    overflow: visible;
  }
}

@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    min-height: 102px;
    padding: 0.75rem;
  }

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

/* Mobile touch targets & table improvements */
@media (max-width: 767px) {
  .db-table .col-hide-mobile {
    display: none;
  }

  .db-btn-link {
    padding: 8px 12px;
    font-size: 0.82rem;
    min-height: 36px;
  }

  .mobile-date-filter {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--card-bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
  }

  .mobile-date-filter .db-date-input {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
  }
}

/* Very small phones: <= 380px */
@media (max-width: 380px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .btn-filter {
    padding: 8px 10px;
  }
}

/* =============================================================
   FRANCHISE & STAFF MANAGEMENT — New Styles
   ============================================================= */

/* SuperAdmin sidebar link — purple accent */
.sidebar-link-superadmin {
  color: rgba(167, 139, 250, 0.85);
}

.sidebar-link-superadmin:hover {
  color: #c4b5fd;
}

.sidebar-link-superadmin.active {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.35);
}

.sidebar-link-superadmin.active .sidebar-link-icon {
  background: linear-gradient(135deg, #7c3aed, #8b5cf6);
  color: #fff;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.4);
}

/* Badge variants for role display */
.db-badge-purple {
  background: var(--purple-light);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.db-badge-secondary {
  background: #f1f5f9;
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* Franchise form — responsive grid */
.form-row-franchise {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  align-items: start;
}

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

.form-row-franchise .form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}

.form-row-franchise .form-group input,
.form-row-franchise .form-group select {
  padding: 10px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text-1);
  outline: none;
  transition: all var(--transition);
}

.form-row-franchise .form-group input:focus,
.form-row-franchise .form-group select:focus {
  border-color: var(--purple);
  background: var(--card-bg);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

/* Inline form error message */
.franchise-form-error {
  margin-top: 0.75rem;
  padding: 10px 14px;
  background: var(--red-light);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  color: var(--red);
  font-size: 0.85rem;
  font-weight: 600;
}

/* =============================================================
   PLAN GATE — Premium Feature Gating UI
   ============================================================= */

/* Sidebar: Nav lock badge (amber→red gradient pill) */
.plan-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.06em;
  margin-left: auto;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
  animation: lockPulse 3s ease-in-out infinite;
}

@keyframes lockPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.75;
  }
}

/* Dim locked nav link slightly */
.plan-locked-link {
  opacity: 0.6;
  pointer-events: auto !important;
  /* still clickable — shows upgrade overlay */
}

.plan-locked-link:hover {
  opacity: 0.85;
}

/* Full-section dark overlay behind the gate card */
.plan-gate-overlay {
  position: absolute;
  inset: 0;
  min-height: calc(100vh - 100px);
  /* Ensure it fills the screen even if section is empty */
  background: rgba(8, 12, 28, 0.92);
  backdrop-filter: blur(12px) saturate(120%);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  z-index: 50;
  /* Keep below sidebar (200) and header (100) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border-radius: inherit;
}

/* ── The Gate Card ────────────────────────────────────────── */
.plan-gate-card {
  background: linear-gradient(165deg, #111827 0%, #1a2744 50%, #0f172a 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  animation: pgPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 80px rgba(99, 102, 241, 0.08);
  position: relative;
  overflow: hidden;
}

/* Subtle shimmer top edge */
.plan-gate-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      rgba(139, 92, 246, 0.5) 30%,
      rgba(99, 102, 241, 0.6) 50%,
      rgba(139, 92, 246, 0.5) 70%,
      transparent);
}

@media (max-width: 480px) {
  .plan-gate-card {
    padding: 24px 18px;
    border-radius: 20px;
  }
}

@keyframes pgPop {
  from {
    transform: scale(0.85) translateY(16px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* Plan name badge pill */
.plan-gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 20px;
}

/* Lock icon circle with glow */
.plan-gate-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid rgba(99, 102, 241, 0.3);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.5rem;
  color: #818cf8;
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.2),
    0 0 0 6px rgba(99, 102, 241, 0.06);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.plan-gate-card:hover .plan-gate-icon {
  transform: scale(1.05);
  box-shadow:
    0 12px 32px rgba(99, 102, 241, 0.3),
    0 0 0 8px rgba(99, 102, 241, 0.1);
}

/* Title */
.plan-gate-title {
  color: #f1f5f9;
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  font-family: var(--font);
}

/* Subtitle */
.plan-gate-sub {
  color: #94a3b8;
  font-size: 0.84rem;
  line-height: 1.6;
  margin: 0 0 20px;
  font-family: var(--font);
}

.plan-gate-sub strong {
  color: #fbbf24;
  font-weight: 700;
}

/* ── Benefits List ─────────────────────────────────────── */
.plan-gate-benefits {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 22px;
  text-align: left;
}

.plan-gate-benefit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.84rem;
  color: #e2e8f0;
  font-weight: 500;
  font-family: var(--font);
}

.plan-gate-benefit+.plan-gate-benefit {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.plan-gate-benefit i {
  color: #34d399;
  font-size: 0.8rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

/* ── CTA Button (indigo→violet gradient) ──────────────── */
.plan-gate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #7c3aed 100%);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

/* Shine sweep on hover */
.plan-gate-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transition: left 0.5s ease;
}

.plan-gate-btn:hover::after {
  left: 100%;
}

.plan-gate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(99, 102, 241, 0.55);
}

.plan-gate-btn:active {
  transform: scale(0.97);
}

/* Price line + secondary link */
.plan-gate-price {
  color: #64748b;
  font-size: 0.78rem;
  font-family: var(--font);
}

.plan-gate-price strong {
  color: #94a3b8;
  font-weight: 700;
}

.plan-gate-link {
  color: #818cf8;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}

.plan-gate-link:hover {
  color: #a5b4fc;
  text-decoration: underline;
}


/* =============================================================
   BOTTOM NAVIGATION BAR — Mobile only (shows at <= 768px)
   ============================================================= */

/* The bar */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.06);
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
  height: 65px;
  align-items: stretch;
  justify-content: space-around;
  transition: all 0.3s ease;
}

[data-theme="dark"] .bottom-nav {
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Each tab item */
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  text-decoration: none;
  color: var(--text-3);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font);
  padding: 8px 0;
  position: relative;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.bnav-item:active {
  transform: scale(0.9);
}

/* Active state */
.bnav-item.active {
  color: var(--blue);
  font-weight: 700;
}

.bnav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--indigo));
  border-radius: 0 0 4px 4px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

/* Icon wrapper */
.bnav-icon {
  font-size: 1.3rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bnav-item.active .bnav-icon {
  background: rgba(59, 130, 246, 0.15);
  transform: translateY(-2px);
}

/* Centre tab FAB-style */
.bnav-icon-center {
  background: linear-gradient(135deg, var(--blue), var(--indigo)) !important;
  color: #fff !important;
  width: 48px;
  height: 48px;
  border-radius: 18px;
  font-size: 1.25rem;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  margin-top: -24px;
  border: 4px solid var(--bg);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bnav-item:active .bnav-icon-center {
  transform: translateY(2px) scale(0.95);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.bnav-item:has(.bnav-icon-center)::before {
  display: none;
}

.bnav-label {
  line-height: 1;
}

/* ---- MORE SHEET ---- */
/* Overlay (dim background) */
.bnav-more-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bnav-more-overlay.is-open {
  display: block;
  opacity: 1;
}

/* Slide-up sheet */
.bnav-more-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  background: var(--card-bg);
  border-radius: 24px 24px 0 0;
  padding: 12px 20px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.16);
}

.bnav-more-sheet.is-open {
  transform: translateY(0);
}

/* Drag handle */
.bnav-sheet-handle {
  width: 40px;
  height: 5px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 16px;
}

/* Sheet title */
.bnav-sheet-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 16px;
  text-align: center;
}

/* Grid of icons */
.bnav-sheet-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Each sheet item */
.bnav-sheet-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-1);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  padding: 4px 0;
  transition: transform var(--transition);
}

.bnav-sheet-item:active {
  transform: scale(0.92);
}

/* Rounded icon box */
.bnav-sheet-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: all var(--transition);
}

.bnav-sheet-item:hover .bnav-sheet-icon {
  filter: brightness(0.93);
}

/* Sheet label */
.bnav-sheet-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-2);
  text-align: center;
  line-height: 1.2;
}

/* Sheet logout button — danger tint */
.bnav-sheet-logout .bnav-sheet-label {
  color: var(--red);
}

/* ---- MEDIA QUERY: Show bottom nav only on mobile ---- */
/* ---- Desktop: always hide bottom nav ---- */
@media (min-width: 769px) {
  .bottom-nav {
    display: none !important;
  }
}

/* ---- Mobile: always show bottom nav ---- */
@media (max-width: 768px) {
  .bottom-nav {
    display: flex !important;
    align-items: stretch;
  }
}


/* =============================================================
   MOBILE APP / RESPONSIVE FIXES
   ============================================================= */

/* Desktop Date Filter defaults */
.mobile-date-btn {
  display: none;
}

/* Table native horizontal scroll */
.db-table-container {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
  scrollbar-width: thin;
}

/* Mobile specific styling */
@media (max-width: 1023px) {

  /* Capacitor Safe Areas */
  .db-header {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--header-h) + env(safe-area-inset-top));
  }

  #main-content {
    /* Prevent content hiding under bottom nav */
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(60px + env(safe-area-inset-bottom));
  }

  /* Date Filter Popup on Mobile */
  .mobile-date-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-2);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
  }

  .mobile-date-btn:active {
    background: var(--bg);
  }

  #date-filter-popup {
    display: none;
    position: absolute;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    right: 16px;
    background: var(--card-bg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    z-index: 400;
    /* Above sidebar */
    width: 240px;
    animation: popupFade 0.2s ease-out;
  }

  #date-filter-popup.show {
    display: flex;
  }

  #date-filter-popup .db-date-input {
    width: 100%;
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 6px;
  }

  #date-filter-popup .date-sep {
    display: none;
  }

  #date-filter-popup .btn-filter {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
  }
}

@keyframes popupFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

/* Fix plan gate overlay to not obscure sidebar */
.plan-gate-overlay {
  z-index: 50 !important;
}

/* Fix AI Risk Board table overflow on mobile */
.risk-table-wrap .db-table {
  min-width: 100% !important;
}

.risk-table-wrap th,
.risk-table-wrap td {
  white-space: normal !important;
}
.ledger-conflict-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: center;
  padding: 16px;
  margin: 12px 0;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #dc2626;
  border-radius: 12px;
  background: #fff;
}

.ledger-conflict-row p {
  grid-column: 1;
  margin: 0;
  color: #64748b;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.ledger-conflict-row button {
  grid-column: 2;
  grid-row: 1 / span 2;
}
.ledger-review-decision { display:grid; gap:10px; margin-top:14px; padding:14px; border:1px solid #cbd5e1; border-radius:12px; background:#f8fafc; }
.ledger-review-decision label { display:grid; gap:6px; font-weight:600; }
.ledger-review-decision input, .ledger-review-decision select, .ledger-review-decision textarea { width:100%; min-height:42px; padding:9px 11px; border:1px solid #cbd5e1; border-radius:8px; font:inherit; }
.ledger-review-decision textarea { min-height:84px; resize:vertical; }

@media (max-width: 640px) {
  .ledger-conflict-row { grid-template-columns: 1fr; }
  .ledger-conflict-row button { grid-column: 1; grid-row: auto; }
}

/* Stock workspace overrides follow the older shared mobile toolbar rules. */
@media (max-width: 700px) {
  #stock .stock-filter-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stock .stock-filter-toolbar .search-box { grid-column: 1 / -1; }
  #stock .stock-filter-toolbar .smart-filter { max-width: none; min-width: 0; }
  #stock .stock-clear-filters { text-align: left; }
}
@media (max-width: 480px) {
  .stock-section-header { flex-direction: column; }
  .stock-section-header > button { align-self: flex-start; }
  .stock-overview { gap: .5rem; }
  .stock-overview-card { padding: .75rem; }
  .inventory-choice-tabs .inv-tab-btn { min-height: 76px; }
}
#productForm #retry-product-categories { width: auto; padding: .4rem .7rem; border: 1px solid var(--border); background: var(--card-bg); color: var(--brand-600); box-shadow: none; font-size: .78rem; }
#productForm #retry-product-categories:hover { transform: none; background: var(--bg); }

@media print {
  body > *:not(#universalModal) { display: none !important; }
  #universalModal.customer-profile-open { position: static; display: block !important; padding: 0; background: #fff; }
  #universalModal.customer-profile-open .db-modal-card { width: 100%; max-width: none; max-height: none; overflow: visible; box-shadow: none; }
  #universalModal.customer-profile-open .db-modal-body { overflow: visible; }
  #universalModal.customer-profile-open .db-modal-header button,
  #universalModal.customer-profile-open .customer-profile-edit,
  #universalModal.customer-profile-open .customer-profile-nav,
  #universalModal.customer-profile-open .customer-profile-actions,
  #universalModal.customer-profile-open .customer-statement-toolbar { display: none !important; }
  #universalModal.customer-profile-open .customer-profile-panel,
  #universalModal.customer-profile-open .customer-profile-hero { break-inside: avoid; box-shadow: none; }
  #universalModal.customer-profile-open .invoice-detail-table-wrap { overflow: visible; }
  #universalModal.customer-profile-open .customer-statement-table { min-width: 0; font-size: 10px; }
}

@media (max-width: 980px) {
  .customers-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  #users .customers-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #users .customers-toolbar .search-box { grid-column: 1 / -1; min-width: 0; }
  #users .customers-toolbar .smart-filter { min-width: 0; width: 100%; }
  #users .customers-clear-filters { grid-column: 1 / -1; justify-self: start; }
  .customers-directory-heading { padding: 1rem; }
  #users .customers-smart-table tbody tr.customers-empty-row { display: table-row; }
  #users .customers-smart-table tbody tr.customers-empty-row td { display: table-cell; }
}
@media (max-width: 480px) {
  .customers-overview { gap: .55rem; }
  .customers-overview-card { gap: .55rem; padding: .8rem; }
  .customers-overview-icon { flex-basis: 34px; width: 34px; height: 34px; border-radius: 10px; }
  .customers-overview-card strong { font-size: 1.25rem; }
  .customers-overview-card div > span { display: none; }
  .customers-directory-heading { align-items: flex-start; }
  .customers-results-count { font-size: .65rem; }
  .customer-profile-nav a { flex: 1 1 auto; justify-content: center; }
}

/* Narrow-screen Stock and customer workspaces: readable cards, no clipped actions. */
@media screen and (max-width: 700px) {
  #stock .inventory-choice-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem !important; padding: 0; overflow: visible; border: 0 !important; background: transparent; }
  #stock .inventory-choice-tabs .inv-tab-btn { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .55rem; min-width: 0; min-height: 106px; padding: .8rem !important; border: 1px solid var(--border) !important; border-radius: 14px; }
  #stock .inventory-choice-tabs .inv-tab-btn.active { border-color: var(--brand-500) !important; }
  #stock .inventory-choice-tabs .inv-tab-btn i { width: 36px; height: 36px; flex-basis: 36px; font-size: .95rem; }
  #stock .inventory-choice-tabs .inv-tab-btn strong { font-size: .83rem; line-height: 1.25; }
  #stock .inventory-choice-tabs .inv-tab-btn small { font-size: .69rem; line-height: 1.3; }
  #stock .stock-plan-heading { flex-wrap: wrap; }
  #stock .stock-overview-card { min-height: 94px; }
  #stock .stock-overview-card small { font-size: .7rem; }
  #stock .stock-filter-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stock .stock-filter-toolbar .search-box { grid-column: 1 / -1; }
  #stock .stock-filter-toolbar .smart-filter { width: 100%; min-height: 44px; max-width: none; font-size: .78rem; }
  #stock .stock-clear-filters { grid-column: 1 / -1; justify-self: start; min-height: 40px; }
  #stock .stock-results-count { padding: .65rem .9rem; line-height: 1.4; }
  #stock .stock-smart-table tbody tr { gap: .2rem .65rem; }
  #stock .stock-smart-table td[colspan] { grid-column: 1 / -1; }
  #stock .stock-smart-table .row-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stock .stock-smart-table .row-actions .db-btn-link { min-height: 42px; }
  #stock .stock-pagination { justify-content: space-between; gap: .35rem; padding: .75rem .9rem; }
  #stock .stock-pagination button { min-height: 42px; }
  #stock .stock-create-card-body { display: grid; grid-template-columns: 1fr; }
  #stock .custom-product-action { width: 100%; min-height: 48px; }
  #stock #tab-global-catalog .db-card-header { display: grid; gap: .8rem; }
  #stock #tab-global-catalog .db-card-header .search-box { width: 100%; min-width: 0; }
  #stock .catalog-mobile-table, #stock .catalog-mobile-table tbody, #stock .catalog-mobile-table tr, #stock .catalog-mobile-table td { display: block; width: 100%; min-width: 0; }
  #stock .catalog-mobile-table thead { display: none; }
  #stock .catalog-mobile-table tbody { display: grid; gap: .7rem; padding: .8rem; }
  #stock .catalog-mobile-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; padding: .85rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card-bg); box-shadow: 0 4px 14px rgba(15, 23, 42, .04); }
  #stock .catalog-mobile-table td { padding: 0; border: 0; overflow-wrap: anywhere; }
  #stock .catalog-mobile-table td:first-child, #stock .catalog-mobile-table td:last-child, #stock .catalog-mobile-table td[colspan] { grid-column: 1 / -1; }
  #stock .catalog-mobile-table td:nth-child(2):not([colspan])::before, #stock .catalog-mobile-table td:nth-child(3):not([colspan])::before { display: block; margin-bottom: .2rem; color: var(--text-2); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
  #stock .catalog-mobile-table td:nth-child(2):not([colspan])::before { content: 'Category'; }
  #stock .catalog-mobile-table td:nth-child(3):not([colspan])::before { content: 'Recommended price'; }
  #stock .catalog-mobile-table .add-global-product-btn { width: 100%; min-height: 44px; justify-content: center; }
  #add-global-modal .db-modal-card { width: 100%; max-width: 100% !important; max-height: min(92dvh, 650px); overflow-y: auto; border-radius: 18px 18px 0 0; }
  #add-global-modal .db-modal-body { padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  #add-global-modal input[type="number"] { width: 100%; min-height: 44px; font-size: 16px; }
  #add-global-modal .form-group { margin-bottom: .85rem; }
  #universalModal.product-editor-open .db-modal-card, #universalModal.customer-profile-open .db-modal-card { max-height: min(94dvh, 850px); border-radius: 18px 18px 0 0; }
  #universalModal.product-editor-open .db-modal-header, #universalModal.customer-profile-open .db-modal-header { flex: 0 0 auto; padding: .85rem 1rem; }
  #universalModal.product-editor-open .db-modal-body, #universalModal.customer-profile-open .db-modal-body { overflow-y: auto; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  #universalModal.product-editor-open #productForm .grid { grid-template-columns: 1fr; gap: .8rem; }
  #universalModal.product-editor-open #productForm input, #universalModal.product-editor-open #productForm select { min-height: 44px; font-size: 16px; }
  #universalModal.customer-profile-open .customer-profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #universalModal.customer-profile-open .customer-profile-metrics strong { overflow-wrap: anywhere; }
  #universalModal.customer-profile-open .customer-statement-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #universalModal.customer-profile-open .customer-statement-toolbar label { grid-column: 1 / -1; }
  #universalModal.customer-profile-open .customer-statement-toolbar button { width: 100%; min-height: 44px; }
  #universalModal.invoice-details-open .db-modal-card { max-height: min(94dvh, 850px); border-radius: 18px 18px 0 0; }
  #universalModal.invoice-details-open .db-modal-body { overflow-y: auto; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  #universalModal.invoice-details-open .invoice-detail-table-wrap { overflow: visible; border: 0; }
  #universalModal.invoice-details-open .invoice-items-table { display: block; min-width: 0; }
  #universalModal.invoice-details-open .invoice-items-table thead { display: none; }
  #universalModal.invoice-details-open .invoice-items-table tbody { display: grid; gap: .6rem; }
  #universalModal.invoice-details-open .invoice-items-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .7rem; padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
  #universalModal.invoice-details-open .invoice-items-table td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  #universalModal.invoice-details-open .invoice-items-table td:nth-child(2), #universalModal.invoice-details-open .invoice-items-table td:nth-child(5), #universalModal.invoice-details-open .invoice-items-table td[colspan] { grid-column: 1 / -1; }
  #universalModal.invoice-details-open .invoice-items-table td:not([colspan])::before { display: block; margin-bottom: .12rem; color: var(--text-2); font-size: .63rem; font-weight: 800; text-transform: uppercase; }
  .invoice-items-table td:nth-child(1)::before { content: 'Line'; }
  .invoice-items-table td:nth-child(2)::before { content: 'Product'; }
  .invoice-items-table td:nth-child(3)::before { content: 'Quantity'; }
  .invoice-items-table td:nth-child(4)::before { content: 'Unit price'; }
  .invoice-items-table td:nth-child(5)::before { content: 'Line total'; }
  #universalModal.customer-profile-open .invoice-detail-table-wrap { overflow: visible; border: 0; }
  #universalModal.customer-profile-open .customer-statement-table { display: block; width: 100%; min-width: 0; }
  #universalModal.customer-profile-open .customer-statement-table thead { display: none; }
  #universalModal.customer-profile-open .customer-statement-table tbody { display: grid; gap: .6rem; }
  #universalModal.customer-profile-open .customer-statement-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem .7rem; padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
  #universalModal.customer-profile-open .customer-statement-table td { display: block; min-width: 0; padding: 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  #universalModal.customer-profile-open .customer-statement-table td[colspan] { grid-column: 1 / -1; }
  #universalModal.customer-profile-open .customer-statement-movements td:nth-child(1), #universalModal.customer-profile-open .customer-statement-movements td:nth-child(2), #universalModal.customer-profile-open .customer-statement-movements td:nth-child(3), #universalModal.customer-profile-open .customer-statement-movements td:nth-child(6), #universalModal.customer-profile-open .customer-statement-bills td:nth-child(1), #universalModal.customer-profile-open .customer-statement-bills td:nth-child(2), #universalModal.customer-profile-open .customer-statement-bills td:nth-child(5) { grid-column: 1 / -1; }
  #universalModal.customer-profile-open .customer-statement-table td:not([colspan])::before { display: block; margin-bottom: .15rem; color: var(--text-2); font-size: .63rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
  .customer-statement-movements td:nth-child(1)::before, .customer-statement-bills td:nth-child(1)::before { content: 'Date / time'; }
  .customer-statement-movements td:nth-child(2)::before { content: 'Particulars'; }
  .customer-statement-movements td:nth-child(3)::before, .customer-statement-bills td:nth-child(2)::before { content: 'Bill'; }
  .customer-statement-movements td:nth-child(4)::before { content: 'Debit'; }
  .customer-statement-movements td:nth-child(5)::before { content: 'Credit'; }
  .customer-statement-movements td:nth-child(6)::before { content: 'Balance'; }
  .customer-statement-bills td:nth-child(3)::before { content: 'Method'; }
  .customer-statement-bills td:nth-child(4)::before { content: 'Status'; }
  .customer-statement-bills td:nth-child(5)::before { content: 'Amount'; }
}
@media screen and (max-width: 380px) {
  #stock .inventory-choice-tabs .inv-tab-btn small { display: none; }
  #stock .inventory-choice-tabs .inv-tab-btn { min-height: 80px; }
  #stock .stock-overview-card span { display: none; }
  #universalModal.customer-profile-open .customer-profile-metrics { grid-template-columns: 1fr; }
  #universalModal.customer-profile-open .customer-statement-balances { grid-template-columns: 1fr 1fr; }
}
.expense-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:16px 0}
.expense-summary article{background:#fff;border:1px solid var(--border);border-radius:14px;padding:18px;display:flex;flex-direction:column;gap:8px}
.expense-summary span{font-size:12px;color:var(--text-2)}.expense-summary strong{font-size:24px;color:var(--text-1)}
.expense-filters{display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:0 0 14px}
.expense-filters label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:700;color:var(--text-2)}
.expense-filters input{min-height:40px;padding:8px 10px;border:1px solid var(--border);border-radius:8px;background:#fff;max-width:100%}
.expense-pages{display:flex;align-items:center;justify-content:flex-end;gap:12px;margin-top:14px}
.expense-pages button{padding:8px 12px;border:1px solid var(--border);border-radius:8px;background:#fff;cursor:pointer}
.expense-pages button:disabled{opacity:.5;cursor:not-allowed}
@media(max-width:650px){.expense-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.expense-filters label{min-width:0}.expense-filters input{width:100%;box-sizing:border-box}.expense-summary strong{font-size:20px}}
#expenses .expense-dashboard{background:#0d1117;color:#f8fafc;border:1px solid #263140;border-radius:20px;padding:24px;margin:18px 0;box-shadow:0 18px 40px rgba(15,23,42,.16)}
#expenses .expense-dashboard-title{display:flex;align-items:start;justify-content:space-between;gap:16px}
#expenses .expense-dashboard-title h3{font-size:21px;margin:0 0 4px;color:#fff}
#expenses .expense-dashboard-title p{margin:0;color:#9fb0c5;font-size:12px}
#expenses .expense-dashboard-title i{color:#cbd5e1}
#expenses .expense-summary{gap:12px;margin:22px 0}
#expenses .expense-summary article{border:1px solid #293748;background:#161e2a;border-radius:13px;padding:18px;min-height:112px;gap:5px}
#expenses .expense-summary span{color:#aebed0;font-size:12px}
#expenses .expense-summary strong{color:#f8fafc;font-size:25px;line-height:1.18;overflow-wrap:anywhere}
#expenses .expense-summary small{color:#8ea3b9;font-size:11px}
#expenses .expense-budget{border:1px solid #344251;border-radius:12px;padding:15px;margin:18px 0 22px}
#expenses .expense-budget>div:first-child{display:flex;justify-content:space-between;gap:12px;font-size:13px}
#expenses .expense-budget>div:first-child span{color:#aebed0}
#expenses .expense-budget-track{height:9px;border-radius:9px;background:#293440;margin:12px 0}
#expenses .expense-budget-track span{display:block;width:0;height:100%;border-radius:inherit;background:#4aa5e0}
#expenses .expense-budget p{font-size:12px;color:#aebed0;margin:0}
#expenses .expense-categories h4,#expenses .expense-recent h4{font-size:14px;color:#fff;margin:0 0 14px}
#expenses .expense-category-layout{display:flex;align-items:center;gap:30px}
#expenses .expense-donut{width:142px;height:142px;border-radius:50%;display:grid;place-items:center;flex:0 0 142px}
#expenses .expense-donut>div{width:90px;height:90px;border-radius:50%;background:#0d1117;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center}
#expenses .expense-donut small{color:#9fb0c5;font-size:10px}
#expenses .expense-donut strong{color:#fff;font-size:13px;max-width:80px;overflow-wrap:anywhere}
#expenses .expense-category-legend{flex:1;min-width:0}
#expenses .expense-category-item{display:flex;align-items:center;gap:10px;margin:9px 0;font-size:12px}
#expenses .expense-category-item i{width:9px;height:9px;border-radius:50%;flex:0 0 9px}
#expenses .expense-category-item span{flex:1;overflow-wrap:anywhere}
#expenses .expense-category-item strong{white-space:nowrap}
#expenses .expense-recent{border-top:1px solid #263140;margin-top:22px;padding-top:20px}
#expenses .expense-recent-item{display:flex;align-items:center;gap:13px;padding:10px 4px;border-bottom:1px solid #1d2835}
#expenses .expense-recent-item>i{width:24px;text-align:center;color:#95a9bf}
#expenses .expense-recent-item>div{flex:1;min-width:0}
#expenses .expense-recent-item strong,#expenses .expense-recent-item small{display:block;overflow-wrap:anywhere}
#expenses .expense-recent-item strong{font-size:13px;color:#fff}
#expenses .expense-recent-item small{font-size:11px;color:#9fb0c5;margin-top:3px}
#expenses .expense-recent-item b{font-size:13px;color:#fff;white-space:nowrap}
#expenses .expense-insight{background:#09202a;border-radius:12px;padding:14px 16px;margin-top:18px}
#expenses .expense-insight strong{font-size:13px;color:#d8f2ff}
#expenses .expense-insight strong i{color:#55aef0;margin-right:6px}
#expenses .expense-insight p{margin:7px 0 0;color:#b8d1df;font-size:12px;line-height:1.5}
@media(max-width:650px){#expenses .expense-dashboard{padding:17px;border-radius:16px}#expenses .expense-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}#expenses .expense-summary article{padding:13px;min-height:104px}#expenses .expense-summary strong{font-size:18px}#expenses .expense-category-layout{gap:14px}#expenses .expense-donut{width:108px;height:108px;flex-basis:108px}#expenses .expense-donut>div{width:68px;height:68px}#expenses .expense-donut strong{font-size:10px;max-width:58px}#expenses .expense-category-item{font-size:11px;gap:6px}#expenses .expense-category-item strong{font-size:10px}}
