/* ════════════════════════════════════════════════════════════
   MANAGER DASHBOARD STYLES
   ════════════════════════════════════════════════════════════ */

.manager-dashboard {
  padding: 20px;
  background: linear-gradient(135deg, var(--paper) 0%, var(--cream) 100%);
  min-height: 100vh;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 20px;
}

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

.dashboard-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-filter {
  padding: 8px 12px;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
}

.dashboard-filter:hover {
  border-color: var(--green);
  background: rgba(27,58,45,.05);
}

.btn-refresh {
  padding: 8px 16px;
  background: var(--green);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-refresh:hover {
  background: #134a2e;
  transform: scale(1.05);
}

.btn-refresh:active {
  transform: scale(0.95);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.dashboard-card {
  background: var(--cream);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.dashboard-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--green);
}

.dashboard-card h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

/* Today's Overview */
.today-overview {
  grid-column: span 1;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-item {
  background: linear-gradient(135deg, var(--paper), rgba(237,232,223,.5));
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  border-left: 4px solid var(--muted);
}

.stat-item.present {
  border-left-color: #22c55e;
}

.stat-item.late {
  border-left-color: #f59e0b;
}

.stat-item.flagged {
  border-left-color: #ef4444;
}

.stat-value {
  font-size: 24px;
  font-weight: bold;
  color: var(--green);
  margin-bottom: 4px;
}

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

/* Team Performance */
.team-performance {
  grid-column: span 1;
}

.perf-metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.metric-bar {
  flex: 1;
  height: 20px;
  background: var(--paper);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
}

.metric-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.3s ease;
  min-width: 20px;
}

.metric-row span:first-child {
  font-size: 14px;
  color: var(--ink);
  min-width: 120px;
}

.metric-row span:last-child {
  font-size: 14px;
  font-weight: 600;
  color: var(--green);
  min-width: 50px;
  text-align: right;
}

/* Violations & Anomalies */
.violations-list,
.anomalies-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.violation-item,
.anomaly-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: var(--paper);
  border-radius: 6px;
  border-left: 4px solid #ef4444;
  gap: 10px;
}

.viol-name,
.anom-name {
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}

.viol-count,
.anom-count {
  font-size: 12px;
  color: var(--muted);
}

.btn-small {
  padding: 4px 8px;
  background: var(--green);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-small:hover {
  background: #134a2e;
  transform: translateY(-1px);
}

.none {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Quick Actions */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.action-btn {
  padding: 12px;
  background: linear-gradient(135deg, var(--green), #134a2e);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-size: 12px;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn:active {
  transform: translateY(0);
}

/* Mobile Enhancements */
.mobile-status {
  padding: 12px 0;
  margin-bottom: 16px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
  width: 100%;
  gap: 12px;
}

.status-badge.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
  border: 2px solid #22c55e;
  color: #22c55e;
}

.status-badge.completed {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
  border: 2px solid #3b82f6;
  color: #3b82f6;
}

.status-badge.inactive {
  background: linear-gradient(135deg, rgba(107, 114, 128, 0.1), rgba(107, 114, 128, 0.05));
  border: 2px solid #6b7280;
  color: #6b7280;
}

.badge-time {
  font-size: 12px;
  opacity: 0.8;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeInModal 0.3s ease-out;
}

.modal-content {
  background: var(--cream);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--cream);
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-body {
  padding: 20px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-stats > div {
  background: var(--paper);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
}

.summary-stats strong {
  display: block;
  font-size: 20px;
  color: var(--green);
  margin-top: 4px;
}

.violations-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.viol-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 12px;
  background: var(--paper);
  border-radius: 6px;
  font-size: 12px;
  align-items: center;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stat-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .actions-grid {
    grid-template-columns: 1fr;
  }

  .viol-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 0;
  }

  .modal-content {
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
  }

  .metric-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .metric-row span:last-child {
    text-align: left;
  }

  .dashboard-controls {
    width: 100%;
    flex-direction: column;
  }

  .dashboard-filter {
    width: 100%;
  }
}

/* Loading States */
.loading {
  text-align: center;
  color: var(--muted);
  padding: 20px;
  font-size: 14px;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-card {
  animation: slideIn 0.3s ease-out;
}

/* Severity Colors */
.severity-high {
  border-left-color: #ef4444 !important;
}

.severity-medium {
  border-left-color: #f59e0b !important;
}

.severity-low {
  border-left-color: #3b82f6 !important;
}

.anom-type {
  font-weight: 600;
  color: var(--ink);
  text-transform: capitalize;
}

/* Clock-in/Clock-out Widget */
.clock-widget {
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

/* Dark background - staff dashboard */
.shift-panel .clock-widget {
  background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.2);
}

/* Light background - admin dashboard */
.view-dashboard > div > div:first-child > .clock-widget,
#dashboard-body > div:first-child .clock-widget {
  background: linear-gradient(135deg, var(--cream), rgba(237,232,223,.5));
  border: 1px solid var(--border);
}

.clock-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 600;
}

.shift-panel .clock-label {
  color: rgba(255,255,255,.7);
}

#dashboard-body .clock-label {
  color: var(--muted);
}

.clock-display {
  font-size: 24px;
  font-weight: 700;
  font-family: 'Monaco', 'Courier New', monospace;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.shift-panel .clock-display {
  color: #fff;
}

#dashboard-body .clock-display {
  color: var(--ink);
}

#live-clock-24h {
  display: block !important;
  margin-top: 4px;
  font-size: 11px;
  font-family: 'Monaco', 'Courier New', monospace;
  color: var(--muted) !important;
}

.shift-panel #live-clock-24h {
  color: rgba(255,255,255,.5) !important;
}

#dashboard-body #live-clock-24h {
  color: var(--muted) !important;
}

.clock-date {
  font-size: 10px;
  margin-top: 6px;
}

.shift-panel .clock-date {
  color: rgba(255,255,255,.6);
}

#dashboard-body .clock-date {
  color: var(--muted);
}

.status-widget {
  background: linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.05));
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.status-label {
  font-size: 11px;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12px;
  color: white;
  background: rgba(255,255,255,.2);
}

.status-badge.active {
  background: rgba(34,197,94,.3);
  color: #fff;
}

.status-badge.break {
  background: rgba(251,146,60,.3);
  color: #fff;
}

.status-badge.offline {
  background: rgba(107,114,128,.3);
  color: #fff;
}

/* ════════════════════════════════════════════════════════════
   MOBILE ENHANCEMENTS
   ════════════════════════════════════════════════════════════ */

/* Bottom Mobile Navigation */
.mobile-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cream);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  gap: 0;
  z-index: 100;
}

.mobile-nav-item {
  flex: 1;
  text-align: center;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--muted);
  font-size: 12px;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--green);
  background: rgba(27, 58, 45, 0.05);
}

.mobile-nav-icon {
  font-size: 20px;
}

/* Mobile Action Buttons */
.mobile-action-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cream);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 999;
  animation: slideUp 0.3s ease;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.mobile-action-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.mobile-action-header h2 {
  margin: 0;
  font-size: 18px;
  color: var(--ink);
}

.mobile-action-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-action-item {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
}

.mobile-action-item:active {
  transform: scale(0.98);
  background: rgba(27, 58, 45, 0.05);
}

.mobile-action-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.mobile-action-text {
  flex: 1;
}

.mobile-action-text strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 2px;
}

.mobile-action-text small {
  color: var(--muted);
  font-size: 12px;
}

/* ════════════════════════════════════════════════════════════
   TEAM ANALYTICS
   ════════════════════════════════════════════════════════════ */

.analytics-container {
  display: grid;
  gap: 20px;
}

.analytics-header {
  padding: 12px 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.analytics-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
  font-weight: 600;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.analytics-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.3s ease;
}

.analytics-card:hover {
  border-color: var(--green);
  box-shadow: 0 4px 12px rgba(27, 58, 45, 0.1);
}

.analytics-card-title {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 8px;
}

.analytics-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 4px;
}

.analytics-card-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.analytics-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 8px;
}

.analytics-trend.up {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.analytics-trend.down {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.team-performance-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.team-performance-table thead {
  background: var(--paper);
  border-bottom: 2px solid var(--border);
}

.team-performance-table th {
  padding: 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.team-performance-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.team-performance-table tr:hover {
  background: rgba(27, 58, 45, 0.02);
}

.member-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--ink);
}

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.attendance-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.attendance-badge.present {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.attendance-badge.absent {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.attendance-badge.late {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.compliance-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.compliance-badge.compliant {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

.compliance-badge.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.compliance-badge.alert {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Compliance & Anomaly Detection */

.compliance-alerts-section {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.compliance-alerts-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compliance-alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.compliance-alert-item {
  background: rgba(255, 255, 255, 0.5);
  border-left: 4px solid;
  border-radius: 4px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.compliance-alert-item.high {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.compliance-alert-item.medium {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.compliance-alert-item.low {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.compliance-alert-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.compliance-alert-content {
  flex: 1;
}

.compliance-alert-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 2px;
}

.compliance-alert-message {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.compliance-alert-severity {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
}

.compliance-alert-severity.high {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.compliance-alert-severity.medium {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.compliance-alert-severity.low {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.export-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}

.export-btn {
  padding: 8px 12px;
  background: var(--green);
  border: none;
  border-radius: 4px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-btn:hover {
  background: #134a2e;
  transform: translateY(-1px);
}

.export-btn.secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
}

.export-btn.secondary:hover {
  background: rgba(27, 58, 45, 0.05);
}

/* ════════════════════════════════════════════════════════════
   PATTERNS & TRENDS ANALYSIS
   ════════════════════════════════════════════════════════════ */

.patterns-analysis {
  padding: 20px;
  background: linear-gradient(135deg, var(--paper) 0%, var(--cream) 100%);
  min-height: 100vh;
}

.patterns-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.blocker-pattern-item,
.pattern-item {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
  border-left: 4px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.blocker-pattern-item.severity-high {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.blocker-pattern-item.severity-medium {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.blocker-pattern-item.severity-low {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.blocker-rank {
  font-weight: 700;
  font-size: 16px;
  color: var(--green);
  min-width: 30px;
}

.blocker-info {
  flex: 1;
}

.blocker-text {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 4px;
}

.blocker-meta {
  font-size: 11px;
  color: var(--muted);
}

.blocker-severity {
  flex-shrink: 0;
}

.severity-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: white;
}

.severity-badge.high {
  background: #ef4444;
}

.severity-badge.medium {
  background: #f59e0b;
}

.severity-badge.low {
  background: #3b82f6;
}

/* Impact Assessment */
.impact-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.impact-item {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
}

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

.impact-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
}

.impact-level {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(27, 58, 45, 0.1);
  color: var(--green);
}

.impact-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.impact-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.impact-bar.frequency .impact-fill {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.impact-bar.severity .impact-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.impact-bar {
  flex: 1;
}

.impact-bar .impact-fill {
  height: 12px;
  border-radius: 6px;
  transition: width 0.3s ease;
  min-width: 20px;
}

.impact-value {
  font-size: 10px;
  color: var(--muted);
  min-width: 100px;
}

/* Activity Patterns */
.pattern-item {
  flex-direction: column;
  border-left-color: #3b82f6;
}

.pattern-activity {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  width: 100%;
}

.pattern-stats {
  width: 100%;
  display: flex;
  gap: 16px;
  font-size: 12px;
  margin-top: 4px;
}

.pattern-count {
  font-weight: 700;
  color: var(--green);
}

.pattern-trend {
  color: var(--muted);
}

.pattern-percentage {
  width: 100%;
}

.pattern-bar {
  height: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.pattern-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.3s ease;
}

/* Quality Insights */
.insights-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insight-item {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.insight-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.insight-content {
  flex: 1;
}

.insight-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 2px;
}

.insight-description {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.insight-data {
  font-size: 11px;
  color: var(--green);
  font-weight: 600;
}

.insight-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.insight-badge.positive {
  background: #22c55e;
}

.insight-badge.negative {
  background: #ef4444;
}

.insight-badge.neutral {
  background: #3b82f6;
}

/* Team Health Score */
.health-breakdown {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.health-score {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: center;
}

.health-gauge {
  display: flex;
  justify-content: center;
  align-items: center;
}

.gauge-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 700;
  color: white;
  background: conic-gradient(
    from 0deg,
    #22c55e 0%,
    #22c55e calc(var(--score)),
    rgba(0, 0, 0, 0.1) calc(var(--score))
  );
}

.gauge-circle.good {
  background: conic-gradient(from 0deg, #f59e0b 0%, #f59e0b calc(var(--score)), rgba(0, 0, 0, 0.1) calc(var(--score)));
}

.gauge-circle.needs-improvement {
  background: conic-gradient(from 0deg, #ef4444 0%, #ef4444 calc(var(--score)), rgba(0, 0, 0, 0.1) calc(var(--score)));
}

.gauge-value {
  font-size: 24px;
}

.gauge-label {
  font-size: 10px;
  opacity: 0.9;
}

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

.health-item {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.health-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.health-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

/* Recommendations */
.recommendations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recommendation-item {
  padding: 16px;
  background: var(--paper);
  border-radius: 8px;
  border-left: 4px solid var(--border);
}

.recommendation-item.priority-high {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.recommendation-item.priority-medium {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.recommendation-item.priority-low {
  border-left-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

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

.rec-priority {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rec-category {
  padding: 2px 8px;
  background: rgba(27, 58, 45, 0.1);
  color: var(--green);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.rec-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
  margin-bottom: 4px;
}

.rec-description {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 8px;
}

.rec-impact {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 4px;
}

.rec-action {
  display: flex;
  gap: 8px;
}

.rec-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rec-btn:hover {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

/* Mobile optimizations for analytics */
@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .team-performance-table {
    font-size: 12px;
  }

  .team-performance-table th,
  .team-performance-table td {
    padding: 8px;
  }

  .member-name {
    font-size: 13px;
  }

  .mobile-nav-bar {
    display: flex;
  }

  main {
    padding-bottom: 80px;
  }

  .export-controls {
    flex-direction: column;
  }

  .export-btn {
    width: 100%;
  }
}

/* ════════════════════════════════════════════════════════════
   TEAM PERFORMANCE DASHBOARD
   ════════════════════════════════════════════════════════════ */

.team-performance-dashboard {
  padding: 20px;
  background: linear-gradient(135deg, var(--paper) 0%, var(--cream) 100%);
  min-height: 100vh;
}

/* Sentiment Distribution */
.sentiment-chart {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sentiment-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sentiment-bar {
  flex: 1;
  height: 24px;
  background: var(--paper);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.sentiment-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 12px;
}

.sentiment-item.positive .sentiment-fill {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.sentiment-item.neutral .sentiment-fill {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.sentiment-item.negative .sentiment-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.sentiment-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
}

.sentiment-label .label {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.sentiment-label .count {
  font-size: 14px;
  font-weight: 700;
}

.sentiment-item.positive .count {
  color: #22c55e;
}

.sentiment-item.neutral .count {
  color: #3b82f6;
}

.sentiment-item.negative .count {
  color: #ef4444;
}

.sentiment-label .avg-quality {
  font-size: 11px;
  color: var(--muted);
}

.sentiment-stats {
  display: flex;
  gap: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.sentiment-stats .stat {
  flex: 1;
}

/* Quality Trends */
.trends-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.trend-day {
  padding: 12px;
  background: var(--paper);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 60px 1fr 120px 80px;
  gap: 12px;
  align-items: center;
  border-left: 4px solid var(--border);
}

.trend-date {
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
}

.trend-quality {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quality-value {
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  min-width: 30px;
}

.quality-bar {
  flex: 1;
  height: 16px;
  background: rgba(27, 58, 45, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.quality-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.3s ease;
}

.trend-sentiment {
  display: flex;
  gap: 4px;
}

.sentiment-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

.sentiment-badge.positive {
  background: #22c55e;
}

.sentiment-badge.neutral {
  background: #3b82f6;
}

.sentiment-badge.negative {
  background: #ef4444;
}

.trend-reports {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

/* Blockers & Achievements */
.blockers-list,
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.blocker-item,
.achievement-item {
  padding: 10px;
  background: var(--paper);
  border-radius: 6px;
  border-left: 4px solid var(--border);
}

.blocker-item {
  border-left-color: #ef4444;
}

.achievement-item {
  border-left-color: #22c55e;
}

.blocker-name,
.achievement-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 6px;
}

.blocker-bar,
.achievement-bar {
  height: 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  margin-bottom: 4px;
}

.blocker-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
  transition: width 0.3s ease;
}

.achievement-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: width 0.3s ease;
}

.blocker-pct,
.achievement-pct {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.blocker-count,
.achievement-count {
  font-size: 11px;
  color: var(--muted);
}

/* Staff Rankings Table */
.rankings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.rankings-table thead {
  background: var(--paper);
  border-bottom: 2px solid var(--border);
}

.rankings-table th {
  padding: 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rankings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.rankings-table tbody tr {
  transition: all 0.2s ease;
}

.rankings-table tbody tr:hover {
  background: rgba(27, 58, 45, 0.02);
}

.ranking-row .rank {
  font-weight: 700;
  color: var(--green);
}

.ranking-row .name {
  font-weight: 600;
  color: var(--ink);
}

.ranking-row .dept {
  color: var(--muted);
  font-size: 12px;
}

.ranking-row .reports {
  text-align: center;
}

.ranking-row .points {
  font-weight: 700;
  text-align: center;
}

.ranking-row .points.positive {
  color: #22c55e;
}

.ranking-row .points.negative {
  color: #ef4444;
}

.ranking-row .points.neutral {
  color: var(--muted);
}

.ranking-row .quality {
  text-align: center;
}

.quality-mini {
  height: 12px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 4px;
}

.ranking-row .badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 11px;
  color: white;
}

.ranking-row .badge.positive {
  background: #22c55e;
}

.ranking-row .badge.negative {
  background: #ef4444;
}

/* Department Breakdown */
.department-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.department-item {
  padding: 16px;
  background: var(--paper);
  border-radius: 8px;
  border-left: 4px solid var(--green);
}

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

.dept-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.dept-stats {
  display: flex;
  gap: 8px;
}

.stat-badge,
.points-badge {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.stat-badge {
  background: rgba(27, 58, 45, 0.1);
  color: var(--green);
}

.points-badge {
  color: white;
}

.points-badge.positive {
  background: #22c55e;
}

.points-badge.negative {
  background: #ef4444;
}

.points-badge.neutral {
  background: var(--muted);
}

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

.dept-metrics .metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-bar {
  height: 20px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.metric-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
}

/* Full width card for rankings */
.dashboard-card.full-width {
  grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
  .trend-day {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .trend-date {
    margin-bottom: -4px;
  }

  .trend-sentiment,
  .trend-reports {
    display: none;
  }

  .rankings-table {
    font-size: 11px;
  }

  .rankings-table th,
  .rankings-table td {
    padding: 8px 4px;
  }

  .ranking-row .dept {
    display: none;
  }

  .dept-metrics {
    grid-template-columns: 1fr;
  }

  .dashboard-card.full-width {
    overflow-x: auto;
  }
}

/* ══════════════════════════════════════════════════════════
   MANAGER INTELLIGENCE SUITE v3
   AI briefing, Ask-AI copilot, risk radar, forecast, KPI hero,
   weekday rhythm, correlations, coaching modal, SVG charts
   ══════════════════════════════════════════════════════════ */

/* ── AI cards ─────────────────────────────────────────────── */
.ai-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.ai-card-head h3 { margin: 0; }
.ai-sub {
  font-size: 11px;
  font-weight: 400;
  color: #8a8578;
  margin-left: 8px;
}
.ai-briefing-card {
  border: 1px solid rgba(27, 58, 45, .25);
  background: linear-gradient(160deg, var(--cream) 0%, #f2eee6 60%, #ece4d4 100%);
}
.ai-briefing-headline {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}
.ai-briefing-summary {
  font-size: 13.5px;
  line-height: 1.55;
  color: #3c3830;
  margin-bottom: 12px;
}
.ai-briefing-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 10px;
}
.ai-briefing-cols h4, .ai-coach-cols h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6b6557;
}
.ai-md-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-md-list.bad li::marker { color: #a03028; }
.ai-briefing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.ai-action-chip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: rgba(255, 255, 255, .65);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  max-width: 340px;
}
.ai-action-chip span { color: #6b6557; }
.ai-cache-note {
  margin-top: 10px;
  font-size: 10.5px;
  color: #9a9486;
}
.ai-error { color: #a03028; font-size: 13px; }

/* ── Ask-AI copilot ───────────────────────────────────────── */
.ai-ask-bar {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 18px;
}
.ai-ask-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-ask-icon { font-size: 18px; }
.ai-ask-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
  outline: none;
}
.ai-ask-input:focus { border-color: var(--green); }
.ai-ask-btn {
  padding: 10px 18px;
  background: var(--green);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.ai-ask-btn:disabled { opacity: .6; cursor: wait; }
.ai-ask-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.ai-ask-chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .55);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11.5px;
  color: #5d5749;
  cursor: pointer;
  font-family: inherit;
}
.ai-ask-chip:hover { border-color: var(--green); color: var(--green); }
.ai-ask-answer {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
}
.ai-ask-answer p { margin: 0 0 8px; }
.ai-ask-answer p:last-child { margin-bottom: 0; }
.ai-ask-q {
  font-size: 11.5px;
  color: #8a8578;
  margin-bottom: 8px;
  font-style: italic;
}

/* ── Today's Pulse extras ─────────────────────────────────── */
.pulse-extras {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 12.5px;
  color: #5d5749;
}
.pulse-sparks {
  display: flex;
  gap: 22px;
  margin-top: 12px;
}
.pulse-spark {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pulse-spark > span:first-child {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #9a9486;
}
.ai-delta {
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 4px;
  white-space: nowrap;
}
.ai-delta.up { color: #1d5c3a; }
.ai-delta.down { color: #a03028; }
.ai-delta.flat { color: #9a9486; }
.stat-item.late .ai-delta.up { color: #a03028; }   /* more lates = bad */
.stat-item.late .ai-delta.down { color: #1d5c3a; }

/* ── Forecast ─────────────────────────────────────────────── */
.forecast-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 130px;
}
.forecast-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.forecast-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #6b6557;
  order: 4;
}
.forecast-bar {
  width: 100%;
  max-width: 34px;
  height: 80px;
  background: rgba(0, 0, 0, .06);
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.forecast-fill {
  width: 100%;
  background: linear-gradient(180deg, #2e6b4a, var(--green));
  border-radius: 6px 6px 0 0;
  transition: height .4s ease;
}
.forecast-num { font-size: 13px; font-weight: 700; color: var(--ink); }
.forecast-late { font-size: 9.5px; color: #a03028; }
.forecast-late.ok { color: #1d5c3a; }
.forecast-foot {
  margin-top: 10px;
  font-size: 10.5px;
  color: #9a9486;
}

/* ── Risk radar ───────────────────────────────────────────── */
.risk-summary { display: flex; gap: 8px; }
.risk-pill {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
}
.risk-pill.high  { background: rgba(160, 48, 40, .12); color: #a03028; }
.risk-pill.watch { background: rgba(184, 134, 11, .14); color: #8a6508; }
.risk-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.1fr) minmax(180px, 1.2fr) 2fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--border);
  border-left-width: 4px;
}
.risk-row.level-high  { border-left-color: #a03028; }
.risk-row.level-watch { border-left-color: #b8860b; }
.risk-row.level-ok    { border-left-color: #1d5c3a; }
.risk-name { font-weight: 600; font-size: 13px; }
.risk-role { font-size: 11px; color: #8a8578; }
.risk-score-wrap { display: flex; align-items: center; gap: 8px; }
.risk-bar {
  flex: 1;
  height: 8px;
  background: rgba(0, 0, 0, .07);
  border-radius: 999px;
  overflow: hidden;
}
.risk-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b8860b, #a03028);
}
.risk-score { font-weight: 700; font-size: 13px; min-width: 24px; text-align: right; }
.risk-level-badge {
  font-size: 9.5px;
  font-weight: 800;
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: .03em;
}
.risk-level-badge.high  { background: rgba(160, 48, 40, .12); color: #a03028; }
.risk-level-badge.watch { background: rgba(184, 134, 11, .14); color: #8a6508; }
.risk-level-badge.ok    { background: rgba(29, 92, 58, .12); color: #1d5c3a; }
.risk-factors { display: flex; flex-wrap: wrap; gap: 5px; }
.risk-factor {
  font-size: 10.5px;
  background: rgba(0, 0, 0, .05);
  border-radius: 999px;
  padding: 3px 9px;
  color: #5d5749;
  cursor: help;
}
.risk-actions { display: flex; gap: 6px; }

/* ── KPI hero (performance) ───────────────────────────────── */
.kpi-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-box {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: center;
}
.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}
.kpi-label {
  margin-top: 4px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8a8578;
}

/* ── Spotlight ────────────────────────────────────────────── */
.spotlight-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: rgba(255, 255, 255, .55);
}
.spotlight-item.good { border-left-color: #1d5c3a; }
.spotlight-item.bad  { border-left-color: #a03028; }
.spotlight-icon { font-size: 22px; }
.spotlight-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.spotlight-info span { font-size: 11.5px; color: #6b6557; }

/* ── Rankings extras ──────────────────────────────────────── */
.rank-quality { display: flex; align-items: center; gap: 8px; }
.rank-quality .quality-bar { width: 70px; }
.mom { font-size: 11.5px; font-weight: 700; }
.mom.up { color: #1d5c3a; }
.mom.down { color: #a03028; }
.mom.flat { color: #9a9486; }
.sent-pos { color: #1d5c3a; font-weight: 600; font-size: 12px; }
.sent-neg { color: #a03028; font-weight: 600; font-size: 12px; }
.metric-fill.alt { background: #b8860b; }

/* ── Team health components ───────────────────────────────── */
.ai-gauge { text-align: center; }
.ai-gauge-label { font-size: 12px; font-weight: 600; margin-top: 4px; }
.health-components { margin-top: 12px; display: flex; flex-direction: column; gap: 9px; }
.health-component { font-size: 12px; }
.health-comp-head {
  display: flex;
  justify-content: space-between;
  color: #5d5749;
  margin-bottom: 3px;
}
.health-comp-bar {
  height: 7px;
  background: rgba(0, 0, 0, .07);
  border-radius: 999px;
  overflow: hidden;
}
.health-comp-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}

/* ── Weekday rhythm ───────────────────────────────────────── */
.rhythm-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.rhythm-day { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.rhythm-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: #8a8578;
  text-transform: uppercase;
}
.rhythm-cell {
  text-align: center;
  border-radius: 7px;
  padding: 9px 0;
  font-size: 12px;
  font-weight: 700;
  background: rgba(0, 0, 0, .05);
  color: #6b6557;
}
.rhythm-cell.good { background: rgba(29, 92, 58, .16); color: #1d5c3a; }
.rhythm-cell.mid  { background: rgba(184, 134, 11, .16); color: #8a6508; }
.rhythm-cell.bad  { background: rgba(160, 48, 40, .14); color: #a03028; }
.rhythm-legend {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: #9a9486;
}

/* ── Correlations ─────────────────────────────────────────── */
.corr-item {
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  margin-bottom: 9px;
  background: rgba(255, 255, 255, .55);
}
.corr-item.strong   { border-left-color: #a03028; }
.corr-item.moderate { border-left-color: #b8860b; }
.corr-item.weak     { border-left-color: rgba(140, 133, 119, .5); }
.corr-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  margin-bottom: 4px;
}
.corr-r {
  font-size: 11px;
  font-weight: 700;
  color: #6b6557;
  background: rgba(0, 0, 0, .05);
  border-radius: 999px;
  padding: 2px 8px;
}
.corr-reading { font-size: 12px; line-height: 1.5; color: #5d5749; }

/* ── Trend badges ─────────────────────────────────────────── */
.trend-badge {
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.trend-badge.trend-up   { background: rgba(160, 48, 40, .12); color: #a03028; }
.trend-badge.trend-down { background: rgba(29, 92, 58, .12); color: #1d5c3a; }
.trend-badge.trend-new  { background: rgba(184, 134, 11, .14); color: #8a6508; }
.trend-badge.trend-flat { background: rgba(0, 0, 0, .05); color: #6b6557; }
.rec-first-step {
  margin-top: 6px;
  font-size: 12.5px;
  color: #3c3830;
}

/* ── Coaching modal ───────────────────────────────────────── */
.ai-coach-modal { max-width: 620px; }
.ai-coach-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}
.ai-coach-head span { font-size: 12px; color: #8a8578; }
.ai-coach-summary {
  font-size: 13.5px;
  line-height: 1.6;
  background: rgba(0, 0, 0, .04);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.ai-coach-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
.ai-coach-list { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
.ai-coach-list.good li::marker { color: #1d5c3a; }
.ai-coach-list.bad li::marker { color: #a03028; }
.ai-coach-goal {
  margin-top: 12px;
  padding: 10px 13px;
  background: rgba(29, 92, 58, .08);
  border: 1px solid rgba(29, 92, 58, .25);
  border-radius: 10px;
  font-size: 13px;
}

/* ── Charts ───────────────────────────────────────────────── */
.ai-chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: #6b6557;
}
.ai-chart-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 5px;
  vertical-align: -1px;
}
.ai-line-chart { display: block; }
.ai-spark { display: block; }
.ai-spark-empty { color: #9a9486; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .risk-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "who score" "factors factors" "actions actions";
  }
  .risk-who { grid-area: who; }
  .risk-score-wrap { grid-area: score; min-width: 150px; }
  .risk-factors { grid-area: factors; }
  .risk-actions { grid-area: actions; justify-content: flex-end; }
  .ai-coach-cols { grid-template-columns: 1fr; }
  .forecast-bar { height: 56px; }
}

/* ── Error surfacing + diagnostics (v3.1) ─────────────────── */
.ai-error-banner {
  background: rgba(160, 48, 40, .07);
  border: 1px solid rgba(160, 48, 40, .35);
  border-left: 4px solid #a03028;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
}
.ai-error-title { font-weight: 700; font-size: 13px; color: #a03028; }
.ai-error-msg {
  font-size: 12px;
  color: #5d5749;
  margin: 4px 0 8px;
  font-family: ui-monospace, monospace;
  word-break: break-word;
}
.ai-section-warnings {
  background: rgba(184, 134, 11, .08);
  border: 1px solid rgba(184, 134, 11, .35);
  border-left: 4px solid #b8860b;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-size: 12px;
}
.ai-section-warnings ul {
  margin: 6px 0 8px;
  padding-left: 18px;
}
.ai-section-warnings code {
  background: rgba(0, 0, 0, .06);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
}
.ai-diag-modal { max-width: 720px; }
.diag-summary {
  font-weight: 700;
  font-size: 13.5px;
  padding: 10px 13px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.diag-summary.good { background: rgba(29, 92, 58, .1); color: #1d5c3a; }
.diag-summary.bad  { background: rgba(160, 48, 40, .1); color: #a03028; }
.diag-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.diag-table th {
  text-align: left;
  padding: 6px 8px;
  color: #8a8578;
  font-size: 10.5px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.diag-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  vertical-align: top;
}
.diag-table tr.diag-fail td { background: rgba(160, 48, 40, .06); }
.diag-detail {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  word-break: break-word;
  max-width: 380px;
}
