/**
 * Admin CRM Styles
 * The Journeyman - Admin Dashboard
 * 
 * Styles specific to the CRM/Contacts module.
 * Extends admin.css with CRM-specific components.
 */

/* ========================================
   LAYOUT OVERRIDES
   ======================================== */

/* Wider layout for CRM page */
.admin-wrap--wide {
  max-width: 1600px;
}

.admin-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ========================================
   HEADER INLINE STATS
   ======================================== */

.crm-header-stats {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

.header-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-stat i {
  font-size: 11px;
  opacity: 0.8;
}

.header-stat--primary {
  color: #60a5fa;
  border-color: rgba(96, 165, 250, 0.3);
}

.header-stat--success {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.3);
}

.header-stat--warning {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
}

.header-stat--danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

.header-stat--info {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.3);
}

/* ========================================
   STATS ROW (legacy - kept for analytics)
   ======================================== */

.crm-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.stat-card--compact {
  padding: 14px;
}

.stat-card--compact .stat-icon {
  width: 36px;
  height: 36px;
  font-size: 16px;
  margin-bottom: 8px;
}

.stat-card--compact .stat-value {
  font-size: 24px;
}

.stat-card--compact .stat-label {
  font-size: 10px;
}

.stat-card--warning {
  border-color: rgba(245, 158, 11, 0.3);
}

.stat-card--danger {
  border-color: rgba(239, 68, 68, 0.3);
}

/* ========================================
   CHARTS ROW
   ======================================== */

.crm-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .crm-charts-row {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  min-height: 280px;
  padding: 20px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  overflow: hidden;
}

.chart-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 8px;
  height: 140px;
  padding: 0 10px;
}

.bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 60px;
  height: 100%;
}

.bar-wrapper .bar {
  width: 100%;
  min-height: 4px;
  margin-top: auto;
  position: relative;
}

.bar-owner {
  background: linear-gradient(to top, #3b82f6, rgba(59, 130, 246, 0.4)) !important;
}

/* ========================================
   FILTER BAR
   ======================================== */

.crm-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group--search {
  flex: 1;
  min-width: 200px;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-select,
.filter-input {
  padding: 8px 12px;
  min-width: 140px;
  font-size: 13px;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
  font-size: 13px;
}

.search-input-wrap input {
  padding-left: 36px;
  width: 100%;
}

/* ========================================
   MAIN LAYOUT (LEFT PANEL + DRAWER)
   ======================================== */

.crm-main {
  display: flex;
  gap: 20px;
  min-height: calc(100vh - 120px); /* Minimum height, but can grow */
  align-items: flex-start; /* Allow drawer to extend past list */
  padding-bottom: 200px; /* Dead space at bottom for scrolling */
}

/* Left panel contains nav tabs, filters, and table - shrinks when drawer opens */
.crm-left-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all 0.3s ease;
}

/* Nav tabs row inside left panel */
.crm-left-panel .crm-nav-tabs-row {
  flex-shrink: 0;
}

/* Filter bar inside left panel */
.crm-left-panel .crm-filter-bar {
  flex-shrink: 0;
}

.crm-table-panel {
  flex: 1;
  min-width: 0;
  min-height: 500px; /* Taller minimum for the list */
  max-height: calc(100vh - 280px); /* Cap height so it scrolls internally */
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.crm-table-panel .table-responsive {
  flex: 1;
  overflow-y: auto;
}

.table-responsive {
  overflow-x: auto;
}

/* ========================================
   CRM TABLE
   ======================================== */

.crm-table {
  width: 100%;
  min-width: 900px;
}

.crm-table th {
  position: sticky;
  top: 0;
  background: var(--admin-card);
  z-index: 10;
  white-space: nowrap;
}

.crm-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.crm-table th.sortable:hover {
  color: var(--admin-accent);
}

.crm-table th.sortable i {
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
}

.crm-table th.sort-asc i::before {
  content: "\f0de"; /* fa-sort-up */
}

.crm-table th.sort-desc i::before {
  content: "\f0dd"; /* fa-sort-down */
}

.crm-table th.sort-asc i,
.crm-table th.sort-desc i {
  opacity: 1;
  color: var(--admin-accent);
}

.crm-row {
  cursor: pointer;
  transition: background 0.15s;
}

.crm-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.crm-row.selected {
  background: rgba(255, 107, 43, 0.08);
  border-left: 3px solid var(--admin-accent);
}

.crm-row td {
  padding: 12px 14px;
  font-size: 13px;
  white-space: nowrap;
}

.cell-company {
  font-weight: 600;
  color: var(--admin-text);
}

.cell-contact {
  color: var(--admin-text-secondary);
}

.cell-role {
  color: var(--admin-text-muted);
  font-size: 12px;
}

/* Phase badges */
.phase-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.phase-P0 { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.phase-P1 { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.phase-P2 { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.phase-P3 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.phase-P4 { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.phase-P5 { background: rgba(34, 197, 94, 0.3); color: #22c55e; border: 1px solid rgba(34, 197, 94, 0.4); }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid;
}

/* Owner badge */
.owner-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--admin-text-muted);
}

/* Days since last contact - urgency colors */
.urgency-green {
  color: #4ade80;
}

.urgency-yellow {
  color: #fbbf24;
}

.urgency-red {
  color: #f87171;
  font-weight: 600;
}

/* Overdue indicator */
.cell-next-action.overdue {
  color: #f87171;
  font-weight: 600;
}

.cell-next-action.overdue i {
  margin-left: 4px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Loading & empty states */
.loading-state,
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--admin-text-muted);
}

.loading-state i {
  font-size: 24px;
  margin-bottom: 12px;
  display: block;
}

/* ========================================
   DETAIL DRAWER
   ======================================== */

.crm-detail-drawer {
  width: 0;
  min-width: 0;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  overflow: hidden;
  transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease;
  display: flex;
  flex-direction: column;
}

.crm-detail-drawer.open {
  width: 520px;
  min-width: 520px;
  max-height: none; /* Allow drawer to grow as tall as needed */
  overflow: hidden; /* Container doesn't scroll, content does */
}

/* Drawer header stays fixed at top */
.drawer-header {
  flex-shrink: 0;
}

/* Drawer tabs stay fixed */
.drawer-tabs {
  flex-shrink: 0;
}

.drawer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--admin-text-muted);
  text-align: center;
  padding: 24px;
}

.drawer-placeholder i {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
}

/* Drawer Header - New Layout */
.drawer-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--admin-line);
  background: var(--admin-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top Row: Company Name + Actions */
.drawer-header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.drawer-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.drawer-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Bottom Row: 3 Columns */
.drawer-header-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
}

.drawer-header-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-col-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--admin-text-muted);
}

.drawer-col-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--admin-text);
}

.drawer-col-sub {
  font-size: 12px;
  color: var(--admin-text-secondary);
}

.drawer-status-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Legacy - keep for compatibility */
.drawer-header-main {
  display: flex;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

/* Profile Image in Drawer */
.drawer-profile-image {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--admin-panel);
  border: 2px solid var(--admin-line);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.drawer-profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-profile-image i {
  font-size: 18px;
  color: var(--admin-text-muted);
}

.drawer-profile-edit {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--admin-accent);
  color: #000;
  border: 2px solid var(--admin-panel);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 8px;
  transition: transform 0.2s;
}

.drawer-profile-edit:hover {
  transform: scale(1.1);
}

.drawer-header-info {
  flex: 1;
  min-width: 0;
}

/* Quick Actions Bar */
.drawer-quick-actions {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-line);
  flex-shrink: 0;
}

.drawer-quick-action {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-line);
  color: var(--admin-text-secondary);
  text-decoration: none;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.drawer-quick-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--admin-text);
  border-color: var(--admin-accent);
}

.drawer-quick-action[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.drawer-quick-action i {
  font-size: 16px;
}

/* Phase Stepper */
.drawer-phase-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--admin-panel);
  border-bottom: 1px solid var(--admin-line);
  flex-shrink: 0;
}

.phase-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.phase-step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--admin-card);
  border: 2px solid var(--admin-line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  transition: all 0.3s;
}

.phase-step.completed .phase-step-dot {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #000;
}

.phase-step.current .phase-step-dot {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.2);
}

.phase-step-label {
  font-size: 10px;
  color: var(--admin-text-muted);
  font-weight: 500;
}

.phase-step.current .phase-step-label {
  color: var(--admin-accent);
}

.phase-step-line {
  flex: 1;
  height: 2px;
  background: var(--admin-line);
  margin: 0 4px;
  margin-bottom: 18px;
}

.drawer-company {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 2px 0;
  line-height: 1.2;
}

.drawer-contact-info {
  font-size: 12px;
  color: var(--admin-text-secondary);
  margin-bottom: 2px;
}

.drawer-contact-name {
  font-weight: 500;
}

.drawer-role {
  color: var(--admin-text-muted);
}

.drawer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Old drawer-header-actions moved to drawer-header-right section */

/* Drawer Tabs */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--admin-line);
  background: var(--admin-card);
  overflow-x: auto; /* Enable horizontal scroll when tabs overflow */
  overflow-y: hidden;
  scrollbar-width: thin; /* Firefox */
  -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
}

/* Custom scrollbar for tabs */
.drawer-tabs::-webkit-scrollbar {
  height: 4px;
}

.drawer-tabs::-webkit-scrollbar-track {
  background: var(--admin-panel);
}

.drawer-tabs::-webkit-scrollbar-thumb {
  background: var(--admin-line);
  border-radius: 2px;
}

.drawer-tab {
  flex: 0 0 auto; /* Don't shrink, allow natural width */
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
  white-space: nowrap; /* Prevent text wrapping */
}

.drawer-tab:hover {
  color: var(--admin-text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.drawer-tab.active {
  color: var(--admin-accent);
  border-bottom-color: var(--admin-accent);
}

/* Tab with icon */
.drawer-tab i {
  margin-right: 4px;
  font-size: 0.85em;
}

/* Tab badge for action count */
.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: var(--admin-warning, #f59e0b);
  border-radius: 9px;
}

.drawer-tab.active .tab-badge {
  background: var(--admin-accent);
}

/* Drawer Content - grows with content, page scrolls instead */
.drawer-content {
  padding: 0;
  flex: 1 0 auto; /* Grow but don't shrink, allow natural height */
  overflow-y: visible; /* Let page scroll instead of internal scroll */
  min-height: 400px; /* Minimum content area */
}

.drawer-panel {
  display: none;
  padding: 20px;
}

.drawer-panel.active {
  display: block;
}

/* Form Sections */
.form-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--admin-line);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.form-section-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.form-section.danger-zone {
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  padding: 16px;
  margin-top: 24px;
}

.form-section.danger-zone .form-section-title {
  color: #f87171;
}

.form-section.danger-zone .form-section-title i {
  margin-right: 8px;
}

/* ========================================
   TASKS PANEL
   ======================================== */

.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tasks-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
}

.tasks-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  width: 100px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--admin-accent), #ff8f5a);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--admin-text-muted);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: all 0.2s;
}

.task-item:hover {
  border-color: var(--admin-line-strong);
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-label {
  text-decoration: line-through;
}

.task-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.task-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.task-label {
  font-size: 13px;
  color: var(--admin-text-secondary);
}

/* Previous phase tasks */
.tasks-history {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.tasks-history h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.phase-group {
  margin-bottom: 16px;
}

.phase-group-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  margin-bottom: 8px;
}

.phase-group-tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-item-small {
  font-size: 12px;
  color: var(--admin-text-muted);
  padding: 4px 0;
}

.task-item-small i {
  margin-right: 8px;
  font-size: 10px;
}

.task-item-small.completed i {
  color: var(--admin-success);
}

/* ========================================
   NOTES PANEL
   ======================================== */

.notes-add {
  margin-bottom: 20px;
}

.notes-add textarea {
  min-height: 80px;
  margin-bottom: 12px;
}

.notes-add-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--admin-text-muted);
  cursor: pointer;
}

.checkbox-label input {
  width: auto;
}

.notes-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  padding: 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.note-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.note-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

.note-date {
  font-size: 11px;
  color: var(--admin-text-muted);
}

.note-delete {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.2s;
}

.note-item:hover .note-delete {
  opacity: 1;
}

.note-body {
  font-size: 13px;
  color: var(--admin-text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
}

/* Voice memo notes */
.note-voice {
  border-left: 3px solid var(--admin-accent, #f97316);
}

.note-voice-icon {
  color: var(--admin-accent, #f97316);
  font-size: 14px;
}

.note-audio {
  margin-top: 10px;
}

.note-audio audio {
  width: 100%;
  height: 36px;
  border-radius: 6px;
}

/* ========================================
   CUSTOM FIELDS PANEL
   ======================================== */

.custom-fields-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.custom-field-item {
  display: flex;
  gap: 8px;
  align-items: center;
}

.custom-field-item .field-key {
  width: 120px;
  flex-shrink: 0;
}

.custom-field-item .field-value {
  flex: 1;
}

.custom-fields-add {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.custom-fields-add input:first-child {
  width: 120px;
  flex-shrink: 0;
}

.custom-fields-add input:nth-child(2) {
  flex: 1;
}

/* ========================================
   EMPTY STATES
   ======================================== */

.empty-state-small {
  text-align: center;
  padding: 24px;
  color: var(--admin-text-muted);
  font-size: 13px;
}

/* ========================================
   MODAL OVERRIDES
   ======================================== */

.modal-lg {
  max-width: 600px;
}

.radio-group {
  display: flex;
  gap: 24px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--admin-text-secondary);
  cursor: pointer;
}

.radio-label input {
  width: auto;
}

.radio-label input:disabled + span {
  opacity: 0.5;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
  .crm-detail-drawer.open {
    width: 400px;
    min-width: 400px;
  }
}

@media (max-width: 1000px) {
  .crm-main {
    flex-direction: column;
  }

  .crm-detail-drawer {
    width: 100% !important;
    min-width: 100% !important;
    max-height: 0;
    transition: max-height 0.3s ease;
  }

  .crm-detail-drawer.open {
    max-height: 2000px;
  }
}

@media (max-width: 768px) {
  .crm-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .crm-filter-bar {
    flex-direction: column;
  }

  .filter-group {
    width: 100%;
  }

  .filter-select,
  .filter-input {
    width: 100%;
  }

  .drawer-header-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .crm-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   CRM SETTINGS PAGE
   ======================================== */

/* Type Tabs */
.type-tabs {
  display: flex;
  gap: 12px;
}

.type-tab {
  padding: 12px 24px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.type-tab:hover {
  border-color: var(--admin-line-strong);
  color: var(--admin-text-secondary);
}

.type-tab.active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: white;
}

.type-tab i {
  margin-right: 8px;
}

/* Phases Container */
.phases-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Phase Card */
.phase-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.phase-card:hover {
  border-color: var(--admin-line-strong);
}

.phase-card.collapsed .phase-tasks,
.phase-card.collapsed .phase-description {
  display: none;
}

.phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-line);
}

.phase-drag-handle {
  color: var(--admin-text-muted);
  cursor: grab;
  padding: 4px;
}

.phase-drag-handle:active {
  cursor: grabbing;
}

.phase-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.phase-code-input {
  width: 60px;
  padding: 8px 12px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  text-align: center;
  text-transform: uppercase;
}

.phase-label-input {
  flex: 1;
  padding: 8px 12px;
  font-weight: 600;
}

.phase-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  color: var(--admin-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  border-color: var(--admin-line-strong);
  color: var(--admin-text-secondary);
}

.btn-danger-icon:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.phase-description {
  padding: 12px 16px;
  border-bottom: 1px solid var(--admin-line);
}

.phase-desc-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--admin-text-muted);
}

/* Phase Tasks */
.phase-tasks {
  padding: 16px;
}

.phase-tasks .tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.phase-tasks .tasks-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text-secondary);
}

.phase-tasks .tasks-header h4 i {
  margin-right: 8px;
  color: var(--admin-text-muted);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item-template {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  transition: all 0.2s;
}

.task-item-template:hover {
  border-color: var(--admin-line-strong);
}

.task-drag-handle {
  color: var(--admin-text-muted);
  cursor: grab;
  padding: 4px;
}

.task-label-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--admin-text-secondary);
}

.task-label-input:focus {
  border-color: var(--admin-line);
  background: var(--admin-panel);
}

.empty-tasks {
  text-align: center;
  padding: 24px;
  color: var(--admin-text-muted);
  font-size: 13px;
  font-style: italic;
}

/* Add Phase Button */
.add-phase-wrap {
  text-align: center;
}

/* Save Button States */
.btn-warning {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
}

.btn-success {
  background: #22c55e !important;
  border-color: #22c55e !important;
}

/* Error State */
.error-state {
  text-align: center;
  padding: 48px 24px;
  color: #f87171;
}

.error-state i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* ========================================
   NAVIGATION TABS
   ======================================== */

.crm-nav-tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.crm-nav-actions {
  display: flex;
  gap: 12px;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 8px;
}

.crm-nav-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  width: fit-content;
}

.crm-nav-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.crm-nav-tab:hover {
  color: var(--admin-text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.crm-nav-tab.active {
  background: var(--admin-accent);
  color: white;
  box-shadow: 0 2px 8px rgba(255, 107, 43, 0.3);
}

.crm-nav-tab i {
  font-size: 16px;
}

/* Nav Link (for linking to Analytics page) */
.crm-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-accent);
  text-decoration: none;
  border-radius: 8px;
  background: rgba(255, 107, 43, 0.1);
  border: 1px solid rgba(255, 107, 43, 0.2);
  transition: all 0.2s;
}

.crm-nav-link:hover {
  background: rgba(255, 107, 43, 0.2);
  border-color: var(--admin-accent);
}

.crm-nav-link i {
  font-size: 14px;
}

/* Tab Content */
.crm-tab-content {
  display: none;
}

.crm-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   DRAWER OPEN - COMPACT MODE
   When a contact is selected, the left panel shrinks and
   filter bar + nav tabs become compact
   ======================================== */

/* Compact filter bar when drawer is open */
.crm-detail-drawer.open ~ .crm-left-panel .crm-filter-bar,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-filter-bar,
.drawer-open .crm-filter-bar {
  padding: 6px 10px;
  gap: 8px;
}

.crm-detail-drawer.open ~ .crm-left-panel .filter-label,
.crm-left-panel:has(~ .crm-detail-drawer.open) .filter-label,
.drawer-open .filter-label {
  display: none; /* Hide labels to save space */
}

.crm-detail-drawer.open ~ .crm-left-panel .filter-select,
.crm-detail-drawer.open ~ .crm-left-panel .filter-input,
.crm-left-panel:has(~ .crm-detail-drawer.open) .filter-select,
.crm-left-panel:has(~ .crm-detail-drawer.open) .filter-input,
.drawer-open .filter-select,
.drawer-open .filter-input {
  padding: 5px 8px;
  font-size: 11px;
  min-width: 80px;
}

.crm-detail-drawer.open ~ .crm-left-panel .filter-group,
.crm-left-panel:has(~ .crm-detail-drawer.open) .filter-group,
.drawer-open .filter-group {
  gap: 0;
}

.crm-detail-drawer.open ~ .crm-left-panel .filter-group--search,
.crm-left-panel:has(~ .crm-detail-drawer.open) .filter-group--search,
.drawer-open .filter-group--search {
  min-width: 120px;
}

.crm-detail-drawer.open ~ .crm-left-panel .search-input-wrap input,
.crm-left-panel:has(~ .crm-detail-drawer.open) .search-input-wrap input,
.drawer-open .search-input-wrap input {
  padding-left: 28px;
}

.crm-detail-drawer.open ~ .crm-left-panel .search-input-wrap i,
.crm-left-panel:has(~ .crm-detail-drawer.open) .search-input-wrap i,
.drawer-open .search-input-wrap i {
  left: 8px;
  font-size: 10px;
}

/* Compact nav tabs row when drawer is open */
.crm-detail-drawer.open ~ .crm-left-panel .crm-nav-tabs-row,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-nav-tabs-row,
.drawer-open .crm-nav-tabs-row {
  gap: 8px;
}

.crm-detail-drawer.open ~ .crm-left-panel .crm-nav-tabs,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-nav-tabs,
.drawer-open .crm-nav-tabs {
  padding: 2px;
  gap: 2px;
}

.crm-detail-drawer.open ~ .crm-left-panel .crm-nav-tab,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-nav-tab,
.drawer-open .crm-nav-tab {
  padding: 6px 12px;
  font-size: 11px;
  gap: 4px;
}

.crm-detail-drawer.open ~ .crm-left-panel .crm-nav-tab i,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-nav-tab i,
.drawer-open .crm-nav-tab i {
  font-size: 11px;
}

.crm-detail-drawer.open ~ .crm-left-panel .crm-nav-tab span,
.crm-left-panel:has(~ .crm-detail-drawer.open) .crm-nav-tab span,
.drawer-open .crm-nav-tab span {
  display: none; /* Hide text, show only icons on compact */
}

.crm-detail-drawer.open ~ .crm-left-panel .btn-export,
.crm-left-panel:has(~ .crm-detail-drawer.open) .btn-export,
.drawer-open .btn-export {
  padding: 5px 10px;
  font-size: 11px;
}

/* Smooth transitions for all compact elements */
.crm-filter-bar,
.crm-nav-tabs-row,
.crm-nav-tabs,
.crm-nav-tab,
.filter-select,
.filter-input,
.filter-label,
.crm-left-panel {
  transition: all 0.3s ease;
}

/* ========================================
   QUICK STATS (Overview)
   ======================================== */

.crm-quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.quick-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.quick-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.quick-stat-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 24px;
}

.quick-stat-card--primary .quick-stat-icon {
  background: rgba(255, 107, 43, 0.15);
  color: var(--admin-accent);
}

.quick-stat-card--success .quick-stat-icon {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.quick-stat-card--warning .quick-stat-icon {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.quick-stat-card--danger .quick-stat-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.quick-stat-card--info .quick-stat-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.quick-stat-content {
  flex: 1;
}

.quick-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--admin-text);
  line-height: 1;
}

.quick-stat-label {
  font-size: 13px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

@media (max-width: 1200px) {
  .crm-quick-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .crm-quick-stats {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   OVERVIEW GRID
   ======================================== */

.crm-overview-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

.overview-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  padding: 24px;
}

.overview-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.overview-card-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

.overview-card-header h3 i {
  margin-right: 10px;
  color: var(--admin-accent);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--admin-line);
  color: var(--admin-text-muted);
}

.btn-ghost:hover {
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

/* Mini Funnel */
.mini-funnel {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 120px;
  gap: 8px;
}

.mini-funnel-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mini-funnel-fill {
  width: 100%;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.mini-funnel-fill::after {
  content: attr(data-count);
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.mini-funnel-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
}

/* Phase Mini Cards */
.phase-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Analytics version - 6 columns for full width */
.phase-cards-grid--analytics {
  grid-template-columns: repeat(6, 1fr);
}

/* Phase Breakdown section in Analytics */
.crm-phase-breakdown {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  padding: 24px;
}

.phase-mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
}

.phase-mini-card:hover {
  transform: scale(1.05);
}

.phase-mini-code {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
}

.phase-mini-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
}

.phase-mini-label {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 2px;
}

.phase-mini-card--p0 {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

.phase-mini-card--p1 {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.phase-mini-card--p2 {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.phase-mini-card--p3 {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.phase-mini-card--p4 {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.phase-mini-card--p5 {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

@media (max-width: 1000px) {
  .crm-overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) {
  .phase-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========================================
   ANALYTICS VISUALIZATIONS
   ======================================== */

/* Section Headers */
.section-header {
  margin-bottom: 16px;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

.section-title i {
  margin-right: 10px;
  color: var(--admin-accent);
}

.section-subtitle {
  font-size: 13px;
  color: var(--admin-text-muted);
}

/* Analytics Row Layout */
.crm-analytics-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.crm-analytics-row:nth-child(odd) {
  grid-template-columns: 1fr 2fr;
}

/* Row 3: Owner Leaderboard smaller, Win/Loss wider */
.crm-analytics-row:has(#owner-leaderboard) {
  grid-template-columns: 1fr 3fr;
}

.chart-container--wide {
  grid-column: span 1;
}

.chart-header {
  margin-bottom: 16px;
}

.chart-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 4px 0;
}

.chart-title i {
  margin-right: 8px;
  color: var(--admin-accent);
}

.chart-subtitle {
  font-size: 11px;
  color: var(--admin-text-muted);
}

@media (max-width: 1000px) {
  .crm-analytics-row,
  .crm-analytics-row:nth-child(odd) {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   PIPELINE FUNNEL
   ======================================== */

.crm-funnel-section {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  padding: 24px;
  overflow: hidden;
  min-height: 280px;
}

.funnel-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
  height: 200px;
  padding: 20px 0;
}

.funnel-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 140px;
  position: relative;
}

.funnel-bar-wrap {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.funnel-bar {
  width: 100%;
  min-height: 8px;
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.funnel-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.2), transparent);
}

/* Animated drip effect */
.funnel-bar::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 0;
  background: inherit;
  filter: brightness(1.3);
  animation: drip 3s ease-in-out infinite;
  opacity: 0;
}

@keyframes drip {
  0%, 100% { height: 0; opacity: 0; bottom: 0; }
  10% { opacity: 0.8; }
  50% { height: 20px; opacity: 0.8; bottom: -25px; }
  60% { opacity: 0; }
}

.funnel-stage:nth-child(1) .funnel-bar { background: linear-gradient(to top, #6b7280, #9ca3af); }
.funnel-stage:nth-child(2) .funnel-bar { background: linear-gradient(to top, #3b82f6, #60a5fa); }
.funnel-stage:nth-child(3) .funnel-bar { background: linear-gradient(to top, #8b5cf6, #a78bfa); }
.funnel-stage:nth-child(4) .funnel-bar { background: linear-gradient(to top, #f59e0b, #fbbf24); }
.funnel-stage:nth-child(5) .funnel-bar { background: linear-gradient(to top, #10b981, #34d399); }
.funnel-stage:nth-child(6) .funnel-bar { background: linear-gradient(to top, #22c55e, #4ade80); }

.funnel-count {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.funnel-label {
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.funnel-code {
  font-size: 10px;
  color: var(--admin-text-muted);
  opacity: 0.7;
}

/* Connector arrows between stages */
.funnel-connector {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-muted);
  opacity: 0.3;
  font-size: 10px;
}

/* ========================================
   ACTIVITY PULSE (Line Chart)
   ======================================== */

.pulse-chart {
  position: relative;
  width: 100%;
}

.pulse-chart-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.pulse-svg {
  width: 100%;
  height: 150px;
  display: block;
}

.pulse-x-labels {
  display: flex;
  justify-content: space-between;
  padding: 8px 30px 0 30px;
}

.pulse-x-label {
  font-size: 10px;
  color: var(--admin-text-muted);
}

.pulse-x-label--today {
  color: var(--admin-accent);
  font-weight: 600;
}

.pulse-line {
  fill: none;
  stroke: var(--admin-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pulse-area {
  fill: url(#pulseGradient);
  opacity: 0.3;
}

.pulse-dot {
  fill: var(--admin-accent);
  filter: drop-shadow(0 0 4px var(--admin-accent));
}

.pulse-dot-pulse {
  fill: var(--admin-accent);
  opacity: 0.3;
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { r: 4; opacity: 0.3; }
  50% { r: 8; opacity: 0; }
}

.pulse-grid-line {
  stroke: var(--admin-line);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.pulse-label {
  font-size: 10px;
  fill: var(--admin-text-muted);
}

.pulse-today {
  font-size: 10px;
  fill: var(--admin-accent);
  font-weight: 600;
}

/* Animated line drawing */
.pulse-line-animated {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 2s ease-out forwards;
}

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* ========================================
   VELOCITY GAUGE
   ======================================== */

.gauge-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  padding-top: 20px;
}

.gauge-svg {
  width: 220px;
  height: 130px;
  overflow: visible;
}

.gauge-bg {
  fill: none;
  stroke: var(--admin-line);
  stroke-width: 12;
  stroke-linecap: round;
}

.gauge-fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-needle {
  fill: var(--admin-text);
  transform-origin: 90px 90px;
  transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-center {
  fill: var(--admin-card);
  stroke: var(--admin-line);
  stroke-width: 2;
}

.gauge-value {
  font-size: 28px;
  font-weight: 700;
  fill: var(--admin-text);
  text-anchor: middle;
}

.gauge-unit {
  font-size: 12px;
  fill: var(--admin-text-muted);
  text-anchor: middle;
}

.gauge-value-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 12px;
}

.gauge-value-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--admin-text);
  line-height: 1;
}

.gauge-value-unit {
  font-size: 14px;
  color: var(--admin-text-muted);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  width: 220px;
  margin-top: 8px;
}

.gauge-label-item {
  font-size: 10px;
  color: var(--admin-text-muted);
}

.gauge-status {
  margin-top: 12px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.gauge-status--fast { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.gauge-status--normal { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.gauge-status--slow { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.gauge-status--critical { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* ========================================
   STALENESS HEATMAP
   ======================================== */

.heatmap-container {
  padding: 10px 0;
}

.heatmap-legend {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--admin-text-muted);
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.heatmap-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.1);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.heatmap-cell--green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.heatmap-cell--yellow { background: linear-gradient(135deg, #f59e0b, #d97706); }
.heatmap-cell--orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.heatmap-cell--red { 
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: heatmapPulse 2s ease-in-out infinite;
}

@keyframes heatmapPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.heatmap-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.heatmap-cell:hover .heatmap-tooltip {
  opacity: 1;
}

.heatmap-tooltip-name {
  font-weight: 600;
  color: var(--admin-text);
}

.heatmap-tooltip-days {
  color: var(--admin-text-muted);
}

/* ========================================
   SOURCE DONUT CHART
   ======================================== */

.donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  height: 200px;
  flex-wrap: wrap;
}

.donut-svg {
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.donut-segment {
  fill: none;
  stroke-width: 24;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.donut-segment:hover {
  filter: brightness(1.2);
  cursor: pointer;
}

.donut-center-text {
  transform: rotate(90deg);
  transform-origin: center;
}

.donut-total {
  font-size: 24px;
  font-weight: 700;
  fill: var(--admin-text);
  text-anchor: middle;
}

.donut-total-label {
  font-size: 10px;
  fill: var(--admin-text-muted);
  text-anchor: middle;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--admin-text-secondary);
}

.donut-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.donut-legend-value {
  margin-left: auto;
  font-weight: 600;
  color: var(--admin-text);
}

/* Source colors */
.source-tjm { stroke: #ff6b2b; background: #ff6b2b; }
.source-social { stroke: #3b82f6; background: #3b82f6; }
.source-event { stroke: #8b5cf6; background: #8b5cf6; }
.source-referral { stroke: #22c55e; background: #22c55e; }
.source-cold { stroke: #6b7280; background: #6b7280; }

/* ========================================
   OWNER LEADERBOARD
   ======================================== */

.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: transform 0.2s, border-color 0.2s;
}

.leaderboard-item:hover {
  transform: translateX(4px);
  border-color: var(--admin-accent);
}

.leaderboard-rank {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.leaderboard-rank--1 { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1a1a; }
.leaderboard-rank--2 { background: linear-gradient(135deg, #9ca3af, #6b7280); color: white; }
.leaderboard-rank--3 { background: linear-gradient(135deg, #cd7f32, #a0522d); color: white; }
.leaderboard-rank--other { background: var(--admin-line); color: var(--admin-text-muted); }

.leaderboard-info {
  flex: 1;
}

.leaderboard-name {
  font-weight: 600;
  color: var(--admin-text);
  font-size: 14px;
}

.leaderboard-stats {
  font-size: 11px;
  color: var(--admin-text-muted);
}

.leaderboard-bar-wrap {
  flex: 2;
  height: 8px;
  background: var(--admin-line);
  border-radius: 4px;
  overflow: hidden;
}

.leaderboard-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaderboard-bar--phase {
  display: flex;
}

.leaderboard-bar-segment {
  height: 100%;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaderboard-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
  min-width: 40px;
  text-align: right;
}

/* ========================================
   WIN/LOSS TREND LINE
   ======================================== */

.trend-container {
  position: relative;
  width: 100%;
}

.trend-chart-wrap {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.trend-svg {
  width: 100%;
  height: 150px;
  display: block;
}

.trend-x-labels {
  display: flex;
  justify-content: space-between;
  padding: 8px 25px 0 25px;
}

.trend-x-label {
  font-size: 10px;
  color: var(--admin-text-muted);
}

.trend-area-win {
  fill: url(#winGradient);
  opacity: 0.3;
}

.trend-area-loss {
  fill: url(#lossGradient);
  opacity: 0.3;
}

.trend-line-win {
  fill: none;
  stroke: #22c55e;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-line-loss {
  fill: none;
  stroke: #ef4444;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-dot-win {
  fill: #22c55e;
}

.trend-dot-loss {
  fill: #ef4444;
}

.trend-legend {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 16px;
  font-size: 11px;
}

.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--admin-text-muted);
}

.trend-legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.trend-legend-line--win { background: #22c55e; }
.trend-legend-line--loss { background: #ef4444; }

/* Animated line drawing */
.trend-line-animated {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 2s ease-out forwards;
}

/* ========================================
   EXPORT MENU
   ======================================== */

.export-menu {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
  animation: menuSlide 0.2s ease;
}

@keyframes menuSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.export-menu-header {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--admin-text-muted);
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-line);
}

.export-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--admin-text-secondary);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

.export-menu-item:hover {
  background: rgba(255, 107, 43, 0.1);
  color: var(--admin-accent);
}

.export-menu-item i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.export-menu-item i.fa-file-csv { color: #22c55e; }
.export-menu-item i.fa-file-code { color: #3b82f6; }
.export-menu-item i.fa-file-pdf { color: #ef4444; }
.export-menu-item i.fa-table { color: #8b5cf6; }
.export-menu-item i.fa-database { color: #f59e0b; }

.export-menu-divider {
  height: 1px;
  background: var(--admin-line);
  margin: 4px 0;
}

/* ========================================
   CRM SETTINGS - CONFIG GRID
   ======================================== */

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.config-section {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 20px;
}

.config-section-full {
  grid-column: 1 / -1;
}

.config-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.config-section-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

.config-section-header h3 i {
  margin-right: 8px;
  color: var(--admin-accent);
}

.config-section-desc {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-bottom: 16px;
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: all 0.2s;
}

.config-item:hover {
  border-color: var(--admin-line-strong);
}

.config-item.archived {
  opacity: 0.5;
}

.config-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 107, 43, 0.1);
  border-radius: 8px;
  color: var(--admin-accent);
  font-size: 14px;
}

.config-item-info {
  flex: 1;
  min-width: 0;
}

.config-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
}

.config-item-meta {
  font-size: 11px;
  color: var(--admin-text-muted);
  margin-top: 2px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.config-item-meta .task-desc {
  color: var(--admin-text-secondary);
  font-style: italic;
}

.config-item-meta .task-desc i {
  margin-right: 4px;
  opacity: 0.6;
}

/* Task description display */
.config-item-desc {
  font-size: 12px;
  color: var(--admin-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
  max-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.config-item-info-icon {
  font-size: 10px;
  color: var(--admin-text-muted);
  margin-left: 4px;
  opacity: 0.6;
}

.config-item.has-description {
  align-items: flex-start;
}

.config-item.has-description .config-item-icon {
  margin-top: 4px;
}

.config-item-actions {
  display: flex;
  gap: 4px;
}

/* Delete button styling */
.config-item-actions .btn-delete-default,
.config-item-actions .btn-delete-item {
  color: var(--admin-text-muted);
  opacity: 0.5;
  transition: all 0.2s;
}

.config-item-actions .btn-delete-default:hover,
.config-item-actions .btn-delete-item:hover {
  color: #ef4444;
  opacity: 1;
  background: rgba(239, 68, 68, 0.1);
}

.config-item-actions .btn-delete-default:disabled,
.config-item-actions .btn-delete-item:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ========================================
   TASK DRAG AND DROP REORDERING
   ======================================== */

/* Drag handle on left side of task cards */
.config-item-drag-handle {
  width: 24px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-muted);
  cursor: grab;
  opacity: 0.4;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: -4px;
  border-radius: 4px;
}

.config-item-drag-handle:hover {
  opacity: 1;
  color: var(--admin-accent);
  background: rgba(255, 107, 43, 0.1);
}

.config-item-drag-handle:active {
  cursor: grabbing;
}

.config-item-drag-handle i {
  font-size: 14px;
}

/* Dragging state - the item being dragged */
.config-item.dragging {
  opacity: 0.5;
  background: rgba(255, 107, 43, 0.1);
  border-color: var(--admin-accent);
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Drop indicator - shows where item will be placed */
.config-item.drag-over-top {
  border-top: 3px solid var(--admin-accent);
  margin-top: -2px;
}

.config-item.drag-over-bottom {
  border-bottom: 3px solid var(--admin-accent);
  margin-bottom: -2px;
}

/* Highlight effect when hovering over a drop target */
.config-item.drag-over-top,
.config-item.drag-over-bottom {
  background: rgba(255, 107, 43, 0.05);
}

/* Phase Selector */
.phase-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.phase-select-btn {
  padding: 10px 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.phase-select-btn:hover {
  border-color: var(--admin-line-strong);
  color: var(--admin-text-secondary);
}

.phase-select-btn.active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: white;
}

/* Admin Modal */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.admin-modal.open {
  opacity: 1;
  visibility: visible;
}

.admin-modal-content {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.2s;
}

.admin-modal.open .admin-modal-content {
  transform: translateY(0);
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: var(--admin-card);
  border-bottom: 1px solid var(--admin-line);
  flex-shrink: 0;
}

.admin-modal-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

.admin-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.admin-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  background: var(--admin-card);
  border-top: 1px solid var(--admin-line);
  flex-shrink: 0;
}

/* Icon Picker */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  color: var(--admin-text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  border-color: var(--admin-line-strong);
  color: var(--admin-text-secondary);
}

.icon-btn.active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: white;
}

/* Type Checkboxes */
.type-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.type-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.type-checkbox:hover {
  border-color: var(--admin-line-strong);
}

.type-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.type-checkbox span {
  font-size: 13px;
  color: var(--admin-text-secondary);
}

.type-checkbox span i {
  margin-right: 8px;
  color: var(--admin-accent);
}

.form-hint {
  font-size: 11px;
  color: var(--admin-text-muted);
  margin-top: 8px;
}

/* ========================================
   ROSTER HISTORY
   ======================================== */

.roster-history-container {
  margin-top: 16px;
  padding: 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
}

.roster-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.roster-history-count {
  font-family: 'Montserrat', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-accent);
  min-width: 50px;
}

.roster-history-date {
  font-size: 12px;
  color: var(--admin-text-secondary);
  min-width: 100px;
}

.roster-history-by {
  font-size: 11px;
  color: var(--admin-text-muted);
  flex: 1;
}

.roster-history-note {
  font-size: 11px;
  color: var(--admin-text-secondary);
  font-style: italic;
}

.loading-small {
  padding: 12px;
  text-align: center;
  color: var(--admin-text-muted);
  font-size: 13px;
}

.loading-small i {
  margin-right: 8px;
}

/* ========================================
   NEW ANALYTICS - COMPANY TYPE CHART
   ======================================== */

.type-chart-layout {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 0;
}

.type-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.type-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.type-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.type-legend-label {
  flex: 1;
  color: var(--admin-text-secondary);
}

.type-legend-value {
  font-weight: 600;
  color: var(--admin-text);
  min-width: 24px;
  text-align: right;
}

/* ========================================
   NEW ANALYTICS - EMPLOYEE SIZE CHART
   ======================================== */

.size-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 180px;
  padding: 16px 0;
}

.size-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 60px;
}

.size-bar-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

.size-bar {
  width: 100%;
  min-height: 8px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
}

.size-bar-label {
  font-size: 10px;
  color: var(--admin-text-muted);
  text-align: center;
  white-space: nowrap;
}

.size-chart-summary {
  display: flex;
  justify-content: center;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
  margin-top: 12px;
}

.size-summary-item {
  font-size: 12px;
  color: var(--admin-text-secondary);
}

.size-summary-item i {
  margin-right: 6px;
  color: var(--admin-accent);
}

/* ========================================
   NEW ANALYTICS - ROSTER ANALYTICS
   ======================================== */

.chart-container--full {
  grid-column: 1 / -1;
}

.roster-analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
}

.roster-stats-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.roster-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  text-align: center;
}

.roster-stat-card--highlight {
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.1), rgba(255, 107, 43, 0.05));
  border-color: rgba(255, 107, 43, 0.3);
}

.roster-stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-panel);
  border-radius: 10px;
  margin-bottom: 12px;
  color: var(--admin-accent);
  font-size: 18px;
}

.roster-stat-card--highlight .roster-stat-icon {
  background: var(--admin-accent);
  color: white;
}

.roster-stat-value {
  font-family: 'Montserrat', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--admin-text);
  line-height: 1;
}

.roster-stat-label {
  font-size: 11px;
  color: var(--admin-text-muted);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.roster-section {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 16px;
}

.roster-section-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Roster by Phase bars */
.roster-phase-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-phase-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roster-phase-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-secondary);
  min-width: 28px;
}

.roster-phase-bar-wrap {
  flex: 1;
  height: 16px;
  background: var(--admin-panel);
  border-radius: 4px;
  overflow: hidden;
}

.roster-phase-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.roster-phase-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  min-width: 80px;
  text-align: right;
}

.roster-phase-value small {
  font-weight: 400;
  color: var(--admin-text-muted);
}

/* Top companies list */
.roster-top-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.roster-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--admin-panel);
  border-radius: 8px;
}

.roster-top-rank {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-accent);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.roster-top-name {
  flex: 1;
  font-size: 12px;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-top-phase {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--admin-card);
  color: var(--admin-text-secondary);
}

.roster-top-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-accent);
  min-width: 40px;
  text-align: right;
}

/* Roster by type bars */
.roster-type-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-type-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.roster-type-label {
  font-size: 11px;
  color: var(--admin-text-secondary);
  min-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-type-bar-wrap {
  flex: 1;
  height: 14px;
  background: var(--admin-panel);
  border-radius: 4px;
  overflow: hidden;
}

.roster-type-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.roster-type-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  min-width: 40px;
  text-align: right;
}

.chart-empty-small {
  padding: 16px;
  text-align: center;
  color: var(--admin-text-muted);
  font-size: 12px;
}

/* Responsive */
@media (max-width: 1200px) {
  .roster-analytics-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .roster-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
  
  .config-section-full {
    grid-column: 1;
  }
  
  .roster-history-item {
    flex-wrap: wrap;
  }
  
  .roster-analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .roster-stats-row {
    grid-template-columns: 1fr 1fr;
  }
  
  .type-chart-layout {
    flex-direction: column;
  }
}

/* ========================================
   PEOPLE PANEL (Multiple Contacts per Company)
   ======================================== */

.people-header {
  margin-bottom: 20px;
}

.people-header h3 {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.people-header h3 i {
  color: var(--admin-accent);
}

.people-header .help-text {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin: 0;
}

.people-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.people-list .empty-state-small {
  padding: 40px 20px;
  text-align: center;
  background: var(--admin-card);
  border: 1px dashed var(--admin-line);
  border-radius: 12px;
}

.people-list .empty-state-small i {
  font-size: 32px;
  color: var(--admin-text-muted);
  margin-bottom: 12px;
  display: block;
}

.people-list .empty-state-small p {
  font-size: 13px;
  color: var(--admin-text-secondary);
  margin: 0;
}

/* Person Card */
.person-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.person-card:hover {
  border-color: var(--admin-accent);
  box-shadow: 0 2px 8px rgba(255, 106, 26, 0.1);
}

.person-card.primary {
  border-color: var(--admin-accent);
  background: linear-gradient(135deg, rgba(255, 106, 26, 0.05), transparent);
}

.person-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.person-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.person-name {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--admin-text);
}

.primary-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--admin-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.primary-badge i {
  font-size: 10px;
}

.person-actions {
  display: flex;
  gap: 4px;
}

.person-actions .btn-icon {
  width: 28px;
  height: 28px;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.person-card:hover .person-actions .btn-icon {
  opacity: 1;
}

.person-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.person-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--admin-text-secondary);
}

.person-detail i {
  width: 16px;
  text-align: center;
  color: var(--admin-text-muted);
  font-size: 12px;
}

.person-detail a {
  color: var(--admin-accent);
  text-decoration: none;
}

.person-detail a:hover {
  text-decoration: underline;
}

.person-notes {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--admin-text-muted);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid var(--admin-line);
  margin-top: 4px;
}

.person-notes i {
  width: 16px;
  text-align: center;
  font-size: 11px;
  margin-top: 2px;
}

/* Add Person Section */
.people-add-section {
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.people-add-section .btn {
  width: 100%;
}

/* Person Modal */
.person-modal .modal-content {
  max-width: 500px;
}

.person-modal .form-group {
  margin-bottom: 16px;
}

.person-modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.person-modal textarea {
  resize: vertical;
  min-height: 80px;
}

.person-modal .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.person-modal .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--admin-accent);
}

.person-modal .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

/* Responsive */
@media (max-width: 600px) {
  .person-modal .form-row {
    grid-template-columns: 1fr;
  }
  
  .person-card-header {
    flex-direction: column;
    gap: 12px;
  }
  
  .person-actions {
    align-self: flex-end;
  }
}

/* ========================================
   ANALYTICS INTERACTIVE ELEMENTS
   ======================================== */

/* Clickable funnel stages */
.funnel-stage--clickable {
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
}

.funnel-stage--clickable:hover {
  transform: translateY(-4px);
}

.funnel-stage--clickable:hover .funnel-bar {
  filter: brightness(1.2);
}

/* Clickable leaderboard items */
.leaderboard-item--clickable {
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.leaderboard-item--clickable:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

/* Clickable donut legend */
.donut-legend-item--clickable {
  cursor: pointer;
  transition: background 0.2s, padding-left 0.2s;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 6px;
}

.donut-legend-item--clickable:hover {
  background: rgba(255, 255, 255, 0.1);
  padding-left: 12px;
}

/* Clickable heatmap cells */
.heatmap-cell--clickable {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.heatmap-cell--clickable:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

/* Variable size heatmap grid */
.heatmap-grid--variable {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

/* Heatmap cell sizes based on tier - override aspect-ratio */
.heatmap-grid--variable .heatmap-cell {
  aspect-ratio: unset;
}

.heatmap-grid--variable .heatmap-cell--sm,
.heatmap-cell--sm {
  width: 36px !important;
  height: 36px !important;
  font-size: 11px;
}

.heatmap-grid--variable .heatmap-cell--md,
.heatmap-cell--md {
  width: 44px !important;
  height: 44px !important;
  font-size: 12px;
}

.heatmap-grid--variable .heatmap-cell--lg,
.heatmap-cell--lg {
  width: 52px !important;
  height: 52px !important;
  font-size: 13px;
}

.heatmap-grid--variable .heatmap-cell--xl,
.heatmap-cell--xl {
  width: 64px !important;
  height: 64px !important;
  font-size: 14px;
  font-weight: 600;
}

/* Heatmap size legend */
.heatmap-size-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--admin-text-muted);
}

.heatmap-size-label {
  font-weight: 500;
}

.heatmap-size-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.heatmap-size-dot {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.heatmap-size-dot--sm { width: 12px; height: 12px; }
.heatmap-size-dot--md { width: 16px; height: 16px; }
.heatmap-size-dot--lg { width: 20px; height: 20px; }
.heatmap-size-dot--xl { width: 24px; height: 24px; }

/* Heatmap tooltip tier */
.heatmap-tooltip-tier {
  font-size: 10px;
  color: var(--admin-accent);
  margin-bottom: 2px;
}

/* ========================================
   ANALYTICS FILTER POPUP
   ======================================== */

.analytics-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.analytics-popup {
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.analytics-popup-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--admin-line);
}

.analytics-popup-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.analytics-popup-title i {
  color: var(--admin-accent);
}

.analytics-popup-count {
  background: var(--admin-accent);
  color: #000;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.analytics-popup-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--admin-text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}

.analytics-popup-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--admin-text);
}

.analytics-popup-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.analytics-popup-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--admin-text-muted);
}

.analytics-popup-table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-popup-table th {
  position: sticky;
  top: 0;
  background: var(--admin-card);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--admin-text-muted);
  border-bottom: 1px solid var(--admin-line);
}

.analytics-popup-row {
  cursor: pointer;
  transition: background 0.2s;
}

.analytics-popup-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.analytics-popup-row td {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--admin-text-secondary);
  border-bottom: 1px solid var(--admin-line);
}

.popup-cell-company strong {
  color: var(--admin-text);
}

.popup-phase {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.popup-phase--p0 { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.popup-phase--p1 { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.popup-phase--p2 { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.popup-phase--p3 { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.popup-phase--p4 { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.popup-phase--p5 { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

.popup-days--fresh { color: #34d399; }
.popup-days--warning { color: #fbbf24; }
.popup-days--stale { color: #f87171; }

.analytics-popup-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--admin-line);
  display: flex;
  justify-content: flex-end;
}

/* Responsive popup */
@media (max-width: 768px) {
  .analytics-popup {
    max-height: 90vh;
  }
  
  .analytics-popup-table th,
  .analytics-popup-row td {
    padding: 10px 12px;
    font-size: 12px;
  }
  
  .analytics-popup-table th:nth-child(4),
  .analytics-popup-table th:nth-child(5),
  .analytics-popup-row td:nth-child(4),
  .analytics-popup-row td:nth-child(5) {
    display: none;
  }
}

/* ========================================
   PHOTOS PANEL
   ======================================== */

.photos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.photos-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.photo-item:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  font-size: 11px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0;
  transition: opacity 0.2s;
}

.photo-item:hover .photo-delete {
  opacity: 1;
}

.photo-delete:hover {
  background: #ef4444;
}

/* Photo Viewer Modal */
.photo-viewer-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.photo-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.photo-viewer-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.photo-viewer-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.photo-viewer-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-viewer-caption {
  margin-top: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  max-width: 600px;
  text-align: center;
}

/* ========================================
   COMPANY TYPE CHART
   ======================================== */

.type-chart-layout {
  display: flex;
  align-items: center;
  gap: 24px;
}

.donut-svg {
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}

.donut-segment {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transform-origin: center;
  transition: stroke-width 0.2s, opacity 0.2s;
}

.donut-segment--clickable {
  cursor: pointer;
}

.donut-segment--clickable:hover {
  stroke-width: 16;
  opacity: 0.9;
}

.donut-center-text {
  text-anchor: middle;
}

.donut-total {
  font-size: 24px;
  font-weight: 700;
  fill: var(--admin-text);
}

.donut-total-label {
  font-size: 11px;
  fill: var(--admin-text-muted);
  text-transform: uppercase;
}

.type-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.type-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.type-legend-item--clickable {
  cursor: pointer;
}

.type-legend-item--clickable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.type-legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.type-legend-label {
  flex: 1;
  font-size: 12px;
  color: var(--admin-text-secondary);
}

.type-legend-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

/* ========================================
   EMPLOYEE SIZE CHART
   ======================================== */

.size-chart-bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  height: 120px;
  padding: 0 8px;
}

.size-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  max-width: 60px;
  transition: transform 0.2s;
}

.size-bar-group--clickable {
  cursor: pointer;
}

.size-bar-group--clickable:hover {
  transform: translateY(-4px);
}

.size-bar-group--clickable:hover .size-bar {
  filter: brightness(1.1);
}

.size-bar-value {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.size-bar-wrap {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.size-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease, filter 0.2s;
  min-height: 8px;
}

.size-bar-label {
  font-size: 10px;
  color: var(--admin-text-muted);
  margin-top: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.size-chart-summary {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--admin-line);
  text-align: center;
}

.size-summary-item {
  font-size: 12px;
  color: var(--admin-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.size-summary-item i {
  color: var(--admin-accent);
}

/* ========================================
   ROSTER ANALYTICS
   ======================================== */

.roster-analytics-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.roster-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.roster-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.roster-stat-card--highlight {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.roster-stat-icon {
  font-size: 18px;
  color: var(--admin-accent);
  margin-bottom: 8px;
}

.roster-stat-card--highlight .roster-stat-icon {
  color: #22c55e;
}

.roster-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 4px;
}

.roster-stat-card--highlight .roster-stat-value {
  color: #22c55e;
}

.roster-stat-label {
  font-size: 11px;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.roster-section {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 16px;
}

.roster-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Roster by Phase */
.roster-phase-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-phase-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.roster-phase-label {
  width: 28px;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-muted);
}

.roster-phase-bar-wrap {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
}

.roster-phase-bar {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.roster-phase-value {
  min-width: 80px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

.roster-phase-value small {
  font-weight: 400;
  color: var(--admin-text-muted);
}

/* Top Companies */
.roster-top-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.roster-top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  transition: background 0.15s;
}

.roster-top-item--clickable {
  cursor: pointer;
}

.roster-top-item--clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

.roster-top-rank {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  border-radius: 50%;
}

.roster-top-name {
  flex: 1;
  font-size: 13px;
  color: var(--admin-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-top-phase {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.roster-top-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-accent);
  min-width: 40px;
  text-align: right;
}

/* Roster by Type */
.roster-type-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.roster-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  transition: background 0.15s;
  border-radius: 6px;
}

.roster-type-row--clickable {
  cursor: pointer;
  padding: 6px 8px;
  margin: 0 -8px;
}

.roster-type-row--clickable:hover {
  background: rgba(255, 255, 255, 0.05);
}

.roster-type-label {
  width: 100px;
  font-size: 12px;
  color: var(--admin-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-type-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.roster-type-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.roster-type-value {
  min-width: 40px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

/* Empty states */
.chart-empty-small {
  padding: 16px;
  text-align: center;
  color: var(--admin-text-muted);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 768px) {
  .type-chart-layout {
    flex-direction: column;
  }
  
  .roster-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .size-chart-bars {
    gap: 6px;
  }
}

/* ========================================
   TYPE CARDS (Company Type Selection)
   Selectable cards with green border highlight
   ======================================== */

.type-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.type-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--admin-card, #141414);
  border: 2px solid var(--admin-line, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.type-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.05);
}

.type-card.selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.type-card.selected::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.2);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.type-card i {
  font-size: 16px;
  color: var(--admin-text-muted, #a0a0a0);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.type-card.selected i {
  color: #22c55e;
}

.type-card-label {
  font-size: 13px;
  color: var(--admin-text-secondary, #e8e8e8);
  line-height: 1.3;
}

.type-card.selected .type-card-label {
  color: #86efac;
}

.type-card-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Primary type indicator - star button (hidden by default) */
.type-card-primary-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--admin-text-muted, #666);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, color 0.2s, transform 0.2s;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Only show stars when 2+ types selected (grid has show-primary-stars class) */
.show-primary-stars .type-card.selected .type-card-primary-btn {
  opacity: 0.5;
  pointer-events: auto;
}

.show-primary-stars .type-card.selected .type-card-primary-btn:hover {
  opacity: 1;
  color: #f59e0b;
  transform: scale(1.2);
}

.show-primary-stars .type-card-primary-btn.is-primary {
  opacity: 1;
  color: #f59e0b;
}

/* Primary type card styling (only when 2+ selected) */
.show-primary-stars .type-card.primary {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3);
}

.show-primary-stars .type-card.primary::before {
  content: 'PRIMARY';
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 8px;
  font-weight: 700;
  color: #f59e0b;
  letter-spacing: 0.5px;
}

/* Help text inline variant */
.help-text-inline {
  font-size: 11px;
  color: var(--admin-text-muted, #888);
  font-weight: 400;
}

/* Responsive - 2 columns on smaller screens */
@media (max-width: 600px) {
  .type-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .type-card {
    padding: 10px 12px;
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
  
  .type-card i {
    font-size: 20px;
  }
  
  .type-card-label {
    font-size: 11px;
  }
}

/* ========================================
   TJM FOLLOW-UP ACTIONS
   ======================================== */

/* Large modal variant */
.admin-modal-lg {
  max-width: 640px;
}

/* Modal subtitle */
.modal-subtitle {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 4px;
}

.modal-subtitle span {
  color: var(--admin-accent);
  font-weight: 600;
}

/* Follow-up section */
.followup-section {
  margin-bottom: 24px;
}

.followup-section:last-child {
  margin-bottom: 0;
}

.followup-section-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.followup-section-title i {
  color: var(--admin-accent);
}

/* Follow-up list */
.followup-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Follow-up item */
.followup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: all 0.2s;
}

.followup-item:hover {
  border-color: var(--admin-line-strong);
}

.followup-item.disabled {
  opacity: 0.5;
}

.followup-item-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.15), rgba(255, 193, 7, 0.1));
  border-radius: 8px;
  color: var(--admin-accent);
  font-size: 14px;
}

.followup-item-info {
  flex: 1;
  min-width: 0;
}

.followup-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

.followup-item-desc {
  font-size: 11px;
  color: var(--admin-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.followup-item-actions {
  display: flex;
  gap: 4px;
}

.followup-item-actions .btn-icon {
  opacity: 0.6;
  transition: opacity 0.2s;
}

.followup-item:hover .followup-item-actions .btn-icon {
  opacity: 1;
}

/* Toggle button colors */
.btn-toggle-followup i.fa-toggle-on {
  color: #22c55e;
}

.btn-toggle-followup i.fa-toggle-off {
  color: var(--admin-text-muted);
}

/* Follow-up badge on task items */
.followup-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.2), rgba(255, 193, 7, 0.15));
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  color: var(--admin-accent);
}

.followup-badge i {
  font-size: 9px;
}

/* Task item with follow-up indicator */
.config-item.has-followup {
  border-left: 3px solid var(--admin-accent);
}

.config-item.has-followup .config-item-icon {
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.15), rgba(255, 193, 7, 0.1));
}

/* Add follow-up button */
.btn-add-followup {
  color: var(--admin-accent) !important;
}

.btn-add-followup:hover {
  background: rgba(255, 107, 43, 0.1) !important;
}

/* Form row for side-by-side fields */
.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* Improved form input for follow-up modal */
#followup-fields-container .form-group {
  margin-bottom: 16px;
}

#followup-fields-container .form-group:last-child {
  margin-bottom: 0;
}

#followup-fields-container textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

/* Textarea styling */
.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: 'Montserrat', sans-serif;
  line-height: 1.5;
}

/* Optional label indicator */
.form-label-optional {
  font-size: 11px;
  font-weight: 400;
  color: var(--admin-text-muted);
  font-style: italic;
}

/* Action type select styling */
#followup-action-type {
  font-size: 13px;
}

#followup-action-type option {
  padding: 8px;
}

/* ========================================
   PRIORITY LEVELS
   ======================================== */

/* Priority badge in table */
.cell-priority {
  width: 40px;
  text-align: center;
}

.priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  transition: transform 0.15s ease;
}

.priority-badge:hover {
  transform: scale(1.15);
}

.priority-badge.priority-none {
  color: var(--admin-text-muted, #6b7280);
  font-size: 12px;
}

.priority-badge.priority-1 {
  background: rgba(239, 68, 68, 0.15);
}

.priority-badge.priority-2 {
  background: rgba(245, 158, 11, 0.15);
}

.priority-badge.priority-3 {
  background: rgba(59, 130, 246, 0.15);
}

.priority-badge.priority-4 {
  background: rgba(107, 114, 128, 0.15);
}

/* Priority selector in drawer form */
.priority-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.priority-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  color: var(--admin-text-secondary, #e8e8e8);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 500;
}

.priority-option:hover {
  border-color: var(--priority-color, #6b7280);
  background: rgba(255, 255, 255, 0.06);
}

.priority-option.selected {
  border-color: var(--priority-color, #6b7280);
  background: color-mix(in srgb, var(--priority-color, #6b7280) 15%, transparent);
  color: var(--priority-color, #6b7280);
}

.priority-option i {
  font-size: 14px;
  color: var(--priority-color, #6b7280);
}

.priority-option span {
  font-weight: 600;
}

/* ========================================
   QUICK FILTER CHIPS (v54.0)
   Desktop equivalent of mobile quick filters
   ======================================== */

.crm-quick-filters {
  display: flex;
  gap: 10px;
  padding: 12px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--admin-line);
}

.crm-quick-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-line);
  border-radius: 20px;
  color: var(--admin-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.crm-quick-filter:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--admin-text-secondary);
}

.crm-quick-filter.active {
  background: rgba(255, 106, 26, 0.15);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

.crm-quick-filter i {
  font-size: 12px;
}

.crm-quick-filter--warning:hover,
.crm-quick-filter--warning.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}

.crm-quick-filter--danger:hover,
.crm-quick-filter--danger.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.crm-quick-filter--hot:hover,
.crm-quick-filter--hot.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

.crm-quick-filter .filter-count {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.crm-quick-filter.active .filter-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Company Type Dropdown Filter */
.crm-quick-filter-dropdown {
  margin-left: auto;
}

.crm-type-filter {
  padding: 8px 32px 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-line);
  border-radius: 20px;
  color: var(--admin-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.crm-type-filter:hover {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: var(--admin-text-secondary);
}

.crm-type-filter:focus {
  outline: none;
  border-color: var(--admin-accent);
}

.crm-type-filter option {
  background: var(--admin-card);
  color: var(--admin-text);
  padding: 8px;
}

/* Active state when a type is selected */
.crm-type-filter.active {
  background-color: rgba(255, 106, 26, 0.15);
  border-color: var(--admin-accent);
  color: var(--admin-accent);
}

/* ========================================
   SKELETON LOADING STATES (v54.0)
   ======================================== */

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-line);
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
}

.skeleton-line--short {
  width: 40%;
}

.skeleton-line--medium {
  width: 60%;
}

.skeleton-line--long {
  width: 80%;
}

.skeleton-badge {
  width: 50px;
  height: 24px;
  border-radius: 12px;
}

/* ========================================
   TOAST NOTIFICATIONS (v54.0)
   ======================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toast-in 0.3s ease;
  max-width: 400px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast.hiding {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.toast--success .toast-icon {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.toast--error .toast-icon {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
}

.toast--warning .toast-icon {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.toast--info .toast-icon {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
}

.toast-message {
  font-size: 12px;
  color: var(--admin-text-secondary);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--admin-text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.toast-close:hover {
  opacity: 1;
}

/* ========================================
   ENHANCED TABLE ROW STATES (v54.0)
   ======================================== */

.crm-table tbody tr {
  transition: background 0.2s ease, transform 0.1s ease;
}

.crm-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.crm-table tbody tr.selected {
  background: rgba(255, 106, 26, 0.08);
  border-left: 3px solid var(--admin-accent);
}

/* Overdue indicator on table rows */
.crm-table tbody tr.row--overdue {
  border-left: 3px solid #ef4444;
}

.crm-table tbody tr.row--overdue td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ef4444;
}

/* Stale indicator */
.crm-table tbody tr.row--stale {
  opacity: 0.85;
}

.overdue-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.15);
  border-radius: 4px;
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

.overdue-badge i {
  font-size: 10px;
}

/* Source and Owner inline badges */
.inline-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-size: 11px;
  color: var(--admin-text-secondary);
  margin-right: 6px;
}

.inline-badge--source {
  background: rgba(96, 165, 250, 0.1);
  color: #60a5fa;
}

.inline-badge--owner {
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
}

/* ========================================
   MICRO-INTERACTIONS (v54.0)
   ======================================== */

/* Card hover lift effect */
.crm-left-panel,
.crm-detail-drawer,
.chart-container,
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-container:hover,
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Button press effect */
.btn:active {
  transform: scale(0.97);
}

/* Focus states for accessibility */
.btn:focus-visible,
.filter-select:focus-visible,
.filter-input:focus-visible,
.crm-quick-filter:focus-visible {
  outline: 2px solid var(--admin-accent);
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
  }
  
  .toast {
    animation: none;
  }
  
  .toast.hiding {
    animation: none;
    opacity: 0;
  }
  
  .crm-table tbody tr,
  .chart-container,
  .stat-card,
  .btn {
    transition: none;
  }
}

/* ========================================
   PHASE NAMES EDITOR (CRM Settings)
   ======================================== */

.phase-names-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase-name-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--admin-line);
  border-left: 3px solid var(--phase-color, #6b7280);
  border-radius: 8px;
  transition: background 0.2s ease;
}

.phase-name-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.phase-name-code {
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--phase-color, #6b7280);
  background: color-mix(in srgb, var(--phase-color, #6b7280) 15%, transparent);
  padding: 4px 10px;
  border-radius: 6px;
  min-width: 40px;
  text-align: center;
}

.phase-name-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--admin-text);
  font-family: 'Montserrat', sans-serif;
}

.phase-name-input:focus {
  outline: none;
  border-color: var(--phase-color, var(--admin-accent));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--phase-color, var(--admin-accent)) 20%, transparent);
}

.btn-save-phase-name {
  color: var(--phase-color, #10b981);
  opacity: 0.6;
}

.btn-save-phase-name:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--phase-color, #10b981) 15%, transparent);
}

/* Enhanced phase selector with labels */
.phase-select-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 16px;
  min-width: 70px;
}

.phase-select-btn .phase-code {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.8;
}

.phase-select-btn .phase-label {
  font-size: 10px;
  opacity: 0.6;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-select-btn.active .phase-label {
  opacity: 1;
}

/* ========================================
   TASK CARDS (Selectable Cards Style)
   ======================================== */

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--admin-line);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.task-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.task-card.completed {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Processing state - shows spinner while saving */
.task-card.processing {
  opacity: 0.7;
  pointer-events: none;
}

.task-card.processing .task-card-check::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: task-spin 0.6s linear infinite;
}

.task-card.processing .task-card-check i {
  display: none;
}

@keyframes task-spin {
  to { transform: rotate(360deg); }
}

.task-card.completed .task-card-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.task-card.completed .task-card-label {
  color: #10b981;
}

.task-card-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 14px;
  color: var(--admin-text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.task-card-content {
  flex: 1;
  min-width: 0;
}

.task-card-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--admin-text);
  margin-bottom: 2px;
}

.task-card-meta {
  font-size: 11px;
  color: var(--admin-text-muted);
}

.task-card-check {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--admin-line);
  border-radius: 50%;
  color: transparent;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.task-card.completed .task-card-check {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
}

/* Previous phase tasks (collapsible) */
.tasks-history {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.tasks-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 8px 12px;
  margin: -8px -12px 0;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.tasks-history-header:hover {
  background: rgba(107, 114, 128, 0.1);
}

.tasks-history-header.expanded {
  margin-bottom: 12px;
}

.tasks-history-header h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text-muted);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tasks-history-header h4 i {
  color: var(--admin-text-muted);
  font-size: 11px;
}

.tasks-history-header .toggle-icon {
  color: var(--admin-text-muted);
  font-size: 11px;
  transition: transform 0.2s ease;
}

.tasks-history-content {
  padding-top: 8px;
}

/* ========================================
   COLLAPSIBLE FORM GROUPS (v11.4)
   ======================================== */

.collapsible-group {
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 16px;
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.collapsible-header:hover {
  background: rgba(107, 114, 128, 0.08);
}

.collapsible-header .form-label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.collapsible-header .form-label i {
  color: var(--admin-text-muted);
  font-size: 13px;
}

.collapsible-summary {
  font-size: 12px;
  font-weight: 400;
  color: var(--admin-text-secondary);
  margin-left: 8px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collapsible-header .toggle-icon {
  color: var(--admin-text-muted);
  font-size: 11px;
  transition: transform 0.2s ease;
}

.collapsible-content {
  padding: 12px 14px;
  border-top: 1px solid var(--admin-line);
}

.task-card--mini {
  padding: 8px 12px;
  gap: 8px;
}

.task-card--mini .task-card-icon {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.task-card--mini .task-card-label {
  font-size: 12px;
}

.task-card--mini .task-card-check {
  width: 18px;
  height: 18px;
  font-size: 10px;
}

/* Phase group in tasks */
.task-phase-group {
  margin-bottom: 16px;
}

.task-phase-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--admin-line);
}

.task-phase-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--phase-color, rgba(255, 255, 255, 0.1));
  color: var(--admin-text);
}

.task-phase-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
}

.task-phase-progress {
  margin-left: auto;
  font-size: 11px;
  color: var(--admin-text-muted);
}

/* ========================================
   PENDING ACTIONS (Manual Review Queue)
   v56.0 - Improved UI/UX for Ready vs Scheduled
   ======================================== */

.pending-actions-container {
  display: none;
  margin-bottom: 20px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(255, 107, 43, 0.08), rgba(255, 193, 7, 0.05));
  border: 1px solid rgba(255, 107, 43, 0.3);
  border-radius: 12px;
}

.pending-actions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 107, 43, 0.2);
}

.pending-actions-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--admin-accent);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-actions-count {
  background: var(--admin-accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.pending-actions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pending-action-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  transition: all 0.2s;
}

.pending-action-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pending-action-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 16px;
  flex-shrink: 0;
}

.pending-action-content {
  flex: 1;
  min-width: 0;
}

/* Action type label - shows "Create Task", "Send Message", etc. */
.pending-action-type-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--admin-text-muted);
  margin-bottom: 4px;
}

.pending-action-preview {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin-bottom: 6px;
  line-height: 1.4;
}

/* Trigger task link - shows which task triggered this action */
.pending-action-trigger {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pending-action-trigger i {
  font-size: 10px;
  opacity: 0.7;
}

.pending-action-trigger strong {
  color: var(--admin-text);
  font-weight: 500;
}

.pending-action-meta {
  font-size: 11px;
  color: var(--admin-text-muted);
  opacity: 0.8;
}

/* Schedule info row */
.pending-action-schedule {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.pending-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ========================================
   PENDING ACTIONS SECTIONS - Ready vs Scheduled
   ======================================== */

.pending-actions-section {
  margin-bottom: 16px;
}

.pending-actions-section:last-child {
  margin-bottom: 0;
}

.pending-actions-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.section-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.section-status-ready {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  animation: pulse-ready 2s ease-in-out infinite;
}

@keyframes pulse-ready {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.section-status-scheduled {
  background: #8b5cf6;
  opacity: 0.7;
}

.pending-actions-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--admin-text-muted);
  background: var(--admin-bg);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

/* ========================================
   READY TO EXECUTE Section
   ======================================== */

.pending-actions-section--ready {
  padding: 12px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(34, 197, 94, 0.03));
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 10px;
}

.pending-actions-section--ready .pending-actions-section-title {
  color: #22c55e;
}

.pending-action-item--ready {
  border-color: rgba(34, 197, 94, 0.3);
}

.pending-action-item--ready:hover {
  border-color: #22c55e;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

.pending-action-icon--ready {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.1));
  color: #22c55e;
}

/* Run Now button - green, prominent */
.btn-execute-ready {
  background: linear-gradient(135deg, #22c55e, #16a34a) !important;
  border: none !important;
  color: white !important;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
}

.btn-execute-ready:hover {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(34, 197, 94, 0.4);
}

/* ========================================
   SCHEDULED Section
   ======================================== */

.pending-actions-section--scheduled {
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.02));
  border: 1px dashed rgba(139, 92, 246, 0.3);
  border-radius: 10px;
}

.pending-actions-section--scheduled .pending-actions-section-title {
  color: #8b5cf6;
}

.pending-action-item--scheduled {
  background: var(--admin-bg);
  border-style: dashed;
  border-color: rgba(139, 92, 246, 0.25);
  opacity: 0.9;
}

.pending-action-item--scheduled:hover {
  border-color: #8b5cf6;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
  opacity: 1;
}

.pending-action-icon--scheduled {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.08));
  color: #8b5cf6;
}

/* Scheduled date badge */
.scheduled-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
}

.scheduled-countdown {
  font-size: 11px;
  font-weight: 500;
  color: var(--admin-text-muted);
  background: var(--admin-bg);
  padding: 3px 8px;
  border-radius: 4px;
}

.cancel-condition-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #ef4444;
  opacity: 0.8;
}

/* Run Early button - purple, secondary */
.btn-execute-scheduled {
  background: transparent !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  color: #8b5cf6 !important;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
}

.btn-execute-scheduled:hover {
  background: rgba(139, 92, 246, 0.1) !important;
  border-color: #8b5cf6 !important;
}

/* Dismiss button - subtle */
.btn-dismiss {
  background: transparent !important;
  border: 1px solid var(--admin-line) !important;
  color: var(--admin-text-muted) !important;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
}

.btn-dismiss:hover {
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
  background: rgba(239, 68, 68, 0.08) !important;
}

/* ========================================
   COMPLETED HISTORY Section
   ======================================== */

.pending-actions-section--completed {
  padding: 12px;
  margin-top: 12px;
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.06), rgba(107, 114, 128, 0.02));
  border: 1px solid rgba(107, 114, 128, 0.2);
  border-radius: 10px;
}

.pending-actions-section--completed .pending-actions-section-title {
  color: var(--admin-text-muted);
}

.section-status-completed {
  background: #6b7280;
  opacity: 0.6;
}

/* Collapsible header */
.pending-actions-section-header--collapsible {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.pending-actions-section-header--collapsible:hover {
  opacity: 0.8;
}

.section-toggle-icon {
  margin-left: auto;
  font-size: 12px;
  color: var(--admin-text-muted);
  transition: transform 0.2s;
}

.pending-actions-section-header--collapsible.expanded .section-toggle-icon {
  transform: rotate(180deg);
}

/* Completed actions list */
.completed-actions-list {
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

/* Executed action styling */
.pending-action-item--executed {
  background: rgba(34, 197, 94, 0.04);
  border-color: rgba(34, 197, 94, 0.15);
  opacity: 0.85;
}

.pending-action-icon--executed {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
  color: #22c55e;
}

/* Dismissed action styling */
.pending-action-item--dismissed {
  background: rgba(239, 68, 68, 0.04);
  border-color: rgba(239, 68, 68, 0.15);
  opacity: 0.75;
}

.pending-action-icon--dismissed {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.08));
  color: #ef4444;
}

/* Status badges for completed items */
.pending-action-status-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.pending-action-status-badge.status-executed {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.pending-action-status-badge.status-dismissed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Follow-up Timing Section in Settings */
.followup-timing-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--admin-line);
}

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title i {
  color: var(--admin-accent);
}

/* Delay badge in follow-up list */
.followup-delay-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

/* ========================================
   CRM SETTINGS PAGE - Company Type Cards
   ======================================== */

/* Settings page type grid - larger cards */
.settings-type-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.settings-type-card {
  padding: 16px 18px;
  min-height: 60px;
}

.settings-type-card i {
  font-size: 20px;
}

.settings-type-card .type-card-label {
  font-size: 14px;
  font-weight: 500;
}

/* Selected type header in funnel editor */
.selected-type-header {
  margin-bottom: 24px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
}

.selected-type-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.selected-type-info i {
  font-size: 28px;
  color: #22c55e;
}

.selected-type-info h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--admin-text);
}

.selected-type-badge {
  font-size: 11px;
  font-weight: 600;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Config section improvements */
.config-section.mb-24 {
  margin-bottom: 24px;
}

/* Phase selector in settings - horizontal layout */
#config-phase-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#config-phase-selector .phase-select-btn {
  flex: 1;
  min-width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
}

#config-phase-selector .phase-code {
  font-size: 14px;
  font-weight: 700;
}

#config-phase-selector .phase-label {
  font-size: 10px;
  opacity: 0.7;
}

/* ========================================
   MASTER TEMPLATE STYLES
   ======================================== */

/* Master Template Bar - top of settings page */
.master-template-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(251, 191, 36, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 12px;
}

.btn-master-template {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-master-template:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-master-template i {
  font-size: 16px;
}

.master-template-hint {
  font-size: 13px;
  color: var(--admin-text-muted);
}

/* Apply Master Button in phase tasks section */
.config-section-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-apply-master {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-apply-master:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
}

.btn-apply-master i {
  font-size: 12px;
}

/* Master Template Modal Body */
.master-template-body {
  max-height: 70vh;
  overflow-y: auto;
}

.master-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--admin-line);
}

.master-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.master-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--admin-text);
}

.master-section-title i {
  color: #f59e0b;
}

/* Master Phase Names Grid */
.master-phase-names {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.master-phase-name-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  border-left: 3px solid var(--phase-color, #6b7280);
}

.master-phase-code {
  font-size: 12px;
  font-weight: 700;
  color: var(--phase-color, #6b7280);
  min-width: 28px;
}

.master-phase-name-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
}

/* Master Phase Selector */
.master-phase-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.master-phase-selector .phase-select-btn {
  flex: 1;
  min-width: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
}

/* Master Tasks Header */
.master-tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.05);
  border-radius: 8px;
}

.master-tasks-header span {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
}

/* Master Tasks List */
.master-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.master-task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.master-task-item:hover {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.02);
}

.master-task-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-radius: 6px;
  font-size: 12px;
}

.master-task-info {
  flex: 1;
  min-width: 0;
}

.master-task-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--admin-text);
}

.master-task-desc {
  font-size: 12px;
  color: var(--admin-text-muted);
  margin-top: 2px;
}

.master-task-actions {
  display: flex;
  gap: 4px;
}

.master-task-actions .btn-icon {
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.master-task-item:hover .master-task-actions .btn-icon {
  opacity: 1;
}

.master-task-actions .btn-delete-master-task:hover {
  color: #ef4444;
}

/* Apply Master Modal */
.apply-master-desc {
  font-size: 14px;
  color: var(--admin-text);
  margin-bottom: 16px;
  line-height: 1.5;
}

.apply-master-desc strong {
  color: #f59e0b;
}

.apply-master-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 8px;
}

.apply-master-preview {
  padding: 16px;
  background: rgba(245, 158, 11, 0.05);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
}

.apply-preview-summary {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
}

.preview-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #f59e0b;
}

.preview-stat i {
  font-size: 16px;
}

.apply-preview-phases {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preview-phase {
  font-size: 12px;
  color: var(--admin-text-muted);
  padding: 6px 10px;
  background: var(--admin-panel);
  border-radius: 4px;
}

.preview-phase strong {
  color: var(--admin-text);
}

/* ========================================
   ACTIVITY LOG SECTION (v11.0)
   ======================================== */

.drawer-activity-log {
  padding: 16px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  margin-bottom: 16px;
}

.activity-log-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-log-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-log-header h3 i {
  color: #f59e0b;
}

/* Activity Log Form */
.activity-log-form {
  padding: 12px;
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-form-row {
  display: flex;
  gap: 10px;
}

.activity-select {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  background: var(--admin-panel);
  color: var(--admin-text);
}

.activity-log-form textarea {
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--admin-line);
  border-radius: 6px;
  background: var(--admin-panel);
  color: var(--admin-text);
  resize: vertical;
  min-height: 60px;
}

.activity-form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.activity-form-buttons {
  display: flex;
  gap: 8px;
}

/* Next Action Display */
.next-action-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 8px;
}

.next-action-display.empty {
  background: rgba(107, 114, 128, 0.05);
  border-color: rgba(107, 114, 128, 0.2);
}

.next-action-label {
  font-size: 12px;
  font-weight: 600;
  color: #10b981;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.next-action-display.empty .next-action-label {
  color: var(--admin-text-muted);
}

.next-action-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.next-action-text {
  font-size: 13px;
  color: var(--admin-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-action-date {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-radius: 4px;
  white-space: nowrap;
}

.next-action-date.overdue {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.next-action-empty {
  font-size: 13px;
  color: var(--admin-text-muted);
  font-style: italic;
}

/* Activity Timeline */
.activity-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.activity-empty {
  font-size: 12px;
  color: var(--admin-text-muted);
  text-align: center;
  padding: 16px;
}

.activity-entry {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-line);
  border-radius: 6px;
}

.activity-entry-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 12px;
  flex-shrink: 0;
}

.activity-icon-call { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.activity-icon-email { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.activity-icon-meeting { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.activity-icon-demo { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.activity-icon-text { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.activity-icon-voicemail { background: rgba(99, 102, 241, 0.1); color: #6366f1; }
.activity-icon-linkedin { background: rgba(14, 118, 168, 0.1); color: #0e76a8; }
.activity-icon-other { background: rgba(107, 114, 128, 0.1); color: #6b7280; }

.activity-entry-content {
  flex: 1;
  min-width: 0;
}

.activity-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.activity-entry-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--admin-text);
}

.activity-entry-outcome {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
}

.outcome-connected { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.outcome-left_message { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.outcome-no_answer { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.outcome-scheduled { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.outcome-interested { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.outcome-not_interested { background: rgba(107, 114, 128, 0.1); color: #6b7280; }
.outcome-needs_follow_up { background: rgba(236, 72, 153, 0.1); color: #ec4899; }

.activity-entry-note {
  font-size: 12px;
  color: var(--admin-text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.activity-entry-meta {
  font-size: 11px;
  color: var(--admin-text-muted);
  display: flex;
  gap: 6px;
}

/* ========================================
   NOTES & MEDIA PANEL (v11.0)
   ======================================== */

.notes-quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-line);
}

.notes-quick-actions .btn {
  flex: 1;
  justify-content: center;
}

.notes-add-buttons {
  display: flex;
  gap: 8px;
}

/* Photos Section in Notes */
.notes-media-section {
  margin-bottom: 16px;
  border: 1px solid var(--admin-line);
  border-radius: 8px;
  overflow: hidden;
}

.notes-media-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(107, 114, 128, 0.05);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
  transition: background 0.2s ease;
}

.notes-media-header:hover {
  background: rgba(107, 114, 128, 0.1);
}

.notes-media-header i:first-child {
  color: #6b7280;
}

.notes-media-header .toggle-icon {
  margin-left: auto;
  font-size: 11px;
  color: var(--admin-text-muted);
}

.photos-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 8px;
  padding: 12px;
  background: var(--admin-panel);
}

.photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--admin-line);
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-thumb-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.photo-thumb:hover .photo-thumb-delete {
  opacity: 1;
}

.photo-thumb-delete:hover {
  background: #ef4444;
}

.empty-state-mini {
  font-size: 12px;
  color: var(--admin-text-muted);
  text-align: center;
  padding: 12px;
}

/* Notes Timeline Header */
.notes-timeline-header {
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.notes-timeline-header i {
  color: #6b7280;
}

/* Note text icon */
.note-text-icon {
  color: #6b7280;
  margin-right: 6px;
}

/* ========================================
   DRAWER HEADER PRIORITY SELECTOR (v11.2)
   ======================================== */

.drawer-priority-selector {
  display: flex;
  gap: 4px;
}

.priority-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 8px;
  background: rgba(107, 114, 128, 0.1);
  color: var(--admin-text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.priority-btn:hover {
  background: rgba(var(--priority-color), 0.15);
  color: var(--priority-color);
  border-color: var(--priority-color);
}

.priority-btn.selected {
  background: var(--priority-color);
  color: white;
  border-color: var(--priority-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Priority color overrides for hover/selected states */
.priority-btn[data-value="1"]:hover,
.priority-btn[data-value="1"].selected { 
  --priority-color: #ef4444; 
  background: #ef4444;
}
.priority-btn[data-value="1"]:hover:not(.selected) {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.priority-btn[data-value="2"]:hover,
.priority-btn[data-value="2"].selected { 
  --priority-color: #f59e0b;
  background: #f59e0b;
}
.priority-btn[data-value="2"]:hover:not(.selected) {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.priority-btn[data-value="3"]:hover,
.priority-btn[data-value="3"].selected { 
  --priority-color: #3b82f6;
  background: #3b82f6;
}
.priority-btn[data-value="3"]:hover:not(.selected) {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.priority-btn[data-value="4"]:hover,
.priority-btn[data-value="4"].selected { 
  --priority-color: #6b7280;
  background: #6b7280;
}
.priority-btn[data-value="4"]:hover:not(.selected) {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}

.priority-btn[data-value=""]:hover,
.priority-btn[data-value=""].selected { 
  --priority-color: #6b7280;
  background: #6b7280;
}
.priority-btn[data-value=""]:hover:not(.selected) {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
}
