/* ==========================================================================
   WFM Lead CRM - application theme
   Light-sidebar admin layout inspired by the "Analytic" dashboard reference.
   All colours/spacing come from the tokens below.
   ========================================================================== */

:root {
  --crm-primary: #884ffb;
  --crm-primary-rgb: 136, 79, 251;
  --crm-primary-dark: #6f35e6;
  --crm-primary-soft: #f2ecff;
  --crm-success: #1cbb8c;
  --crm-success-soft: #e3f7f0;
  --crm-warning: #ff9f43;
  --crm-warning-soft: #fff2e5;
  --crm-danger: #f65365;
  --crm-danger-soft: #feecee;
  --crm-info: #2f90f7;
  --crm-info-soft: #e6f2fe;
  --crm-secondary: #8890b5;
  --crm-secondary-soft: #eef0f7;

  --crm-heading: #2e4765;
  --crm-text: #6c7489;
  --crm-muted: #9aa1b5;
  --crm-border: #e9ecf4;
  --crm-body-bg: #f4f5fb;
  --crm-card-bg: #ffffff;
  --crm-sidebar-bg: #ffffff;
  --crm-sidebar-width: 270px;
  --crm-header-height: 72px;
  --crm-radius: 14px;
  --crm-radius-sm: 8px;
  --crm-shadow: 0 4px 24px rgba(46, 71, 101, 0.06);
  --crm-shadow-lg: 0 12px 40px rgba(46, 71, 101, 0.12);
  --crm-font: 'Mulish', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --bs-primary: var(--crm-primary);
  --bs-primary-rgb: var(--crm-primary-rgb);
  --bs-body-font-family: var(--crm-font);
  --bs-body-color: var(--crm-text);
  --bs-body-bg: var(--crm-body-bg);
  --bs-border-color: var(--crm-border);
  --bs-link-color: var(--crm-primary);
  --bs-link-color-rgb: var(--crm-primary-rgb);
  --bs-link-hover-color: var(--crm-primary-dark);
}

html, body { height: 100%; }

body {
  font-family: var(--crm-font);
  font-size: 0.9rem;
  color: var(--crm-text);
  background: var(--crm-body-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  color: var(--crm-heading);
  font-weight: 800;
}

a { text-decoration: none; }
.text-muted { color: var(--crm-muted) !important; }
.text-heading { color: var(--crm-heading) !important; }
.fw-extrabold { font-weight: 800 !important; }
.small-caps { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--crm-sidebar-width);
  background: var(--crm-sidebar-bg);
  border-right: 1px solid var(--crm-border);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.25s ease, width 0.25s ease;
}

.app-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--crm-sidebar-width);
  display: flex;
  flex-direction: column;
  transition: margin-left 0.25s ease;
}

.app-content { flex: 1; padding: 28px 30px 10px; }

.app-footer {
  padding: 18px 30px;
  font-size: 0.8rem;
  color: var(--crm-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-backdrop { display: none; }

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar-brand {
  height: var(--crm-header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 26px;
  flex-shrink: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--crm-primary), #b18cff);
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(var(--crm-primary-rgb), 0.35);
  flex-shrink: 0;
}

.brand-text { line-height: 1.1; }
.brand-text strong { display: block; color: var(--crm-heading); font-size: 1.05rem; font-weight: 900; }
.brand-text span { font-size: 0.72rem; color: var(--crm-muted); font-weight: 600; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 16px 24px;
  scrollbar-width: thin;
}

.nav-section {
  margin: 22px 12px 8px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--crm-muted);
}

.nav-section:first-child { margin-top: 8px; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: 10px;
  color: var(--crm-text);
  font-weight: 700;
  font-size: 0.88rem;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link i { font-size: 1.1rem; width: 22px; text-align: center; color: var(--crm-secondary); transition: color 0.15s ease; }
.sidebar-link:hover { color: var(--crm-primary); background: #faf8ff; }
.sidebar-link:hover i { color: var(--crm-primary); }

.sidebar-link.active {
  color: var(--crm-primary);
  background: var(--crm-primary-soft);
}

.sidebar-link.active i { color: var(--crm-primary); }

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: -16px;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--crm-primary);
}

.sidebar-link.disabled { opacity: 0.55; cursor: default; pointer-events: none; }
.sidebar-link .badge { margin-left: auto; font-size: 0.62rem; }

.sidebar-footer {
  margin: 0 16px 16px;
  padding: 16px;
  border-radius: var(--crm-radius);
  background: linear-gradient(135deg, var(--crm-primary-soft), #fbf9ff);
  font-size: 0.78rem;
}

.sidebar-footer strong { color: var(--crm-heading); display: block; font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.app-header {
  height: var(--crm-header-height);
  background: #fff;
  border-bottom: 1px solid var(--crm-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 0;
  background: var(--crm-body-bg);
  color: var(--crm-heading);
  display: inline-grid;
  place-items: center;
  font-size: 1.15rem;
  position: relative;
}

.header-icon-btn:hover { background: var(--crm-primary-soft); color: var(--crm-primary); }

.header-icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--crm-danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
}

.org-switcher .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--crm-border);
  background: #fff;
  border-radius: 12px;
  padding: 6px 14px 6px 6px;
  color: var(--crm-heading);
  max-width: 340px;
}

.org-switcher .dropdown-toggle:hover, .org-switcher .dropdown-toggle:focus { border-color: rgba(var(--crm-primary-rgb), 0.45); }
.org-switcher .dropdown-toggle::after { margin-left: auto; color: var(--crm-muted); }

.org-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
  font-weight: 900;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.org-switcher .org-label { line-height: 1.15; text-align: left; min-width: 0; }
.org-switcher .org-label small { display: block; font-size: 0.66rem; color: var(--crm-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.org-switcher .org-label span { display: block; font-weight: 800; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.org-switcher .dropdown-menu { min-width: 300px; }
.org-option { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 12px; border-radius: 8px; text-align: left; }
.org-option:hover { background: var(--crm-body-bg); }
.org-option.current { background: var(--crm-primary-soft); }
.org-option .meta { line-height: 1.2; min-width: 0; }
.org-option .meta strong { display: block; color: var(--crm-heading); font-size: 0.86rem; }
.org-option .meta span { font-size: 0.74rem; color: var(--crm-muted); }

.profile-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--crm-primary), #b18cff);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.72rem; }
.profile-toggle .who { line-height: 1.2; }
.profile-toggle .who strong { display: block; color: var(--crm-heading); font-size: 0.86rem; }
.profile-toggle .who span { font-size: 0.74rem; color: var(--crm-muted); }

.dropdown-menu {
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  box-shadow: var(--crm-shadow-lg);
  padding: 8px;
  font-size: 0.86rem;
}

.dropdown-item { border-radius: 8px; padding: 8px 12px; color: var(--crm-text); font-weight: 600; }
.dropdown-item i { width: 20px; color: var(--crm-secondary); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--crm-body-bg); color: var(--crm-primary); }
.dropdown-item:hover i { color: var(--crm-primary); }
.dropdown-header { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 800; color: var(--crm-muted); }

/* --------------------------------------------------------------------------
   Page header / breadcrumbs
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 1.45rem; margin: 0 0 4px; }
.breadcrumb { margin: 0; font-size: 0.8rem; font-weight: 600; }
.breadcrumb-item a { color: var(--crm-muted); }
.breadcrumb-item.active { color: var(--crm-primary); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Cards & widgets
   -------------------------------------------------------------------------- */
.card {
  border: 0;
  border-radius: var(--crm-radius);
  box-shadow: var(--crm-shadow);
  background: var(--crm-card-bg);
  margin-bottom: 24px;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--crm-border);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header:first-child { border-radius: var(--crm-radius) var(--crm-radius) 0 0; }
.card-title { margin: 0; font-size: 1rem; font-weight: 800; color: var(--crm-heading); }
.card-subtitle { font-size: 0.78rem; color: var(--crm-muted); margin: 2px 0 0; }
.card-body { padding: 22px 24px; }
.card-footer { background: transparent; border-top: 1px solid var(--crm-border); padding: 14px 24px; }

.stat-card { padding: 22px 22px; display: flex; align-items: center; gap: 16px; height: calc(100% - 24px); }
.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.stat-card .stat-label { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--crm-muted); margin-bottom: 4px; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 900; color: var(--crm-heading); line-height: 1.1; }
.stat-card .stat-meta { font-size: 0.76rem; margin-top: 4px; }

.bg-soft-primary { background: var(--crm-primary-soft) !important; color: var(--crm-primary) !important; }
.bg-soft-success { background: var(--crm-success-soft) !important; color: var(--crm-success) !important; }
.bg-soft-warning { background: var(--crm-warning-soft) !important; color: var(--crm-warning) !important; }
.bg-soft-danger { background: var(--crm-danger-soft) !important; color: var(--crm-danger) !important; }
.bg-soft-info { background: var(--crm-info-soft) !important; color: var(--crm-info) !important; }
.bg-soft-secondary { background: var(--crm-secondary-soft) !important; color: var(--crm-secondary) !important; }

.welcome-card {
  background: linear-gradient(120deg, var(--crm-primary) 0%, #a274ff 60%, #c3a6ff 100%);
  color: #fff;
  overflow: hidden;
  position: relative;
}

.welcome-card h2, .welcome-card h3 { color: #fff; }
.welcome-card p { color: rgba(255, 255, 255, 0.85); }
.welcome-card::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.welcome-card::before {
  content: '';
  position: absolute;
  right: 80px;
  bottom: -90px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.welcome-card .card-body { position: relative; z-index: 1; }

.detail-list { margin: 0; }
.detail-list dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800; color: var(--crm-muted); margin-bottom: 2px; }
.detail-list dd { color: var(--crm-heading); font-weight: 600; margin-bottom: 16px; word-break: break-word; }

.permission-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--crm-body-bg);
  font-size: 0.74rem;
  font-weight: 700;
  margin: 0 6px 6px 0;
  color: var(--crm-heading);
}

.permission-chip i { color: var(--crm-success); }

.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  background: var(--crm-primary-soft);
  color: var(--crm-primary);
}

.empty-state h5 { margin-bottom: 6px; }

.timeline-mini { list-style: none; padding: 0; margin: 0; }
.timeline-mini li { position: relative; padding: 0 0 16px 24px; }
.timeline-mini li::before { content: ''; position: absolute; left: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--crm-primary); box-shadow: 0 0 0 4px var(--crm-primary-soft); }
.timeline-mini li::after { content: ''; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--crm-border); }
.timeline-mini li:last-child::after { display: none; }
.timeline-mini .t-title { font-weight: 700; color: var(--crm-heading); font-size: 0.84rem; }
.timeline-mini .t-meta { font-size: 0.74rem; color: var(--crm-muted); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */
.table-crm { margin: 0; font-size: 0.86rem; }
.table-crm > :not(caption) > * > * { padding: 14px 18px; border-color: var(--crm-border); }
.table-crm thead th {
  background: #f8f9fd;
  color: var(--crm-secondary);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  border-bottom: 0;
  white-space: nowrap;
}

.table-crm thead th:first-child { border-top-left-radius: 10px; }
.table-crm thead th:last-child { border-top-right-radius: 10px; }
.table-crm tbody tr:hover > * { background: #fbfaff; }
.table-crm .cell-title { font-weight: 800; color: var(--crm-heading); }
.table-crm .cell-sub { font-size: 0.76rem; color: var(--crm-muted); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.search-input { position: relative; min-width: 240px; }
.search-input i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--crm-muted); }
.search-input .form-control { padding-left: 38px; }

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */
.badge { font-weight: 800; padding: 0.42em 0.75em; border-radius: 6px; letter-spacing: 0.02em; }
.badge-soft-primary { background: var(--crm-primary-soft); color: var(--crm-primary); }
.badge-soft-success { background: var(--crm-success-soft); color: var(--crm-success); }
.badge-soft-warning { background: var(--crm-warning-soft); color: #e3871f; }
.badge-soft-danger { background: var(--crm-danger-soft); color: var(--crm-danger); }
.badge-soft-info { background: var(--crm-info-soft); color: var(--crm-info); }
.badge-soft-secondary { background: var(--crm-secondary-soft); color: var(--crm-secondary); }

/* --------------------------------------------------------------------------
   Buttons & forms
   -------------------------------------------------------------------------- */
.btn { font-weight: 700; border-radius: var(--crm-radius-sm); padding: 0.55rem 1.1rem; font-size: 0.86rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.78rem; }
.btn-lg { padding: 0.75rem 1.4rem; font-size: 0.95rem; }
.btn i { margin-right: 4px; }
.btn-icon i { margin: 0; }

.btn-primary {
  --bs-btn-bg: var(--crm-primary);
  --bs-btn-border-color: var(--crm-primary);
  --bs-btn-hover-bg: var(--crm-primary-dark);
  --bs-btn-hover-border-color: var(--crm-primary-dark);
  --bs-btn-active-bg: var(--crm-primary-dark);
  --bs-btn-active-border-color: var(--crm-primary-dark);
  --bs-btn-disabled-bg: var(--crm-primary);
  --bs-btn-disabled-border-color: var(--crm-primary);
  box-shadow: 0 6px 14px rgba(var(--crm-primary-rgb), 0.25);
}

.btn-outline-primary {
  --bs-btn-color: var(--crm-primary);
  --bs-btn-border-color: rgba(var(--crm-primary-rgb), 0.45);
  --bs-btn-hover-bg: var(--crm-primary);
  --bs-btn-hover-border-color: var(--crm-primary);
  --bs-btn-active-bg: var(--crm-primary);
  --bs-btn-active-border-color: var(--crm-primary);
}

.btn-light { --bs-btn-bg: var(--crm-body-bg); --bs-btn-border-color: var(--crm-body-bg); --bs-btn-color: var(--crm-heading); --bs-btn-hover-bg: var(--crm-primary-soft); --bs-btn-hover-border-color: var(--crm-primary-soft); --bs-btn-hover-color: var(--crm-primary); }
.btn-soft-danger { background: var(--crm-danger-soft); color: var(--crm-danger); border: 0; }
.btn-soft-danger:hover { background: var(--crm-danger); color: #fff; }
.btn-soft-success { background: var(--crm-success-soft); color: var(--crm-success); border: 0; }
.btn-soft-success:hover { background: var(--crm-success); color: #fff; }

.form-label { font-weight: 700; color: var(--crm-heading); font-size: 0.82rem; margin-bottom: 6px; }
.form-label .req { color: var(--crm-danger); }
.form-control, .form-select {
  border-radius: var(--crm-radius-sm);
  border-color: var(--crm-border);
  padding: 0.6rem 0.9rem;
  font-size: 0.88rem;
  color: var(--crm-heading);
}

/* Keep room for the dropdown arrow (the shorthand padding above would otherwise remove it). */
.form-select { padding-right: 2.4rem; background-position: right 0.85rem center; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.form-select-sm { padding: 0.35rem 2.1rem 0.35rem 0.75rem; background-position: right 0.65rem center; font-size: 0.82rem; }
.form-control-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.form-control::placeholder { color: #b5bacb; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--crm-primary-rgb), 0.6); box-shadow: 0 0 0 0.2rem rgba(var(--crm-primary-rgb), 0.12); }
.form-check-input:checked { background-color: var(--crm-primary); border-color: var(--crm-primary); }
.form-text { color: var(--crm-muted); font-size: 0.76rem; }
.invalid-feedback { font-weight: 600; font-size: 0.78rem; }
.input-group-text { background: var(--crm-body-bg); border-color: var(--crm-border); color: var(--crm-muted); }

.form-section-title { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--crm-primary); margin: 6px 0 16px; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert { border: 0; border-radius: 12px; font-weight: 600; font-size: 0.86rem; display: flex; gap: 10px; align-items: flex-start; }
.alert i { font-size: 1.1rem; line-height: 1.2; }
.alert-success { background: var(--crm-success-soft); color: #128a66; }
.alert-danger { background: var(--crm-danger-soft); color: #d63649; }
.alert-warning { background: var(--crm-warning-soft); color: #c06a14; }
.alert-info { background: var(--crm-info-soft); color: #1b6fc8; }
.alert .btn-close { margin-left: auto; padding: 0.4rem; font-size: 0.7rem; }

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */
.pagination { margin: 0; gap: 4px; }
.page-link { border: 0; border-radius: 8px !important; color: var(--crm-text); font-weight: 700; min-width: 34px; text-align: center; font-size: 0.82rem; }
.page-item.active .page-link { background: var(--crm-primary); color: #fff; }
.page-link:hover { background: var(--crm-primary-soft); color: var(--crm-primary); }

/* --------------------------------------------------------------------------
   Authentication pages
   -------------------------------------------------------------------------- */
.auth-wrapper { min-height: 100vh; display: flex; background: #fff; }

.auth-aside {
  flex: 0 0 44%;
  background: linear-gradient(150deg, #6f35e6 0%, var(--crm-primary) 45%, #b18cff 100%);
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-aside::before, .auth-aside::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, 0.08); }
.auth-aside::before { width: 420px; height: 420px; right: -140px; top: -120px; }
.auth-aside::after { width: 300px; height: 300px; left: -100px; bottom: -110px; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand-mark { background: #fff; color: var(--crm-primary); box-shadow: none; }
.auth-aside h1 { color: #fff; font-size: 2.1rem; font-weight: 900; line-height: 1.2; }
.auth-aside p { color: rgba(255, 255, 255, 0.85); font-size: 0.98rem; }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.auth-feature i { width: 38px; height: 38px; border-radius: 10px; background: rgba(255, 255, 255, 0.16); display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
.auth-feature strong { display: block; color: #fff; }
.auth-feature span { font-size: 0.84rem; color: rgba(255, 255, 255, 0.78); }

.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--crm-body-bg); }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 18px; box-shadow: var(--crm-shadow-lg); padding: 40px 38px; }
.auth-card.wide { max-width: 640px; }
.auth-card h2 { font-size: 1.5rem; margin-bottom: 6px; }
.auth-card .lead-text { color: var(--crm-muted); margin-bottom: 28px; }

.org-choice { display: block; cursor: pointer; margin-bottom: 12px; }
.org-choice input { position: absolute; opacity: 0; pointer-events: none; }
.org-choice .choice-body {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--crm-border);
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.org-choice .choice-body:hover { border-color: rgba(var(--crm-primary-rgb), 0.45); }
.org-choice input:checked + .choice-body { border-color: var(--crm-primary); background: #fbf9ff; }
.org-choice input:focus-visible + .choice-body { box-shadow: 0 0 0 0.2rem rgba(var(--crm-primary-rgb), 0.18); }
.org-choice .check { margin-left: auto; color: var(--crm-border); font-size: 1.3rem; }
.org-choice input:checked + .choice-body .check { color: var(--crm-primary); }

.password-toggle { cursor: pointer; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (min-width: 1200px) {
  body.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
  body.sidebar-collapsed .app-main { margin-left: 0; }
}

@media (max-width: 1199.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--crm-shadow-lg); }
  .app-main { margin-left: 0; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(30, 30, 60, 0.35); z-index: 1035; }
}

@media (max-width: 991.98px) {
  .auth-aside { display: none; }
}

@media (max-width: 767.98px) {
  .app-header { padding: 0 16px; gap: 10px; }
  .app-content { padding: 20px 16px 8px; }
  .app-footer { padding: 16px; }
  .profile-toggle .who { display: none; }
  .org-switcher .dropdown-toggle { max-width: 190px; }
  .org-switcher .org-label small { display: none; }
  .auth-card { padding: 30px 22px; }
  /* Filter bars: controls share the full width instead of overflowing. */
  .page-header > .filter-bar, .card .filter-bar { width: 100%; }
  .filter-bar > .form-select, .filter-bar > .form-control, .filter-bar > [data-custom] { flex: 1 1 140px; width: auto !important; max-width: none !important; min-width: 0; }
  .filter-bar > [data-custom] > .form-control { flex: 1 1 0; min-width: 0; }
  .filter-bar > .search-input { flex: 1 1 100%; min-width: 0; }
  .filter-bar > .btn { flex: 0 0 auto; }
  .card-body { padding: 18px; }
  .card-header { padding: 16px 18px; }
}

/* Settings navigation */
.settings-nav .nav-link { color: var(--crm-text); font-weight: 700; border-radius: 10px; padding: 9px 14px; font-size: 0.86rem; display: flex; gap: 10px; align-items: center; }
.settings-nav .nav-link i { color: var(--crm-secondary); }
.settings-nav .nav-link:hover { background: var(--crm-body-bg); color: var(--crm-primary); }
.settings-nav .nav-link.active { background: var(--crm-primary-soft); color: var(--crm-primary); }
.settings-nav .nav-link.active i { color: var(--crm-primary); }
a.stat-card:hover { box-shadow: var(--crm-shadow-lg); }

/* Tabs */
.crm-tabs { gap: 4px; flex-wrap: wrap; }
.crm-tabs .nav-link { border: 0; background: none; color: var(--crm-text); font-weight: 700; font-size: 0.86rem; padding: 8px 14px; border-radius: 10px; }
.crm-tabs .nav-link:hover { color: var(--crm-primary); background: #faf8ff; }
.crm-tabs .nav-link.active { color: var(--crm-primary); background: var(--crm-primary-soft); }
.crm-tabs .count { display: inline-block; min-width: 22px; padding: 1px 7px; margin-left: 4px; border-radius: 10px; background: rgba(46, 71, 101, 0.07); font-size: 0.72rem; text-align: center; }
.crm-tabs .nav-link.active .count { background: rgba(var(--crm-primary-rgb), 0.15); }

/* Bulk action bar */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 24px; background: #fbfaff; border-bottom: 1px solid var(--crm-border); }

/* Lead detail */
.contact-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lead-timeline { list-style: none; padding: 0; margin: 0; }
.lead-timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 20px; }
.lead-timeline li::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--crm-border); }
.lead-timeline li:last-child::before { display: none; }
.lead-timeline .t-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; font-size: 1rem; }
.lead-timeline .t-body { flex: 1; min-width: 0; }
.lead-timeline .t-notes { margin-top: 6px; padding: 10px 14px; border-radius: 10px; background: var(--crm-body-bg); color: var(--crm-heading); font-size: 0.86rem; }
.lead-timeline li.is-interaction .t-notes { background: #f8f5ff; }
.lead-timeline .t-meta { font-size: 0.74rem; color: var(--crm-muted); margin-top: 4px; }
.list-group-item { border-color: var(--crm-border); }
.modal-content .form-section-title { margin-bottom: 4px; }

/* Import wizard steps */
.import-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.import-steps .step { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: #fff; box-shadow: var(--crm-shadow); color: var(--crm-muted); font-weight: 700; font-size: 0.86rem; }
.import-steps .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--crm-body-bg); font-size: 0.8rem; }
.import-steps .step.current { color: var(--crm-primary); }
.import-steps .step.current .num { background: var(--crm-primary); color: #fff; }
.import-steps .step.done { color: var(--crm-success); }
.import-steps .step.done .num { background: var(--crm-success-soft); color: var(--crm-success); }

/* Charts */
.chart-box { position: relative; height: 280px; }
.chart-legend { display: flex; gap: 14px; font-size: 0.78rem; font-weight: 700; color: var(--crm-text); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.meter { height: 6px; border-radius: 3px; background: var(--crm-secondary-soft); overflow: hidden; display: inline-block; width: 70px; margin-right: 6px; vertical-align: middle; }
.meter span { display: block; height: 100%; background: var(--crm-success); border-radius: 3px; }

/* Notifications */
.notification-row { display: flex; gap: 14px; align-items: center; width: 100%; border: 0; background: none; padding: 0; text-align: left; }
.notification-unread { background: #fbf9ff; }
.notification-unread .fw-bold::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--crm-primary); margin-right: 8px; vertical-align: 1px; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; text-align: left; }
.notif-item:hover { background: var(--crm-body-bg); }
.notif-item .title { font-weight: 700; color: var(--crm-heading); font-size: 0.84rem; display: block; }
.notif-item .meta { font-size: 0.74rem; color: var(--crm-muted); }

/* Brand logo */
.brand-logo { width: 40px; height: 40px; display: block; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(29, 78, 216, 0.25)); }
.brand-tile { width: 52px; height: 52px; border-radius: 14px; background: #fff; display: grid; place-items: center; flex-shrink: 0; }
.brand-tile .brand-logo { width: 38px; height: 38px; filter: none; }
