:root {
  --bg: #f5f3ff;
  --card-bg: #ffffff;
  --text: #2e1065;
  --text-muted: #6b7280;
  --border: #e5d9fb;
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #ede9fe;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(109, 40, 217, 0.10);

  --sidebar-bg: #120b26;
  --sidebar-bg-alt: #1b1140;
  --sidebar-text: #a29bc7;
  --sidebar-text-active: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- App shell ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  padding: 6px 10px 20px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  font-size: 15px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: none;
  background: transparent;
  color: var(--sidebar-text);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.nav-item:hover { background: var(--sidebar-bg-alt); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item.is-placeholder { opacity: 0.55; }

.nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  border-radius: 20px;
  padding: 1px 7px;
  min-width: 16px;
  text-align: center;
}
.nav-item.is-placeholder:hover { opacity: 0.85; }

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 10px 6px;
}

.sidebar-logout {
  margin-top: 10px;
  width: 100%;
  background: var(--sidebar-bg-alt);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logout:hover { background: #241a52; }

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.view { padding-bottom: 30px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}

.topbar-title { font-size: 18px; font-weight: 800; color: var(--text); }

.scope-select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.scope-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.spacer { flex: 1; }

.notif-wrap { position: relative; }

.notif-bell {
  position: relative;
  font-size: 17px;
  padding: 6px 8px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(46,16,101,0.18);
  z-index: 60;
}

.notif-dropdown-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 14px 8px;
}

.notif-list { display: flex; flex-direction: column; }

.notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.notif-item:hover { background: var(--primary-light); }
.notif-item .ni-name { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-item .ni-meta { font-size: 11px; color: var(--danger); }
.notif-item .ni-meta.ni-meta-assigned { color: #16a34a; }
.notif-empty { padding: 16px 14px; font-size: 12px; color: var(--text-muted); text-align: center; }

.notif-bell.shake { animation: notif-bell-shake 0.6s ease; }
@keyframes notif-bell-shake {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(18deg); }
  30% { transform: rotate(-16deg); }
  45% { transform: rotate(12deg); }
  60% { transform: rotate(-10deg); }
  75% { transform: rotate(6deg); }
  90% { transform: rotate(-4deg); }
}

.notif-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  min-width: 15px;
  text-align: center;
}

.current-user {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-user b { color: var(--text); }

.current-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  overflow: hidden;
  flex-shrink: 0;
}
.current-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.role-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-small { padding: 6px 12px; font-size: 12px; }

/* ---------- Generic status badge ---------- */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* ---------- Global Config ---------- */
.config-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  min-height: 30px;
}

.config-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 13px;
  font-weight: 600;
}

.config-chip button {
  border: none;
  background: rgba(109,40,217,0.15);
  color: var(--primary-dark);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.config-add-form { display: flex; gap: 8px; }
.config-add-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}

/* ---------- Attendance ---------- */
.attendance-widget {
  margin: 18px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.attendance-widget .aw-status { font-size: 13px; color: var(--text-muted); }
.attendance-widget .aw-status b { color: var(--text); }
.attendance-widget .spacer { flex: 1; }

/* ---------- Reports source bars ---------- */
.source-perf-row { margin-bottom: 12px; }
.source-perf-row .spr-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; color: var(--text-muted); font-weight: 600; }
.source-perf-row .spr-track { background: var(--primary-light); border-radius: 999px; height: 10px; overflow: hidden; }
.source-perf-row .spr-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a78bfa); border-radius: 999px; }

/* ---------- Agent focus bar ---------- */
.agent-focus-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, #4c1d95, #7c3aed);
  color: #fff;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 15;
}

.afb-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.afb-exit-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 6px 14px;
  font-size: 12px;
}
.afb-exit-btn:hover { background: rgba(255,255,255,0.28); }

/* ---------- Agent snapshot ---------- */
.agent-snapshot {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.as-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.as-name { font-weight: 800; font-size: 16px; color: var(--text); }
.as-role { font-size: 12px; color: var(--text-muted); }
.as-spacer { flex: 1; }
.as-attendance-chip { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.as-attendance-chip.present { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.as-attendance-chip.absent { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.as-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.as-activity-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.as-activity-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.as-activity-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px 12px;
}
.as-activity-item .aa-text { color: var(--text); }
.as-activity-item .aa-text b { color: var(--primary-dark); }
.as-activity-item .aa-meta { color: var(--text-muted); white-space: nowrap; }
.as-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 10px; }

/* ---------- Dashboard ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  padding: 18px 24px;
  align-items: start;
}

.dash-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.dash-cd-section { padding: 0 24px 24px; }
.dash-cd-title { margin: 0 0 12px; font-size: 15px; color: var(--text); }

.dash-topstats {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.topstat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 90px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
}
.topstat:hover { background: var(--primary-light); }

.topstat .label { font-size: 12px; color: var(--text-muted); }
.topstat .value { font-size: 22px; font-weight: 800; color: var(--text); }

.dash-colorcards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.import-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 4px 0 6px;
}
.import-result-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent, var(--primary));
  padding: 12px 14px;
}
.import-result-card .irc-label { font-size: 11.5px; color: var(--text-muted); font-weight: 700; }
.import-result-card .irc-value { font-size: 24px; font-weight: 800; color: var(--text); margin-top: 2px; }
.import-result-card .irc-hint { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.color-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent, var(--primary));
  padding: 12px 14px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.color-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(46,16,101,0.15); }

.color-card .cc-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.color-card .cc-value { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 2px; }
.color-card .cc-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: var(--accent, var(--primary));
  color: #fff;
  flex-shrink: 0;
}

.dash-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 14px; color: var(--text); }

.source-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.source-col-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 8px;
}

.source-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--primary-light);
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.source-row b { font-size: 13px; }

.radar-wrap, .donut-wrap { display: flex; align-items: center; justify-content: center; min-height: 180px; }

.radar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.radar-legend span.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

.pipeline-wrap { display: flex; flex-direction: column; gap: 12px; }

.pipeline-stage { display: flex; align-items: center; gap: 12px; }
.pipeline-stage .ps-label { width: 110px; font-size: 12px; color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.pipeline-stage .ps-bar-track { flex: 1; background: var(--primary-light); border-radius: 999px; height: 16px; overflow: hidden; }
.pipeline-stage .ps-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a78bfa); border-radius: 999px; }
.pipeline-stage .ps-value { width: 34px; text-align: right; font-weight: 700; font-size: 13px; }

.donut-inner-label { text-align: center; }
.donut-inner-label .big { font-size: 24px; font-weight: 800; color: var(--text); }
.donut-inner-label .small { font-size: 11px; color: var(--text-muted); }

/* ---------- Booking Done target widget (simple road) ---------- */
.booking-target-wrap { display: flex; flex-direction: column; align-items: center; min-height: 296px; padding: 10px 0 4px; }

.booking-progress-label { font-size: 13px; font-weight: 800; color: var(--text); margin: 2px 0 22px; }
.booking-progress-label .big { font-size: 20px; color: var(--primary-dark, #4c1d95); }

.booking-road-wrap {
  position: relative;
  width: 100%;
  height: 266px;
  margin: 0 auto 8px;
}

.booking-road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  height: 14px;
  background: #3f3f52;
  border-radius: 7px;
  z-index: 1;
}
.booking-road::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background-image: repeating-linear-gradient(to right, #fbbf24 0, #fbbf24 8px, transparent 8px, transparent 16px);
  background-size: 16px 2px;
  animation: booking-road-scroll 0.6s linear infinite;
}

@keyframes booking-road-scroll {
  from { background-position-x: 0; }
  to { background-position-x: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  .booking-road::after { animation: none; }
}

.road-milestone {
  position: absolute;
  bottom: 130px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 46px;
  z-index: 3;
}

.road-milestone-emoji {
  position: relative;
  font-size: 21px;
  filter: grayscale(1) opacity(0.35);
  transition: filter 0.3s ease;
}
.road-milestone.unlocked .road-milestone-emoji {
  filter: none;
  animation: bt-unlock-pop 0.6s ease;
}

.road-milestone-lock { position: absolute; top: -4px; right: -8px; font-size: 10px; filter: none; }

.road-milestone-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-align: center; line-height: 1.15; }
.road-milestone.unlocked .road-milestone-label { color: var(--primary-dark, #4c1d95); }

.road-milestone-target { font-size: 8px; color: var(--text-muted); }

.booking-walker {
  position: absolute;
  bottom: -4px;
  width: 126px;
  height: 126px;
  transform: translateX(-50%);
  transition: left 1.2s ease-in-out;
  z-index: 2;
}

@media (max-width: 480px) {
  .booking-road-wrap { height: 218px; }
  .booking-walker { width: 98px; height: 98px; }
  .road-milestone { bottom: 105px; width: 40px; }
  .road-milestone-emoji { font-size: 18px; }
}

.booking-target-caption { font-size: 12px; font-weight: 700; color: var(--primary-dark, #4c1d95); margin-top: 8px; }

.booking-target-agent-name { font-size: 15px; font-weight: 800; color: var(--text); margin-top: 6px; }
.booking-target-keepgoing { font-size: 12px; font-weight: 700; color: var(--primary); font-style: italic; margin-top: 2px; }
.booking-target-motivation { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; max-width: 320px; text-align: center; }

@keyframes bt-unlock-pop {
  0% { transform: scale(0.4) rotate(-15deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

.congrats-modal { text-align: center; max-width: 360px; }
.congrats-icon { font-size: 56px; animation: bt-unlock-pop 0.6s ease; }
.congrats-title { font-size: 20px; font-weight: 800; color: var(--primary-dark, #4c1d95); margin: 8px 0 6px; }
.congrats-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }

.welcome-modal { text-align: center; max-width: 340px; background: #fcfcff; }
.welcome-avatar {
  position: relative;
  width: 165px;
  height: 290px;
  margin: 0 auto 10px;
  animation: bt-unlock-pop 0.5s ease;
}
.welcome-avatar::before {
  content: "";
  position: absolute;
  inset: -16px -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.45) 0%, rgba(167, 139, 250, 0) 70%);
  z-index: 0;
}
.welcome-avatar img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.welcome-title { font-size: 22px; font-weight: 800; color: var(--primary-dark, #4c1d95); margin: 0 0 6px; }
.welcome-msg { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

/* ---------- Reminders panel ---------- */
.dash-side { min-width: 0; }

.reminders-panel {
  background: var(--sidebar-bg);
  border-radius: var(--radius);
  padding: 18px;
  color: #fff;
}

.reminders-panel h3 { margin: 0 0 14px; font-size: 15px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.reminders-clear-filter {
  font-size: 10.5px;
  font-weight: 700;
  color: #a78bfa;
  cursor: pointer;
  background: rgba(167, 139, 250, 0.15);
  border-radius: 10px;
  padding: 2px 8px;
}
.reminders-clear-filter:hover { background: rgba(167, 139, 250, 0.28); }

.calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 16px;
}

.cal-day {
  text-align: center;
  border-radius: 8px;
  padding: 6px 2px;
  background: var(--sidebar-bg-alt);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.cal-day:hover { background: rgba(167, 139, 250, 0.25); }

.cal-day .cd-name { font-size: 9px; color: var(--sidebar-text); text-transform: uppercase; }
.cal-day .cd-num { font-size: 13px; font-weight: 700; margin-top: 2px; }
.cal-day .cd-dot { width: 4px; height: 4px; border-radius: 50%; background: #a78bfa; margin: 3px auto 0; }
.cal-day.today { background: var(--primary); }
.cal-day.selected { box-shadow: 0 0 0 2px #fbbf24 inset; background: rgba(251, 191, 36, 0.18); }
.cal-day.today.selected { box-shadow: 0 0 0 2px #fbbf24 inset; }

.reminders-list { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }

.reminder-item {
  display: flex;
  gap: 10px;
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  transition: background 0.15s ease;
}
.reminder-item:hover { background: rgba(255,255,255,0.06); }

.reminder-item .ri-badge {
  width: 6px;
  border-radius: 4px;
  flex-shrink: 0;
}

.reminder-item .ri-body { flex: 1; min-width: 0; }
.reminder-item .ri-when { font-size: 11px; color: #a29bc7; }
.reminder-item .ri-time { color: #fbbf24; font-weight: 800; }
.reminder-item .ri-overdue { color: #ef4444; font-weight: 800; }
.reminder-item.overdue { background: rgba(239, 68, 68, 0.1); }
.reminder-item.overdue:hover { background: rgba(239, 68, 68, 0.18); }
.reminder-item .ri-title { font-size: 13px; font-weight: 700; margin-top: 1px; }
.reminder-item .ri-sub { font-size: 11px; color: #c4bce8; margin-top: 1px; }

.reminders-empty { font-size: 12px; color: #a29bc7; text-align: center; padding: 16px 4px; }

/* ---------- Stats (legacy chip style, used elsewhere) ---------- */
.stat-chip {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

.stat-chip b { color: var(--text); }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input, .toolbar select {
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
  color: var(--text);
}

#searchInput { flex: 1; min-width: 220px; }

.overdue-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.overdue-toggle-label input { accent-color: var(--danger); }

/* ---------- Table ---------- */
.table-wrap {
  margin: 0 24px 30px;
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.leads-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.leads-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.leads-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.leads-table tr:hover td { background: #faf8ff; }

.lead-name { font-weight: 700; color: var(--text); }
.muted { color: var(--text-muted); font-size: 12px; }

.status-select {
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #1f2937;
}

.status-pill-static {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cd-status-select, .cd-followup-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 7px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.cd-followup-input { width: 128px; }

.followup-badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.followup-overdue { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.followup-today { background: #fff7ed; color: #9a3412; border-color: #fcd9b6; }
.followup-upcoming { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }

.row-actions { display: flex; gap: 6px; }

.icon-btn {
  border: none;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  text-decoration: none;
  display: inline-block;
}

.icon-btn:hover { background: #ddd6fe; }
.icon-btn.danger { background: #fef2f2; color: var(--danger); }
.icon-btn.danger:hover { background: #fee2e2; }

.empty-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 30px 6px;
}

.pagination-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 6px;
}

.pagination-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.pagination-size select {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-weight: 700;
  color: var(--text);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.pagination-pages button {
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.pagination-pages button:hover:not(:disabled) { background: var(--primary-light, #f3effc); }
.pagination-pages button.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pagination-pages button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-pages span.pagination-ellipsis {
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 12.5px;
}

.pagination-total {
  margin-left: auto;
  font-size: 12.5px;
  color: var(--text-muted);
}

.archive-tabs {
  display: flex;
  gap: 6px;
}
.archive-tab {
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.archive-tab:hover { background: var(--primary-light, #f3effc); }
.archive-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Modal ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 11, 38, 0.55);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 24px 24px;
}

.modal.modal-wide { max-width: 780px; }

/* ---------- Academy ---------- */
.academy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.academy-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.academy-card-project { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; }
.academy-card-title { font-size: 16px; font-weight: 800; color: var(--text); }
.academy-card-meta { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.academy-status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}
.academy-status-pill.draft { background: #fef3c7; color: #92400e; }
.academy-status-pill.published { background: #dcfce7; color: #166534; }

.academy-card-score {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--sidebar-bg-alt, #f3effc);
  border-radius: 8px;
  padding: 6px 10px;
}
.academy-card-score.fail { background: #fee2e2; color: #991b1b; }
.academy-card-score.average { background: #fef3c7; color: #92400e; }
.academy-card-score.good { background: #dbeafe; color: #1e40af; }
.academy-card-score.excellent { background: #ede9fe; color: #5b21b6; }
.academy-card-score.super { background: #fef9c3; color: #854d0e; }

.academy-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.academy-qform {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px;
  margin: 16px 0;
  background: var(--sidebar-bg-alt, #f9f8fd);
}
.academy-qform-title { font-size: 13px; font-weight: 800; margin-bottom: 8px; color: var(--text); }

.academy-option-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.academy-option-row input[type="text"] { flex: 1; }
.academy-option-row .academy-option-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
}

.academy-question-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.academy-question-item .aq-text { font-weight: 700; font-size: 13.5px; margin-bottom: 6px; }
.academy-question-item .aq-options { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--text-muted); }
.academy-question-item .aq-options .correct { color: #16a34a; font-weight: 700; }
.academy-question-item .aq-actions { display: flex; gap: 8px; margin-top: 8px; }

.academy-builder-footer { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 4px; }

.academy-take-question {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.academy-take-question:first-child { padding-top: 0; }
.academy-take-question .atq-text { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.academy-take-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.academy-take-option:hover { background: var(--sidebar-bg-alt, #f9f8fd); }

.academy-review-question {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}
.academy-review-question.correct { border-left: 4px solid #16a34a; }
.academy-review-question.wrong { border-left: 4px solid #ef4444; }
.academy-review-option {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}
.academy-review-option.is-correct-answer { background: #dcfce7; color: #166534; font-weight: 700; }
.academy-review-option.is-wrong-selected { background: #fee2e2; color: #991b1b; font-weight: 700; }
.academy-dispute-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 8px;
}
.academy-dispute-btn:hover { background: #fef3c7; color: #92400e; }
.academy-dispute-btn.flagged { background: #fef3c7; color: #92400e; border-color: #fde68a; }

.academy-score-banner {
  text-align: center;
  padding: 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #4c1d95));
  color: #fff;
  margin-bottom: 16px;
}
.academy-score-banner .asb-score { font-size: 32px; font-weight: 900; }
.academy-score-banner .asb-label { font-size: 12.5px; opacity: 0.9; }
.academy-score-banner .asb-grade {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.2);
}
.academy-score-banner .asb-retake-note {
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 6px 10px;
}

/* ---------- API Connections (Integrations) ---------- */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.integration-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.integration-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.integration-card-title { font-size: 14.5px; font-weight: 800; color: var(--text); }

.integration-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.integration-toggle input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

.integration-copy-row {
  display: flex;
  gap: 6px;
}
.integration-copy-row input {
  flex: 1;
  font-size: 11.5px;
  background: var(--bg);
  color: var(--text);
}

.int-regen-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  text-decoration: underline;
}

.integration-card-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---------- Teams (inside Team view) ---------- */
.team-modal-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.team-modal-member-chip {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}
.academy-score-banner.fail { background: linear-gradient(135deg, #ef4444, #991b1b); }
.academy-score-banner.average { background: linear-gradient(135deg, #f59e0b, #92400e); }
.academy-score-banner.good { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.academy-score-banner.excellent { background: linear-gradient(135deg, #8b5cf6, #5b21b6); }
.academy-score-banner.super { background: linear-gradient(135deg, #eab308, #854d0e); }

.academy-dispute-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.academy-dispute-item .adi-meta { font-size: 11.5px; color: var(--text-muted); margin-bottom: 6px; }

/* ---------- Calculator ---------- */
.calc-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: start;
  padding: 0 6px 20px;
}
@media (max-width: 900px) {
  .calc-grid { grid-template-columns: 1fr; }
}

.calc-form-panel, .calc-result-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.calc-result-panel { position: sticky; top: 14px; }
@media (max-width: 900px) {
  .calc-result-panel { position: static; }
}

.calc-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  margin: 16px 0 8px;
}
.calc-section-title:first-child { margin-top: 0; }

.calc-result-empty-icon { text-align: center; font-size: 34px; margin-bottom: 8px; }

.calc-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.calc-breakdown-row .cbr-label { color: var(--text-muted); }
.calc-breakdown-row .cbr-value { font-weight: 700; color: var(--text); }

.calc-breakdown-row.subtotal { border-bottom: 2px solid var(--border); margin-top: 4px; }
.calc-breakdown-row.subtotal .cbr-label,
.calc-breakdown-row.subtotal .cbr-value { font-weight: 800; }

.calc-grand-total {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark, #4c1d95));
  color: #fff;
  text-align: center;
}
.calc-grand-total .cgt-label { font-size: 11.5px; opacity: 0.9; text-transform: uppercase; font-weight: 700; }
.calc-grand-total .cgt-value { font-size: 26px; font-weight: 900; margin: 2px 0; }
.calc-grand-total .cgt-words { font-size: 12px; font-style: italic; opacity: 0.95; margin: 4px 0; padding: 0 8px; }
.calc-grand-total .cgt-sub { font-size: 12px; opacity: 0.9; margin-top: 4px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.modal-header h2 { margin: 0; font-size: 18px; color: var(--text); }

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
}

.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 5px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.form-success { color: #16a34a; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

.settings-avatar-row { display: flex; align-items: center; gap: 20px; margin-bottom: 16px; }
.settings-avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.settings-avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.settings-avatar-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.settings-upload-label { display: inline-block; text-align: center; }
.settings-emoji-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.settings-emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.settings-emoji-btn {
  font-size: 22px;
  padding: 6px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  line-height: 1;
}
.settings-emoji-btn:hover { background: var(--primary-light); }
.settings-emoji-btn.active { border-color: var(--primary); background: var(--primary-light); }
.form-row label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.form-row input, .form-row select, .form-row textarea {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}

.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- Login ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #7c3aed 0%, #4c1d95 100%);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 34px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}

.login-brand {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
  text-align: center;
}

.login-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 22px;
}

.login-btn { width: 100%; padding: 11px; margin-top: 6px; }

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.login-demo {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.login-demo-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-demo table { width: 100%; border-collapse: collapse; font-size: 12px; }
.login-demo td { padding: 3px 0; color: var(--text-muted); }
.login-demo code { background: var(--primary-light); color: var(--primary-dark); padding: 1px 5px; border-radius: 4px; }

.otp-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}
.otp-link {
  background: none;
  border: none;
  color: var(--primary-dark, #6d28d9);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}
.otp-link:hover { text-decoration: underline; }
#otpCode {
  font-size: 22px;
  letter-spacing: 6px;
  text-align: center;
  font-weight: 700;
}

/* ---------- Mobile leads (app-style cards) ---------- */
.mobile-leads-bar, .leads-cards, .mobile-fab { display: none; }

.leads-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px 4px;
}

.chip-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: inherit;
  cursor: pointer;
}

.dsr-interested-count {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 13px;
  padding: 0;
}

.dsr-agent-link {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 13px;
  padding: 0;
}

.dic-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  background: var(--primary-light);
  border-radius: 8px;
  padding: 10px 12px;
}

.dic-item .dic-name { font-weight: 700; font-size: 13px; color: var(--text); }
.dic-item .dic-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.dic-item .dic-notes { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }

.chip-pill .cp-count {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
}

.chip-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-pill.active .cp-count { background: rgba(255,255,255,0.25); color: #fff; }
.chip-pill .cp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.mobile-search-row { display: flex; gap: 8px; padding: 8px 14px 4px; }
.mobile-search-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
}

.mobile-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 16px;
  color: var(--primary-dark);
  cursor: pointer;
  flex-shrink: 0;
}

.lead-card-m {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lcm-top { display: flex; align-items: flex-start; gap: 10px; }

.lcm-select {
  display: flex;
  align-items: center;
  padding-top: 10px;
  flex-shrink: 0;
}
.lcm-select input {
  width: 19px;
  height: 19px;
  accent-color: var(--primary);
  cursor: pointer;
}

.lcm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.lcm-body { flex: 1; min-width: 0; }
.lcm-name { font-weight: 700; font-size: 14px; color: var(--text); }
.lcm-sub { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: 1px; }
.lcm-property { font-size: 12px; color: var(--primary, #6d28d9); font-weight: 600; margin-top: 2px; }
.lcm-status-line { font-size: 12px; color: var(--text-muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.lcm-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.lcm-source { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }

.lcm-assignee {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 10px;
}

.lcm-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.lcm-actions a, .lcm-actions button, .lcm-actions span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 auto;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.lcm-actions a:hover, .lcm-actions button:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  filter: brightness(1.06);
}

.act-edit { background: linear-gradient(145deg, #60a5fa, #2563eb); }
.act-delete { background: linear-gradient(145deg, #f87171, #dc2626); }
.act-call { background: linear-gradient(145deg, #34d399, #059669); }
.act-whatsapp { background: #fff; border: 1px solid var(--border); }
.act-email { background: #fff; border: 1px solid var(--border); }
.act-files { background: linear-gradient(145deg, #fb923c, #ea580c); }
.act-disabled { background: #d1d5db !important; box-shadow: none !important; cursor: not-allowed; pointer-events: none; }

/* ---------- Property file attachments ---------- */
.prop-file-btns { display: flex; gap: 6px; }
.prop-file-slot { display: flex; align-items: center; gap: 2px; }
.pf-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  border: none;
}
.pf-upload { background: #e5e7eb; color: var(--text-muted); opacity: 0.85; }
.pf-upload:hover { background: #d1d5db; opacity: 1; }
.pf-view { background: linear-gradient(145deg, #60a5fa, #2563eb); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); }
.pf-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: #fee2e2;
  color: #991b1b;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
}

.ld-send-files-panel {
  background: #fff7ed;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
}
.ld-sfp-title { font-size: 13px; font-weight: 800; color: #9a3412; margin-bottom: 10px; }
.ld-sfp-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.ld-sfp-empty { font-size: 12.5px; color: var(--text-muted); }

.mobile-fab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 26px;
  border: none;
  box-shadow: 0 8px 20px rgba(109,40,217,0.4);
  cursor: pointer;
  z-index: 50;
}

/* ---------- Lead detail overlay ---------- */
.lead-detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  overflow-anchor: none;
  display: flex;
  flex-direction: column;
}

.lead-detail-overlay.open { transform: translateX(0); }

@media (min-width: 901px) {
  .lead-detail-overlay { left: auto; width: 460px; box-shadow: -10px 0 30px rgba(46,16,101,0.15); }
}

.ld-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ld-back {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

.ld-header-actions { display: flex; gap: 9px; }

.ld-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.ld-icon:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.22);
  filter: brightness(1.06);
}

.ld-contact {
  background: var(--card-bg);
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.ld-name { font-size: 19px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.ld-contact-row {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ld-contact-row a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }

.ld-tabs {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 4px;
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
  background: var(--card-bg, #ffffff);
  padding: 0 12px;
  border-bottom: 1px solid var(--border, #e5d9fb);
  overflow-x: auto;
  flex-shrink: 0;
  visibility: visible;
  opacity: 1;
}

.ld-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  padding: 12px 12px;
  min-height: 44px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
  visibility: visible;
  opacity: 1;
}

.ld-tab.active { color: var(--primary-dark, #6d28d9); border-bottom-color: var(--primary, #7c3aed); }

.ld-body { padding: 16px; flex: 1; }

.ld-section { margin-bottom: 20px; }
.ld-section-title { font-size: 11px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }

.ld-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.ld-status-row .ld-status-badge { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.ld-change-status-btn { background: var(--primary); color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-size: 12px; font-weight: 700; cursor: pointer; }

.ld-followup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.ld-flags { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-flag-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}
.ld-flag-chip.active { color: #fff; border-color: transparent; }

.ld-assign-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}

.ld-assign-name { font-weight: 700; font-size: 13px; flex: 1; }
.ld-reassign-btn { background: #0891b2; color: #fff; border: none; border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; }

.ld-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ld-edit-field { display: flex; flex-direction: column; gap: 4px; }
.ld-edit-field label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.ld-edit-field input, .ld-edit-field select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-family: inherit;
}
.ld-edit-field input:disabled {
  background: #f3f0fb;
  color: var(--text-muted);
  cursor: not-allowed;
}

.reminder-popup-modal {
  border-top: 6px solid #ef4444;
  max-width: 460px;
}

.reminder-popup-warning {
  background: #fef2f2;
  color: #991b1b;
  font-weight: 800;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

.reminder-popup-lead {
  font-size: 14px;
  margin-bottom: 12px;
}

.reminder-popup-lead b { color: var(--primary-dark); }

.reminder-lead-box {
  background: #f9fafb;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 12px 14px;
}

.reminder-lead-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 15px;
}

.reminder-lead-header .status-pill {
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

.reminder-lead-row {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.reminder-lead-row b { color: var(--text-main, #222); }

.reminder-history-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  margin: 10px 0 6px;
}

.reminder-history-list {
  max-height: 130px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reminder-history-item {
  font-size: 12px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 6px 8px;
}

.reminder-history-when {
  display: block;
  color: var(--text-muted);
  font-size: 10.5px;
  margin-bottom: 2px;
}

.reminder-history-what { color: #333; }

.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 24px 14px;
  padding: 10px 16px;
  background: #ecf5ff;
  border: 1px solid #b8ddff;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark, #4c1d95);
}

.bulk-col { width: 34px; text-align: center; }
.bulk-col input, .lead-select-cb { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

.bulk-assign-radio {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}
.bulk-assign-radio input { margin-top: 3px; accent-color: var(--primary); }
.bulk-assign-radio b { color: var(--text-main, #222); }

.ld-locked-note {
  display: inline-block;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}

.ld-info-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.ld-info-item { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.ld-info-item:last-child { border-bottom: none; }
.ld-info-item .ld-info-label { color: var(--text-muted); }
.ld-info-item .ld-info-value { font-weight: 600; color: var(--text); text-align: right; }

.ld-history-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ld-history-item:last-child { border-bottom: none; }
.ld-history-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.ld-history-content { flex: 1; min-width: 0; }
.ld-history-actor { font-size: 12px; color: var(--text-muted); display: flex; justify-content: space-between; margin-bottom: 5px; }
.ld-history-actor b { color: var(--text); }
.ld-history-time { color: var(--text-muted); font-weight: 600; }

.ld-hist-date-header {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 16px 0 8px;
}
.ld-hist-date-header:first-child { margin-top: 0; }

.ld-hist-filters { display: flex; gap: 18px; margin-bottom: 14px; }
.ld-hist-filter { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); font-weight: 600; cursor: pointer; }
.ld-hist-filter input { accent-color: var(--primary); }

.ld-hist-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  margin-top: 2px;
}
.ld-hist-card-title { font-size: 13px; color: var(--text); font-weight: 600; }
.ld-hist-card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.ld-hist-plain {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
}
.ld-hist-plain b { color: var(--text); }

#ldStatusSelect, #ldReassignSelect, #ldFollowUpInput {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background: #fff;
}

.ld-current-status-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.ld-cs-top { display: flex; align-items: center; gap: 8px; }
.ld-cs-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ld-cs-label { font-weight: 700; font-size: 14px; color: var(--text); }
.ld-cs-date { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.ld-quick-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.ld-quick-status-btn {
  padding: 12px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: center;
}
.ld-quick-status-btn.selected { border-color: transparent; }

.ld-more-statuses-toggle {
  border: none;
  background: none;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}

.ld-status-btn-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-status-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
}
.ld-status-btn.selected { border-color: transparent; }

.ld-stars { display: flex; gap: 6px; }
.ld-star { font-size: 26px; color: #d1d5db; cursor: pointer; line-height: 1; }
.ld-star.filled { color: #f59e0b; }

.ld-stars.readonly { gap: 3px; }
.ld-stars.readonly .ld-star { font-size: 16px; cursor: default; }

.lcm-rating { font-size: 11px; color: #f59e0b; letter-spacing: -1px; }

.ld-status-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0 4px;
}

.ld-notes-feed { display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 260px); overflow-y: auto; padding-bottom: 10px; }

.ld-note-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 10px 13px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}
.ld-note-text { font-size: 13px; color: var(--text); }
.ld-note-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.ld-note-input-row {
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 10px 0 4px;
}
.ld-note-input-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
}
.ld-note-input-row button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.ld-notes-textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

/* ---------- Hamburger / mobile drawer ---------- */
.hamburger-btn {
  display: none;
  border: none;
  background: transparent;
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 11, 38, 0.55);
  z-index: 199;
}

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

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-row { grid-template-columns: 1fr; }
  .source-columns { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .hamburger-btn { display: inline-block; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-logout { display: block; }

  .topbar { padding: 12px 14px; gap: 10px; flex-wrap: wrap; }
  .topbar-title { font-size: 16px; }
  .current-user { display: none; }
  .scope-select { font-size: 12px; padding: 6px 8px; flex: 1 1 auto; min-width: 0; }
  .scope-controls { order: 10; width: 100%; margin-top: 4px; }

  .dash-grid, .toolbar, .table-wrap, .attendance-widget, .dash-cd-section { padding-left: 14px; padding-right: 14px; }
  .dash-grid { padding: 14px; gap: 12px; }
  .table-wrap { margin-left: 14px; margin-right: 14px; }
  .toolbar { padding: 12px 14px; }
  .attendance-widget { margin-left: 14px; margin-right: 14px; }

  .form-grid { grid-template-columns: 1fr; }
  .source-columns { grid-template-columns: 1fr; }
  .dash-colorcards { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
  .dash-topstats { gap: 14px 22px; padding: 14px 16px; }
  .topstat .value { font-size: 18px; }

  .leads-table { font-size: 12px; }
  .leads-table th, .leads-table td { padding: 9px 10px; }

  .modal { padding: 16px 16px 18px; max-height: 92vh; }
  .modal-header h2 { font-size: 16px; }

  .calendar-strip { gap: 3px; }
  .cal-day { padding: 5px 1px; }
  .cal-day .cd-name { font-size: 8px; }
  .cal-day .cd-num { font-size: 11px; }

  #leadsView .toolbar { display: none; }
  #leadsView .table-wrap { display: none; }
  #leadsView .bulk-action-bar { margin: 0 14px 10px; flex-wrap: wrap; }
  .mobile-leads-bar { display: block; }
  .leads-cards { display: flex; flex-direction: column; gap: 12px; padding: 6px 14px 90px; }
  .mobile-fab { display: flex; align-items: center; justify-content: center; }
}

@media (max-width: 480px) {
  .login-card { padding: 26px 20px; max-width: 100%; }
  .dash-colorcards { grid-template-columns: 1fr 1fr; }
  .row-actions { flex-direction: column; }
  .stat-chip { font-size: 12px; padding: 6px 12px; }
  .radar-wrap svg { width: 170px; height: 170px; }

  .welcome-modal { max-width: 100%; padding: 22px 16px 20px; }
  .welcome-avatar { width: 125px; height: 220px; }
  .welcome-title { font-size: 19px; }
  .welcome-msg { font-size: 13px; }
}
