/* ─── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── CSS Variables / Design Tokens ────────────────────────────────────────── */
:root {
  --blue-900:   #0d1b2a;
  --blue-800:   #1a2e44;
  --blue-700:   #1e3a5f;
  --blue-600:   #1d4ed8;
  --blue-500:   #2563eb;
  --blue-400:   #3b82f6;
  --blue-300:   #60a5fa;
  --blue-100:   #dbeafe;
  --blue-50:    #eff6ff;

  --gold-500:   #f59e0b;
  --gold-400:   #fbbf24;
  --gold-300:   #fcd34d;
  --gold-100:   #fef3c7;

  --green-600:  #16a34a;
  --green-500:  #22c55e;
  --green-100:  #dcfce7;

  --orange-500: #f97316;
  --orange-100: #ffedd5;

  --red-500:    #ef4444;
  --red-100:    #fee2e2;

  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-100: #ede9fe;

  --pink-500:   #ec4899;
  --pink-100:   #fce7f3;

  --slate-900:  #0f172a;
  --slate-800:  #1e293b;
  --slate-700:  #334155;
  --slate-600:  #475569;
  --slate-500:  #64748b;
  --slate-400:  #94a3b8;
  --slate-300:  #cbd5e1;
  --slate-200:  #e2e8f0;
  --slate-100:  #f1f5f9;
  --slate-50:   #f8fafc;
  --white:      #ffffff;

  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-full:9999px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.18);

  --sidebar-w:  218px;
  --topbar-h:   64px;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow: hidden;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
img { display: block; max-width: 100%; }

/* ─── Layout Shell ──────────────────────────────────────────────────────────── */
#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.3);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.topbar-logo {
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  flex-shrink: 0;
  padding: 3px 8px;
}

.topbar-title { color: var(--white); }
.topbar-title h1 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.topbar-title span { font-size: 11px; color: rgba(255,255,255,.6); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.1);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,.2); }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red-500);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  padding: 1px 4px;
  min-width: 16px;
  text-align: center;
  line-height: 14px;
}

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

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--blue-800);
  height: calc(100vh - var(--topbar-h));
  margin-top: var(--topbar-h);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  transition: transform .3s ease;
}

.sidebar-nav {
  padding: 8px 8px 10px;
  flex: 1;
}

.sidebar-menu-caption {
  padding: 7px 8px 6px;
  color: rgba(255,255,255,.36);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-group {
  margin: 2px 0;
  border-radius: 8px;
  overflow: hidden;
}

.nav-group-toggle {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.72);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}

.nav-group-toggle:hover,
.nav-group[data-collapsed="false"] > .nav-group-toggle {
  background: rgba(255,255,255,.065);
  color: var(--white);
}

.nav-group-icon {
  width: 18px;
  flex: 0 0 18px;
  color: #93c5fd;
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.nav-group-label {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-group-chevron {
  color: rgba(255,255,255,.38);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform .18s ease;
}

.nav-group[data-collapsed="false"] .nav-group-chevron {
  transform: rotate(90deg);
}

.nav-group[data-collapsed="true"] .nav-group-items {
  display: none;
}

.nav-group-items {
  padding: 2px 0 4px 19px;
}

.nav-group-super > .nav-group-toggle .nav-group-icon,
.nav-group-super > .nav-group-toggle .nav-group-label {
  color: var(--gold-400);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 8px 6px 10px;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-left: 2px solid rgba(255,255,255,.09);
  border-radius: 0 6px 6px 0;
  transition: all .15s;
  user-select: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--white); }
.nav-item.active {
  background: rgba(37,99,235,.25);
  color: var(--white);
  border-left-color: var(--blue-400);
  font-weight: 600;
}
.nav-item .nav-icon { font-size: 13px; width: 16px; text-align: center; color: rgba(255,255,255,.55); }
.nav-item .nav-label { flex: 1; }

.sidebar-footer {
  padding: 9px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.employee-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
}
.employee-card .emp-info { flex: 1; min-width: 0; }
.employee-card .emp-name { color: white; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.employee-card .emp-role { color: rgba(255,255,255,.5); font-size: 10.5px; }

/* ─── Main Content Area ─────────────────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - var(--topbar-h));
  min-width: 0;
}

.page { display: none; }
.page.active { display: block; }

/* ─── Avatar ────────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 13px;
}
.avatar-sm  { width: 32px; height: 32px; font-size: 11px; }
.avatar-md  { width: 40px; height: 40px; font-size: 13px; }
.avatar-lg  { width: 52px; height: 52px; font-size: 16px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 24px; }

/* ─── Gradient Header ───────────────────────────────────────────────────────── */
.gradient-header {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-500));
  padding: 24px 24px 20px;
  color: white;
}
.gradient-header h2 { font-size: 22px; font-weight: 700; }
.gradient-header p  { font-size: 12px; color: rgba(255,255,255,.7); margin-top: 2px; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.card-body { padding: 16px; }

/* ─── Lead Card ──────────────────────────────────────────────────────────────── */
.lead-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 16px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  position: relative;
  overflow: hidden;
}
.lead-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--priority-color, var(--blue-400));
}
.lead-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.lead-card[data-priority="HIGH"]   { --priority-color: var(--red-500); }
.lead-card[data-priority="MEDIUM"] { --priority-color: var(--gold-400); }
.lead-card[data-priority="LOW"]    { --priority-color: var(--green-500); }

.lead-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lead-card-info   { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lead-card-name   { font-weight: 600; font-size: 14px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-card-phone  { font-size: 12px; color: var(--text-muted); }
.lead-card-meta   { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.lead-card-brand  { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.lead-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; flex-wrap: wrap; gap: 6px; }
.lead-card-chips  { display: flex; gap: 4px; }
.followup-row     { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.followup-row span { font-size: 11px; color: var(--orange-500); }

/* ─── Lead Pipeline Board ───────────────────────────────────────────────────── */
.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px 0;
}
.pipeline-view-toggle {
  display: inline-flex;
  background: var(--slate-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
}
.pipeline-view-toggle button {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
}
.pipeline-view-toggle button.active {
  background: var(--surface);
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}
.pipeline-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 16px 0;
}
.pipeline-summary-grid div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.pipeline-summary-grid strong {
  display: block;
  font-size: 18px;
  line-height: 1;
  color: var(--blue-700);
}
.pipeline-summary-grid span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .02em;
}
.pipeline-board {
  padding: 16px;
  overflow-x: auto;
}
.pipeline-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 320px);
  gap: 12px;
  align-items: start;
  padding-bottom: 8px;
}
.pipeline-column {
  background: rgba(255,255,255,.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-height: 180px;
}
.pipeline-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  background: linear-gradient(135deg, var(--surface), var(--slate-50));
  border-top: 3px solid var(--stage-color);
  border-bottom: 1px solid var(--border);
}
.pipeline-stage-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
}
.pipeline-stage-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.pipeline-stage-count {
  min-width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--stage-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}
.pipeline-column-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}
.pipeline-lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.pipeline-lead-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--priority-color, var(--blue-400));
}
.pipeline-lead-card[data-priority="HIGH"] { --priority-color: var(--red-500); }
.pipeline-lead-card[data-priority="MEDIUM"] { --priority-color: var(--gold-400); }
.pipeline-lead-card[data-priority="LOW"] { --priority-color: var(--green-500); }
.pipeline-lead-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.pipeline-lead-name {
  font-size: 13px;
  font-weight: 850;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}
.pipeline-lead-phone,
.pipeline-lead-product,
.pipeline-lead-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}
.pipeline-lead-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pipeline-lead-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.chip-danger {
  background: var(--red-100) !important;
  color: var(--red-500) !important;
}
.pipeline-lead-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.pipeline-lead-actions .btn {
  padding: 7px 8px;
  font-size: 11px;
  justify-content: center;
}
.pipeline-empty {
  min-height: 92px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
}

/* ─── Status Badge ───────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Priority Indicator ─────────────────────────────────────────────────────── */
.priority-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.priority-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
}

/* ─── Mini Chip ──────────────────────────────────────────────────────────────── */
.chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.chip-exchange { background: var(--orange-100); color: #c2410c; }
.chip-finance  { background: var(--green-100);  color: var(--green-600); }

/* ─── Stat Card ───────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.stat-card-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
}
.stat-card-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── KPI Grid ────────────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  gap: 12px;
}
.kpi-grid-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ─── Section Header ──────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.section-header .see-all {
  font-size: 12px;
  color: var(--blue-500);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.section-header .see-all:hover { text-decoration: underline; }

/* ─── Form Elements ───────────────────────────────────────────────────────────── */
.form-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}

.form-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--slate-50);
}
.form-section-header .section-icon { font-size: 16px; }
.form-section-header span { font-size: 13px; font-weight: 700; color: var(--blue-500); }

.form-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control.error { border-color: var(--red-500); }
.form-control::placeholder { color: var(--slate-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.field-error { font-size: 11px; color: var(--red-500); font-weight: 500; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.toggle-row .toggle-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }

.toggle {
  position: relative;
  width: 42px; height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--slate-300);
  border-radius: 24px;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--blue-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  border: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--blue-500); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--blue-600); }

.btn-success { background: var(--green-500); color: white; }
.btn-success:hover:not(:disabled) { background: var(--green-600); }

.btn-danger { background: var(--red-500); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { background: var(--slate-50); border-color: var(--slate-300); }

.btn-ghost { background: transparent; color: var(--blue-500); padding: 8px 12px; }
.btn-ghost:hover { background: var(--blue-50); }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.btn-full { width: 100%; }
.btn-lg { padding: 13px 24px; font-size: 15px; }

/* ─── FAB ─────────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--blue-500);
  color: white;
  border-radius: 28px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  border: none;
  transition: all .15s;
  z-index: 50;
}
.fab:hover { background: var(--blue-600); transform: translateY(-2px); box-shadow: var(--shadow-xl); }

/* ─── Search Box ──────────────────────────────────────────────────────────────── */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 14px;
  margin: 16px;
  transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.search-box .search-icon { color: var(--text-muted); font-size: 16px; flex-shrink: 0; }
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: 13.5px;
  background: transparent;
  color: var(--text);
}
.search-box input::placeholder { color: var(--slate-400); }
.search-clear { background: none; border: none; cursor: pointer; color: var(--slate-400); font-size: 16px; padding: 4px; }
.search-clear:hover { color: var(--text); }

/* ─── Filter Chips ────────────────────────────────────────────────────────────── */
.filter-chips {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  flex-shrink: 0;
}
.filter-chip:hover { border-color: var(--blue-400); color: var(--blue-500); }
.filter-chip.active {
  background: var(--blue-100);
  border-color: var(--blue-400);
  color: var(--blue-600);
  font-weight: 600;
}

/* ─── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 52px; margin-bottom: 16px; opacity: .5; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ─── Progress / Funnel Bar ───────────────────────────────────────────────────── */
.progress-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}
.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 500;
}
.progress-track {
  height: 8px;
  background: var(--slate-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width .4s ease;
}

.funnel-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.funnel-bar-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; }
.funnel-track {
  height: 28px;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
.funnel-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-700), var(--blue-400));
  border-radius: var(--radius-sm);
  transition: width .6s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
}
.funnel-fill span { color: white; font-size: 11px; font-weight: 700; }

/* ─── Screenshot-style Chart Dashboard ─────────────────────────────────────── */
.chart-dashboard-wrap {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}
.chart-panel {
  background: var(--surface);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(15,23,42,.08);
  overflow: hidden;
}
.chart-panel-title {
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 13px;
  font-weight: 900;
  color: #111827;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.chart-panel-funnel { padding-bottom: 10px; }
.funnel-dashboard {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 28px;
  align-items: center;
  padding: 22px 22px 18px;
  min-height: 250px;
}
.funnel-metrics {
  display: grid;
  gap: 10px;
}
.funnel-metric-box {
  border: 2px solid #e5e7eb;
  background: #fff;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(15,23,42,.07);
  cursor: pointer;
  border-left-width: 5px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.funnel-metric-box:hover,
.funnel-metric-box:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(15,23,42,.12);
}
.funnel-metric-box.metric-all { border-left-color: #2563eb; background: #eff6ff; }
.funnel-metric-box.metric-progress { border-left-color: #7c3aed; background: #f5f3ff; }
.funnel-metric-box.metric-closed { border-left-color: #16a34a; background: #f0fdf4; }
.funnel-metric-box span {
  font-size: 13px;
  color: #9ca3af;
  font-weight: 800;
  text-transform: uppercase;
}
.funnel-metric-box strong {
  font-size: 16px;
  color: #111827;
  margin-top: 3px;
}
.funnel-visual-wrap {
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.funnel-layer {
  height: 58px;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 18% 100%);
  max-width: 420px;
  min-width: 160px;
  cursor: pointer;
  transition: filter .16s ease, transform .16s ease;
}
.funnel-layer:hover { filter: brightness(1.08); transform: scale(1.015); }
.funnel-layer-new { background: #18aeea; }
.funnel-layer-progress { background: #5a50c8; margin-top: -1px; }
.funnel-layer-closed {
  background: #0bdc73;
  width: 36% !important;
  clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%);
}
.funnel-label {
  position: absolute;
  left: 73%;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 12px;
  color: #111827;
  font-weight: 900;
  cursor: pointer;
}
.funnel-label i {
  display: inline-block;
  width: 78px;
  height: 3px;
  border-radius: 999px;
}
.funnel-label-new { top: 38px; }
.funnel-label-progress { top: 97px; }
.funnel-label-closed { top: 156px; }
.funnel-label-new i { background: #7dd3fc; }
.funnel-label-progress i { background: #8b82e8; }
.funnel-label-closed i { background: #86efac; }
.stage-tag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px 42px;
  padding: 28px 42px 34px;
}
.stage-tag-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.stage-tag-chart.chart-clickable {
  cursor: pointer;
  border-radius: 14px;
  padding: 10px;
  transition: background .16s ease, transform .16s ease;
}
.stage-tag-chart.chart-clickable:hover,
.stage-tag-chart.chart-clickable:focus-visible {
  background: #f8fafc;
  transform: translateY(-2px);
}
.tag-donut,
.tag-pie {
  width: 172px;
  height: 172px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.06);
}
.tag-donut {
  position: relative;
}
.tag-donut span {
  position: absolute;
  inset: 38px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(15,23,42,.04);
}
.stage-tag-title {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 900;
  color: #111827;
  text-align: center;
}
.tag-legend-box {
  width: min(260px, 100%);
  max-height: 136px;
  overflow-y: auto;
  background: #f3f4f6;
  padding: 8px 10px;
  border-radius: 4px;
}
.tag-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  line-height: 1.8;
}
.tag-legend-row i {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 auto;
}

/* ─── Timeline ────────────────────────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 16px; }
.timeline-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.timeline-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--blue-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.timeline-content { flex: 1; }
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.timeline-type { font-size: 13px; font-weight: 600; }
.timeline-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.timeline-note { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Detail Sections ─────────────────────────────────────────────────────────── */
.detail-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}
.detail-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--blue-500);
  padding: 12px 16px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-section-body { padding: 10px 16px 14px; }

.detail-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
}
.detail-row-icon { font-size: 14px; color: var(--text-muted); width: 18px; text-align: center; margin-top: 1px; flex-shrink: 0; }
.detail-row-label { font-size: 12px; color: var(--text-muted); width: 100px; flex-shrink: 0; }
.detail-row-value { font-size: 12.5px; font-weight: 500; color: var(--text); flex: 1; }

/* ─── My Report ─────────────────────────────────────────────────────────────── */
.report-header { background: linear-gradient(135deg, var(--blue-800), #4c1d95); }
.my-report-page { padding-bottom: 96px; }
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 22px; }
.report-date-control { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; box-shadow: var(--shadow-sm); font-size: 16px; }
.report-date-control input { border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 700; }
.report-section-title { margin: 20px 0 12px; font-size: 17px; font-weight: 800; color: var(--text); }
.report-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-metric { min-height: 132px; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.report-metric strong { font-size: 25px; line-height: 1.1; color: var(--text); }
.report-metric span { max-width: 150px; font-size: 13px; font-weight: 650; line-height: 1.25; color: var(--text); }
.report-metric-grid-compact .report-metric { min-height: 105px; }
.report-call-list { margin-top: 22px; }
.report-call-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; cursor: pointer; }
.report-call-row:last-child { border-bottom: 0; }
.report-call-contact, .report-call-outcome { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.report-call-contact strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-size: 13px; }
.report-call-contact small, .report-call-outcome small { color: var(--text-muted); font-size: 11px; }
.report-call-outcome { align-items: flex-end; flex-shrink: 0; }
.report-call-outcome b { font-size: 11px; }
.report-empty { padding: 22px 10px; }

/* ─── Action Buttons Bar ──────────────────────────────────────────────────────── */
.action-btn-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 60px;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1.5px solid;
  cursor: pointer;
  background: transparent;
  transition: all .15s;
  font-size: 10px;
  font-weight: 600;
}
.tag-legend-row[onclick] {
  cursor: pointer;
  border-radius: 5px;
  padding: 3px 4px;
}
.tag-legend-row[onclick]:hover { background: #e2e8f0; }
.dashboard-filter-banner {
  margin: 0 16px 12px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}
.dashboard-filter-banner button {
  border: 0;
  background: #2563eb;
  color: white;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.integration-link-card {
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.integration-link-card:hover,
.integration-link-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(15,23,42,.14);
  filter: saturate(1.06);
  outline: 2px solid rgba(37,99,235,.35);
  outline-offset: 2px;
}
.action-btn:hover { transform: translateY(-1px); }
.action-btn .action-icon { font-size: 18px; }

/* ─── Hero Banner ─────────────────────────────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  padding: 20px;
  color: white;
}

/* ─── Quick Stat Chips (Dashboard) ───────────────────────────────────────────── */
.quick-stat-chips { display: flex; gap: 10px; margin-top: 16px; }
.stat-chip {
  flex: 1;
  background: rgba(255,255,255,.13);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.12);
}
.stat-chip .chip-value { font-size: 22px; font-weight: 800; color: white; line-height: 1; }
.stat-chip .chip-label { font-size: 10px; color: rgba(255,255,255,.7); margin-top: 2px; }
.stat-chip.alert { background: rgba(245,158,11,.2); border-color: rgba(245,158,11,.3); }
.stat-chip.alert .chip-value { color: var(--gold-300); }

/* ─── Quick Actions Grid ──────────────────────────────────────────────────────── */
.quick-actions-grid { display: flex; gap: 10px; }
.quick-action-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.quick-action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.quick-action-icon {
  width: 42px; height: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0 auto 8px;
}
.quick-action-label { font-size: 11px; font-weight: 600; color: var(--text); }

/* ─── Modals / Overlays ───────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 420px;
  width: calc(100% - 32px);
  animation: popIn .2s ease;
  align-self: center;
}
@keyframes popIn { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-handle {
  width: 36px; height: 4px;
  background: var(--slate-300);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; }

/* ─── WhatsApp Screen ─────────────────────────────────────────────────────────── */
.wa-template-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.wa-template-card:hover { border-color: var(--blue-300); }
.wa-template-card.active { border-color: var(--blue-500); background: var(--blue-50); }
.wa-template-title { font-size: 13.5px; font-weight: 700; margin-bottom: 2px; }
.wa-template-category { font-size: 10px; color: var(--blue-500); font-weight: 600; background: var(--blue-100); padding: 2px 7px; border-radius: 99px; display: inline-block; margin-bottom: 6px; }
.wa-template-msg { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.wa-preview {
  background: #e5ddd5;
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 100px;
}
.wa-bubble {
  background: white;
  border-radius: 8px 8px 8px 0;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 90%;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
  white-space: pre-wrap;
}

/* ─── Campaign Screen ─────────────────────────────────────────────────────────── */
.campaign-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

/* ─── Branch Comparison Table ────────────────────────────────────────────────── */
.branch-table { width: 100%; border-collapse: collapse; }
.branch-table th, .branch-table td { text-align: left; padding: 8px 10px; font-size: 12px; }
.branch-table th { color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.branch-table td { border-bottom: 1px solid var(--slate-100); }
.branch-table tr:last-child td { border-bottom: none; }
.attendance-report-table th,
.attendance-report-table td { white-space: nowrap; vertical-align: top; }

.attendance-tabs { display:flex; gap:24px; overflow-x:auto; padding:0; margin-bottom:16px; border-bottom:1px solid var(--border); scrollbar-width:none; }
.attendance-tabs::-webkit-scrollbar { display:none; }
.attendance-tab { flex:0 0 auto; border:0; background:transparent; color:var(--text-secondary); border-radius:0; padding:12px 2px; margin-bottom:-1px; border-bottom:2px solid transparent; font:600 13px/1.2 inherit; cursor:pointer; transition:.2s ease; white-space:nowrap; }
.attendance-tab.active { color:var(--blue-500); background:transparent; border-color:transparent; border-bottom:2px solid var(--blue-500); box-shadow:none; }
.section-subtitle { margin:4px 0 0; color:var(--text-muted); font-size:12px; }
.attendance-status-grid { display:grid; grid-template-columns:repeat(6,minmax(100px,1fr)); gap:10px; margin:14px 0 16px; }
.attendance-status-card { background:white; border:1px solid var(--slate-200); border-top:3px solid var(--status-color); border-radius:12px; padding:14px; box-shadow:var(--shadow-sm); }
.attendance-status-card strong { display:block; color:var(--status-color); font-size:24px; line-height:1; margin-bottom:6px; }
.attendance-status-card span { color:var(--text-muted); font-size:11px; font-weight:700; }
.attendance-table-wrap { overflow:auto; width:100%; }
.table-subtext { font-size:10px; color:var(--text-muted); margin-top:3px; font-weight:500; }
.table-flag { color:var(--orange-500); font-size:10px; margin-top:4px; }
.live-pill { display:inline-flex; padding:5px 9px; border-radius:999px; font-size:10px; font-weight:800; background:var(--slate-100); color:var(--slate-600); }
.live-in { background:#dcfce7; color:#15803d; }.live-out { background:#dbeafe; color:#1d4ed8; }.live-break { background:#ede9fe; color:#7c3aed; }.live-no-punch { background:#fee2e2; color:#dc2626; }
.attendance-toolbar,.attendance-policy-header { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:14px; }
.attendance-filter-row { display:flex; gap:12px; align-items:end; flex-wrap:wrap; }
.attendance-filter-row > label { min-width:190px; font-size:11px; font-weight:700; color:var(--text-muted); }
.daily-count { min-width:92px; border-radius:10px; padding:9px 12px; display:flex; align-items:center; gap:8px; background:var(--slate-50); }
.daily-count strong { font-size:20px; }.daily-count span { font-size:10px; font-weight:700; }
.daily-count.present { color:#15803d;background:#f0fdf4}.daily-count.absent{color:#dc2626;background:#fef2f2}.daily-count.half{color:#b45309;background:#fffbeb}
.attendance-dashboard-kpis { margin-bottom:16px; }
.attendance-insight-grid,.attendance-request-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:start; }
.attendance-week-nav { display:flex; gap:6px; align-items:center; }.attendance-week-nav input{width:145px}
.roster-table th,.roster-table td { min-width:120px; text-align:center; }.roster-table th:first-child,.roster-table td:first-child{position:sticky;left:0;background:white;text-align:left;z-index:1;min-width:170px}
.roster-cell { width:100%; border:1px dashed var(--slate-300); background:var(--slate-50); color:var(--blue-600); border-radius:8px; padding:9px 6px; font-size:10px; font-weight:700; cursor:pointer; }.roster-cell.off{background:#ccfbf1;color:#0f766e;border-style:solid;border-color:#99f6e4}
.attendance-request-actions { display:flex; gap:10px; flex-wrap:wrap; margin:0 0 14px; }
.policy-card { display:grid; grid-template-columns:minmax(120px,1fr) minmax(180px,1.4fr) auto; gap:12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--slate-100); font-size:12px; }.policy-card:last-child{border-bottom:none}
.check-row { display:flex; align-items:center; gap:8px; padding:10px 0 16px; font-size:12px; font-weight:700; color:var(--slate-700); }
.btn-sm { padding:6px 9px; min-height:0; font-size:10px; }

@media (max-width: 900px) {
  .attendance-status-grid { grid-template-columns:repeat(3,minmax(90px,1fr)); }
  .attendance-insight-grid,.attendance-request-grid { grid-template-columns:1fr; }
}
@media (max-width: 600px) {
  .attendance-toolbar,.attendance-policy-header { align-items:flex-start; flex-direction:column; }
  .attendance-status-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .attendance-filter-row { align-items:stretch; }.attendance-filter-row > label{width:100%}
  .policy-card { grid-template-columns:1fr auto; }.policy-card > div:nth-child(2){grid-column:1 / -1;grid-row:2}
}

/* ─── Notification item ───────────────────────────────────────────────────────── */
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.notif-item:hover { background: var(--slate-50); }
.notif-item .notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
  flex-shrink: 0;
  margin-top: 5px;
}
.notif-content .notif-title { font-size: 13px; font-weight: 600; }
.notif-content .notif-sub   { font-size: 12px; color: var(--text-muted); }

/* ─── Login Page ──────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--blue-900) 0%, var(--blue-700) 60%, var(--blue-500) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
}
.startup-error {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.startup-error-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-xl);
  text-align: center;
}
.startup-error-icon { font-size: 44px; line-height: 1; margin-bottom: 12px; }
.startup-error-card h2 { margin: 0 0 8px; font-size: 20px; }
.startup-error-card p { color: var(--slate-500, #64748b); margin: 0 0 20px; font-size: 14px; line-height: 1.5; }
.btn-block { display: flex; width: 100%; justify-content: center; margin-top: 10px; }
.login-brand-block {
  text-align: center;
  margin-bottom: 16px;
}
.login-brand-logo {
  width: min(220px, 58vw);
  height: auto;
  margin: 0 auto 8px;
  filter: brightness(0) invert(1);
}
.login-brand-kicker {
  color: var(--gold-300);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-top: 2px;
}
.login-logo-wrap {
  width: 72px; height: 72px;
  background: rgba(255,255,255,.13);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  border: 2px solid rgba(255,255,255,.2);
}
.login-logo-text { font-size: 36px; font-weight: 900; color: white; line-height: 1; }

.login-brand-name { font-size: 22px; font-weight: 800; color: var(--text); text-align: center; }
.login-brand-sub  { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--gold-500); text-transform: uppercase; text-align: center; margin-bottom: 28px; }

@media (max-height: 760px) {
  .login-page { align-items: flex-start; padding-top: 42px; }
  .login-brand-block { margin-bottom: 12px; }
  .login-brand-logo { width: min(200px, 56vw); margin-bottom: 6px; }
  .login-card { padding-top: 30px; padding-bottom: 30px; }
}

.pin-input {
  width: 50px;
  height: 50px;
  font-size: 24px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  transition: border-color .15s, box-shadow .15s;
}
.pin-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
  outline: none;
}
.pin-input.shake {
  animation: pinShake .4s ease;
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
@keyframes pinShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.demo-btns { display: flex; gap: 8px; margin-top: 12px; }
.demo-btn {
  flex: 1;
  padding: 9px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  background: white;
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
}
.demo-btn:hover { background: var(--blue-50); border-color: var(--blue-300); color: var(--blue-600); }

.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--text-muted); font-size: 11px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ─── Employee Leaderboard ────────────────────────────────────────────────────── */
.leaderboard-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  cursor: default;
}
.leaderboard-card.rank-1 { background: linear-gradient(135deg, #fef3c7, #fffbeb); border-color: var(--gold-400); }

/* ─── Branch Stat Card ────────────────────────────────────────────────────────── */
.branch-stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

/* ─── Note Box ────────────────────────────────────────────────────────────────── */
.note-box {
  background: var(--slate-50);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── Interaction Type Picker ─────────────────────────────────────────────────── */
.interaction-type-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.interaction-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s;
}
.interaction-type-btn .type-emoji { font-size: 20px; }
.interaction-type-btn:hover { border-color: var(--blue-300); color: var(--blue-500); }
.interaction-type-btn.active {
  border-color: currentColor;
  background: rgba(37,99,235,.07);
}

/* ─── Purchase Card ───────────────────────────────────────────────────────────── */
.purchase-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

/* ─── Alert Banner ────────────────────────────────────────────────────────────── */
.alert-banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
}
.alert-banner.success { background: var(--green-100); color: var(--green-600); }
.alert-banner.warning { background: var(--orange-100); color: #c2410c; }

/* ─── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 246px;
    transform: translateX(-100%);
    z-index: 150;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }

  .main-content {
    margin-left: 0;
    padding-bottom: 72px;
  }

  .add-lead-page {
    padding-bottom: 164px;
  }

  .add-lead-inline-action {
    display: block;
  }

  .add-lead-footer {
    left: 0;
    bottom: 68px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(15,23,42,.08);
  }

  .topbar-menu-btn { display: flex; }

  .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .report-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-metric { min-height: 128px; padding: 16px; }
  .report-metric strong { font-size: 23px; }
  #att-report-start,
  #att-report-end,
  #att-report-branch,
  #att-report-employee,
  #att-report-status {
    min-width: 0;
  }
  .form-body > div[style*="repeat(5"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .quick-actions-grid { flex-wrap: wrap; }
  .quick-actions-grid .quick-action-card { min-width: calc(50% - 5px); }
  .quick-stat-chips { gap: 6px; }

  .fab { right: 16px; bottom: 84px; }

  .interaction-type-grid { grid-template-columns: repeat(3, 1fr); }

  /* Mobile bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: white;
    border-top: 1px solid var(--border);
    z-index: 80;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  }

  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    cursor: pointer;
    transition: color .15s;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    gap: 3px;
  }
  .bottom-nav-item .nav-icon { font-size: 20px; }
  .bottom-nav-item.active { color: var(--blue-500); }
}

@media (min-width: 769px) {
  .bottom-nav { display: none; }
  .mobile-overlay { display: none !important; }
}

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

/* ─── Page Paddings ───────────────────────────────────────────────────────────── */
.page-content { padding: 20px; max-width: 900px; }
.page-padded  { padding: 0 20px; }

.add-lead-page {
  padding-bottom: 112px;
}

.add-lead-inline-action {
  display: none;
  margin-top: 8px;
  margin-bottom: 16px;
}

.add-lead-footer {
  position: fixed;
  left: var(--sidebar-w);
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
  .add-lead-page {
    padding-bottom: 164px;
  }

  .add-lead-inline-action {
    display: block;
  }

  .add-lead-footer {
    left: 0;
    bottom: 68px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(15,23,42,.08);
    z-index: 90;
  }

  .funnel-dashboard {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px 14px;
  }

  .funnel-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .funnel-metric-box {
    min-height: 58px;
    padding: 6px;
  }

  .funnel-metric-box span {
    font-size: 9px;
  }

  .funnel-label {
    left: 58%;
    font-size: 9px;
  }

  .funnel-label i {
    width: 34px;
  }

  .stage-tag-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 22px 18px 28px;
  }

  .tag-donut,
  .tag-pie {
    width: 154px;
    height: 154px;
  }

  .tag-donut span {
    inset: 34px;
  }
}

/* ─── Lead detail hero ────────────────────────────────────────────────────────── */
.lead-hero-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

/* ─── Scrollable Lists ────────────────────────────────────────────────────────── */
.leads-list   { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.scroll-list  { display: flex; flex-direction: column; }

/* ─── Toast ───────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--slate-800);
  color: white;
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  z-index: 999;
  animation: toastIn .2s ease, toastOut .2s ease 2.5s forwards;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}
.toast-error { background: var(--red-500); }
@keyframes toastIn  { from { opacity:0; transform: translateX(-50%) translateY(8px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; } }

/* ─── Page Header (Back bar) ──────────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-600));
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-header-back {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  color: white;
  font-size: 18px;
  flex-shrink: 0;
}
.page-header-back:hover { background: rgba(255,255,255,.25); }
.page-header h2 { font-size: 16px; font-weight: 700; flex: 1; }
.page-header .header-actions { display: flex; gap: 6px; }

/* ─── Workforce & Payroll ─────────────────────────────────────────────────── */
.workforce-page { padding-bottom: 110px; }
.workforce-tabs { display:flex; gap:8px; overflow-x:auto; padding:4px 0 16px; scrollbar-width:thin; }
.workforce-tab { flex:0 0 auto; border:1px solid var(--border); background:var(--bg-card); color:var(--text-secondary); border-radius:10px; padding:10px 14px; font:600 12px/1.2 inherit; cursor:pointer; }
.workforce-tab.active { color:#fff; border-color:transparent; background:linear-gradient(135deg,var(--blue-600),var(--purple-600)); box-shadow:0 5px 16px rgba(37,99,235,.2); }
.workforce-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.workforce-actions .form-control { width:220px; }
.workforce-table { min-width:820px; }
/* SalaryBox-style My Team: underline tabs + clean white table */
.workforce-tabs { gap:24px; padding:0; border-bottom:1px solid var(--border); margin-bottom:16px; }
.workforce-tab { flex:0 0 auto; border:0; background:transparent; color:var(--text-secondary); border-radius:0; padding:12px 2px; margin-bottom:-1px; border-bottom:2px solid transparent; box-shadow:none; font:600 13px/1.2 inherit; }
.workforce-tab.active { color:var(--blue-500); background:transparent; border-color:transparent; border-bottom:2px solid var(--blue-500); box-shadow:none; }
.wf-salarybox { background:#fff; }
.wf-salarybox thead th { background:#f8fafc; color:#64748b; font-weight:600; font-size:12px; padding:12px 14px; border-bottom:1px solid var(--border); white-space:nowrap; }
.wf-salarybox td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--slate-100); vertical-align:middle; }
.wf-salarybox tbody tr:hover { background:#f8fafc; }
.wf-salarybox .wf-check-col { width:40px; text-align:center; }
.wf-check { width:15px; height:15px; accent-color:var(--blue-500); cursor:pointer; vertical-align:middle; }
.wf-name-link { color:var(--blue-500); font-weight:600; cursor:pointer; }
.wf-name-link:hover { text-decoration:underline; }
.attendance-report-table td.num, .attendance-report-table th.num { text-align:center; white-space:nowrap; }
.attendance-dashboard-row { cursor:pointer; }
.attendance-dashboard-row:hover { background:var(--gray-50, #f8fafc); }
.attendance-dashboard-actions { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.attendance-dashboard-actions label { display:flex; align-items:center; gap:6px; font-size:13px; color:var(--gray-600,#475569); }
.attendance-dashboard-actions input[type=month] { width:auto; }
.audit-action { display:inline-block; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; font-weight:600; color:var(--blue-700,#1d4ed8); background:var(--blue-50,#eff6ff); border:1px solid var(--blue-100,#dbeafe); border-radius:6px; padding:2px 7px; white-space:nowrap; }
.att-cal-editlink { color:var(--blue-500,#2563eb); font-size:11px; font-weight:600; opacity:0; margin-left:6px; }
.attendance-dashboard-row:hover .att-cal-editlink { opacity:1; }
/* SalaryBox-style Edit Attendance calendar modal */
.att-cal-sheet { max-width:860px; width:96vw; }
.att-cal-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:14px; }
.att-cal-body { display:grid; grid-template-columns:1fr 300px; gap:20px; }
@media (max-width:720px){ .att-cal-body { grid-template-columns:1fr; } }
.att-cal-chips { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.att-cal-chip { flex:1; min-width:64px; border:1px solid #e2e8f0; border-left:3px solid var(--c); border-radius:8px; padding:6px 8px; text-align:center; }
.att-cal-chip strong { display:block; font-size:16px; color:var(--c); }
.att-cal-chip span { font-size:11px; color:#64748b; }
.att-cal-weekdays { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:6px; }
.att-cal-weekdays span { text-align:center; font-size:11px; color:#94a3b8; font-weight:600; }
.att-cal-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:6px; }
.att-cal-cell { position:relative; aspect-ratio:1; border-radius:8px; font-weight:700; font-size:13px; display:flex; align-items:center; justify-content:center; cursor:pointer; border:1px solid #e2e8f0; background:#fff; }
.att-cal-cell.empty { background:transparent; border:none; cursor:default; }
.att-cal-cell.sel { outline:2px solid #2563eb; outline-offset:1px; }
.att-cal-late { position:absolute; bottom:1px; left:0; right:0; font-size:7px; font-weight:800; letter-spacing:.4px; }
.att-cal-markall { margin-top:14px; width:100%; }
.att-cal-right { border-left:1px solid #eef2f7; padding-left:16px; }
@media (max-width:720px){ .att-cal-right { border-left:none; padding-left:0; border-top:1px solid #eef2f7; padding-top:14px; margin-top:8px; } }
.att-cal-daytitle { font-weight:800; margin-bottom:10px; }
.att-cal-subhead { font-size:12px; color:#64748b; font-weight:700; margin:14px 0 6px; }
.att-cal-statusrow { display:flex; flex-wrap:wrap; gap:6px; }
.att-cal-status { border:1px solid #cbd5e1; background:#fff; border-radius:16px; padding:5px 12px; font-size:12px; font-weight:600; cursor:pointer; color:#475569; }
.att-cal-status:hover { border-color:#94a3b8; }
.att-cal-status.active { background:#16a34a; border-color:#16a34a; color:#fff; }
.att-cal-status.leave.active { background:#7c3aed; border-color:#7c3aed; }
.att-cal-punch { margin-top:12px; font-size:13px; background:#f8fafc; border-radius:8px; padding:8px 10px; }
.att-cal-punch.muted { color:#94a3b8; }
.workforce-status { display:inline-flex; align-items:center; border:1px solid color-mix(in srgb,var(--workforce-status),transparent 65%); background:color-mix(in srgb,var(--workforce-status),transparent 90%); color:var(--workforce-status); border-radius:999px; padding:4px 8px; font-size:10px; font-weight:800; text-transform:uppercase; }
.workforce-modal { max-width:900px; max-height:92vh; overflow:auto; }
.workforce-form-title { margin:18px 0 10px; color:var(--text-primary); border-bottom:1px solid var(--border); padding-bottom:8px; }
.workforce-form-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.payroll-filters { display:flex; gap:12px; align-items:end; margin-bottom:18px; flex-wrap:wrap; }
.payroll-filters label,.report-builder-grid label { font-size:12px; font-weight:700; color:var(--text-secondary); }
.payroll-filters .form-control { min-width:190px; margin-top:6px; }
.payroll-run-banner { display:grid; grid-template-columns:1.5fr 1fr auto; align-items:center; gap:16px; padding:18px; margin-bottom:16px; border:1px solid rgba(37,99,235,.18); background:linear-gradient(135deg,rgba(37,99,235,.08),rgba(124,58,237,.07)); border-radius:14px; }
.payroll-run-banner strong { font-size:16px; }
.report-builder-grid { display:grid; grid-template-columns:2fr 1.2fr 1fr 1fr 1fr auto; gap:12px; align-items:end; }
.report-builder-grid .form-control { margin-top:6px; }
.report-type-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; padding:16px; }
.report-type-grid button,.settings-link-grid button { text-align:left; border:1px solid var(--border); background:var(--bg-card); border-radius:12px; padding:14px; cursor:pointer; color:var(--text-primary); }
.report-type-grid button:hover,.settings-link-grid button:hover { border-color:var(--blue-500); background:rgba(37,99,235,.05); }
.report-type-grid span { font-size:22px; display:block; margin-bottom:8px; }
.report-type-grid strong,.settings-link-grid strong { display:block; font-size:13px; }
.report-type-grid small,.settings-link-grid small { display:block; color:var(--text-muted); margin-top:4px; line-height:1.35; }
.settings-card-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.settings-link-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }

@media (max-width: 820px) {
  .workforce-form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .report-builder-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-card-grid { grid-template-columns:1fr; }
  .settings-link-grid,.report-type-grid { grid-template-columns:1fr; }
  .payroll-run-banner { grid-template-columns:1fr; }
}
@media (max-width: 520px) {
  .workforce-form-grid,.report-builder-grid { grid-template-columns:1fr; }
  .workforce-actions .form-control { width:100%; }
}

.attendance-mode-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:18px; }
.attendance-mode-card { border:1px solid var(--border); background:var(--bg-card); border-radius:16px; padding:20px; box-shadow:var(--shadow-sm); }
.attendance-mode-card > span { display:flex; width:48px; height:48px; align-items:center; justify-content:center; border-radius:14px; font-size:25px; background:linear-gradient(135deg,rgba(37,99,235,.12),rgba(124,58,237,.12)); }
.attendance-mode-card h3 { margin:14px 0 6px; font-size:16px; }
.attendance-mode-card p { color:var(--text-muted); font-size:12px; line-height:1.55; min-height:56px; }
.attendance-mode-card strong { display:block; color:var(--blue-600); font-size:12px; margin:10px 0; }
.code-entry { text-align:center; font-size:25px; font-weight:800; letter-spacing:.3em; }
.location-card-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.location-card { display:flex; gap:12px; border:1px solid var(--border); background:var(--bg-card); border-radius:14px; padding:16px; }
.location-card p { color:var(--text-muted); font-size:11px; margin:3px 0 7px; }
.location-card span,.location-card small,.location-card a { display:block; font-size:11px; margin-top:5px; }
.location-card small { color:var(--text-muted); }
.location-card a { color:var(--blue-600); font-weight:700; }
@media (max-width:820px){.attendance-mode-grid,.location-card-grid{grid-template-columns:1fr;}}
