:root {
  --primary:       #6C3FC5;
  --primary-dark:  #5530A8;
  --primary-muted: #6C3FC520;
  --accent:        #00C896;
  --accent-muted:  #00C89615;
  --danger:        #F44336;
  --warning:       #FF9800;
  --success:       #4CAF50;
  --info:          #2196F3;
  --bg:            #F4F6FB;
  --surface:       #FFFFFF;
  --border:        #E8ECF4;
  --text:          #1A1D2E;
  --text-muted:    #8892A4;
  --sidebar-w:     72px;
  --topbar-h:      64px;
  --radius:        12px;
  --shadow:        0 2px 12px rgba(0,0,0,.07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Shell ─────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

/* ── Sidebar (icon-only on desktop) ─────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #0D0D1A;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  gap: 4px;
}
.sidebar-logo {
  width: 56px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.sidebar-logo img { max-width: 56px; max-height: 36px; width: auto; height: auto; object-fit: contain; display: block; }
.nav-item {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #6B7280;
  font-size: 18px;
  position: relative;
  transition: all .15s;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .tooltip {
  position: absolute;
  left: calc(100% + 12px);
  background: #1a1d2e;
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.nav-item:hover .tooltip { opacity: 1; }
.nav-divider { width: 32px; height: 1px; background: rgba(255,255,255,.08); margin: 8px 0; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.avatar-sm {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color .15s;
}
.avatar-sm:hover { border-color: var(--primary); }
.avatar-sm .avatar-photo { width:100%;height:100%;border-radius:50%;object-fit:cover;display:block; }
.nav-logout {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: #6B7280; font-size: 16px;
  border-radius: 8px;
  transition: all .15s;
}
.nav-logout:hover { color: var(--danger); background: rgba(244,67,54,.1); }

/* ── Main ────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar-user .name { font-weight: 600; }
.topbar-user .role { color: var(--text-muted); font-size: 12px; }

/* ── Page content ────────────────────────────── */
.page { padding: 28px; flex: 1; }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 800; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 2px; }

/* ── Stat Cards ──────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.stat-sub.up { color: var(--success); }
.stat-sub.down { color: var(--danger); }

/* ── Cards ───────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body { padding: 20px; }

/* ── Table ───────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ── Pipeline cards ──────────────────────────── */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}
.lead-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.lead-card-title { font-weight: 700; font-size: 15px; }
.lead-card-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.lead-card-meta i { margin-right: 4px; }

/* ── Badges ──────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-success { background: #4CAF5020; color: #4CAF50; }
.badge-warning { background: #FF980020; color: #FF9800; }
.badge-danger  { background: #F4433620; color: #F44336; }
.badge-info    { background: #2196F320; color: #2196F3; }

/* ── Buttons ─────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; font-weight: 600; font-size: 14px; border: none; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.1); }
.btn-ghost   { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-icon { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); transition: all .15s; }
.btn-icon:hover { background: var(--bg); color: var(--primary); }

/* ── Forms ───────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #6c6d6e;
  border-radius: 8px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
.input-eye-wrap { position: relative; }
.input-eye-wrap .form-control { padding-right: 42px; }
.input-eye-btn {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 40px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  transition: color .15s;
}
.input-eye-btn:hover { color: var(--primary); }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 18px; padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; 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 {
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(120%); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── Leaderboard ─────────────────────────────── */
.leaderboard-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.rank { font-size: 18px; font-weight: 900; color: var(--text-muted); width: 28px; text-align: center; }
.rank.gold   { color: #F9A825; }
.rank.silver { color: #9E9E9E; }
.rank.bronze { color: #A1590F; }
.lb-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lb-name { font-weight: 600; font-size: 14px; }
.lb-dept { font-size: 12px; color: var(--text-muted); }
.lb-count { margin-left: auto; font-size: 22px; font-weight: 800; color: var(--accent); }
.lb-label { font-size: 11px; color: var(--text-muted); text-align: right; }

/* ── Progress bar ────────────────────────────── */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width .4s; }
.progress-fill.accent { background: var(--accent); }

/* ── Announcement banner ─────────────────────── */
.ann-banner {
  padding: 14px 18px;
  border-radius: 10px;
  border-left: 4px solid;
  margin-bottom: 12px;
  font-size: 14px;
}
.ann-banner.info     { background: #E3F2FD; border-color: var(--info); }
.ann-banner.warning  { background: #FFF8E1; border-color: var(--warning); }
.ann-banner.success  { background: #E8F5E9; border-color: var(--success); }
.ann-banner.critical { background: #FEECEC; border-color: var(--danger); }
.ann-title { font-weight: 700; margin-bottom: 2px; }

/* ── Status selector ─────────────────────────── */
.status-select {
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
}

/* ── Empty state ─────────────────────────────── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; display: block; opacity: .3; }
.empty-state h4 { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

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

/* ── Auth layout ─────────────────────────────── */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 25% 20%, #6C3FC528 0%, transparent 55%),
    radial-gradient(ellipse at 75% 80%, #00C89612 0%, transparent 55%),
    linear-gradient(135deg, #0D0D1A 0%, #1a1040 100%);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card { background: #fff; border-radius: 20px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 28px; }
.auth-brand-logo { max-height: 52px; width: auto; max-width: 200px; object-fit: contain; display: block; }
.auth-logo-tag { font-size: 11px; font-weight: 700; letter-spacing: 2.5px; color: var(--text-muted); text-transform: uppercase; padding-left: 2px; }
.auth-logo-text .sub { font-size: 12px; color: var(--text-muted); }
.auth-title { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.auth-error { background: #FEECEC; border: 1px solid #F4433640; color: var(--danger); padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── Filter tabs ─────────────────────────────── */
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-tab { padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-muted); transition: all .15s; }
.filter-tab:hover { border-color: var(--primary); color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-tab .cnt { font-size: 11px; opacity: .8; margin-left: 4px; }

/* ── Avatar upload ───────────────────────────── */
.avatar-upload {
  position: relative; display: inline-block; cursor: pointer;
  width: 80px; height: 80px; border-radius: 50%;
  border: 4px solid #fff; box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-initials {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 900;
}
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.55);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; opacity: 0; transition: opacity .2s;
}
.avatar-upload:hover .avatar-overlay { opacity: 1; }

/* ── Profile detail rows ─────────────────────── */
.profile-detail-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text);
}
.profile-detail-label {
  color: var(--text-muted); min-width: 118px; font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}

/* ── Pipeline mode switcher ──────────────────── */
.pipeline-switcher {
  display: flex; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px;
  align-self: flex-start; margin-bottom: 20px;
  width: fit-content;
}
.pipeline-mode-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 20px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  transition: all .15s; text-decoration: none; white-space: nowrap;
}
.pipeline-mode-btn:hover { color: var(--text); background: var(--bg); }
.pipeline-mode-btn.active { background: var(--primary); color: #fff; }
.mode-count {
  background: rgba(255,255,255,.25); color: inherit;
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 20px; margin-left: 2px;
}
.pipeline-mode-btn:not(.active) .mode-count { background: var(--primary-muted); color: var(--primary); }

/* ── Dashboard tab button active state ───────── */
.pipeline-dash-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Notification bell ───────────────────────── */
.notif-wrap {
  position: relative;
}
.notif-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 17px;
  transition: all .15s;
}
.notif-btn:hover { background: var(--bg); color: var(--text); }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: 8px;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  line-height: 1;
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.16);
  z-index: 300;
  overflow: hidden;
  display: none;
}
.notif-panel.open { display: block; }
.notif-panel-hd {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.notif-panel-hd-title { font-size: 14px; font-weight: 700; }
.notif-mark-all {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--primary); font-weight: 600;
  padding: 0;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid transparent;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-item.unread { border-left-color: var(--primary); background: var(--primary-muted); }
.notif-item.unread:hover { background: #6C3FC514; }
.notif-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.notif-icon.info    { background: #2196F318; color: #2196F3; }
.notif-icon.warning { background: #FF980018; color: #FF9800; }
.notif-icon.success { background: #00C89618; color: #00C896; }
.notif-icon.alert   { background: #F4433618; color: #F44336; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.notif-item.unread .notif-item-title { color: var(--primary); }
.notif-item-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { font-size: 11px; color: var(--text-muted); }
.notif-empty {
  padding: 36px 18px; text-align: center; color: var(--text-muted); font-size: 13px;
}
.notif-empty i { font-size: 28px; display: block; opacity: .25; margin-bottom: 8px; }
.notif-footer {
  padding: 10px 18px; border-top: 1px solid var(--border);
  text-align: center; font-size: 12px; color: var(--primary); font-weight: 600;
}
.notif-footer a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .notif-panel { width: calc(100vw - 28px); right: -14px; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

/* ── Tablet (601 – 900px) ────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .grid-2     { grid-template-columns: 1fr; }
  .grid-3     { grid-template-columns: repeat(2,1fr); }
  .page       { padding: 20px; }
}

/* ── Mobile (<= 640px) ───────────────────────────────── */
@media (max-width: 640px) {

  /* ── Sidebar → fixed bottom navigation bar ── */
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 100%;
    height: 58px;
    flex-direction: row;
    top: auto; bottom: 0; left: 0; right: 0;
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 0 4px;
    justify-content: space-around;
    align-items: center;
    gap: 0;
    z-index: 200;
  }
  .sidebar-logo { display: none; }
  .nav-item {
    flex: 1;
    width: auto;
    height: 44px;
    border-radius: 8px;
    font-size: 17px;
    max-width: 56px;
  }
  .nav-item .tooltip { display: none; }
  .nav-divider { display: none; }
  .sidebar-bottom {
    flex-direction: row;
    margin-top: 0;
    gap: 0;
    flex: 0 0 auto;
  }
  .avatar-sm { width: 28px; height: 28px; font-size: 11px; border: none; }
  .nav-logout { width: 40px; height: 44px; border-radius: 8px; }

  /* ── Main — remove left offset, clear bottom nav ── */
  .main { margin-left: 0; }
  .page { padding: 14px 14px 82px; }

  /* ── Topbar ── */
  .topbar { padding: 0 14px; height: 54px; gap: 10px; }
  .topbar-title { font-size: 15px; }
  .topbar-user .name,
  .topbar-user .role { display: none; }
  .topbar-user { gap: 0; }

  /* ── Page header ── */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }
  .page-header h1 { font-size: 20px; }
  .page-header > .btn,
  .page-header > button { width: 100%; justify-content: center; }

  /* ── Stats ── */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
  .stat-card  { padding: 14px 12px; gap: 10px; }
  .stat-icon  { width: 40px; height: 40px; font-size: 16px; flex-shrink: 0; }
  .stat-value { font-size: 20px; }
  .stat-label,
  .stat-sub   { font-size: 11px; }

  /* ── Cards ── */
  .card { overflow: visible; } /* lets inner overflow-x:auto scroll on iOS */
  .card-header { padding: 12px 16px; }
  .card-body   { padding: 14px; }

  /* ── Layout grids ── */
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .grid-3 { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* ── Inline 2-col form grids → single column ── */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* ── Buttons ── */
  .btn    { font-size: 13px; }
  .btn-sm { font-size: 12px; padding: 6px 12px; }

  /* ── Modals → slide-up bottom sheet ── */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    max-width: 100%;
  }
  .modal-header { padding: 16px 20px 14px; }
  .modal-body   { padding: 16px 20px; }
  .modal-footer { padding: 12px 20px; flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1; justify-content: center; min-width: 100px; }

  /* ── Toast — sits above bottom nav ── */
  .toast-container { bottom: 68px; left: 12px; right: 12px; }
  .toast { width: 100%; }

  /* ── Filter tabs ── */
  .filter-tabs { gap: 6px; }
  .filter-tab  { font-size: 12px; padding: 6px 10px; }

  /* ── Pipeline mode switcher ── */
  .pipeline-switcher { width: 100%; }
  .pipeline-mode-btn { flex: 1; justify-content: center; padding: 8px 6px; font-size: 12px; gap: 5px; }
  .mode-count { display: none; }

  /* ── Empty state ── */
  .empty-state   { padding: 40px 16px; }
  .empty-state i { font-size: 36px; }

  /* ── Profile detail rows ── */
  .profile-detail-row   { flex-direction: column; align-items: flex-start; gap: 2px; }
  .profile-detail-label { min-width: unset; }

  /* ── Data tables ── */
  .data-table th { padding: 10px; font-size: 11px; }
  .data-table td { padding: 11px 10px; font-size: 13px; }

  /* ── Agent onboarding — hide step text labels on mobile ── */
  .ob-step-label { display: none; }

  /* ── Leaderboard ── */
  .lb-count { font-size: 18px; }
}

/* ── Very small (<= 380px) ──────────────────────────── */
@media (max-width: 380px) {
  .stats-grid { gap: 8px; }
  .stat-card  { padding: 10px 8px; gap: 8px; }
  .stat-value { font-size: 17px; }
  .stat-icon  { width: 34px; height: 34px; font-size: 14px; }
  .grid-3     { grid-template-columns: 1fr; }
  .nav-item   { max-width: 46px; font-size: 15px; }
}

/* ── Auth pages ──────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-body  { padding: 20px 16px; padding-top: 48px; align-items: flex-start; min-height: 100dvh; }
  .auth-card  { padding: 28px 22px; border-radius: 16px; max-width: 100%; }
  .auth-title { font-size: 22px; }
  .auth-sub   { font-size: 13px; margin-bottom: 20px; }
}
@media (max-width: 360px) {
  .auth-body { padding: 0; align-items: stretch; }
  .auth-card {
    padding: 32px 20px;
    border-radius: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}
