/* =============================================
   FormFlow — Main Stylesheet
   ============================================= */

:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;
  --primary-bg: #eef2ff;
  --secondary: #0ea5e9;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --info: #6366f1;
  --info-bg: #e0e7ff;
  --purple: #8b5cf6;
  --purple-bg: #ede9fe;
  --orange: #f97316;
  --orange-bg: #ffedd5;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --sidebar-w: 260px;
  --sidebar-collapsed: 72px;
  --topbar-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --transition: all .2s ease;
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-size: 14px;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #1e1b4b;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .company-info,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span:not(.nav-badge),
.sidebar.collapsed .user-info,
.sidebar.collapsed .offline-indicator { display: none; }
.sidebar.collapsed .company-switcher { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px; }
.sidebar.collapsed .nav-badge { display: none; }
.sidebar.collapsed .user-card { justify-content: center; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; flex-shrink: 0;
}
.brand-name { display: block; color: white; font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-tag { display: block; color: rgba(255,255,255,.4); font-size: 10px; font-weight: 400; }

.sidebar-toggle {
  background: rgba(255,255,255,.08);
  border: none; color: rgba(255,255,255,.6);
  width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.15); color: white; }

.company-switcher {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer;
  transition: var(--transition);
}
.company-switcher:hover { background: rgba(255,255,255,.05); }
.company-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.company-info { flex: 1; min-width: 0; }
.company-name { display: block; color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-plan { display: block; color: rgba(255,255,255,.4); font-size: 10px; }
.company-switcher > .fa-chevron-down { color: rgba(255,255,255,.3); font-size: 11px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent; }
.nav-section-label {
  color: rgba(255,255,255,.25); font-size: 10px; font-weight: 600;
  letter-spacing: .08em; padding: 12px 8px 4px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 9px;
  color: rgba(255,255,255,.6); text-decoration: none;
  transition: var(--transition); margin-bottom: 2px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.nav-item.active { background: rgba(99,102,241,.25); color: #a5b4fc; }
.nav-item.active i { color: #818cf8; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-item span:first-of-type { flex: 1; }
.nav-badge {
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.7);
  font-size: 10px; font-weight: 600; padding: 2px 6px;
  border-radius: 10px; min-width: 20px; text-align: center;
}
.nav-badge.pending-badge { background: rgba(245,158,11,.2); color: #fbbf24; }
.nav-badge.alert-badge { background: rgba(239,68,68,.2); color: #f87171; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 9px;
  transition: var(--transition); cursor: pointer; margin-bottom: 8px;
}
.user-card:hover { background: rgba(255,255,255,.07); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-name { display: block; color: white; font-size: 12.5px; font-weight: 600; }
.user-role { display: block; color: rgba(255,255,255,.35); font-size: 10px; }
.user-info { flex: 1; min-width: 0; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.4); font-size: 14px;
  padding: 4px; border-radius: 6px; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.btn-icon:hover { color: rgba(255,255,255,.8); background: rgba(255,255,255,.08); }

.offline-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  color: rgba(255,255,255,.35); font-size: 11px; border-radius: 8px;
}
.offline-indicator.offline { color: #fbbf24; background: rgba(245,158,11,.1); }
.offline-indicator i { font-size: 10px; }

/* ─── MAIN WRAPPER ─── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; transition: var(--transition);
  min-width: 0;
}
.main-wrapper.expanded { margin-left: var(--sidebar-collapsed); }

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.mobile-menu-btn {
  display: none; background: none; border: none;
  font-size: 18px; cursor: pointer; color: var(--text-secondary);
  padding: 6px; border-radius: 8px;
}

.breadcrumb { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; }
.bc-home { color: var(--primary); }
.bc-sep { font-size: 10px; }
.bc-current { color: var(--text-primary); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 8px; }
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px var(--primary-bg); }
.search-bar i { color: var(--text-muted); font-size: 13px; }
.search-bar input { border: none; background: none; outline: none; font-size: 13px; color: var(--text-primary); width: 200px; font-family: inherit; }
.search-bar input::placeholder { color: var(--text-muted); }

.topbar-btn {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; width: 38px; height: 38px;
  color: var(--text-secondary); transition: var(--transition);
}
.topbar-btn:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.notif-dot { position: relative; }
.notif-dot::after {
  content: ''; position: absolute;
  top: -8px; right: -8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid white;
}

/* ─── PAGE CONTAINER ─── */
.page-container {
  flex: 1; padding: 24px;
  overflow-y: auto; animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── PAGE HEADER ─── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1.5px solid transparent; transition: var(--transition);
  text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface); color: var(--text-secondary); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); border-color: var(--border-strong); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

/* ─── STAT CARDS ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
  transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-card.primary::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.stat-card.success::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::before { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.info::before { background: linear-gradient(90deg, var(--secondary), #38bdf8); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), #a78bfa); }

.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-header { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.stat-icon.primary { background: var(--primary-bg); color: var(--primary); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.info { background: #e0f2fe; color: var(--secondary); }
.stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-change { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 20px; }
.stat-change.up { background: var(--success-bg); color: var(--success); }
.stat-change.down { background: var(--danger-bg); color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }

/* ─── CARDS ─── */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
}
.card-header {
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.card-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ─── TABLES ─── */
.table-wrapper { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table th {
  padding: 11px 16px; background: var(--surface-2);
  text-align: left; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.data-table td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; color: var(--text-secondary); vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table td strong { color: var(--text-primary); }

/* ─── BADGES / CHIPS ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: #e0f2fe; color: var(--secondary); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-gray { background: var(--surface-2); color: var(--text-muted); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary); background: var(--surface);
  outline: none; transition: var(--transition); font-family: inherit;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ─── FILTER BAR ─── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-bar .search-input {
  flex: 1; min-width: 200px;
  padding: 9px 14px 9px 36px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; outline: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z' stroke='%2394a3b8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") 10px center / 16px no-repeat;
  transition: var(--transition);
}
.filter-bar .search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.filter-bar select {
  padding: 9px 13px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; background: var(--surface);
  outline: none; cursor: pointer; font-family: inherit; color: var(--text-secondary);
  transition: var(--transition);
}
.filter-bar select:focus { border-color: var(--primary); }

/* ─── TABS ─── */
.tab-bar {
  display: flex; gap: 2px;
  border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 18px; background: none; border: none;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: var(--transition); border-radius: 4px 4px 0 0;
  display: flex; align-items: center; gap: 6px; font-family: inherit;
}
.tab-btn:hover { color: var(--text-primary); background: var(--surface-2); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn .2s ease; }

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 2000; backdrop-filter: blur(3px);
}
.modal-container {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 2001; max-height: 90vh; overflow-y: auto;
  width: 90%; max-width: 640px; border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
.modal-container.modal-lg { max-width: 900px; }
.modal-container.modal-xl { max-width: 1100px; }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.hidden { display: none !important; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: var(--surface-2); border: 1px solid var(--border);
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ─── TOAST ─── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px; z-index: 9999;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary); min-width: 300px;
  animation: slideIn .3s ease; font-size: 13.5px;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast-icon { font-size: 16px; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-msg { flex: 1; color: var(--text-primary); font-weight: 500; }
.toast-dismiss { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ─── PROGRESS BAR ─── */
.progress-bar {
  height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width .5s ease;
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #34d399); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #f87171); }

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state-title { font-size: 16px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-desc { font-size: 13px; margin-bottom: 20px; }

/* ─── AVATAR ─── */
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
}
.avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }

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

/* ─── TOGGLE / SWITCH ─── */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border-strong); border-radius: 24px;
  transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: white; border-radius: 50%; transition: var(--transition);
  box-shadow: var(--shadow);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── DRAG & DROP ─── */
.drag-handle {
  cursor: grab; color: var(--text-muted);
  padding: 4px; border-radius: 4px;
}
.drag-handle:hover { background: var(--surface-2); color: var(--text-secondary); }
.drag-handle:active { cursor: grabbing; }
.dragging { opacity: .45; border: 2px dashed var(--primary) !important; box-shadow: none !important; }
.drag-over { border: 2px solid var(--primary) !important; background: var(--primary-bg) !important; transform: scale(1.01); }

/* Drop zone — highlight driven by JS inline styles (see builder.js highlightDropZone) */

/* ─── CONTEXT SWITCHER ─── */
.context-switcher { border-bottom: 1px solid rgba(255,255,255,.08); }
.ctx-switcher {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer; transition: var(--transition);
}
.ctx-switcher:hover { background: rgba(255,255,255,.05); }
.ctx-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
}
.ctx-info { flex: 1; min-width: 0; }
.ctx-name { display: block; color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-sub  { display: block; color: rgba(255,255,255,.4); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-caret { color: rgba(255,255,255,.3); font-size: 10px; flex-shrink: 0; }

/* ─── LOCATION SWITCHER MODAL ITEMS ─── */
.loc-switch-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); margin-bottom: 6px;
  border: 1.5px solid var(--border);
}
.loc-switch-item:hover { background: var(--primary-bg); border-color: var(--primary); }
.loc-switch-item.active { background: var(--primary-bg); border-color: var(--primary); }
.loc-switch-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700;
}
.loc-switch-info { flex: 1; min-width: 0; }
.loc-switch-info strong { display: block; font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.loc-switch-info span   { display: block; font-size: 12px; color: var(--text-muted); }

/* ─── SCOPE PILL (topbar) ─── */
.scope-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.scope-pill-hq       { background: var(--primary-bg); color: var(--primary); }
.scope-pill-location { background: var(--success-bg); color: var(--success); }
.scope-pill-super    { background: var(--danger-bg);  color: var(--danger); }

/* ─── BREADCRUMB SCOPE ─── */
.bc-scope { color: var(--text-muted); font-size: 13px; }
.bc-scope-sep { font-size: 10px; color: var(--text-muted); }

/* ─── LOCATION CARDS ─── */
.location-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: var(--transition);
}
.location-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.location-card-header {
  padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.location-badge {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: white;
}

/* ─── SUPER ADMIN PANEL ─── */
.sa-company-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; transition: var(--transition);
}
.sa-company-card:hover { box-shadow: var(--shadow-md); }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── LOADING SPINNER ─── */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 300px; gap: 12px; color: var(--text-muted);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex !important; }
  .topbar { padding: 0 16px; }
  .search-bar { display: none; }
  .page-container { padding: 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal-container { width: 96%; }
}
