/* CaseMix Pro — Dark theme + Amber accent
   Konsisten dengan ekosistem TeknoMedis (slate-900 bg, amber-500 brand)
*/

/* ================= Optimization tab disclaimer ================= */
.optim-disclaimer {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.optim-disclaimer-icon {
  font-size: 22px;
  flex-shrink: 0;
  line-height: 1.3;
}
.optim-disclaimer-body { flex: 1; min-width: 0; }
.optim-disclaimer-title {
  font-weight: 700;
  color: #fbbf24;
  font-size: 14px;
  margin-bottom: 4px;
}
.optim-disclaimer-text {
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}
.optim-disclaimer-text b { color: #fbbf24; }
.optim-disclaimer-foot {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(245, 158, 11, 0.2);
}

/* ================= Demo banner (VPS demo only) ================= */
.demo-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: linear-gradient(90deg, #f59e0b, #d97706);
  color: #0f172a;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  border-bottom: 2px solid #fbbf24;
}
.demo-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 16px 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.demo-banner .demo-icon { font-size: 18px; flex-shrink: 0; }
.demo-banner .demo-text { flex: 1; }
.demo-banner .demo-text b { color: #000; font-weight: 800; }
.demo-banner .demo-cta {
  color: #1e3a8a;
  font-weight: 700;
  text-decoration: underline;
  white-space: nowrap;
  margin-left: 8px;
}
.demo-banner .demo-cta:hover { color: #1e40af; }
.demo-banner .demo-dismiss {
  background: rgba(0, 0, 0, 0.15);
  border: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 700;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.demo-banner .demo-dismiss:hover { background: rgba(0, 0, 0, 0.3); }
@media (max-width: 700px) {
  .demo-banner-inner { flex-wrap: wrap; padding: 8px 12px; font-size: 12px; }
  .demo-banner .demo-cta { margin-left: 0; }
}

:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --bg-3: #0b1220;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --brand: #f59e0b;          /* Amber — CaseMix accent */
  --brand-hover: #fbbf24;
  --brand-dim: #92400e;
  --deep: #0d2137;            /* TeknoMedis master deep */
  --cyan: #0891b2;
  --success: #10b981;
  --warning: #eab308;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ========== LOGIN SCREEN ========== */
.screen-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 20% 30%, rgba(245,158,11,0.08), transparent 40%),
              radial-gradient(circle at 80% 70%, rgba(13,33,55,0.4), transparent 50%),
              var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-mark.sm {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
}

.brand-name-sm {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.brand-tag {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

form label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 12px;
}

form input[type=text], form input[type=password] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s;
}

form input:focus {
  outline: none;
  border-color: var(--brand);
}

.btn-primary {
  width: 100%;
  background: var(--brand);
  color: var(--deep);
  border: none;
  padding: 11px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.15s;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}

.btn-ghost:hover { background: var(--bg-3); color: var(--text); }

.login-error {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  color: #fca5a5;
  font-size: 13px;
}

.login-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.license-banner {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  background: rgba(234,179,8,0.1);
  border: 1px solid rgba(234,179,8,0.3);
  color: #fde047;
}

.ecosystem-note {
  margin-top: 30px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.ecosystem-note b { color: var(--brand); font-weight: 600; }

/* ========== APP SHELL ========== */
.screen-app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-3);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 6px;
  margin-bottom: 2px;
  transition: all 0.15s;
}

.nav-item:hover { background: rgba(245,158,11,0.08); color: var(--text); }
.nav-item.active { background: rgba(245,158,11,0.15); color: var(--brand); font-weight: 600; }
.nav-item.disabled { opacity: 0.4; pointer-events: none; }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 8px;
}

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.topbar-title { font-size: 16px; font-weight: 600; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.badge-clinic {
  padding: 4px 10px;
  background: var(--deep);
  color: var(--brand);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-lic {
  padding: 4px 10px;
  background: rgba(16,185,129,0.15);
  color: var(--success);
  border-radius: 4px;
  font-size: 11px;
}

.tab {
  display: none;
  padding: 24px;
}

.tab.active { display: block; }

/* ========== KPI CARDS ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ========== PANEL ========== */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.placeholder {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--bg-3);
  border-radius: 8px;
  border: 1px dashed var(--border);
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 6px; font-size: 18px; }
.empty-state p { margin: 0 0 20px; color: var(--text-muted); font-size: 13px; }
.empty-state .btn-primary { width: auto; padding: 10px 24px; }

/* ========== TABLES ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-3);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

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

.data-table tbody tr:hover { background: rgba(245,158,11,0.04); }

/* ========== UPLOAD UI ========== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: var(--bg-3);
  cursor: pointer;
  transition: all 0.15s;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--brand);
  background: rgba(245,158,11,0.05);
}

.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.drop-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.drop-subtitle a { color: var(--brand); text-decoration: none; }
.drop-subtitle a:hover { text-decoration: underline; }
.drop-hint { font-size: 11px; color: var(--text-muted); margin-top: 8px; }
.drop-hint code {
  background: var(--bg-2); padding: 2px 6px; border-radius: 3px;
  font-family: 'SF Mono', Monaco, monospace; color: var(--brand);
}

.upload-progress {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-3);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.upload-filename {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text);
}

.progress-bar {
  height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-hover));
  width: 0%;
  transition: width 0.3s;
}

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

.upload-result {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-3);
}

.upload-result.success { border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.05); }
.upload-result.partial { border-color: rgba(234,179,8,0.4); background: rgba(234,179,8,0.05); }
.upload-result.error { border-color: rgba(239,68,68,0.4); background: rgba(239,68,68,0.05); }

.result-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  font-size: 16px; font-weight: 600;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px,1fr));
  gap: 12px;
  margin: 12px 0;
}

.result-stat {
  background: var(--bg-2); padding: 10px 14px; border-radius: 6px;
}
.result-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.result-stat-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.result-errors {
  margin-top: 12px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, monospace;
  background: var(--bg);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ========== TWO COLUMN ========== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ========== DIST LIST ========== */
.dist-list { display: flex; flex-direction: column; gap: 8px; }
.dist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--bg-3); border-radius: 6px;
}
.dist-label { font-size: 13px; font-weight: 600; flex-shrink: 0; width: 140px; }
.dist-bar-wrap { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.dist-bar { height: 100%; background: var(--brand); transition: width 0.4s; }
.dist-count { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-muted); width: 80px; text-align: right; }

/* ========== FILTER SELECT ========== */
.filter-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 150px;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--brand); }
.filter-select option { background: var(--bg-2); }

/* ========== CHART BOXES ========== */
.chart-box {
  position: relative;
  height: 260px;
  padding: 8px;
}
.chart-box.compact { height: 200px; }

/* ========== KPI EXTENDED ========== */
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.kpi-sub.positive { color: var(--success); }
.kpi-sub.negative { color: var(--danger); }

/* ========== PANEL ACTIONS ========== */
.panel-title { display: flex; justify-content: space-between; align-items: center; }
.panel-actions { display: flex; gap: 4px; }

.btn-tab {
  background: var(--bg-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-tab:hover { background: var(--bg); color: var(--text); }
.btn-tab.active { background: var(--brand); color: var(--deep); border-color: var(--brand); }

/* ========== ALERTS PANEL ========== */
.alerts-container { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-3);
  border-radius: 6px;
  border-left: 3px solid var(--border);
  font-size: 13px;
}
.alert-item.critical { border-left-color: var(--danger); background: rgba(239,68,68,0.06); }
.alert-item.warning { border-left-color: var(--warning); background: rgba(234,179,8,0.06); }
.alert-item.info { border-left-color: var(--cyan); }
.alert-icon { font-size: 18px; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; color: var(--text); }
.alert-msg { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ========== FINANCIAL TABLE ========== */
.margin-positive { color: var(--success); font-weight: 600; }
.margin-negative { color: var(--danger); font-weight: 600; }
.margin-breakeven { color: var(--text-muted); }

/* small code cell */
.data-table code {
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 12px;
  color: var(--brand);
  background: rgba(245,158,11,0.08);
  padding: 2px 5px;
  border-radius: 3px;
}

/* ========== DPJP SCORECARD ========== */
.badges-inline {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  color: white;
  font-weight: 600;
  white-space: nowrap;
}

/* ========== MATRIX HEATMAP ========== */
.matrix-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.matrix-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
}
.matrix-table {
  border-collapse: collapse;
  font-size: 11px;
}
.matrix-table th, .matrix-table td {
  padding: 6px 8px;
  text-align: center;
  border: 1px solid var(--border);
  min-width: 70px;
}
.matrix-table th {
  background: var(--bg-3);
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
.matrix-table th.row-header {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-3);
  text-align: left;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.matrix-cell {
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: filter 0.15s;
}
.matrix-cell:hover { filter: brightness(1.25); }
.matrix-cell.empty { background: var(--bg-3); color: var(--text-muted); opacity: 0.4; }

/* Color scale: dark red → red → orange → yellow → green */
.matrix-cell.p0  { background: #10b981; color: white; }    /* margin >= +20% */
.matrix-cell.p1  { background: #34d399; color: #0b1220; }  /* +10% to +20% */
.matrix-cell.p2  { background: #a7f3d0; color: #0b1220; }  /* 0 to +10% */
.matrix-cell.p3  { background: #fcd34d; color: #0b1220; }  /* -10% to 0 */
.matrix-cell.p4  { background: #fca5a5; color: #0b1220; }  /* -20% to -10% */
.matrix-cell.p5  { background: #ef4444; color: white; }    /* < -20% */

.matrix-cell-sub {
  display: block;
  font-size: 9px;
  opacity: 0.8;
  margin-top: 2px;
}

/* ========== OPTIMIZATION ========== */
.kpi-card.highlight-success {
  border-color: rgba(16,185,129,0.4);
  background: linear-gradient(135deg, var(--bg-2) 0%, rgba(16,185,129,0.08) 100%);
}
.kpi-card.highlight-success .kpi-value { color: var(--success); }

.opt-tipe-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.opt-tipe-card {
  background: var(--bg-3);
  padding: 12px;
  border-radius: 8px;
  border-left: 3px solid var(--brand);
}
.opt-tipe-card .label { font-size: 12px; color: var(--text-muted); }
.opt-tipe-card .count { font-size: 20px; font-weight: 700; color: var(--text); }
.opt-tipe-card .potential { font-size: 14px; color: var(--success); font-weight: 600; margin-top: 4px; }

.opt-actions {
  display: flex; gap: 4px;
}
.btn-action {
  background: var(--bg-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}
.btn-action.apply:hover { background: rgba(16,185,129,0.15); color: var(--success); border-color: var(--success); }
.btn-action.review:hover { background: rgba(245,158,11,0.15); color: var(--brand); border-color: var(--brand); }
.btn-action.dismiss:hover { background: rgba(239,68,68,0.15); color: var(--danger); border-color: var(--danger); }

.opt-row-reason {
  font-size: 11px;
  color: var(--text-muted);
  max-width: 400px;
}

.disclaimer {
  margin-top: 16px;
  padding: 14px 18px;
  background: rgba(234,179,8,0.06);
  border-left: 3px solid var(--warning);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.disclaimer b { color: var(--warning); }

/* ========== COMPARISON TABLE ========== */
.comparison-table {
  overflow-x: auto;
}
.comparison-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.comparison-table th {
  padding: 10px 12px;
  background: var(--bg-3);
  color: var(--text-muted);
  font-weight: 600;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.comparison-table th:first-child { text-align: left; }
.comparison-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.comparison-table td:first-child { text-align: left; font-weight: 500; }

.change-pos { color: var(--success); font-weight: 600; }
.change-neg { color: var(--danger); font-weight: 600; }
.change-zero { color: var(--text-muted); }

.forecast-note {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  font-style: italic;
}

/* ========== PHASE 3: NAV BADGE ========== */
.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* ========== CASE MANAGER ========== */
.cm-summary-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cm-summary-pill {
  padding: 6px 12px;
  background: var(--bg-3);
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.cm-summary-pill.extended { color: var(--danger); border: 1px solid rgba(239,68,68,0.3); }
.cm-summary-pill.review { color: var(--warning); border: 1px solid rgba(234,179,8,0.3); }
.cm-summary-pill.normal { color: var(--success); border: 1px solid rgba(16,185,129,0.3); }

.flag-chip {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  border-radius: 3px;
  margin-right: 3px;
  white-space: nowrap;
}
.flag-chip.warning { background: rgba(234,179,8,0.15); color: #fde047; }
.flag-chip.info { background: rgba(8,145,178,0.15); color: #67e8f9; }

.risk-bar {
  display: inline-block;
  width: 50px;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin-right: 6px;
  vertical-align: middle;
}
.risk-bar-fill { height: 100%; }
.risk-low { background: var(--success); }
.risk-medium { background: var(--warning); }
.risk-high { background: var(--danger); }

/* ========== ALERTS INBOX ========== */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-3);
  border-radius: 8px;
  border-left: 4px solid var(--border);
  transition: background 0.15s;
}
.alert-row:hover { background: rgba(245,158,11,0.03); }
.alert-row.critical { border-left-color: var(--danger); }
.alert-row.warning { border-left-color: var(--warning); }
.alert-row.info { border-left-color: var(--cyan); }
.alert-row.status-read { opacity: 0.7; }

.alert-meta { display: flex; gap: 6px; align-items: center; font-size: 11px; color: var(--text-muted); margin-top: 4px; flex-wrap: wrap; }
.alert-row-actions { display: flex; gap: 4px; }

/* ========== AUDIT ========== */
.completeness-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.completeness-row {
  display: grid;
  grid-template-columns: 1fr auto 160px;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-3);
  border-radius: 6px;
  font-size: 13px;
  align-items: center;
}
.completeness-row.ok { color: var(--success); }
.completeness-row.warn { color: var(--warning); }
.completeness-row.bad { color: var(--danger); }
.completeness-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  width: 100px;
}
.completeness-bar-fill { height: 100%; }

.anomaly-group {
  margin-bottom: 16px;
}
.anomaly-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--warning);
  margin-bottom: 6px;
}

/* ========== RI-ONLY PANEL OVERLAY ========== */
.panel[data-ri-only] { position: relative; }
.panel[data-ri-only] .ri-only-overlay {
  display: none;
}
.panel[data-ri-only].panel-ri-only-hidden .ri-only-overlay {
  display: flex;
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  color: var(--text-muted);
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  z-index: 2;
  backdrop-filter: blur(2px);
  padding: 20px;
  text-align: center;
}

/* ========== LICENSE TAB hero ========== */
.license-hero {
  background: linear-gradient(135deg, rgba(245,158,11,0.08), rgba(245,158,11,0.02));
  border-left: 4px solid var(--amber);
}
.lic-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.lic-plan-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--amber);
  color: #0d2137;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 1px;
  border-radius: 12px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.lic-clinic-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.lic-product-name {
  font-size: 13px;
  color: var(--text-muted);
}
.lic-progress-section { margin-bottom: 20px; }
.lic-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
}
.lic-progress-bar {
  width: 100%;
  height: 12px;
  background: var(--bg-3);
  border-radius: 6px;
  overflow: hidden;
}
.lic-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), #fbbf24);
  border-radius: 6px;
  transition: width 0.3s;
}
.lic-progress-fill.warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.lic-progress-fill.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }
.lic-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.lic-meta-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lic-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.lic-meta-value {
  font-size: 14px;
  font-weight: 600;
  font-family: monospace;
  color: var(--text);
}

/* ========== LICENSE CTA (Trial + Buy di login screen) ========== */
.license-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.license-cta.hidden { display: none; }
.btn-trial, .btn-buy {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-trial {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}
.btn-trial:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.btn-buy {
  background: linear-gradient(135deg, var(--amber), #d97706);
  color: #0d2137;
}
.btn-buy:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.cta-note {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
}

/* ========== RENEWAL MODAL pricing grid ========== */
.renewal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 380px;
  overflow-y: auto;
}
.renewal-pkg {
  border: 1px solid var(--border);
  background: var(--bg-3);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.renewal-pkg:hover {
  border-color: var(--amber);
  background: var(--bg-2);
}
.renewal-pkg.selected {
  border-color: var(--amber);
  background: rgba(245,158,11,0.1);
}
.renewal-pkg-name {
  font-weight: 700;
  font-size: 14px;
}
.renewal-pkg-meta {
  font-size: 11px;
  color: var(--text-muted);
}
.renewal-pkg-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--amber);
}
.renewal-summary {
  background: var(--bg-3);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 10px;
}

/* ========== UPDATE NOTIFICATION ========== */
.update-banner {
  background: linear-gradient(90deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05));
  border-bottom: 1px solid rgba(245,158,11,0.5);
  color: var(--text);
  padding: 10px 18px;
  font-size: 13px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.update-banner.hidden { display: none; }
.update-badge {
  display: inline-block;
  background: var(--amber);
  color: #0d2137;
  font-weight: 700;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  margin-top: 6px;
  cursor: help;
  text-align: center;
}
.update-badge.hidden { display: none; }

/* ========== BADGE ROLE ========== */
.badge-role {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  font-family: monospace;
  color: var(--amber);
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(2px);
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  min-width: 360px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--amber); }
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 6px;
  line-height: 1;
}
.modal-close:hover { color: var(--danger); }
.modal-content label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin: 10px 0 4px;
  font-weight: 600;
}
.modal-content input,
.modal-content select {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
}

/* ========== DEDUP GROUPS ========== */
.dedup-group {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.dedup-group-header {
  font-weight: 700;
  font-size: 14px;
  color: var(--amber);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.dedup-group-hash {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
  font-weight: normal;
}
.dedup-candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 4px;
  background: var(--bg-2);
  border-radius: 4px;
  border-left: 3px solid transparent;
}
.dedup-candidate input[type="radio"]:checked + .dedup-label {
  color: var(--amber);
  font-weight: 600;
}
.dedup-candidate:has(input:checked) {
  border-left-color: var(--amber);
  background: rgba(245, 158, 11, 0.08);
}
.dedup-label { flex: 1; }
.dedup-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}
.dedup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.dedup-actions button { padding: 6px 14px; font-size: 12px; }

/* ========== JENIS TOGGLE (Semua / Ranap / Rajal) ========== */
.jenis-toggle {
  display: inline-flex;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.jenis-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 4px;
  font-family: inherit;
  transition: all 0.12s;
}
.jenis-btn:hover {
  color: var(--text);
  background: var(--bg-2);
}
.jenis-btn.active {
  background: var(--amber);
  color: #0d2137;
}

/* ========== PERIODE PICKER (year + month pair) ========== */
.periode-picker {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.periode-picker select {
  min-width: 140px;
}
.periode-picker select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== REPORTS & EXPORT ========== */
.report-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.report-controls label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.export-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  color: var(--text);
  font-family: inherit;
}
.export-card:hover {
  border-color: var(--amber);
  background: var(--bg-2);
  transform: translateY(-1px);
}
.export-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.export-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.export-desc {
  font-size: 11px;
  color: var(--text-muted);
}

/* ============================================================================
   Case Manager Accordion (collapsible panels)
   ============================================================================ */
.cm-accordion {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.cm-accordion[open] {
  border-color: var(--accent2);
}

.cm-accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
  background: var(--panel);
  transition: background 0.15s;
}

.cm-accordion-summary::-webkit-details-marker { display: none; }
.cm-accordion-summary::marker { content: ''; }

.cm-accordion-summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.cm-accordion[open] .cm-accordion-summary {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, rgba(245, 158, 11, 0.02) 100%);
  border-bottom: 1px solid var(--border);
}

.cm-acc-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.cm-acc-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  flex-shrink: 0;
}

.cm-acc-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent2);
  background: rgba(245, 158, 11, 0.12);
  padding: 3px 10px;
  border-radius: 999px;
  min-width: 38px;
  text-align: center;
  flex-shrink: 0;
}

.cm-acc-count.zero {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.cm-acc-count.danger {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.12);
}

.cm-acc-count.warning {
  color: var(--warning);
  background: rgba(234, 179, 8, 0.12);
}

.cm-acc-count.success {
  color: var(--success);
  background: rgba(16, 185, 129, 0.12);
}

.cm-acc-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-acc-chevron {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.cm-accordion[open] .cm-acc-chevron {
  transform: rotate(180deg);
  color: var(--accent2);
}

.cm-acc-body {
  padding: 14px 18px;
  background: var(--panel);
}

.cm-acc-body > .cm-summary-row {
  margin-bottom: 12px;
}

/* Mobile: hide hint pada layar kecil biar gak overflow */
@media (max-width: 768px) {
  .cm-acc-hint { display: none; }
  .cm-accordion-summary { padding: 12px 14px; gap: 8px; }
  .cm-acc-title { font-size: 14px; }
}

/* ============================================================================
   Sidebar Group Labels (Tier 1 — UX restructure 2026-04-28)
   ============================================================================ */
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px 4px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-group-label:first-child {
  margin-top: 0;
  border-top: none;
}

.nav-group-label.admin-section {
  color: rgba(245, 158, 11, 0.7);
  border-top: 1px dashed rgba(245, 158, 11, 0.2);
  margin-top: 8px;
}

.persona-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
}

.persona-switcher::before {
  content: "👁";
  font-size: 14px;
  opacity: 0.6;
}

/* Hide nav items not in current persona */
.nav-item.persona-hidden {
  display: none;
}

/* ============================================================================
   Case Manager Sub-tabs (Tier 2 — split Daily/Risk/Trends)
   ============================================================================ */
.cm-subtabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--panel);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.cm-subtab {
  background: transparent;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--text-muted);
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
  flex: 1 1 auto;
  min-width: 180px;
}

.cm-subtab:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.cm-subtab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
  color: var(--accent2);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.cm-subtab-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
}

.cm-subtab.active .cm-subtab-hint {
  color: var(--text);
  opacity: 0.7;
}

@media (max-width: 768px) {
  .cm-subtabs { flex-direction: column; }
  .cm-subtab { min-width: 100%; }
}
