:root {
  --bg-main: #f8fafc;
  --panel-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary-blue: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --danger-color: #ef4444;
  --success-color: #10b981;
  --warning-color: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  padding: 24px;
  line-height: 1.5;
}

.dashboard-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

header {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.title-group h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.title-group p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.control-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

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

.control-item input[type="date"] {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.dropdown-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 220px;
  user-select: none;
}

.dropdown-btn:hover {
  border-color: var(--primary-blue);
}

.multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  margin-top: 4px;
  z-index: 100;
  display: none;
  width: 320px;
  padding: 8px;
}

.multiselect-dropdown.show {
  display: block;
}

.dropdown-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.btn-xs {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  cursor: pointer;
  font-weight: 500;
}

.btn-xs:hover {
  background: #e2e8f0;
}

.rep-list-container {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rep-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.rep-item:hover {
  background: var(--accent-light);
}

.badge-mandeep {
  margin-left: auto;
  font-size: 10px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary-blue);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-export {
  background: #059669;
}

.btn-export:hover {
  background: #047857;
}

/* AI Executive Analysis Box */
.ai-narrative-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 100%);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-header {
  display: flex;
  align-items: center;
}

.ai-header h3 {
  font-size: 16px;
  color: #1e40af;
  font-weight: 700;
}

.ai-body {
  font-size: 13px;
  color: #1e3a8a;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Interactive AI Q&A Container */
.ai-ask-container {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 16px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-ask-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.ai-prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.prompt-chip:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.ai-input-group {
  display: flex;
  gap: 8px;
}

.ai-input-group input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
}

.ai-input-group input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.ai-ask-response {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #0f172a;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* AI Predictor Card */
.ai-predictor-card {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 22px 26px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

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

.predictor-icon {
  font-size: 24px;
}

.predictor-title h3 {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.predictor-subtitle {
  font-size: 11px;
  color: #94a3b8;
}

.confidence-badge {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: #34d399;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #34d399;
}

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

.predictor-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pred-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  font-weight: 600;
}

.pred-value {
  font-size: 24px;
  font-weight: 800;
  color: #38bdf8;
  margin: 6px 0 2px 0;
}

.pred-sub {
  font-size: 11px;
  color: #64748b;
}

.pred-takeaway {
  font-size: 12px;
  color: #e2e8f0;
  line-height: 1.5;
  margin-top: 6px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.kpi-card.highlight {
  border-left: 4px solid var(--primary-blue);
}

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

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  margin: 6px 0 2px 0;
}

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

.kpi-sub.warning {
  color: var(--warning-color);
  font-weight: 600;
}

.kpi-sub.danger {
  color: var(--danger-color);
  font-weight: 600;
}

/* Tables */
.section-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.pulse-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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