/* ============================================================
   FMS Pro – Franchise Management System
   style.css – Enterprise UI Design System
   ============================================================ */

/* ── CSS VARIABLES ───────────────────────────────────────────── */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --secondary: #06b6d4;
  --accent: #f59e0b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --bg: #0f0f1a;
  --bg-surface: #16172b;
  --bg-card: #1e1f38;
  --bg-hover: #252640;
  --bg-input: #1a1b30;

  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255, 255, 255, 0.07);
  --border-focus: rgba(99, 102, 241, 0.5);

  --glass-bg: rgba(30, 31, 56, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(16px);

  --sidebar-w: 250px;
  --sidebar-collapsed-w: 68px;
  --topbar-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
  --font: 'Inter', system-ui, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

.light-mode {
  --bg: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --bg-input: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border: rgba(0,0,0,0.08);
  --glass-bg: rgba(255, 255, 255, 0.92);
  --glass-border: rgba(0,0,0,0.06);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --bg-surface: #ffffff;
}

/* ── RESET & BASE ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
}
a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
table { border-collapse: collapse; width: 100%; }
ul, ol { list-style: none; }

/* ── GLASS EFFECT ─────────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

/* ── LOGIN SCREEN ─────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 20% 50%, #1a1040 0%, var(--bg) 60%);
}
.login-bg { position: fixed; inset: 0; pointer-events: none; }
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
  animation: blobFloat 8s ease-in-out infinite;
}
.blob-1 { width: 400px; height: 400px; background: var(--primary); top: -100px; left: -100px; animation-delay: 0s; }
.blob-2 { width: 300px; height: 300px; background: var(--secondary); bottom: -50px; right: -80px; animation-delay: -3s; }
.blob-3 { width: 250px; height: 250px; background: var(--accent); top: 50%; left: 50%; animation-delay: -6s; }
@keyframes blobFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(20px, -30px) scale(1.05); }
}
.login-card {
  width: 420px;
  max-width: 94vw;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  position: relative;
  z-index: 10;
}
.login-brand { text-align: center; margin-bottom: 2rem; }
.brand-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.6rem; color: #fff;
  box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}
.login-brand h1 { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; }
.login-brand h1 span { background: linear-gradient(90deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-brand p { color: var(--text-muted); font-size: 0.875rem; margin-top: 0.25rem; }
.login-footer { text-align: center; margin-top: 1.5rem; color: var(--text-dim); }

/* ── FORM ELEMENTS ────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.input-icon { position: relative; }
.input-icon > i:first-child { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 0.85rem; pointer-events: none; z-index: 1; }
.input-icon input,
.input-icon select {
  width: 100%; padding: 0.75rem 1rem 0.75rem 2.4rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-icon input:focus, .input-icon select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.eye-btn {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; color: var(--text-dim); padding: 4px; font-size: 0.8rem;
}
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="tel"], select, textarea {
  width: 100%; padding: 0.7rem 0.875rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
select option { background: var(--bg-card); color: var(--text); }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 600; transition: all 0.2s;
  border: 1px solid transparent; cursor: pointer;
}
.btn-full { width: 100%; justify-content: center; padding: 0.85rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-secondary { background: var(--bg-hover); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #000; }
.btn-info { background: var(--info); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; align-items: center; justify-content: center; border-radius: var(--radius-sm); }
.btn-icon-sm {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); display: flex;
  align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-icon-sm:hover { background: var(--bg-hover); color: var(--text); }
.btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── ALERTS ───────────────────────────────────────────────────── */
.alert { padding: 0.75rem 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; border: 1px solid transparent; }
.alert-danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #f87171; }
.alert-success { background: rgba(16,185,129,0.12); border-color: rgba(16,185,129,0.3); color: #34d399; }
.alert-warning { background: rgba(245,158,11,0.12); border-color: rgba(245,158,11,0.3); color: #fbbf24; }
.alert-info { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #60a5fa; }

/* ── BADGES ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
}
.badge-primary { background: rgba(99,102,241,0.18); color: var(--primary-light); }
.badge-success { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-danger { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-warning { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-info { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-secondary { background: var(--bg-hover); color: var(--text-muted); }

/* ── APP SHELL ────────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ──────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease;
  position: relative;
  z-index: 100;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); min-width: var(--sidebar-collapsed-w); }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0.65rem; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .sidebar-bottom { justify-content: center; flex-direction: column; gap: 0.5rem; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.6rem; }
.brand-icon-sm {
  width: 32px; height: 32px; min-width: 32px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: #fff;
}
.brand-name { font-family: var(--font-display); font-size: 1rem; font-weight: 700; white-space: nowrap; }
.sidebar-toggle { background: transparent; color: var(--text-muted); font-size: 1rem; padding: 4px; border-radius: 6px; }
.sidebar-toggle:hover { color: var(--text); background: var(--bg-hover); }

.sidebar-user {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
}
.user-info strong { display: block; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-info small { color: var(--text-muted); font-size: 0.72rem; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.5rem; scrollbar-width: thin; }
.nav-section-label {
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--text-dim); padding: 0.6rem 0.6rem 0.3rem;
  white-space: nowrap; overflow: hidden;
}
.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
  transition: all 0.15s; margin-bottom: 2px; position: relative; white-space: nowrap;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,0.15); color: var(--primary-light); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 20%; height: 60%; width: 3px; background: var(--primary); border-radius: 2px; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 0.65rem; font-weight: 700; min-width: 18px; height: 18px;
  border-radius: 10px; padding: 0 4px; display: flex; align-items: center; justify-content: center;
}

.sidebar-bottom {
  padding: 0.75rem 1rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

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

/* ── TOPBAR ───────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); min-height: var(--topbar-h);
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; gap: 1rem; position: relative; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.sidebar-toggle-mobile { background: transparent; color: var(--text-muted); font-size: 1rem; display: none; padding: 6px; border-radius: 6px; }
.search-bar {
  position: relative; flex: 1; max-width: 480px;
}
.search-bar > i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); font-size: 0.82rem; }
.search-bar input {
  width: 100%; padding: 0.5rem 0.875rem 0.5rem 2.2rem;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 20px; color: var(--text); font-size: 0.85rem;
}
.search-bar input:focus { outline: none; border-color: var(--primary); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  max-height: 300px; overflow-y: auto; display: none; z-index: 200;
  box-shadow: var(--shadow);
}
.search-results.visible { display: block; }
.search-result-item {
  padding: 0.6rem 0.875rem; display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.82rem;
}
.search-result-item:hover { background: var(--bg-hover); }
.search-result-type { font-size: 0.65rem; font-weight: 700; background: rgba(99,102,241,0.15); color: var(--primary-light); padding: 1px 6px; border-radius: 4px; }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; position: relative; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; position: relative; font-size: 0.9rem;
  transition: all 0.2s;
}
.topbar-btn:hover { color: var(--text); background: var(--bg-hover); }
.badge-dot {
  width: 8px; height: 8px; background: var(--danger); border-radius: 50%;
  position: absolute; top: 4px; right: 4px; border: 2px solid var(--bg-surface);
  display: none;
}
.badge-dot.visible { display: block; }
.topbar-user { display: flex; align-items: center; gap: 0.5rem; }
.user-avatar-sm {
  width: 30px; height: 30px;
  border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #fff;
}

/* ── NOTIFICATION PANEL ───────────────────────────────────────── */
.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 40px;
  width: 320px; border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 300;
}
.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1rem; border-bottom: 1px solid var(--border);
}
.notif-header button { background: transparent; color: var(--text-muted); font-size: 0.85rem; }
.notif-list { max-height: 280px; overflow-y: auto; }
.notif-item { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-item-title { font-size: 0.82rem; font-weight: 600; }
.notif-item-msg { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.notif-item-time { font-size: 0.7rem; color: var(--text-dim); margin-top: 4px; }
.empty-state-sm { padding: 1.5rem; text-align: center; color: var(--text-dim); font-size: 0.82rem; }

/* ── PAGE CONTAINER ───────────────────────────────────────────── */
.page-container {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.75rem;
}
.page-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }

/* ── KPI CARDS ────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.25rem;
  transition: transform 0.2s, box-shadow 0.2s; position: relative; overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--card-color, var(--primary)), transparent);
}
.kpi-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; margin-bottom: 0.75rem;
  background: color-mix(in srgb, var(--card-color, var(--primary)) 15%, transparent);
  color: var(--card-color, var(--primary));
}
.kpi-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; line-height: 1; }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; font-weight: 500; }
.kpi-trend { font-size: 0.72rem; margin-top: 0.4rem; }
.kpi-trend.up { color: var(--success); }
.kpi-trend.down { color: var(--danger); }

/* ── CHARTS ───────────────────────────────────────────────────── */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.chart-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.chart-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; position: relative;
}
.chart-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.chart-card-title { font-size: 0.875rem; font-weight: 700; }
.chart-canvas-wrap { position: relative; height: 200px; }

/* ── DATA TABLE ───────────────────────────────────────────────── */
.table-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem;
}
.table-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 0.5rem;
}
.table-card-title { font-size: 0.875rem; font-weight: 700; }
.table-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.table-search input {
  padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: 20px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text); width: 200px;
}
.table-filter select { padding: 0.4rem 0.6rem; font-size: 0.78rem; border-radius: var(--radius-sm); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; }
.data-table th {
  padding: 0.65rem 1rem; text-align: left; font-size: 0.72rem;
  font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--bg-hover); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td {
  padding: 0.75rem 1rem; font-size: 0.82rem; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.table-actions { display: flex; gap: 0.3rem; align-items: center; }
.table-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted);
}
.table-pagination .btn { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

/* ── MODAL ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
}
.modal-overlay.visible { display: flex; }
.modal {
  width: 560px; max-width: 95vw; max-height: 90vh;
  border-radius: var(--radius-lg); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 32px 80px rgba(0,0,0,0.5);
  animation: modalIn 0.2s ease;
}
.modal-lg { width: 800px; }
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: transparent; color: var(--text-muted); width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 0.875rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; gap: 0.5rem; justify-content: flex-end;
}

/* ── TOAST ────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2000;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.6rem;
  box-shadow: var(--shadow); font-size: 0.85rem; max-width: 320px;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast i { font-size: 0.9rem; }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info i { color: var(--info); }

/* ── LOADER ───────────────────────────────────────────────────── */
.page-loader {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.loader-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SECTION LOADING ──────────────────────────────────────────── */
.section-loader { display: flex; align-items: center; justify-content: center; padding: 3rem; }
.section-loader .loader-spinner { width: 30px; height: 30px; border-width: 2px; }

/* ── EMPTY STATE ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; color: var(--border); margin-bottom: 1rem; }
.empty-state h4 { font-size: 0.95rem; margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.82rem; }

/* ── CARD ─────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-size: 0.9rem; font-weight: 700; }

/* ── TABS ─────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tab-btn {
  padding: 0.65rem 1.1rem; font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); background: transparent; border-bottom: 2px solid transparent;
  white-space: nowrap; transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary-light); border-bottom-color: var(--primary); }

/* ── PIPELINE (CRM) ───────────────────────────────────────────── */
.pipeline-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.pipeline-col { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem; }
.pipeline-col-header { font-size: 0.78rem; font-weight: 700; margin-bottom: 0.75rem; display: flex; align-items: center; justify-content: space-between; }
.pipeline-col-count { background: var(--bg-hover); padding: 1px 7px; border-radius: 10px; font-size: 0.7rem; }

/* ── FILTER BAR ───────────────────────────────────────────────── */
.filter-bar {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.875rem 1.25rem; margin-bottom: 1rem;
  display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap;
}
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.7rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.filter-group select, .filter-group input { padding: 0.4rem 0.6rem; font-size: 0.8rem; border-radius: var(--radius-sm); min-width: 120px; }

/* ── QUICK STATS BAR ──────────────────────────────────────────── */
.quick-stats { display: flex; gap: 1rem; margin-bottom: 1.25rem; overflow-x: auto; padding-bottom: 4px; }
.quick-stat {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.75rem 1.1rem;
  min-width: 140px; flex-shrink: 0;
}
.quick-stat-val { font-size: 1.3rem; font-weight: 800; font-family: var(--font-display); }
.quick-stat-lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── ACTIVITY FEED ────────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem 0; border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  background: var(--primary);
}
.activity-content { flex: 1; }
.activity-text { font-size: 0.82rem; }
.activity-time { font-size: 0.72rem; color: var(--text-dim); margin-top: 2px; }

/* ── PROGRESS BAR ─────────────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--bg-hover); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 3px; transition: width 0.5s ease; }

/* ── STATUS DOTS ──────────────────────────────────────────────── */
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.status-dot.active, .status-dot.converted, .status-dot.paid { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.inactive, .status-dot.lost, .status-dot.overdue { background: var(--danger); }
.status-dot.pending, .status-dot.new { background: var(--warning); }
.status-dot.follow-up { background: var(--info); }

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 200; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-toggle-mobile { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .topbar-right span { display: none; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-container { padding: 0.875rem; }
}
