/* ================================================================
   MB Workspace — Design System
   Modern SaaS dashboard inspired by Stripe, Linear, Notion
   ================================================================ */

/* ---- CSS Custom Properties (Light theme) ---- */
:root {
  /* Spacing (8px grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 48px;
  --sp-10: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 50px rgba(0,0,0,.1);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;

  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;

  /* ---- Light theme colors ---- */
  --bg-body: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f9fafb;
  --bg-surface-hover: #f3f4f6;
  --bg-sidebar: #1a1a2e;
  --bg-sidebar-hover: rgba(255,255,255,.08);
  --bg-sidebar-active: rgba(255,255,255,.12);

  --border-color: #e5e7eb;
  --border-light: #f0f0f2;

  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;
  --text-sidebar: rgba(255,255,255,.65);
  --text-sidebar-active: #ffffff;

  /* Accent */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --accent-text: #4338ca;

  /* Semantic */
  --color-success: #10b981;
  --color-success-light: #ecfdf5;
  --color-success-text: #065f46;
  --color-warning: #f59e0b;
  --color-warning-light: #fffbeb;
  --color-warning-text: #92400e;
  --color-danger: #ef4444;
  --color-danger-light: #fef2f2;
  --color-danger-text: #991b1b;
  --color-info: #3b82f6;
  --color-info-light: #eff6ff;
  --color-info-text: #1e40af;

  /* Transitions */
  --ease-out: cubic-bezier(.22,1,.36,1);
  --transition-fast: 150ms var(--ease-out);
  --transition-base: 200ms var(--ease-out);
  --transition-slow: 300ms var(--ease-out);
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --bg-body: #0f0f17;
  --bg-surface: #1a1a2e;
  --bg-surface-secondary: #16162a;
  --bg-surface-hover: #22223a;
  --bg-sidebar: #0d0d1a;
  --bg-sidebar-hover: rgba(255,255,255,.06);
  --bg-sidebar-active: rgba(255,255,255,.1);

  --border-color: #2a2a40;
  --border-light: #1f1f35;

  --text-primary: #f1f1f4;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.25);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.35);

  --accent-light: rgba(99,102,241,.15);
}

/* ================================================================
   BASE RESET
   ================================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

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

::selection {
  background: var(--accent);
  color: white;
}

/* ================================================================
   APP SHELL — Sidebar + Header + Content
   ================================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---- Login shell (no sidebar) ---- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
  padding: var(--sp-5);
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: 64px;
}

.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-inverse);
  letter-spacing: -.02em;
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-3) var(--sp-3);
  overflow-y: auto;
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: var(--sp-5) var(--sp-3) var(--sp-2);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
  white-space: nowrap;
}

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

.nav-item.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
}

.nav-item svg, .nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .7;
}

.nav-item.active svg, .nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: var(--sp-4);
  border-top: 1px solid rgba(255,255,255,.06);
}

/* ---- Main Area ---- */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

/* ---- Top Header ---- */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 var(--sp-7);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

[data-theme="dark"] .top-header {
  background: rgba(26,26,46,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.page-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.user-avatar {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

.user-dropdown {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2) var(--sp-1) var(--sp-1);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.user-dropdown:hover {
  background: var(--bg-surface-hover);
}

.user-dropdown-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.user-dropdown {
  position: relative;
}

.user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.user-dropdown.open .user-menu {
  display: block;
}

.user-menu-header {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-color);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: background var(--transition-fast);
}

.user-menu-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: none;
}

/* ---- Content ---- */
.content {
  flex: 1;
  padding: var(--sp-7);
  width: 100%;
}

/* ================================================================
   COMPONENTS
   ================================================================ */

/* ---- Card ---- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: box-shadow var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .card {
  box-shadow: var(--shadow-xs);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ---- KPI Cards ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-5);
  margin-bottom: var(--sp-7);
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  transition: all var(--transition-base);
}

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

.kpi-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: var(--sp-2);
}

.kpi-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  margin-top: var(--sp-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.kpi-trend.up {
  color: var(--color-success-text);
  background: var(--color-success-light);
}

.kpi-trend.down {
  color: var(--color-danger-text);
  background: var(--color-danger-light);
}

/* Stats grid (legacy support) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-7);
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:hover {
  box-shadow: var(--shadow-sm);
}

.stat-card h3 {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.stat-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-card.accepted { border-left: 3px solid var(--color-success); }
.stat-card.declined { border-left: 3px solid var(--color-danger); }
.stat-card.tentative { border-left: 3px solid var(--color-warning); }
.stat-card.pending { border-left: 3px solid var(--text-tertiary); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.5;
}

.btn-primary, .btn {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn-primary:hover, .btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(99,102,241,.25);
  color: white;
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-tertiary);
  box-shadow: none;
  transform: none;
  color: var(--text-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: 0 2px 8px rgba(239,68,68,.25);
  color: white;
}

.btn-success {
  background: var(--color-success);
  color: white;
  border-color: var(--color-success);
}

.btn-success:hover {
  background: #059669;
  color: white;
}

.btn-info {
  background: var(--color-info);
  color: white;
  border-color: var(--color-info);
}

.btn-sm {
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: var(--text-sm);
}

th {
  background: var(--bg-surface-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-surface-hover);
}

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

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
}

.badge-success { background: var(--color-success-light); color: var(--color-success-text); }
.badge-warning { background: var(--color-warning-light); color: var(--color-warning-text); }
.badge-info    { background: var(--color-info-light);    color: var(--color-info-text); }
.badge-danger  { background: var(--color-danger-light);  color: var(--color-danger-text); }
.badge-secondary { background: var(--bg-surface-secondary); color: var(--text-secondary); }

/* ---- Forms ---- */
.form-group {
  margin-bottom: var(--sp-5);
}

label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.form-control {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-row {
  display: flex;
  gap: var(--sp-4);
}

.form-row > .form-group {
  flex: 1;
}

/* ---- Flash Messages ---- */
.flash-messages {
  margin-bottom: var(--sp-5);
}

.flash {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--sp-3);
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.flash.success {
  background: var(--color-success-light);
  color: var(--color-success-text);
  border-color: rgba(16,185,129,.25);
}

.flash.error {
  background: var(--color-danger-light);
  color: var(--color-danger-text);
  border-color: rgba(239,68,68,.25);
}

/* ---- Status badges for meeting / campaign ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.status-completed { background: var(--color-success-light); color: var(--color-success-text); }
.status-partial   { background: var(--color-warning-light); color: var(--color-warning-text); }
.status-failed    { background: var(--color-danger-light);  color: var(--color-danger-text); }
.status-sending   { background: var(--color-info-light);    color: var(--color-info-text); }
.status-pending   { background: var(--bg-surface-secondary);color: var(--text-secondary); }

/* ---- Section card (used in meeting scheduler, etc) ---- */
.card-style {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  margin-bottom: var(--sp-5);
}

/* ---- Theme toggle ---- */
.theme-toggle {
  position: relative;
}

.theme-toggle svg {
  width: 18px; height: 18px;
}

/* ---- Utility ---- */
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none; }

/* ---- Form helpers ---- */
.form-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
  line-height: 1.5;
}

.form-hint a { color: var(--accent); }

/* ---- Info / Warning / Success boxes ---- */
.info-box {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
  border-left: 3px solid;
}

.info-box.info {
  background: var(--color-info-light);
  color: var(--color-info-text);
  border-color: var(--color-info);
}

.info-box.success {
  background: var(--color-success-light);
  color: var(--color-success-text);
  border-color: var(--color-success);
}

.info-box.warning {
  background: var(--color-warning-light);
  color: var(--color-warning-text);
  border-color: var(--color-warning);
}

.info-box.danger {
  background: var(--color-danger-light);
  color: var(--color-danger-text);
  border-color: var(--color-danger);
}

.info-box.neutral {
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

/* ---- Inline status message (for JS toggling) ---- */
.status-msg {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-top: var(--sp-3);
}

.status-msg.is-success { background: var(--color-success-light); color: var(--color-success-text); }
.status-msg.is-error   { background: var(--color-danger-light);  color: var(--color-danger-text); }
.status-msg.is-info    { background: var(--color-info-light);    color: var(--color-info-text); }
.status-msg.is-warning { background: var(--color-warning-light); color: var(--color-warning-text); }

/* ---- Section card (instructions, detail panels) ---- */
.section-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  margin-top: var(--sp-6);
}

.section-panel h3 {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-4);
}

.section-panel ul {
  line-height: 1.9;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  padding-left: var(--sp-5);
}

/* ---- Metric card (for campaign detail advanced analytics) ---- */
.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

.metric-card strong {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.metric-card .metric-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--accent);
  margin: var(--sp-2) 0;
}

.metric-card small {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ---- Profile / Meet links ---- */
.link-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.link-pill.accent {
  background: var(--accent-light);
  color: var(--accent-text);
}

.link-pill.accent:hover {
  background: var(--accent);
  color: white;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-5);
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.empty-state p {
  margin-bottom: var(--sp-5);
}

/* ---- Color text helpers (for JS) ---- */
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info    { color: var(--color-info) !important; }
.text-muted   { color: var(--text-tertiary) !important; }

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */
.toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
  max-width: 420px;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toastIn var(--transition-slow) forwards;
  overflow: hidden;
  position: relative;
}

.toast.removing {
  animation: toastOut 250ms forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(40px) scale(.96); }
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.toast-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

.toast-body {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast-msg {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 2px;
  word-break: break-word;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  padding: 0;
}

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

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  animation: toastProgress linear forwards;
}

@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* Toast variants */
.toast.toast-success .toast-icon { background: var(--color-success-light); color: var(--color-success); }
.toast.toast-success .toast-progress { background: var(--color-success); }

.toast.toast-error .toast-icon { background: var(--color-danger-light); color: var(--color-danger); }
.toast.toast-error .toast-progress { background: var(--color-danger); }

.toast.toast-warning .toast-icon { background: var(--color-warning-light); color: var(--color-warning); }
.toast.toast-warning .toast-progress { background: var(--color-warning); }

.toast.toast-info .toast-icon { background: var(--color-info-light); color: var(--color-info); }
.toast.toast-info .toast-progress { background: var(--color-info); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-area {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: flex;
  }
  .content {
    padding: var(--sp-5);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    flex-direction: column;
  }
  .top-header {
    padding: 0 var(--sp-4);
  }
  .content {
    padding: var(--sp-4);
  }
}

/* ---- Mobile overlay ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}

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