:root {
  --bg-color: #F8FAFC;         /* Soft slate background */
  --surface: #FFFFFF;
  --text-main: #0F172A;        /* Dark slate text */
  --text-muted: #64748B;       /* Muted text */
  --primary: #1F5F40;          /* Deep Forest Green */
  --primary-light: #F0FDF4;    /* Light faint green */
  --primary-accent: #4ADE80;   /* Bright Green Accent */
  --danger: #EF4444;           
  --danger-light: #FEE2E2;
  --border-color: #E2E8F0;
  
  /* Very subtle shadows for the premium look */
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.03), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Global Focus Visible Accessibility Ring */
*:focus-visible {
  outline: 2px solid var(--primary-accent);
  outline-offset: 2px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  background-color: var(--bg-color); 
  color: var(--text-main); 
  min-height: 100vh; 
  padding: 32px; 
}

/* ─── UTILITIES ─── */
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: none; background: transparent; }
input { outline: none; }

.btn { 
  padding: 10px 20px; 
  border-radius: var(--radius-sm); 
  font-weight: 500; 
  font-size: 14px; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 8px; 
  cursor: pointer;
  transition: all var(--transition-normal); 
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary { 
  background-color: var(--primary); 
  color: white; 
}
.btn-primary:hover { 
  background-color: #164830; 
}
.btn-outline { 
  border: 1px solid var(--border-color); 
  background-color: var(--surface); 
  color: var(--text-main); 
}
.btn-outline-small { 
  padding: 6px 14px; 
  border-radius: var(--radius-sm); 
  border: 1px solid var(--border-color); 
  background: var(--surface); 
  color: var(--text-main); 
  font-size: 13px; 
  font-weight: 500; 
  font-family: inherit; 
  cursor: pointer; 
  transition: all var(--transition-normal);
}
.btn-outline-small:hover {
  background: var(--bg-color);
  border-color: #CBD5E1;
}
.btn-danger { background: var(--danger); color: white; padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; }
.full-width { width: 100%; }

/* ─── STAFF TABLE ACTION BUTTONS ─── */
.staff-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 64px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--surface);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}
.staff-action-btn:hover {
  background: var(--bg-color);
  border-color: #CBD5E1;
}
.staff-action-btn:active { transform: scale(0.97); }
.staff-action-danger {
  background: #FEF2F2;
  color: var(--danger);
  border-color: #FECACA;
}
.staff-action-danger:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
}

/* ─── LOGIN ─── */
.login-screen { 
  min-height: 100vh; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%); 
  margin: -32px; 
  padding: 32px; 
}
.login-card { 
  background: white; 
  border-radius: 24px; 
  padding: 48px; 
  width: 100%; 
  max-width: 440px; 
  box-shadow: var(--shadow-lg); 
}
.login-logo { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  font-size: 24px; 
  font-weight: 700; 
  color: var(--text-main); 
  margin-bottom: 24px; 
}
.login-logo i { font-size: 36px; color: var(--primary); }
.login-card h2 { font-size: 26px; margin-bottom: 8px; font-weight: 700; }
.login-sub { color: var(--text-muted); font-size: 15px; margin-bottom: 32px; line-height: 1.5; }
.login-error { background: var(--danger-light); color: var(--danger); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; font-weight: 500; }

/* ─── FORM ─── */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-main); }
.form-group input, .form-group select, .form-group textarea { 
  width: 100%; 
  padding: 12px 16px; 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-sm); 
  font-family: inherit; 
  font-size: 14px; 
  background: #F8FAFC; 
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); background: white; }

/* ─── APP LAYOUT ─── */
.app-container { 
  display: grid; 
  grid-template-columns: 240px 1fr; 
  gap: 32px; 
  max-width: 1600px; 
  margin: 0 auto; 
  min-height: calc(100vh - 64px); 
}

/* ─── SIDEBAR ─── */
.sidebar { 
  background: var(--surface); 
  border-radius: var(--radius-lg); 
  padding: 32px 0; /* Padding inside the sidebar removed from sides to allow full bleed */
  display: flex; 
  flex-direction: column; 
  box-shadow: var(--shadow-sm); 
}
.sidebar-header { margin-bottom: 32px; padding: 0 24px; }
.logo { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 700; color: var(--text-main); }
.logo i { color: var(--primary); font-size: 28px; }
.sidebar-menu { flex: 1; padding: 0 16px; }
.menu-group { margin-bottom: 36px; }
.menu-label { 
  display: block; 
  font-size: 11px; 
  font-weight: 700; 
  color: #94A3B8; 
  letter-spacing: 0.8px; 
  text-transform: uppercase;
  margin-bottom: 12px; 
  padding-left: 16px; 
}
.menu-item { 
  display: flex; 
  align-items: center; 
  gap: 14px; 
  padding: 12px 16px; 
  color: var(--text-muted); 
  text-decoration: none; 
  font-weight: 500; 
  cursor: pointer;
  font-size: 14px; 
  border-radius: var(--radius-md); 
  margin-bottom: 4px; 
  position: relative; 
  transition: all var(--transition-normal); 
}
.menu-item i { font-size: 20px; color: #94A3B8; transition: color var(--transition-normal); }
.menu-item:hover { color: var(--text-main); background: #f1f5f9; }
.menu-item:hover i { color: var(--text-main); }
.menu-item:active { transform: scale(0.98); }
.menu-item.active { 
  color: var(--primary); 
  background: #F8FAFC; 
  font-weight: 600;
}
.menu-item.active i { color: var(--primary); }
.menu-item.active .active-indicator {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
}

/* Beautiful "Ask AI" pill in the sidebar */
.menu-item.copilot-link {
  background: #F0FDF4;
  color: #166534;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-top: 8px;
}
.menu-item.copilot-link i { color: #166534; }
.menu-item.copilot-link:hover { background: #DCFCE7; }

.badge { 
  margin-left: auto; 
  background: var(--danger); 
  color: white; 
  font-size: 11px; 
  font-weight: 700; 
  padding: 2px 7px; 
  border-radius: 12px; 
}

/* Sidebar Promo (Google Sync snippet at bottom) */
.sidebar-promo { display: none; /* Removed to match pure minimalist screenshot aesthetic */ }

/* ─── MAIN CONTENT ─── */
.main-content { display: flex; flex-direction: column; gap: 24px; }

/* ─── TOP NAV ─── */
.top-nav { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  background: var(--surface); 
  padding: 16px 32px; 
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-sm); 
  position: relative; 
  z-index: 100; 
}
.search-wrapper { position: relative; }
.search-bar { 
  display: flex; 
  align-items: center; 
  background: #F8FAFC; 
  padding: 10px 18px; 
  border-radius: var(--radius-full); 
  width: 360px; 
  gap: 12px; 
}
.search-bar i { color: #94A3B8; font-size: 18px; }
.search-bar input { border: none; background: transparent; flex: 1; font-family: inherit; font-size: 14px; outline: none; }
.shortcut-key { background: #E2E8F0; border-radius: 4px; padding: 2px 6px; font-size: 11px; color: var(--text-muted); font-weight: 600; }

.search-dropdown { position: absolute; top: calc(100% + 8px); left: 0; width: 360px; background: white; border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); max-height: 300px; overflow-y: auto; z-index: 200; }
.search-result-item { padding: 12px 18px; cursor: pointer; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.search-result-item:hover { background: #F8FAFC; }
.search-result-item .sname { font-size: 14px; font-weight: 600; color: var(--text-main); }
.search-result-item .sphone { font-size: 12px; color: var(--text-muted); }

.user-actions { display: flex; align-items: center; gap: 24px; }
.notif-wrapper { position: relative; }
.icon-btn { 
  width: 40px; height: 40px; 
  border-radius: 50%; 
  background: white; 
  border: 1px solid var(--border-color); 
  display: flex; align-items: center; justify-content: center; 
  font-size: 20px; color: var(--text-main); 
  position: relative; cursor: pointer; transition: all var(--transition-normal); 
}
.icon-btn:hover { background: #F8FAFC; border-color: #CBD5E1; }
.icon-btn:active { transform: scale(0.95); }
.notif-dot { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid white; }
.notif-panel { position: absolute; top: calc(100% + 12px); right: 0; width: 320px; background: white; border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 200; }
.notif-panel-header { padding: 14px 16px; font-weight: 600; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.user-profile { display: flex; align-items: center; gap: 14px; padding-left: 24px; border-left: 1px solid var(--border-color); }
.user-profile img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 14px; font-weight: 700; color: var(--text-main); }
.user-email { font-size: 12px; color: var(--text-muted); }

/* ─── PAGES/VIEWS ─── */
.view { display: none; }
.view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.view-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; padding: 0 4px; }
.view-header h1 { font-size: 26px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.5px; }
.view-header p { color: var(--text-muted); font-size: 14px; }
.header-actions { display: flex; gap: 12px; align-items: center; }

.filter-dropdown { 
  padding: 8px 16px; 
  border: 1px solid var(--border-color); 
  border-radius: var(--radius-full); 
  font-family: inherit; 
  font-size: 13px; 
  background: white; 
  cursor: pointer; 
  color: var(--text-main);
  outline: none;
}

/* ─── KPI ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 24px; }
.kpi-card { 
  background: var(--surface); 
  padding: 24px; 
  border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-sm); 
  display: flex; flex-direction: column; 
}
.kpi-card.card-dark { 
  background: var(--primary); 
  color: white; 
}
.kpi-top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi-title { font-size: 15px; font-weight: 600; }
.kpi-card:not(.card-dark) .kpi-title { color: var(--text-main); }
.kpi-value { font-size: 38px; font-weight: 700; margin: 16px 0 12px; letter-spacing: -1px; }
.kpi-change { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; font-weight: 500; }
.card-dark .kpi-change { color: rgba(255,255,255,0.8); }

/* Elegant Icon Wrapper for KPIs */
.icon-btn-light { 
  width: 40px; height: 40px; 
  border-radius: 50%; 
  background: rgba(255,255,255,0.2); 
  color: white; 
  display: flex; align-items: center; justify-content: center; 
  font-size: 20px; 
  cursor: pointer;
  transition: background var(--transition-normal);
}
.icon-btn-light:hover { background: rgba(255,255,255,0.3); }
.icon-btn-light.outline { background: white; color: var(--text-main); border: 1px solid var(--border-color); }
.icon-btn-light.outline:hover { background: #f1f5f9; }

/* Arrow Pills */
.kpi-card.card-dark .badge-positive {
  background: rgba(255,255,255,0.2); color: white; padding: 4px 8px; border-radius: 6px; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}
.kpi-card:not(.card-dark) .badge-positive {
  background: #DCFCE7; color: #166534; padding: 4px 8px; border-radius: 6px; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 4px;
}

/* ─── WIDGETS / CARDS ─── */
.widgets-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 24px; }
.widget-card { 
  background: var(--surface); 
  border-radius: var(--radius-lg); 
  padding: 32px; 
  box-shadow: var(--shadow-sm); 
}
.col-span-2 { grid-column: span 2; }
.widget-title { font-size: 16px; font-weight: 700; margin-bottom: 32px; color: var(--text-main); }
.widget-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.widget-header .widget-title { margin-bottom: 0; }

/* ─── BAR CHART FIX ─── */
.bar-chart { 
  display: flex; justify-content: space-around; align-items: flex-end; 
  height: 180px; gap: 12px; 
  padding-bottom: 12px;
}
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 12px; height: 100%; justify-content: flex-end; flex: 1; }
.bar { 
  width: 100%; max-width: 48px; 
  border-radius: 8px 8px 0 0; 
  position: relative; transition: all 0.3s; 
  min-height: 4px; 
}
.bar.solid-light { background: var(--primary-accent); } 
.bar.solid-dark { background: var(--primary); }
.bar.solid-empty { background: repeating-linear-gradient(45deg, transparent, transparent 4px, #E2E8F0 4px, #E2E8F0 8px); }
.bar:hover { filter: brightness(1.1); transform: translateY(-4px); }

.bar-tooltip { 
  position: absolute; 
  top: -34px; left: 50%; transform: translateX(-50%); 
  background: #1E293B; color: white; 
  padding: 6px 10px; border-radius: 6px; 
  font-size: 11px; font-weight: 600; 
  white-space: nowrap; pointer-events: none; 
  opacity: 0; transition: opacity 0.2s, transform 0.2s; 
  box-shadow: var(--shadow-md); z-index: 100;
}
.bar-tooltip::after {
  content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%);
  border-width: 4px 4px 0; border-style: solid; border-color: #1E293B transparent transparent transparent;
}
.bar:hover .bar-tooltip { opacity: 1; transform: translateX(-50%) translateY(-2px); }
.day { font-size: 13px; color: var(--text-main); font-weight: 500; }

/* Live Data Feed */
.live-dot { width: 8px; height: 8px; background: #EF4444; border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }

.live-feed-list { display: flex; flex-direction: column; gap: 20px; }
.feed-item { display: flex; gap: 16px; align-items: flex-start; }
.feed-icon { 
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px; 
}
.feed-icon.green { background: #DCFCE7; color: #16A34A; }
.feed-icon.blue { background: #DBEAFE; color: #2563EB; }
.feed-icon.orange { background: #FEF3C7; color: #D97706; }
.feed-text { font-size: 14px; line-height: 1.5; color: var(--text-main); }
.feed-text strong { font-weight: 700; color: black; }

/* ─── TABLES ─── */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { 
  background: white; 
  padding: 12px 16px; 
  text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); border-bottom: 1px solid var(--border-color); 
}
.table-row { 
  display: flex; align-items: center; padding: 16px; 
  border-bottom: 1px solid var(--border-color); transition: background 0.2s; 
}
.table-row:hover { background: #F8FAFC; }
.table-header { 
  display: flex; padding: 12px 16px; font-weight: 600; font-size: 12px; 
  color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border-color); 
}

/* Status badges */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.status-NEW { background: #EFF6FF; color: #2563EB; }
.status-CONFIRMED { background: #DCFCE7; color: #16A34A; }
.status-CANCELED { background: #FEE2E2; color: #DC2626; }

/* ─── TASKS & CALENDAR ─── */
.task-list { display: flex; flex-direction: column; gap: 12px; list-style: none; margin-bottom: 20px;}
.task-list li { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 10px 14px; background: white; border-radius: var(--radius-sm); border: 1px solid var(--border-color);}
.task-list li input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* Calendar grid styling reset */
.calendar-grid {
  display: grid;
  gap: 12px;
}
.calendar-grid.weekly { grid-template-columns: repeat(6, 1fr); }
.cal-day-header { text-align: center; font-weight: 600; font-size: 13px; padding: 10px; background: #F8FAFC; border-radius: var(--radius-sm); color: var(--text-muted); border: 1px solid var(--border-color); }
.cal-slot { background: white; border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 12px; min-height: 120px; display: flex; flex-direction: column; gap: 8px;}
.appt { background: #F8FAFC; padding: 10px; border-radius: 6px; border-left: 4px solid var(--primary);  font-size: 13px; }
.appt.reminder { border-left-color: #F59E0B; background: #FFFBEB; }
.appt strong { display: block; margin-bottom: 4px; }
.flow-status { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; margin-top: 6px; color: var(--text-muted); }

/* ─── COPILOT OVERHAUL ─── */
.copilot-container { display: flex; flex-direction: column; height: 600px; padding: 0 !important; overflow: hidden; }
.chat-history { padding: 24px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; background: #F8FAFC; border-radius: 0 0 16px 16px; }
.chat-bubble { max-width: 80%; padding: 14px 18px; border-radius: 16px; font-size: 14px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.chat-bubble.bot { background: white; color: var(--text-main); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--border-color); }
.chat-bubble.user { background: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.suggestion-chips { padding: 16px 24px; display: flex; gap: 12px; overflow-x: auto; background: white; border-top: 1px solid var(--border-color); }
.suggestion-chips::-webkit-scrollbar { display: none; }
.chip { padding: 10px 18px; border-radius: var(--radius-full); border: 1px solid var(--border-color); background: white; font-size: 13px; color: var(--text-main); white-space: nowrap; cursor: pointer; transition: all 0.2s;}
.chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.copilot-input-area { padding: 16px 24px; background: white; border-top: 1px solid var(--border-color); display: flex; gap: 12px; }
.copilot-input-area input { flex: 1; padding: 14px 20px; border-radius: var(--radius-full); border: 1px solid var(--border-color); font-size: 14px; background: #F8FAFC; transition: all var(--transition-normal); }
.copilot-input-area input:focus { border-color: var(--primary); background: white; }
.copilot-input-area button { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: white; font-size: 20px; cursor:pointer; transition: transform var(--transition-fast); }
.copilot-input-area button:hover { transform: scale(1.05); }
.copilot-input-area button:active { transform: scale(0.95); }

/* ─── TOAST ─── */
#toast-container { position: fixed; top: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: white; border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 18px; box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 10px; min-width: 260px; animation: slideIn 0.2s ease; border-left: 4px solid var(--primary); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warn { border-left-color: var(--warning); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin    { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ============================================================
   v2 Multi-Tenant Extensions
   ============================================================ */

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; }
.tab-btn { padding: 8px 16px; border: none; background: none; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: var(--transition-fast); }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Credential field with mask + copy */
.cred-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.cred-row .form-group { flex: 1; margin-bottom: 0; }
.cred-row input { font-family: monospace; font-size: 12px; }
.cred-actions { display: flex; gap: 4px; flex-shrink: 0; margin-top: 20px; }
.icon-btn-sm { width: 30px; height: 30px; border: 1px solid var(--border-color); background: var(--surface); border-radius: var(--radius-sm); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; }
.icon-btn-sm:hover { background: var(--bg-color); color: var(--text-main); }

/* Status dot */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.green { background: #22C55E; }
.status-dot.red   { background: #EF4444; }
.status-dot.grey  { background: #94A3B8; }

/* Plan badges */
.plan-badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.plan-starter { background: #F1F5F9; color: #475569; }
.plan-growth  { background: #DBEAFE; color: #1E40AF; }
.plan-pro     { background: #F0FDF4; color: #166534; }

/* Admin page layout */
.admin-page { padding: 28px 32px; max-width: 1300px; }
.admin-page h1 { font-size: 22px; font-weight: 700; color: var(--text-main); margin: 0 0 6px; }
.admin-page .page-sub { font-size: 14px; color: var(--text-muted); margin: 0 0 28px; }

/* Stat row */
.stat-row { display: flex; gap: 16px; margin-bottom: 28px; }
.stat-card { flex: 1; background: var(--surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 18px 20px; }
.stat-card .stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--text-main); }

/* Clients table */
.clients-table { width: 100%; border-collapse: collapse; }
.clients-table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 8px 14px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.clients-table td { font-size: 13px; color: var(--text-main); padding: 12px 14px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr:hover td { background: var(--bg-color); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #CBD5E1; border-radius: 99px; transition: 0.2s; }
.toggle-slider:before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* Filter bar */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar input[type="text"] { padding: 7px 12px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-main); background: var(--surface); width: 240px; }
.filter-bar input[type="text"]:focus { outline: none; border-color: var(--primary); }
.filter-btn { padding: 6px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: var(--surface); font-size: 12px; font-weight: 500; color: var(--text-muted); cursor: pointer; }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Section card inside admin-client */
.section-card { background: var(--surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 24px; margin-bottom: 20px; }
.section-card h3 { font-size: 14px; font-weight: 600; color: var(--text-main); margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }

/* Two column grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.full-span { grid-column: 1 / -1; }

/* Progress bar */
.progress-bar-wrap { background: var(--bg-color); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width 0.4s; }

/* Audience filter section */
.audience-section { border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 16px; background: var(--bg-color); }
.audience-section h4 { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 12px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-main); cursor: pointer; }

/* Back button */
.back-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; border: none; background: none; padding: 0; margin-bottom: 20px; }
.back-btn:hover { color: var(--primary); }

/* Expandable row */
.row-detail { background: var(--bg-color); border-top: 1px dashed var(--border-color); }
.row-detail td { padding: 14px 20px; font-size: 12px; color: var(--text-muted); }
.row-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.row-detail-item .label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.row-detail-item .value { font-size: 13px; color: var(--text-main); }


/* ============================================================
   FlowVerse Product-Wide Polish Pack — 2026-06-30
   ────────────────────────────────────────────────────────────
   This block is purely additive. It only:
     • declares the missing --warning token (referenced by
       .toast.toast-warn but never defined)
     • adds reusable status / empty-state / msg-banner / dense-
       table / mobile-stack utilities
     • declares the responsive layer (tablet 768px, phone 480px)
   No existing rule above this line is modified.
   ============================================================ */

:root {
  /* Missing token — .toast.toast-warn already references it. */
  --warning:        #F59E0B;
  --warning-light:  #FFFBEB;
  --info:           #2563EB;
  --info-light:     #EFF6FF;
  --success:        #16A34A;
  --success-light:  #DCFCE7;
}

/* ─── Reusable status badge (operator-dense) ───────────────────
   .flv-badge is distinct from sidebar .badge (notification dot)
   so it doesn't fight that selector. Use for table cells,
   integration status, plan/billing state, etc.
   Default is neutral; chain a modifier class for color.
*/
.flv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-full);
  background: #F1F5F9;
  color: #475569;
  white-space: nowrap;
}
.flv-badge.success { background: var(--success-light); color: var(--success); }
.flv-badge.warn    { background: var(--warning-light); color: #B45309;       }
.flv-badge.danger  { background: var(--danger-light);  color: var(--danger);  }
.flv-badge.info    { background: var(--info-light);    color: var(--info);    }
.flv-badge.neutral { background: #F1F5F9;              color: #475569;        }
.flv-badge i { font-size: 12px; }

/* ─── Empty state ─────────────────────────────────────────────
   Centered, dense, action-friendly. Use inside any table-wrapper
   or section-card body when there are no rows to show.
*/
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
  gap: 8px;
}
.empty-state i { font-size: 32px; color: #CBD5E1; }
.empty-state .title    { font-size: 14px; font-weight: 600; color: var(--text-main); }
.empty-state .subtitle { font-size: 13px; line-height: 1.45; max-width: 420px; }
.empty-state .actions  { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ─── Inline message banner (form-level result, soft) ─────────
   Replaces ad-hoc `<span style="color:#22C55E;">…</span>` markup.
*/
.msg-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
  border: 1px solid transparent;
}
.msg-banner.info    { background: var(--info-light);    color: var(--info);    border-color: #DBEAFE; }
.msg-banner.success { background: var(--success-light); color: var(--success); border-color: #BBF7D0; }
.msg-banner.warn    { background: var(--warning-light); color: #B45309;        border-color: #FDE68A; }
.msg-banner.error   { background: var(--danger-light);  color: var(--danger);  border-color: #FECACA; }
.msg-banner i { font-size: 14px; }

/* ─── Dense table modifier ────────────────────────────────────
   Use .table-dense on .data-table or .clients-table for ops
   screens that show many rows. Keeps existing tables at their
   current density unless this class is opted-in.
*/
.table-dense th,
.table-dense td { padding: 8px 12px; font-size: 13px; }

/* ─── Horizontal scroll wrapper ───────────────────────────────
   Wrap a table in <div class="scroll-x"> on narrow screens to
   prevent overflow blowing up the viewport.
*/
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Danger action (clearly destructive) ─────────────────────
   .btn-danger already exists but is a small variant. This is
   the full-size destructive button matching .btn metrics.
*/
.btn-danger-outline {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
  font-weight: 500;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-normal);
}
.btn-danger-outline:hover { background: #FEE2E2; border-color: #FCA5A5; }
.btn-danger-outline:active { transform: scale(0.98); }

/* ─── Admin-view banner ───────────────────────────────────────
   Clean non-intrusive banner when an operator is impersonating
   a client. Used by dashboard.html and admin-client.html.
*/
.admin-banner {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.admin-banner i { font-size: 16px; color: #B45309; }
.admin-banner .spacer { flex: 1; }
.admin-banner .exit-link { color: #92400E; text-decoration: underline; cursor: pointer; font-weight: 600; }

/* ─── Modal sizing safety ─────────────────────────────────────
   Generic clamp so no modal exceeds viewport. Existing modal
   .modal-content style remains; this is a max-width safety net.
*/
.modal,
.modal-overlay,
[role="dialog"] { max-width: 100vw; }
.modal-content,
.modal-body { max-width: min(960px, calc(100vw - 24px)); }

/* ─── Sidebar mobile-trigger button ───────────────────────────
   Hidden on desktop. Shown only at the tablet breakpoint when
   the sidebar collapses to a slide-over pattern.
*/
.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border-color);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-main);
}

/* ─── Hide/show utilities ─────────────────────────────────────
   Operator-friendly responsive helpers.
*/
.show-mobile  { display: none !important; }
.hide-mobile  { /* visible by default */ }


/* ============================================================
   RESPONSIVE LAYER
   ────────────────────────────────────────────────────────────
   Two breakpoints. Tablet (768px) collapses the sidebar/main
   grid and tightens padding. Phone (480px) tightens further
   and collapses any remaining multi-column grids.
   ============================================================ */

/* ─── ≤ 768px tablet ──────────────────────────────────────── */
@media (max-width: 768px) {
  body { padding: 16px; }

  /* App shell collapses to a single column. Sidebar becomes
     a slide-over panel triggered by .sidebar-toggle. */
  .app-container {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 100%;
    min-height: calc(100vh - 32px);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 84%;
    max-width: 320px;
    z-index: 1000;
    border-radius: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-toggle { display: inline-flex; }

  /* Topbar tightens; search shrinks; user-profile loses email
     to save space but keeps the avatar. */
  .top-nav {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
    border-radius: var(--radius-md);
  }
  .search-bar { width: 100%; max-width: 100%; }
  .search-dropdown { width: 100%; }
  .user-actions { gap: 12px; }
  .user-profile { padding-left: 12px; }
  .user-info { display: none; }

  /* KPI / widget grids collapse. */
  .kpi-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .widgets-grid { grid-template-columns: 1fr; }
  .col-span-2   { grid-column: span 1; }
  .stat-row     { flex-wrap: wrap; }

  .widget-card { padding: 20px; }
  .view-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .view-header h1 { font-size: 22px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* Tables: never burst the viewport. Wrap in .scroll-x or
     rely on this safety net. */
  .table-wrapper,
  .data-table,
  .clients-table { display: block; max-width: 100%; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table  { min-width: 640px; }
  .clients-table { min-width: 560px; }

  /* Login card tightens. */
  .login-screen { padding: 16px; margin: -16px; }
  .login-card   { padding: 28px 22px; border-radius: var(--radius-md); }

  /* Admin page generic padding. */
  .admin-page { padding: 16px; }

  /* Buttons keep tappable height. */
  .btn         { padding: 10px 16px; }
  .btn-outline-small,
  .staff-action-btn { min-height: 32px; }

  /* Tab list scrolls horizontally instead of wrapping/cramping. */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* ─── ≤ 480px phone ───────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 12px; }

  /* KPI to one column on tight phones. */
  .kpi-grid { grid-template-columns: 1fr; }

  /* Section card tighter. */
  .section-card { padding: 16px; border-radius: var(--radius-sm); }

  /* View header even smaller. */
  .view-header h1 { font-size: 20px; }
  .view-header p  { font-size: 13px; }

  /* Login card edge-to-edge. */
  .login-screen { padding: 8px; margin: -12px; }
  .login-card   { padding: 22px 16px; border-radius: var(--radius-sm); }

  /* Empty state slimmer. */
  .empty-state { padding: 24px 12px; }

  /* Toast container clings to bottom on phone — top-right is
     covered by sidebar-toggle + topbar at this width. */
  #toast-container { top: auto; bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; }

  /* Display helpers flip. */
  .show-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
}

/* ─── ≤ 1280px laptop (light tightening only) ─────────────── */
@media (max-width: 1280px) {
  .kpi-grid { gap: 16px; }
  .widget-card { padding: 24px; }
  .search-bar { width: 280px; }
  .app-container { gap: 24px; }
}
