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

:root {
  --bg: #0f1117;
  --bg-card: #1a1b23;
  --bg-card-alt: #27272a;
  --border: #2d2d33;
  --primary: #990011;
  --accent: #ef4444;
  --orange: #f97316;
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #eab308;
  --indigo: #4338ca;
  --indigo-light: #a5b4fc;
  --white: #ffffff;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
}

.logo-title { font-size: 18px; font-weight: 700; color: var(--white); }
.logo-sub { font-size: 11px; color: var(--text-dim); }

.control-section h3, .history-section h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.control-section label {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 2px;
  display: block;
}

.control-section select {
  width: 100%;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.control-section select:focus { border-color: var(--indigo); }

.btn-group {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  padding: 7px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-start {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: white;
}

.btn-start:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3); }
.btn-start:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-stop {
  background: linear-gradient(135deg, var(--accent), #dc2626);
  color: white;
}

.btn-stop:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.btn-stop:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }

.status-section {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.idle { background: var(--text-dim); }
.status-dot.running { background: var(--green); animation: pulse 1.5s infinite; }
.status-dot.completed { background: var(--blue); }
.status-dot.failed { background: var(--accent); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.status-timer {
  font-size: 22px;
  font-weight: 700;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--white);
  margin-top: 2px;
}

.history-section { flex: 1; overflow-y: auto; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  background: var(--bg);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.2s;
}

.history-item:hover { background: var(--bg-card-alt); }
.history-item .hi-date { color: var(--text-dim); }
.history-item .hi-vus { color: var(--indigo-light); font-weight: 600; }
.history-item .hi-error { font-weight: 600; }
.hi-error.good { color: var(--green); }
.hi-error.warn { color: var(--yellow); }
.hi-error.bad { color: var(--accent); }

/* Main */
.main {
  flex: 1;
  margin-left: 260px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* KPI Bar */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.kpi {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  border: 1px solid var(--border);
  transition: border-color 0.3s;
}

.kpi:hover { border-color: var(--indigo); }
.kpi-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--white); margin: 4px 0; font-family: 'Georgia', serif; }
.kpi-sub { font-size: 11px; color: var(--text-dim); }

.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--accent); }
.kpi-value.orange { color: var(--orange); }
.kpi-value.blue { color: var(--blue); }

/* Charts */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.charts-row:has(.chart-small) {
  grid-template-columns: 1fr 1fr 1fr;
}

.chart-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
}

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

.chart-header h3 { font-size: 14px; color: var(--text); font-weight: 600; }

.chart-badge {
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
}

/* Endpoint Table */
.table-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--indigo-light);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.empty-row {
  text-align: center;
  color: var(--text-dim);
  padding: 30px;
  font-style: italic;
}

tr:hover td { background: rgba(99, 102, 241, 0.05); }

.status-tag {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.status-tag.healthy { background: rgba(34,197,94,0.15); color: var(--green); }
.status-tag.warning { background: rgba(234,179,8,0.15); color: var(--yellow); }
.status-tag.critical { background: rgba(239,68,68,0.15); color: var(--accent); }

/* System Health */
.health-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.health-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  text-align: center;
}

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

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

.gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease, background-color 0.5s;
  background: var(--green);
}

.gauge-fill.warn { background: var(--yellow); }
.gauge-fill.critical { background: var(--accent); }

.health-value { font-size: 14px; font-weight: 600; color: var(--text); }
.health-value.big { font-size: 22px; font-weight: 700; color: var(--white); margin: 8px 0 2px; }
.health-sub { font-size: 10px; color: var(--text-dim); }

/* Responsive */
@media (max-width: 1400px) {
  .kpi-bar { grid-template-columns: repeat(3, 1fr); }
  .health-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1000px) {
  .charts-row { grid-template-columns: 1fr; }
  .charts-row:has(.chart-small) { grid-template-columns: 1fr 1fr; }
}

/* Report Links */
.report-links { display: flex; flex-direction: column; gap: 6px; }
.report-link {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border-radius: 6px; padding: 8px 10px;
  text-decoration: none; color: var(--text); font-size: 12px;
  transition: background 0.2s; border: 1px solid var(--border);
}
.report-link:hover { background: var(--bg-card-alt); border-color: var(--indigo); }
.report-link .rl-icon {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.rl-icon.html { background: #3b82f6; }
.rl-icon.pptx { background: #f97316; }
.rl-icon.json { background: #22c55e; }
.rl-icon.s3 { background: #a855f7; }
.rl-icon.log { background: #71717a; }
.report-link .rl-info { flex: 1; }
.report-link .rl-title { font-weight: 600; font-size: 12px; }
.report-link .rl-desc { font-size: 10px; color: var(--text-dim); }

/* Modal */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal-content {
  background: var(--bg-card); border-radius: 16px; width: 90%; max-width: 900px;
  max-height: 85vh; overflow-y: auto; border: 1px solid var(--border);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 20px; color: var(--white); }
.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 24px;
  cursor: pointer; padding: 4px 8px;
}
.modal-close:hover { color: var(--white); }
#compareBody { padding: 24px; }

.compare-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px;
  align-items: center; margin-bottom: 24px;
}
.compare-card {
  background: var(--bg); border-radius: 10px; padding: 16px;
  text-align: center; border: 1px solid var(--border);
}
.compare-card h4 { font-size: 12px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 8px; }
.compare-vs { font-size: 14px; color: var(--text-dim); font-weight: 700; }
.compare-metric { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; text-transform: uppercase; }
.compare-value { font-size: 24px; font-weight: 700; margin: 2px 0; }
.compare-change { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 12px; display: inline-block; margin-top: 4px; }
.compare-change.improved { background: rgba(34,197,94,0.15); color: var(--green); }
.compare-change.degraded { background: rgba(239,68,68,0.15); color: var(--accent); }
.compare-change.neutral { background: rgba(113,113,122,0.15); color: var(--text-muted); }

/* History item with artifacts */
.history-item { position: relative; }
.history-item .hi-artifacts { display: flex; gap: 4px; margin-top: 4px; }
.hi-artifacts a {
  font-size: 9px; padding: 2px 6px; border-radius: 3px;
  text-decoration: none; color: var(--indigo-light);
  background: rgba(99,102,241,0.1);
}
.hi-artifacts a:hover { background: rgba(99,102,241,0.2); }

.hi-verdict {
  font-size: 9px; font-weight: 700; padding: 1px 6px;
  border-radius: 3px; display: inline-block; margin-left: 4px;
}
.hi-verdict.fail { background: rgba(239,68,68,0.15); color: var(--accent); }
.hi-verdict.pass { background: rgba(34,197,94,0.15); color: var(--green); }
.hi-verdict.warn { background: rgba(234,179,8,0.15); color: var(--yellow); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-card-alt); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* Clickable KPIs */
.kpi.clickable { cursor: pointer; transition: all 0.2s; }
.kpi.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99,102,241,0.3); border-color: #6366f1; }

/* AI Recommendations Panel */
.ai-panel { background: var(--bg-card); border-radius: 12px; padding: 24px; margin-top: 20px; border: 1px solid var(--border); }
.ai-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.ai-icon { width: 36px; height: 36px; background: linear-gradient(135deg, #6366f1, #a855f7); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; }
.ai-header h3 { font-size: 18px; color: #e4e4e7; flex: 1; }
.ai-badge { background: #312e81; color: #a5b4fc; font-size: 11px; padding: 4px 10px; border-radius: 12px; }

.ai-severity { background: var(--bg-card-alt); border-radius: 10px; padding: 16px 20px; margin-bottom: 12px; border-left: 4px solid transparent; cursor: pointer; transition: all 0.2s; }
.ai-severity:hover { transform: translateX(4px); }
.ai-severity.critical { border-left-color: #ef4444; }
.ai-severity.high { border-left-color: #f97316; }
.ai-severity.medium { border-left-color: #eab308; }
.ai-severity.low { border-left-color: #22c55e; }

.ai-sev-tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 3px 8px; border-radius: 4px; margin-bottom: 8px; }
.ai-sev-tag.critical { background: #450a0a; color: #fca5a5; }
.ai-sev-tag.high { background: #431407; color: #fed7aa; }
.ai-sev-tag.medium { background: #422006; color: #fde68a; }
.ai-sev-tag.low { background: #052e16; color: #86efac; }

.ai-severity h4 { font-size: 15px; color: #e4e4e7; margin-bottom: 6px; }
.ai-severity p { font-size: 13px; color: #a1a1aa; line-height: 1.5; margin-bottom: 10px; }
.ai-severity code { background: #1e1b4b; color: #a5b4fc; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

.ai-action { background: rgba(99,102,241,0.08); border-radius: 8px; padding: 12px 16px; }
.ai-action strong { font-size: 12px; color: #a5b4fc; text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.ai-action ul { list-style: none; padding: 0; }
.ai-action li { font-size: 13px; color: #d4d4d8; padding: 3px 0; padding-left: 16px; position: relative; }
.ai-action li::before { content: "->"; position: absolute; left: 0; color: #6366f1; font-size: 11px; }

.ai-summary { background: linear-gradient(135deg, #1e1b4b, #312e81); border-radius: 12px; padding: 20px; margin-top: 16px; border: 1px solid #4338ca; }
.ai-summary h4 { font-size: 16px; color: #fff; margin-bottom: 16px; }
.ai-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ai-sum-item { border-radius: 10px; padding: 16px; text-align: center; }
.ai-sum-item.red-bg { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); }
.ai-sum-item.orange-bg { background: rgba(249,115,22,0.15); border: 1px solid rgba(249,115,22,0.3); }
.ai-sum-item.blue-bg { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.3); }
.ai-sum-item.green-bg { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); }
.ai-sum-label { font-size: 11px; color: #a1a1aa; text-transform: uppercase; letter-spacing: 0.5px; }
.ai-sum-value { font-size: 22px; font-weight: 800; color: #fff; margin: 6px 0; }
.ai-sum-desc { font-size: 11px; color: #71717a; }

/* KPI Modal */
.modal-content.wide { max-width: 800px; }
#kpiModalBody table { width: 100%; }
#kpiModalBody .detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
#kpiModalBody .detail-item { background: var(--bg-card-alt); border-radius: 8px; padding: 14px; }
#kpiModalBody .detail-item .dl { font-size: 11px; color: #71717a; text-transform: uppercase; }
#kpiModalBody .detail-item .dv { font-size: 22px; font-weight: 700; color: #e4e4e7; margin: 4px 0; }
#kpiModalBody .detail-item .dd { font-size: 12px; color: #a1a1aa; }

/* Clickable endpoint rows */
#endpointBody tr { cursor: pointer; transition: background 0.15s; }
#endpointBody tr:hover { background: rgba(99,102,241,0.1) !important; }

/* Status tag clickable */
.status-tag { cursor: pointer; }
.status-tag:hover { opacity: 0.8; }

/* Distributed Config Panel */
.dist-config {
  background: #1a1d2e;
  border: 1px solid #2d2d44;
  border-radius: 5px;
  padding: 6px;
  margin-top: 4px;
}
.dist-table {
  width: 100%;
  border-collapse: collapse;
}
.dist-table tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
.dist-table tr:last-child { border-bottom: none; }
.dt-label {
  font-size: 10px;
  color: #71717a;
  padding: 3px 4px;
  width: 65px;
  white-space: nowrap;
}
.dt-val {
  font-size: 10px;
  color: #c7d2fe;
  padding: 3px 4px;
}
.dt-green { color: #22c55e; font-weight: 600; }

/* Scenario tooltip & info */
.info-icon {
  cursor: pointer;
  color: #6366f1;
  font-size: 12px;
  margin-left: 4px;
}
.info-icon:hover { color: #a5b4fc; }
.scenario-tip {
  font-size: 9px;
  color: #71717a;
  margin-top: 2px;
  line-height: 1.3;
}
.scenario-info-panel {
  background: #1a1d2e;
  border: 1px solid #2d2d44;
  border-radius: 5px;
  padding: 8px;
  margin-top: 4px;
}
.sip-title {
  font-size: 10px;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sip-row {
  font-size: 9px;
  color: #a1a1aa;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  line-height: 1.4;
}
.sip-row:last-child { border-bottom: none; }
.sip-row b { color: #e4e4e7; font-size: 10px; }
.sip-row.rec { background: rgba(99,102,241,0.08); border-radius: 3px; padding: 4px; }

/* Main Tabs */
.main-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}
.main-tab {
  padding: 8px 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.main-tab:hover { color: var(--text); }
.main-tab.active {
  color: var(--white);
  border-bottom-color: #6366f1;
}

/* Scripts Tab */
.scripts-header { margin-bottom: 16px; }
.scripts-header h2 { font-size: 20px; font-weight: 700; color: var(--white); }
.scripts-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Platform Tabs */
.platform-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.platform-tab {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.platform-tab:hover { border-color: #4338ca; color: var(--text); }
.platform-tab.active {
  background: rgba(99,102,241,0.15);
  border-color: #6366f1;
  color: #a5b4fc;
}

/* Script Layout */
.script-layout {
  display: flex;
  gap: 12px;
  height: calc(100vh - 200px);
}

/* File List */
.script-file-list {
  width: 220px;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-y: auto;
}
.sfl-header {
  padding: 8px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.script-file-item {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}
.script-file-item:hover { background: rgba(99,102,241,0.08); color: var(--text); }
.script-file-item.active {
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  border-left: 3px solid #6366f1;
}
.script-file-item .file-icon { font-size: 14px; }
.script-file-item .file-name { font-family: 'Consolas', monospace; font-size: 11px; }

/* Editor */
.script-editor-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #1e1f2e;
  border-bottom: 1px solid var(--border);
}
.editor-filename {
  font-family: 'Consolas', monospace;
  font-size: 12px;
  color: #a5b4fc;
}
.editor-actions { display: flex; gap: 8px; align-items: center; }
.editor-status { font-size: 11px; color: var(--green); }
.btn-editor {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(99,102,241,0.15);
  color: #a5b4fc;
  font-size: 11px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-editor:hover:not(:disabled) { background: rgba(99,102,241,0.3); }
.btn-editor:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-editor.btn-reset { background: rgba(239,68,68,0.1); color: #f87171; border-color: rgba(239,68,68,0.2); }
.btn-editor.btn-reset:hover:not(:disabled) { background: rgba(239,68,68,0.2); }

.script-editor {
  flex: 1;
  width: 100%;
  background: #0d0e14;
  color: #e4e4e7;
  border: none;
  padding: 12px 16px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.6;
  resize: none;
  tab-size: 2;
  outline: none;
}
.script-editor::placeholder { color: #444; }

.editor-footer {
  display: flex;
  gap: 16px;
  padding: 6px 12px;
  background: #1e1f2e;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
}

/* API Health Monitor */
.health-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.health-header-bar h2 { font-size: 20px; font-weight: 700; color: var(--white); }
.health-controls { display: flex; align-items: center; gap: 10px; }
.health-last-check { font-size: 11px; color: var(--text-dim); }
.auto-refresh-label { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.auto-refresh-label input { cursor: pointer; }

/* Overview cards */
.health-overview {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.ho-card {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.ho-count { font-size: 28px; font-weight: 800; }
.ho-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.ho-healthy .ho-count { color: #22c55e; }
.ho-degraded .ho-count { color: #f97316; }
.ho-down .ho-count { color: #ef4444; }
.ho-avg .ho-count { color: #3b82f6; font-size: 22px; }
.ho-uptime .ho-count { color: #22c55e; font-size: 22px; }

/* Health groups */
.health-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.hg-title {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.hg-badge {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 10px;
  font-family: 'Consolas', monospace;
}

/* Health table */
.health-table {
  width: 100%;
  border-collapse: collapse;
}
.health-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.health-table td {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.health-table tr:hover { background: rgba(99,102,241,0.05); }
.health-table .ep-name { font-family: 'Consolas', monospace; font-size: 11px; color: #a5b4fc; }
.health-table .method-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.method-badge.get { background: rgba(34,197,94,0.15); color: #22c55e; }
.method-badge.post { background: rgba(59,130,246,0.15); color: #3b82f6; }

/* Status badges */
.health-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}
.health-status.up { background: rgba(34,197,94,0.15); color: #22c55e; }
.health-status.slow { background: rgba(249,115,22,0.15); color: #f97316; }
.health-status.down { background: rgba(239,68,68,0.15); color: #ef4444; }
.health-status.pending { background: rgba(161,161,170,0.1); color: #71717a; }

.latency-val { font-family: 'Consolas', monospace; font-size: 11px; }
.latency-val.fast { color: #22c55e; }
.latency-val.medium { color: #f97316; }
.latency-val.slow { color: #ef4444; }

.response-preview {
  font-size: 10px;
  color: var(--text-dim);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Health AI Panel */
.health-ai-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.hai-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(99,102,241,0.05);
  border-bottom: 1px solid var(--border);
}
.hai-header h3 { font-size: 13px; color: var(--white); flex: 1; }
.hai-badge {
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.hai-badge.critical { background: rgba(239,68,68,0.15); color: #ef4444; }
.hai-badge.degraded { background: rgba(249,115,22,0.15); color: #f97316; }
.hai-badge.healthy { background: rgba(34,197,94,0.15); color: #22c55e; }
.hai-overall {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.hai-item {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.hai-item:last-child { border-bottom: none; }
.hai-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.hai-impact {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
}
.hai-impact.critical { background: rgba(239,68,68,0.15); color: #ef4444; }
.hai-impact.high { background: rgba(249,115,22,0.15); color: #f97316; }
.hai-impact.medium { background: rgba(234,179,8,0.15); color: #eab308; }
.hai-ep-name { font-size: 12px; font-weight: 600; color: var(--white); }
.hai-suggestion { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.hai-user-impact {
  font-size: 10px;
  color: #f87171;
  background: rgba(239,68,68,0.05);
  padding: 4px 8px;
  border-radius: 4px;
  border-left: 2px solid #ef4444;
}
.hai-user-impact.warn {
  color: #fbbf24;
  background: rgba(234,179,8,0.05);
  border-left-color: #eab308;
}

/* Add Endpoint Form */
.ae-label { display: block; font-size: 9px; color: var(--text-dim); margin-bottom: 2px; text-transform: uppercase; }
.ae-input {
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  min-width: 80px;
}
.ae-input:focus { border-color: #6366f1; outline: none; }

/* Delete button in manage table */
.btn-delete {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  color: #f87171;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
}
.btn-delete:hover { background: rgba(239,68,68,0.2); }
.btn-delete:disabled { opacity: 0.3; cursor: not-allowed; }
.type-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 3px;
}
.type-badge.builtin { background: rgba(99,102,241,0.1); color: #a5b4fc; }
.type-badge.custom { background: rgba(34,197,94,0.1); color: #22c55e; }

/* Resolved AI severity */
.ai-severity.resolved { border-left-color: #22c55e; }
.ai-sev-tag.resolved { background: rgba(34,197,94,0.15); color: #22c55e; }
