@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* AscendAI Brand Colors */
  --primary-teal:    #02968f;
  --dark-teal:       #002d2b;
  --bright-aqua:     #52eae0;
  --light-teal:      #d9efee;
  --berry:           #9f0064;

  /* UI Tokens (mapped from brand) */
  --bg-primary:      #f5fafa;
  --bg-card:         #FFFFFF;
  --bg-card-hover:   #d9efee;
  --bg-input:        #d9efee;
  --bg-sidebar:      #d9efee;
  --border:          #02968f;
  --border-light:    #52eae0;
  --accent:          #02968f;
  --accent-mid:      #02968f;
  --accent-dim:      rgba(2, 150, 143, 0.12);
  --accent-hover:    #006d68;
  --magenta:         #9f0064;
  --magenta-dim:     rgba(159, 0, 100, 0.1);
  --gold:            #52eae0;
  --gold-hover:      #2dd4ce;
  --text-primary:    #002d2b;
  --text-secondary:  #005a54;
  --text-muted:      #7a8f8c;
  --success:         #065f2e;
  --success-dim:     rgba(6, 95, 46, 0.1);
  --warning:         #92400e;
  --warning-dim:     rgba(146, 64, 14, 0.1);
  --error:           #991b1b;
  --error-dim:       rgba(153, 27, 27, 0.1);
  --info:            #02968f;
  --info-dim:        rgba(2, 150, 143, 0.1);
  --radius:          14px;
  --radius-sm:       8px;
  --shadow:          0px 20px 40px rgba(0,45,43,0.08);
  --shadow-hover:    0px 24px 48px rgba(0,45,43,0.12);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name, .page-title, .stat-value, .sidebar-title {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

/* ── Loading overlay ────────────────────────────────────────── */
#page-loading {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Header ─────────────────────────────────────────────────── */
.portal-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.5px;
  color: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.header-divider {
  color: var(--border-light);
  font-size: 18px;
}

.client-name {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-email {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Navigation tabs ────────────────────────────────────────── */
.portal-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav-tab:hover { color: var(--text-primary); }

.nav-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Client Switcher (admin only) ───────────────────────────── */
.client-switcher {
  margin-left: auto;
  display: flex;
  align-items: center;
  padding: 6px 0;
}

.client-switcher select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--accent-dim);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 32px 6px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23005a54' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.client-switcher select:hover {
  border-color: var(--accent);
}

.client-switcher select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* ── Page layout ────────────────────────────────────────────── */
.page-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Stat tiles ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.stat-tile:hover {
  border-color: var(--accent-dim);
  box-shadow: var(--shadow-hover);
}

.stat-tile::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -1px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Section grid ───────────────────────────────────────────── */
.sections-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .sections-grid { grid-template-columns: 1fr; }
}

/* ── Quick links ────────────────────────────────────────────── */
.quick-links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.quick-link:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(31, 58, 147, 0.12);
}

.quick-link-icon {
  font-size: 16px;
  flex-shrink: 0;
}

/* ── Approvals ──────────────────────────────────────────────── */
.approval-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.approval-item:last-child { border-bottom: none; }

.approval-info { flex: 1; min-width: 0; }

.approval-label { font-size: 14px; color: var(--text-primary); }
.approval-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.approval-type-badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  margin-right: 6px;
}

.approval-links {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.approval-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.approval-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

.approval-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--error, #e74c3c);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

.btn-approve {
  padding: 8px 20px;
  border-radius: var(--radius-sm, 6px);
  background: var(--success, #2ecc71);
  color: #fff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.btn-approve:hover { opacity: 0.85; }

.btn-approve:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.approval-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Reports ────────────────────────────────────────────────── */
.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.report-item:last-child { border-bottom: none; }
.report-item--full {
  align-items: flex-start;
  gap: 12px;
}
.report-item--full .btn { flex-shrink: 0; margin-left: auto; }
.report-title { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.report-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.report-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.45;
  max-width: 42rem;
}
.report-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Campaigns ──────────────────────────────────────────────── */
.campaign-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.campaign-row:last-child { border-bottom: none; }
.campaign-name { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.campaign-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.campaign-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ── Status pills ───────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.pill-active   { background: var(--success-dim); color: var(--success); }
.pill-paused   { background: var(--warning-dim); color: var(--warning); }
.pill-inactive { background: var(--bg-input); color: var(--text-muted); }

/* client_activity_status pills */
.status-10 { background: rgba(30,58,138,0.1);  color: #1e3a8a; }
.status-20 { background: rgba(6,95,46,0.1);    color: #065f2e; }
.status-30 { background: rgba(15,118,110,0.1); color: #0f766e; }
.status-40 { background: rgba(146,64,14,0.1);  color: #92400e; }
.status-50 { background: rgba(153,27,27,0.1);  color: #991b1b; }
.status-xx { background: rgba(139,143,168,0.1); color: #8b8fa8; }

/* campaign pill */
.pill-campaign {
  background: var(--magenta-dim);
  color: var(--magenta);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(31, 58, 147, 0.25);
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-primary:hover { 
  background: var(--accent-hover); 
  color: #fff;
  box-shadow: 0 4px 16px rgba(31, 58, 147, 0.35);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border-light);
  color: var(--text-secondary);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-orange {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}
.btn-orange:hover {
  background: var(--gold-hover);
  border-color: var(--gold-hover);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.35);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-logout:hover { border-color: var(--error); color: var(--error); }

/* ── Leads page layout ──────────────────────────────────────── */
.leads-page-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  min-height: calc(100vh - 140px);
}

/* ── Left sidebar ────────────────────────────────────────────── */
.leads-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 28px 20px 20px;
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 2px;
}

#status-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.sidebar-total-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 20px;
}

.sidebar-total-num {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.sidebar-total-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.status-bar-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  border: 1.5px solid transparent;
  user-select: none;
}

.status-bar-item:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(2, 150, 143, 0.12);
}

.status-bar-item.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(2, 150, 143, 0.2);
}

.status-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.status-bar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.3;
}

.status-bar-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

.status-bar-track {
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.status-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 0.4s ease;
}

.fill-10 { background: var(--info); }
.fill-20 { background: var(--success); }
.fill-30 { background: var(--primary-teal); }
.fill-40 { background: var(--warning); }
.fill-50 { background: var(--error); }
.fill-xx { background: var(--text-muted); }

.sidebar-reset {
  margin-top: 20px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
  user-select: none;
}
.sidebar-reset:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(2, 150, 143, 0.2);
}

/* ── Main content area ──────────────────────────────────────── */
.leads-main {
  flex: 1;
  padding: 28px 28px 64px;
  min-width: 0;
}

/* ── Filter bar ─────────────────────────────────────────────── */
.leads-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

/* custom multi-select */
.ms-wrapper {
  position: relative;
}

.ms-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
  min-width: 140px;
}
.ms-trigger:hover { border-color: var(--accent); }
.ms-trigger.open { border-color: var(--accent); }

.ms-trigger-chevron {
  margin-left: auto;
  transition: transform 0.2s;
  font-size: 10px;
  opacity: 0.5;
}
.ms-trigger.open .ms-trigger-chevron { transform: rotate(180deg); }

.ms-trigger-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 100px;
  padding: 1px 5px;
  margin-left: 2px;
}

.ms-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(20,28,42,0.14);
  min-width: 220px;
  z-index: 200;
  display: none;
  overflow: hidden;
}

.ms-dropdown.open { display: block; }

.ms-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.12s;
  user-select: none;
}

.ms-option:hover { background: var(--bg-input); color: var(--text-primary); }
.ms-option.selected { color: var(--accent); font-weight: 500; }

.ms-checkbox {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
  font-size: 9px;
  color: #fff;
  background: var(--bg-card);
}

.ms-option.selected .ms-checkbox {
  background: var(--accent);
  border-color: var(--accent);
}

.leads-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Lead card grid ─────────────────────────────────────────── */
.leads-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 1100px) { .leads-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .leads-grid { grid-template-columns: 1fr; } }

/* ── Lead card ──────────────────────────────────────────────── */
.lead-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid transparent;
}

.lead-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  border-color: var(--border);
}

.lead-card--highlight {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2,150,143,0.25), var(--shadow-hover);
  animation: card-pulse 1s ease-in-out 2;
}

@keyframes card-pulse {
  0%   { box-shadow: 0 0 0 3px rgba(2,150,143,0.25), var(--shadow-hover); }
  50%  { box-shadow: 0 0 0 8px rgba(2,150,143,0.12), var(--shadow-hover); }
  100% { box-shadow: 0 0 0 3px rgba(2,150,143,0.25), var(--shadow-hover); }
}

.lead-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lead-card-header-text {
  flex: 1;
  min-width: 0;
}

.lead-avatar-wrap {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-input);
}

.lead-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lead-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-input);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
}

.lead-card-top {
  flex: 1;
}

.lead-name {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  line-height: 1.3;
}

/* Softr-style single-line header from client_lead_key */
.lead-name-key {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  margin-bottom: 0;
}

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

.lead-days-in-stage {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color:      var(--text-muted);
  font-weight: 500;
  margin-top: -4px;
}

.lead-days-icon {
  font-size: 12px;
  opacity: 0.55;
  line-height: 1;
}

.lead-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lead-meta-item {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.lead-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  margin-top: 2px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  width: 100%;
}

.status-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.status-select {
  background: #f4f2fc;
  border: 1px solid rgba(18, 47, 91, 0.1);
  border-radius: 10px;
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 2px rgba(20, 28, 42, 0.04);
}
.status-select:hover { border-color: rgba(18, 47, 91, 0.18); }
.status-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.status-feedback {
  font-size: 11px;
  font-weight: 600;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.status-feedback.saving { color: var(--text-muted); }
.status-feedback.saved  { color: var(--success); }
.status-feedback.error  { color: var(--error); }
.status-feedback.hidden { opacity: 0; pointer-events: none; }

/* ── Conversation toggle row ─────────────────────────────────── */
.conv-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.btn-conversation {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
  font-family: inherit;
}
.btn-conversation:hover { color: var(--accent); }

.btn-expand-conv {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 7px;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-expand-conv:hover { color: var(--accent); border-color: var(--accent); }

/* ── Inline conversation panel ───────────────────────────────── */
.conversation-panel {
  margin-top: 8px;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  display: none;
}
.conversation-panel.open { display: block; }

.conversation-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Scrollable content area inside inline panel */
.conv-content {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Message blocks ──────────────────────────────────────────── */
.conv-msg {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}
.conv-msg--client {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}
.conv-msg--lead {
  background: var(--success-dim);
  border-left: 3px solid var(--success);
}

.conv-msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}
.conv-msg-dir {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.conv-msg-sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.conv-msg-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}
.conv-msg-body {
  font-size: 12px;
  color: var(--text-primary);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.conv-divider {
  height: 1px;
  background: var(--border-light);
  margin: 4px 0;
}

/* ── Conversation full-screen modal ──────────────────────────── */
.conv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 42, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5100;
  padding: 20px;
}
.conv-modal-overlay.hidden { display: none; }

.conv-modal-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(20, 28, 42, 0.28);
  width: 100%;
  max-width: 900px;
  max-height: 95vh;
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.conv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.conv-modal-lead-name {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
}
.conv-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.15s;
  font-family: inherit;
}
.conv-modal-close:hover { color: var(--text-primary); }

.conv-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.conv-modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 14px 24px;
  flex-shrink: 0;
  background: var(--bg-input);
  border-radius: 0 0 var(--radius) var(--radius);
}
.conv-modal-actions {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.conv-action-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.conv-action-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ── Old filter-select (used on hub/reports pages) ───────────── */
.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--accent); }

/* old toolbar kept for hub */
.leads-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

/* ── Empty / loading states ─────────────────────────────────── */
.state-loading,
.state-empty,
.state-error {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.state-loading .spinner { margin: 0 auto 16px; }

.state-empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.state-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Login page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(124,92,252,0.15) 0%, transparent 70%),
    var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.login-logo {
  width: 52px;
  height: 52px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  margin: 0 auto 20px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.login-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.login-btn:hover { background: var(--accent-hover); }

.login-note {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Confirmation modal (solid card — no glass / undefined tokens) ─ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 24px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(20, 28, 42, 0.25);
  text-align: center;
}

.modal-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  line-height: 1.45;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 110px;
}

/* ── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.text-right { text-align: right; }
.full-width-card { grid-column: 1 / -1; }
