:root {
  --bg-canvas: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --bg-hover: #E2E8F0;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;

  --accent-bronze: #B45309;
  --accent-bronze-dark: #853702;
  --accent-bronze-light: #FEF3C7;
  --accent-gold: #D97706;
  --accent-gold-soft: #FDE68A;
  --accent-gold-glow: rgba(217, 119, 6, 0.12);

  --status-success-bg: #ECFDF5;
  --status-success-text: #047857;
  --status-success-border: #A7F3D0;

  --status-warn-bg: #FFFBEB;
  --status-warn-text: #B45309;
  --status-warn-border: #FDE68A;

  --status-danger-bg: #FEF2F2;
  --status-danger-text: #B91C1C;
  --status-danger-border: #FECACA;

  --status-info-bg: #EFF6FF;
  --status-info-text: #1D4ED8;
  --status-info-border: #BFDBFE;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 10px 25px -4px rgba(15, 23, 42, 0.08), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 12px 28px -4px rgba(180, 83, 9, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-drawer: -8px 0 32px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 13.5px;
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

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

.sidebar {
  width: 244px;
  background-color: var(--bg-sidebar);
  color: #E4E4E7;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #27272A;
  transition: width 0.2s ease;
  z-index: 40;
}

.sidebar.collapsed {
  width: 66px;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .conn-copy {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid #262629;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: linear-gradient(135deg, #B88B58, #8A6136);
  color: #FFF;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.03em;
}

.brand-copy {
  flex: 1;
  min-width: 0;
}

.brand-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #FAFAFA;
}

.brand-subtitle {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #A1A1AA;
  margin-top: 1px;
}

.sidebar-collapse-btn {
  background: transparent;
  border: 1px solid #2E2E32;
  color: #A1A1AA;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-collapse-btn:hover {
  color: #FFF;
  background: #27272A;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: #71717A;
  padding: 16px 18px 6px;
}

.sidebar-nav {
  flex: 1;
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: #A1A1AA;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #F4F4F5;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.18) 0%, rgba(217, 119, 6, 0.04) 100%);
  color: #FFFFFF;
  border-left: 3px solid var(--accent-gold);
  padding-left: 8px;
  font-weight: 600;
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: #1E293B;
  color: #CBD5E1;
}

.nav-badge-urgent {
  background: #B91C1C;
  color: #FEF2F2;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid #1E293B;
}

.crm-conn-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-live {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.dot-warn {
  background: #F59E0B;
}

.conn-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #F8FAFC;
}

.conn-sub {
  font-size: 10.5px;
  color: #94A3B8;
}

/* Main Content Wrapper */
.main-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Sticky Top Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xs);
  padding: 12px 24px 10px;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.mobile-menu-btn {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
}

.page-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-bronze);
}

.page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.global-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.global-search-input {
  width: 280px;
  padding: 7px 28px 7px 32px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.global-search-input:focus {
  border-color: var(--accent-bronze);
  box-shadow: 0 0 0 2px rgba(154, 112, 66, 0.12);
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}

.sync-status-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-label {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Filter Bar */
.header-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-group label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-select,
.filter-input-date {
  padding: 5px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  font-size: 12px;
  color: var(--text-primary);
  font-family: inherit;
  cursor: pointer;
}

.filter-select:focus,
.filter-input-date:focus {
  outline: none;
  border-color: var(--accent-bronze);
}

.preset-select {
  background-color: var(--accent-bronze-light);
  border-color: #DFCBB2;
  color: var(--accent-bronze-dark);
  font-weight: 600;
}

.custom-date-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 5px;
}

.btn-primary {
  background-color: var(--accent-bronze);
  color: #FFF;
  border-color: var(--accent-bronze-dark);
}

.btn-primary:hover {
  background-color: var(--accent-bronze-dark);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-whatsapp {
  background-color: #15803D;
  color: #FFF;
}

.btn-whatsapp:hover {
  background-color: #166534;
}

.btn-danger {
  background-color: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-bronze-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

/* Main Content Area */
.main-content {
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Alerts & Exceptions Strip */
.alerts-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.alert-pill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-bronze);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-xs);
}

.alert-pill-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.alert-pill-card.alert-danger {
  border-left-color: #D92D20;
  background: #FFFDFD;
}

.alert-pill-card.alert-warn {
  border-left-color: #DC6803;
}

.alert-pill-card.alert-info {
  border-left-color: #1570EF;
}

.alert-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.alert-count {
  font-size: 16px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.alert-danger .alert-count {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.alert-warn .alert-count {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
}

/* 10 KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 124px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-hover);
}

.kpi-card:hover::before {
  background: linear-gradient(90deg, var(--accent-bronze), var(--accent-gold));
}

.kpi-card.kpi-urgent {
  border-color: #FECACA;
  background: linear-gradient(180deg, #FFFFFF 0%, #FEF2F2 100%);
}

.kpi-card.kpi-urgent::before {
  background: #EF4444;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-icon-bubble {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-blue { background: #EFF6FF; color: #2563EB; }
.icon-green { background: #ECFDF5; color: #059669; }
.icon-amber { background: #FFFBEB; color: #D97706; }
.icon-red { background: #FEF2F2; color: #DC2626; }
.icon-teal { background: #F0FDFA; color: #0D9488; }
.icon-bronze { background: #FEF3C7; color: #B45309; }
.icon-purple { background: #FAF5FF; color: #7C3AED; }
.icon-emerald { background: #ECFDF5; color: #047857; }
.icon-indigo { background: #EEF2FF; color: #4F46E5; }
.icon-cyan { background: #ECFEFF; color: #0891B2; }

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-delta {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.delta-up {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.delta-down {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
}

.delta-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.kpi-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 25px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 8px 0 4px;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.kpi-urgent .kpi-value {
  color: var(--status-danger-text);
}

.kpi-foot {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

/* Section Cards & Chart Panels */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3col {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.panel-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.chart-box {
  position: relative;
  height: 270px;
  width: 100%;
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* Funnel Stages Component */
.funnel-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.funnel-row {
  display: grid;
  grid-template-columns: 190px 1fr 125px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.funnel-row:hover {
  background: var(--bg-subtle);
}

.funnel-stage-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.funnel-bar-track {
  height: 22px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.funnel-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #9A7042, #C29B61);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.funnel-metrics {
  text-align: right;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.funnel-conv-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Tables */
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.tabs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  background: var(--bg-surface);
}

.tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab-pill:hover {
  background: var(--bg-subtle);
}

.tab-pill.active {
  background: var(--text-primary);
  color: #FFF;
  border-color: var(--text-primary);
}

.tab-pill-count {
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
}

.tab-pill.active .tab-pill-count {
  background: rgba(255, 255, 255, 0.2);
  color: #FFF;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.crm-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.crm-table th {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: #FAF9F6;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.crm-table th:hover {
  color: var(--text-primary);
}

.crm-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  font-size: 12.5px;
}

.crm-table tbody tr {
  transition: background-color 0.1s ease;
}

.crm-table tbody tr:hover {
  background-color: #FAF8F4;
}

.crm-table tbody tr.row-overdue {
  background-color: #FFF9F9;
}

.lead-name-cell {
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lead-name-cell:hover {
  color: var(--accent-bronze);
  text-decoration: underline;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge-high {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border-color: var(--status-danger-border);
}

.badge-medium {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
  border-color: var(--status-warn-border);
}

.badge-low {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.badge-qualified {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border-color: var(--status-success-border);
}

.badge-contacted {
  background: var(--status-info-bg);
  color: var(--status-info-text);
  border-color: var(--status-info-border);
}

.badge-bronze {
  background: var(--accent-bronze-light);
  color: var(--accent-bronze-dark);
  border-color: #E2CGB4;
}

/* Source reconciliation table: wrap text so the lead count never falls off a narrow screen. */
.recon-table th,
.recon-table td {
  white-space: normal;
  vertical-align: top;
}
.recon-table th:last-child,
.recon-table td:last-child {
  text-align: right;
}

/* Architects / trade contacts (Lead_Status "Architects - Only RSS") */
.badge-trade {
  background: #F3E8FF;
  color: #6B21A8;
  border-color: #E9D5FF;
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(265px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-col {
  background: #EFECE6;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  max-height: 76vh;
}

.kanban-col.drag-over {
  border-color: var(--accent-bronze);
  background: var(--accent-bronze-light);
}

.kanban-col-won {
  border-top: 3px solid var(--status-success-text);
}

.kanban-col-lost {
  border-top: 3px solid #CF1322;
  background: #ECEAE4;
}

.kanban-col-header {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border-subtle);
  background: #F6F4EF;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kanban-col-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-col-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.kanban-cards-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 120px;
}

.kanban-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.kanban-card:hover {
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-sm);
}

.kanban-card.card-stale {
  border-left: 3px solid #D92D20;
}

.kanban-card-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kanban-card-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Slide-Over Lead Details Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.35);
  z-index: 90;
}

.lead-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 540px;
  max-width: 95vw;
  height: 100vh;
  background: var(--bg-surface);
  box-shadow: var(--shadow-drawer);
  z-index: 100;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-subtle);
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #FAF9F6;
}

.drawer-body {
  padding: 18px 20px 36px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.drawer-section {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--bg-surface);
}

.drawer-section-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.kv-item label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.kv-item div {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  margin-top: 2px;
  word-break: break-word;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline-item {
  padding: 9px 11px;
  border-left: 2px solid var(--accent-bronze);
  background: var(--bg-subtle);
  border-radius: 0 6px 6px 0;
  font-size: 12px;
}

.timeline-time {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 460px;
  max-width: 100%;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: #FAF9F6;
}

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

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

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: #FAF9F6;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: #18181B;
  color: #FFF;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--accent-gold);
}

.toast.toast-error {
  border-left-color: #EF4444;
}

.toast.toast-success {
  border-left-color: #10B981;
}

.error-banner {
  margin: 12px 24px 0;
  padding: 10px 14px;
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
  border: 1px solid var(--status-danger-border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}

/* Pagination */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Responsive Breakpoints */
@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-3col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .sidebar {
    position: fixed;
    left: -260px;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .top-header {
    padding: 10px 14px;
  }
  .main-content {
    padding: 14px;
  }
}

/* PIN Lock Overlay */
.pin-lock-overlay {
  position: fixed;
  inset: 0;
  background: #161618;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.pin-lock-card {
  background: #1F1F23;
  border: 1px solid #2E2E33;
  border-radius: 14px;
  padding: 28px 24px;
  width: 360px;
  max-width: 100%;
  text-align: center;
  color: #FAFAFA;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.pin-lock-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #F4F4F5;
}

.pin-lock-sub {
  font-size: 12px;
  color: #A1A1AA;
  margin-top: 4px;
  margin-bottom: 18px;
}

.pin-input-box {
  width: 100%;
  padding: 12px;
  font-size: 22px;
  letter-spacing: 0.35em;
  text-align: center;
  border-radius: 8px;
  border: 1px solid #3F3F46;
  background: #121215;
  color: #FFF;
  outline: none;
}

.pin-input-box:focus {
  border-color: var(--accent-gold);
}

.pin-error-msg {
  color: #F87171;
  font-size: 12px;
  margin-top: 8px;
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #161618;
  border-top: 1px solid #27272A;
  z-index: 80;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mob-nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: #A1A1AA;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 2px;
  cursor: pointer;
}

.mob-nav-btn.active {
  color: var(--accent-gold);
}

.mob-badge {
  position: absolute;
  top: -5px;
  right: -9px;
  background: #DC2626;
  color: #FFF;
  font-size: 9.5px;
  font-weight: 700;
  padding: 0 5px;
  border-radius: 999px;
  line-height: 15px;
}

@media (max-width: 920px) {
  .mobile-bottom-nav {
    display: flex;
  }
  .main-content {
    padding-bottom: 84px;
  }
  .global-search-input {
    width: 190px;
  }
  .header-filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
  .filter-group {
    flex-shrink: 0;
  }
}

/* ==========================================================================
   Projects & Finance Module Specific Styles
   ========================================================================== */

/* This Week Executive Summary Strip */
.this-week-strip {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.this-week-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.this-week-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.this-week-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.verified-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.freshness-tag {
  font-size: 11.5px;
  color: var(--text-muted);
}

.this-week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.this-week-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.this-week-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent-bronze);
  background: #FFFFFF;
}

.this-week-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.this-week-card-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.this-week-card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.this-week-card.card-inflow .this-week-card-val {
  color: var(--status-success-text);
}

.this-week-card.card-outflow .this-week-card-val {
  color: var(--status-warn-text);
}

.this-week-card.card-risk .this-week-card-val {
  color: var(--status-danger-text);
}

/* Secondary Navigation Tabs (for Finance & Projects) */
.subnav-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.subnav-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.subnav-tab:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.subnav-tab.active {
  background: var(--accent-bronze-light);
  color: var(--accent-bronze-dark);
}

/* Scenario Selector Buttons */
.scenario-selector {
  display: inline-flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--border-subtle);
}

.scenario-btn {
  background: none;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scenario-btn.active {
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* Aging Bucket Badges */
.aging-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.aging-current {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
}

.aging-1-30 {
  background: var(--status-warn-bg);
  color: var(--status-warn-text);
  border: 1px solid var(--status-warn-border);
}

.aging-31-60 {
  background: #FFF1F0;
  color: #CF1322;
  border: 1px solid #FFA39E;
}

.aging-60-plus {
  background: #5C0011;
  color: #FFF;
  border: 1px solid #820014;
}

/* Budget vs Actual Progress Bar */
.budget-progress-wrap {
  width: 100%;
  background: #E5E7EB;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  margin: 6px 0;
}

.budget-progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.fill-safe {
  background: #10B981;
}

.fill-warn {
  background: #F59E0B;
}

.fill-danger {
  background: #EF4444;
}

/* Project Detail Layout */
.project-detail-header {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.project-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.project-kpi-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.project-kpi-item .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.project-kpi-item .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 3px;
}

/* Integration Status Card */
.integration-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.integration-card-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.integration-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-bronze);
}

.status-badge-live {
  background: var(--status-success-bg);
  color: var(--status-success-text);
  border: 1px solid var(--status-success-border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.status-badge-disconnected {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

/* ==========================================================================
   Production Deadline & Manufacturing Stage Tracker Styles
   ========================================================================== */

.production-tracker-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

.production-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.product-item-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-item-card:hover {
  border-color: var(--accent-bronze);
  box-shadow: var(--shadow-xs);
}

.product-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.product-item-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.deadline-badge-overdue {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.deadline-badge-urgent {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.deadline-badge-ontrack {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.deadline-badge-completed {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.deadline-badge-nodeadline {
  background: #F4F4F5;
  color: #71717A;
  border: 1px solid #E4E4E7;
}

/* Stage Stepper Workflow Bar */
.stage-stepper-track {
  display: flex;
  align-items: stretch;
  gap: 8px;
  position: relative;
  overflow-x: auto;
  padding: 6px 2px 10px;
  margin-top: 10px;
}

.stage-step {
  flex: 1;
  min-width: 130px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stage-step:hover {
  transform: translateY(-2px);
  border-color: var(--accent-bronze);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stage-step.step-completed {
  border-color: #10B981;
  background: #F0FDF4;
}

.stage-step.step-inprogress {
  border-color: var(--accent-bronze);
  background: #FFFBEB;
  box-shadow: 0 0 0 2px rgba(181, 137, 0, 0.2);
}

.stage-step.step-pending {
  border-color: var(--border-subtle);
  background: #FAFAFA;
  opacity: 0.85;
}

.stage-step-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.step-num-bubble {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.step-completed .step-num-bubble {
  background: #10B981;
  color: #FFF;
}

.step-inprogress .step-num-bubble {
  background: var(--accent-bronze);
  color: #FFF;
  animation: pulse-ring 1.5s infinite;
}

.step-pending .step-num-bubble {
  background: #E4E4E7;
  color: #71717A;
}

.step-status-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-completed .step-status-pill {
  background: #DCFCE7;
  color: #15803D;
}

.step-inprogress .step-status-pill {
  background: #FEF3C7;
  color: #92400E;
}

.step-pending .step-status-pill {
  background: #F4F4F5;
  color: #71717A;
}

.step-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.step-notes {
  font-size: 10.5px;
  color: var(--text-muted);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.step-time {
  font-size: 10px;
  color: #047857;
  font-weight: 600;
  margin-top: 4px;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(181, 137, 0, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(181, 137, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(181, 137, 0, 0); }
}

/* Stepper progress connector between cards */
.item-progress-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.progress-bar-container {
  flex: 1;
  min-width: 140px;
  height: 8px;
  background: #E4E4E7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-bar-fill.fill-green {
  background: #10B981;
}

.progress-bar-fill.fill-bronze {
  background: var(--accent-bronze);
}

/* ==========================================================================
   Interactive UI Upgrades: View Toggle, Lead Cards, and Modern Avatars
   ========================================================================== */

/* Segmented View Mode Toggle (Cards vs. Table) */
.view-mode-control {
  display: inline-flex;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.view-mode-btn:hover {
  color: var(--text-primary);
}

.view-mode-btn.active {
  background: #FFFFFF;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Responsive Interactive Cards Grid */
.lead-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 16px 20px 24px;
}

.lead-interactive-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.lead-interactive-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-hover);
}

.lead-interactive-card.card-overdue {
  border-left: 4px solid #EF4444;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDFD 100%);
}

.lead-interactive-card.card-today {
  border-left: 4px solid var(--accent-gold);
}

.lead-interactive-card.card-won {
  border-left: 4px solid #10B981;
}

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

.customer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #FFFFFF;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  letter-spacing: 0.02em;
}

.avatar-bronze { background: linear-gradient(135deg, #B45309, #D97706); }
.avatar-blue { background: linear-gradient(135deg, #1D4ED8, #3B82F6); }
.avatar-emerald { background: linear-gradient(135deg, #047857, #10B981); }
.avatar-purple { background: linear-gradient(135deg, #6D28D9, #8B5CF6); }
.avatar-slate { background: linear-gradient(135deg, #334155, #64748B); }

.lead-title-box {
  flex: 1;
  min-width: 0;
}

.lead-card-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lead-card-name:hover {
  color: var(--accent-bronze);
  text-decoration: underline;
}

.lead-card-company {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Visual Product Chips & Badges */
.lead-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.channel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.deal-quote-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-bronze-light);
  color: var(--accent-bronze-dark);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 12px;
  border: 1px solid var(--accent-gold-soft);
}

.lead-snippet-bubble {
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lead-action-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.btn-wa-interactive {
  background-color: #25D366;
  color: #FFFFFF;
  border: 1px solid #1EBE5D;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(37, 211, 102, 0.25);
}

.btn-wa-interactive:hover {
  background-color: #1EBE5D;
  color: #FFFFFF;
}

/* Polished Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-col {
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 540px;
  position: relative;
}

.kanban-col::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: var(--border-strong);
}

.kanban-col:nth-child(1)::before { background: #64748B; } /* Unset / New */
.kanban-col:nth-child(2)::before { background: #3B82F6; } /* Attempted */
.kanban-col:nth-child(3)::before { background: #06B6D4; } /* Contacted */
.kanban-col:nth-child(4)::before { background: #8B5CF6; } /* Qualified */
.kanban-col:nth-child(5)::before { background: #F59E0B; } /* Quotation */
.kanban-col.kanban-col-won::before { background: #10B981; } /* Won */
.kanban-col.kanban-col-lost::before { background: #EF4444; } /* Lost */

.kanban-col-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.kanban-col-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kanban-col-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.kanban-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.kanban-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: all 0.18s ease;
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-sm);
}

.kanban-card.card-stale {
  border-left: 3px solid #EF4444;
}

.kanban-card-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

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





/* ==========================================================================
   Phone layer (<= 768px) - Phase 1 mobile optimisation.
   Everything above this block is the desktop/tablet design and is unchanged.
   ========================================================================== */

/* Phone-only controls stay out of the desktop layout. */
.sheet-head,
.sheet-extras,
#mobileFiltersBtn,
.filter-sheet-backdrop {
  display: none;
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }

  /* ---- Slim header: title row + search row (was ~300px tall) ---- */
  .top-header {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
    background: #FFFFFF;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .header-top-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-title-group {
    flex: 1 1 0;
    min-width: 0;
    gap: 8px;
  }
  .header-title-group > div {
    min-width: 0;
  }
  .page-eyebrow {
    display: none;
  }
  .page-title {
    font-size: 17px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .header-actions-group {
    display: contents;
  }
  .mobile-menu-btn {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  #mobileFiltersBtn {
    order: 2;
    display: inline-flex;
    position: relative;
  }
  .sync-status-box {
    order: 3;
  }
  .sync-status-box .sync-label {
    display: none;
  }
  #manualRefreshBtn span,
  #mobileFiltersBtn .filters-btn-label {
    display: none;
  }
  #manualRefreshBtn,
  #mobileFiltersBtn {
    min-width: 44px;
    padding: 0 12px;
  }
  .global-search-wrap {
    order: 4;
    flex: 1 1 100%;
  }
  .global-search-input {
    width: 100%;
    font-size: 16px;
    min-height: 44px;
    padding-left: 36px;
  }
  .search-icon {
    left: 12px;
  }
  .search-clear-btn {
    min-width: 44px;
    min-height: 44px;
    right: 0;
  }
  .filter-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--accent-bronze);
    color: #FFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
  }

  /* ---- Filters + saved views live in a bottom sheet ---- */
  .filter-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.45);
    z-index: 140;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body.filters-open .filter-sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.filters-open {
    overflow: hidden;
  }
  .header-filter-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    margin: 0;
    border-top: 0;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 14px;
    background: #FFFFFF;
    border-radius: 18px 18px 0 0;
    padding: 0 16px calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 85vh;
    max-height: 85dvh;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
    transform: translateY(105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  body.filters-open .header-filter-bar {
    transform: translateY(0);
    visibility: visible;
    transition: transform 0.25s ease;
  }
  .sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #FFFFFF;
    padding: 14px 0 8px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
  }
  .sheet-extras {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
  }
  .sheet-extras:empty {
    display: none;
  }
  .sheet-extras .sync-label {
    font-size: 13px;
    color: var(--text-muted);
  }
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    flex-shrink: 0;
  }
  .filter-group label {
    font-size: 13px;
  }
  .filter-select,
  .filter-input-date {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
    padding: 8px 12px;
  }
  .custom-date-inputs {
    flex-wrap: wrap;
    font-size: 13px;
  }
  .checkbox-label {
    min-height: 44px;
    font-size: 15px;
  }
  .header-filter-bar .btn-link {
    align-self: flex-start;
    min-height: 44px;
    font-size: 15px;
  }

  /* ---- Tap targets (>= 44px) and readable text ---- */
  .btn,
  .btn-sm,
  .btn-xs {
    min-height: 44px;
    padding-left: 14px;
    padding-right: 14px;
    font-size: 14px;
  }
  .tab-pill,
  .seg-btn,
  .view-mode-btn,
  .subnav-tab {
    min-height: 44px;
  }
  .scenario-btn {
    min-height: 44px;
  }
  /* Funnel rows: label, bar and numbers stack instead of needing 190px + 125px side columns. */
  .funnel-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }
  .kpi-top {
    flex-wrap: wrap;
  }
  /* Some pages hard-code 3-4 KPI columns inline; two is the most a phone can hold. */
  .kpi-grid[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .kpi-delta {
    white-space: normal;
  }
  /* Inline button rows (input + button) wrap instead of being clipped. */
  .panel-body > [style*="display:flex"]:not([style*="flex-direction:column"]) {
    flex-wrap: wrap;
  }
  input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 0;
  }
  /* One card per row; the desktop grid wants 340px columns, which a phone cannot fit. */
  .lead-cards-grid {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 12px 20px;
    gap: 12px;
  }
  .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  /* "1fr" lets one wide child stretch the whole column; minmax(0, 1fr) does not. */
  .grid-2col,
  .grid-3col {
    grid-template-columns: minmax(0, 1fr);
  }
  .lead-card-name {
    font-size: 16px;
    padding: 10px 0;
    margin: -10px 0;
  }
  .lead-action-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 44px;
  }
  .mob-nav-btn {
    font-size: 11px;
  }

  /* Raise every sub-12px text style to 12px (class-based and inline). */
  .seg-btn,
  .tab-pill-count,
  .step-status-pill,
  .step-time,
  .conn-sub,
  .funnel-conv-sub,
  .step-notes,
  .timeline-time,
  .aging-badge,
  .alert-sub,
  .badge,
  .channel-chip,
  .crm-table th,
  .deadline-badge,
  .kanban-col-sub,
  .kpi-delta,
  .kv-item label,
  .product-chip,
  .project-kpi-item .label,
  .this-week-card-label,
  .this-week-card-sub,
  .verified-pill,
  .conn-title,
  .drawer-section-title,
  .freshness-tag,
  .kanban-card-meta,
  .kpi-foot,
  .kpi-label,
  .lead-card-company,
  .lead-snippet-bubble,
  .panel-subtitle,
  .status-badge-disconnected,
  .status-badge-live,
  .sidebar-section-label {
    font-size: 12px;
  }
  [style*="font-size:9px"],
  [style*="font-size: 9px"],
  [style*="font-size:10px"],
  [style*="font-size: 10px"],
  [style*="font-size:10.5px"],
  [style*="font-size: 10.5px"],
  [style*="font-size:11px"],
  [style*="font-size: 11px"],
  [style*="font-size:11.5px"],
  [style*="font-size: 11.5px"] {
    font-size: 12px !important;
  }

  /* ---- No sideways page scroll: wide tables scroll inside themselves ---- */
  .main-wrapper,
  .main-content {
    min-width: 0;
    max-width: 100vw;
  }
  .panel-card,
  .panel-body {
    min-width: 0;
    max-width: 100%;
  }
  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  code,
  pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
  img,
  svg,
  canvas {
    max-width: 100%;
  }

  /* ---- Drawer and modals become full-width bottom sheets ---- */
  .lead-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 92vh;
    height: 92dvh;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }
  .drawer-header {
    padding: 14px 16px;
    border-radius: 18px 18px 0 0;
  }
  .drawer-body {
    padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .modal-card {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    display: flex;
    flex-direction: column;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }
  .modal-body {
    overflow-y: auto;
  }
  .modal-footer {
    flex-wrap: wrap;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .modal-footer .btn {
    flex: 1 1 auto;
  }
  .modal-close-btn {
    min-width: 44px;
    min-height: 44px;
    font-size: 26px;
  }
}

/* ===== AGY Strategic Follow-ups: Streamlined Conversational UI ===== */
.wa-bubble {
  background: rgba(37, 211, 102, 0.08);
  border: 1px solid rgba(37, 211, 102, 0.28);
  border-radius: 12px 12px 12px 3px;
  padding: 10px 12px;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.wa-bubble:focus-within {
  border-color: rgba(37, 211, 102, 0.55);
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.12);
}
.wa-bubble-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  outline: none;
  padding: 0;
  min-height: 54px;
}
.agy-compact-card {
  padding: 14px 16px;
  gap: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.agy-options-drawer {
  display: none;
  padding-top: 10px;
  margin-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  animation: agySlideDown 0.18s ease-out;
}
.agy-options-drawer.open {
  display: block;
}
@keyframes agySlideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   TRELLO-STYLE TASK KANBAN BOARD & ANIMATIONS
   ============================================================================ */
.trello-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 10px;
}
@media (max-width: 1100px) {
  .trello-board {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}
@media (max-width: 640px) {
  .trello-board {
    grid-template-columns: 1fr;
  }
}
.trello-col {
  background: #F4F1EC;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.trello-col.drag-over {
  background: #FBF6EE;
  border-color: var(--accent-bronze-dark, #9A6216);
  box-shadow: 0 0 0 2px rgba(181, 123, 43, 0.25);
}
.trello-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 8px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
}
.trello-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-primary);
}
.trello-col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.trello-col-count {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-secondary);
}
.trello-cards {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 120px;
}
.trello-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 11px 12px;
  box-shadow: 0 1px 3px rgba(20, 16, 12, 0.06);
  cursor: grab;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.18s ease, opacity 0.18s ease;
  animation: trelloCardIn 0.26s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.trello-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(20, 16, 12, 0.10);
}
.trello-card.dragging {
  opacity: 0.55;
  transform: rotate(1.5deg) scale(1.02);
  cursor: grabbing;
  box-shadow: 0 12px 24px rgba(20, 16, 12, 0.16);
}
.trello-card.done-card {
  opacity: 0.72;
  background: #FAF9F7;
}
.trello-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
}
.trello-label-bar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
}
.trello-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.38;
  margin-bottom: 6px;
}
.trello-card-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 8px;
}
.trello-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 7px;
  border-top: 1px dashed rgba(0, 0, 0, 0.07);
  font-size: 11px;
}
.trello-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 700;
  color: #FFFFFF;
  background: #6E563B;
}
@keyframes trelloCardIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
