/* =========================================================
   KMH Analytics Dashboard — Design System
   Komarock Modern Healthcare Group
   ========================================================= */

:root {
  /* Core palette (Light Theme - ExpenseSync style) */
  --bg-base: #f8f9fc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-sidebar: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-subtle: rgba(0, 0, 0, 0.04);

  /* Brand */
  --indigo: #4f46e5;
  --cyan: #06b6d4;
  --amber: #d97706;
  --emerald: #059669;
  --rose: #e11d48;
  --violet: #7c3aed;

  /* Text */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.05), 0 8px 32px rgba(0,0,0,0.02);
  --shadow-glow: 0 0 40px rgba(79,70,229,0.1);

  /* Sizing */
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 10px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  line-height: 1.5;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-text { display: flex; flex-direction: column; }
.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.sidebar-nav { padding: 12px 12px; flex: 1; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.15));
  color: var(--text-primary);
  border: 1px solid rgba(99,102,241,0.3);
}
.nav-item.active .nav-icon { color: var(--indigo); }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.data-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}
.status-dot.active {
  background: var(--emerald);
  box-shadow: 0 0 8px rgba(16,185,129,0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* =========================================================
   TOPBAR
   ========================================================= */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.menu-toggle:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.page-title-wrap { display: flex; flex-direction: column; }
h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}
.page-subtitle { font-size: 12px; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.branch-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.branch-selector select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 28px 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
  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='%238b8fa8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.branch-selector select:focus { border-color: var(--indigo); }

.topbar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16,185,129,0.12);
  border: 1px solid rgba(16,185,129,0.25);
  color: var(--emerald);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse 2s infinite;
}

/* =========================================================
   VIEWS
   ========================================================= */
.view { display: none; padding: 28px; flex-direction: column; gap: 24px; }
.view.active { display: flex; }

/* =========================================================
   KPI CARDS
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr; }
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.kpi-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 22px; height: 22px; stroke: white; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-label {
  display: block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}
.kpi-value {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.kpi-trend {
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.kpi-trend.up { color: var(--emerald); }
.kpi-trend.down { color: var(--rose); }

/* =========================================================
   CHARTS
   ========================================================= */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.chart-card.wide { grid-column: span 2; }

@media (max-width: 1100px) {
  .charts-row { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: span 1; }
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
  break-inside: avoid;
  page-break-inside: avoid;
}
.chart-card:hover { border-color: rgba(255,255,255,0.1); }

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}
.chart-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.chart-desc { font-size: 12px; color: var(--text-muted); }

.chart-wrap {
  position: relative;
  height: 240px;
}
.chart-wrap canvas { max-height: 240px; }

.donut-wrap {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.donut-wrap canvas { max-height: 200px; }

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* =========================================================
   BRANCH SECTION
   ========================================================= */
.branch-section { display: flex; flex-direction: column; gap: 16px; }
.section-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.section-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.branch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) {
  .branch-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .branch-grid { grid-template-columns: 1fr; }
}

.branch-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.branch-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.branch-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: rgba(255,255,255,0.12);
}

.branch-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.branch-metric {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.bm-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.bm-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.bm-sub { font-size: 11px; color: var(--text-secondary); }

.occ-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.occ-fill { height: 100%; border-radius: 2px; transition: width 1s cubic-bezier(0.4,0,0.2,1); }

/* =========================================================
   PEAK BANNER
   ========================================================= */
.peak-banner {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.peak-icon { font-size: 32px; }
.peak-content { flex: 1; }
.peak-label { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.peak-value { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; color: var(--text-primary); }
.peak-stat {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

/* =========================================================
   DETAIL KPI ROW
   ========================================================= */
.detail-kpi-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.detail-kpi-row::-webkit-scrollbar { display: none; }

.detail-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex-shrink: 0;
  min-width: 160px;
}
.dk-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 6px; display: block; }
.dk-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
}
.dk-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; display: block; }

/* =========================================================
   UPLOAD
   ========================================================= */
.upload-container {
  max-width: 600px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.upload-box {
  background: var(--bg-card);
  border: 2px dashed rgba(99,102,241,0.3);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  transition: all 0.25s;
  cursor: pointer;
}
.upload-box:hover {
  border-color: rgba(99,102,241,0.6);
  background: var(--bg-card-hover);
}
.upload-box h2 { font-size: 20px; color: var(--text-primary); margin: 16px 0 8px; }
.upload-box p { font-size: 14px; color: var(--text-secondary); }
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.upload-icon { width: 64px; height: 64px; margin: 0 auto; }
.upload-icon svg { width: 64px; height: 64px; stroke: var(--indigo); }

.upload-btn {
  margin-top: 24px;
  background: linear-gradient(135deg, var(--indigo), var(--violet));
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity 0.2s, transform 0.2s;
}
.upload-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.upload-status {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}
.upload-status.success { border-color: rgba(16,185,129,0.4); color: var(--emerald); }
.upload-status.error { border-color: rgba(244,63,94,0.4); color: var(--rose); }

/* =========================================================
   LOADING OVERLAY
   ========================================================= */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,9,15,0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
  width: 48px; height: 48px;
  border: 3px solid rgba(255,255,255,0.08);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay p { color: var(--text-secondary); font-size: 14px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar-right .branch-selector label { display: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 0 16px; gap: 8px; }
  .view { padding: 16px; gap: 16px; }
  .header-left h1 { font-size: 20px; }
  .pdf-btn { padding: 6px 10px; }
  .pdf-btn span { display: none; }
  .period-actions { flex-direction: column; align-items: stretch; }
  .gen-btn { margin-left: 0; }
  .ai-section { padding: 16px; }
  .chart-card { padding: 12px; }
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* number animation */
@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.kpi-value, .dk-value { animation: countUp 0.5s ease forwards; }

/* =========================================================
   AI SUMMARY SECTION
   ========================================================= */
.ai-section {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(34,211,238,0.04));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius);
  padding: 24px;
}
.ai-section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.ai-badge { background: linear-gradient(135deg,#6366f1,#22d3ee); color: white; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 4px 10px; border-radius: 20px; }
.ai-section-title { font-family: 'Space Grotesk', sans-serif; font-size: 16px; font-weight: 700; color: var(--text-primary); }
.ai-summary-text { font-size: 13.5px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; padding: 14px 16px; background: rgba(255,255,255,0.03); border-radius: 10px; border-left: 3px solid var(--indigo); }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .ai-cols { grid-template-columns: 1fr; } }
.ai-col-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 12px; }
.ai-insight-list, .ai-rec-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ai-insight-list li { font-size: 13px; color: var(--text-secondary); line-height: 1.6; padding: 10px 14px; background: rgba(255,255,255,0.03); border-radius: 8px; border-left: 2px solid rgba(34,211,238,0.4); }
.ai-rec-list li { font-size: 13px; color: var(--text-secondary); line-height: 1.6; padding: 10px 14px; background: rgba(255,255,255,0.03); border-radius: 8px; border-left: 2px solid rgba(16,185,129,0.4); }

/* HISTORY */
.history-header { margin-bottom: 4px; }
.history-header h2 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 700; color: var(--text-primary); }
.history-header p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.history-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; transition: all 0.25s; }
.history-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-2px); box-shadow: var(--shadow-card); }
.history-card.active-report { border-color: rgba(99,102,241,0.5); background: rgba(99,102,241,0.06); }
.hc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.hc-label { font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.hc-filename { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.hc-active-badge { background: rgba(99,102,241,0.2); border: 1px solid rgba(99,102,241,0.4); color: var(--indigo); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.hc-meta { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.hc-meta-item { display: flex; flex-direction: column; gap: 1px; }
.hc-meta-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }
.hc-meta-value { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.hc-actions { display: flex; gap: 8px; }
.hc-btn { flex: 1; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text-secondary); font-size: 12px; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; text-align: center; }
.hc-btn:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.hc-btn.primary { background: rgba(99,102,241,0.15); border-color: rgba(99,102,241,0.3); color: var(--indigo); }
.hc-btn.primary:hover { background: rgba(99,102,241,0.25); }
.hc-btn.danger:hover { background: rgba(244,63,94,0.15); border-color: rgba(244,63,94,0.3); color: var(--rose); }
.empty-state { color: var(--text-muted); font-size: 14px; text-align: center; padding: 40px; }

/* PERIOD REPORT */
.period-controls { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.period-controls h2 { font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.period-controls > p { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.period-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.period-pills { display: flex; gap: 8px; }
.pill { padding: 7px 16px; border-radius: 20px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.pill.active { background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.4); color: var(--indigo); }
.pill:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.gen-btn { margin-left: auto; background: linear-gradient(135deg, var(--indigo), var(--violet)); border: none; border-radius: 10px; color: white; font-size: 13px; font-weight: 600; padding: 10px 24px; cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity 0.2s, transform 0.2s; }
.gen-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.period-select-list { display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.period-report-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; transition: all 0.2s; }
.period-report-item:hover { background: rgba(255,255,255,0.06); }
.period-report-item.selected { border-color: rgba(99,102,241,0.4); background: rgba(99,102,241,0.08); }
.pri-check { width: 18px; height: 18px; border: 2px solid var(--border); border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; font-size: 11px; color: white; }
.period-report-item.selected .pri-check { background: var(--indigo); border-color: var(--indigo); }

/* PDF BUTTON */
.pdf-btn { display: flex; align-items: center; gap: 7px; background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text-secondary); padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.pdf-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); border-color: rgba(255,255,255,0.15); }

/* UPLOAD LABEL */
.upload-label-row { margin-top: 20px; text-align: left; }
.upload-label-row label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.label-input { width: 100%; background: var(--bg-surface); border: 1px solid var(--border); color: var(--text-primary); padding: 10px 14px; border-radius: 8px; font-size: 13px; font-family: 'Inter', sans-serif; outline: none; }
.label-input:focus { border-color: var(--indigo); }

/* PRINT */
@media print {
  body::before {
    content: "KMH Analytics Report";
    display: block;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #111;
    font-family: 'Space Grotesk', sans-serif;
  }
  .sidebar, .topbar, .pdf-btn, .topbar-badge, .branch-selector, .menu-toggle { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .view { display: flex !important; padding: 16px !important; }
  #view-upload, #view-history, #view-consolidated { display: none !important; }
  body { background: white !important; color: #111 !important; }
  .kpi-card, .chart-card, .branch-card, .ai-section, .peak-banner { break-inside: avoid; background: #f9f9f9 !important; border: 1px solid #ddd !important; }
  .kpi-value, .dk-value, .bm-value, .chart-title, h1, h2 { color: #111 !important; }
  .kpi-label, .dk-label, .bm-label, .page-subtitle, .chart-desc { color: #555 !important; }
  .ai-insight-list li, .ai-rec-list li, .ai-summary-text { background: #f0f0f0 !important; color: #333 !important; }
}
