/* HLW Blend Sandbox — sandbox.css
   Lightweight, dependency-free styling. Dark, engineering-flavored. */

:root {
  --bg: #0b1220;
  --panel: #111a2c;
  --panel-2: #0e1626;
  --line: #1e2a44;
  --text: #dbe4f0;
  --muted: #8ea0bd;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --ok: #34d399;
  --bad: #f87171;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.mono, code { font-family: var(--mono); font-size: 0.92em; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #101a30, #0b1220);
  position: sticky; top: 0; z-index: 5;
}
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.02em; }
.tagline { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 10px; align-items: center; }

button {
  font: inherit; color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 16px; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  font-weight: 600;
}
button.primary:disabled { opacity: 0.6; cursor: wait; }
.help-link { color: var(--muted); font-size: 13px; text-decoration: none; }
.help-link:hover { color: var(--accent-2); }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  padding: 18px 22px;
  align-items: start;
}
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

.sidebar { display: flex; flex-direction: column; gap: 14px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.panel h2 {
  margin: 0 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field span { color: var(--muted); }
select, input[type="number"] {
  font: inherit; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; width: 100%;
}
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.range-row { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.range-row label { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.range-row output { color: var(--text); font-family: var(--mono); }
input[type="range"] { width: 100%; accent-color: var(--accent); }

.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 13px; }
.check input { accent-color: var(--accent); }

details.wac-advanced { margin-top: 8px; }
details.wac-advanced summary {
  color: var(--accent-2); cursor: pointer; font-size: 12px;
}
.wac-ov-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin: 6px 0; font-size: 12px;
}
.wac-ov-row input { width: 110px; }

/* ---------- metrics ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.m-label {
  display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted);
}
.m-value { font-size: 22px; font-weight: 600; font-family: var(--mono); }
/* stale-results marker: metrics dim + amber edge while a rebuild is queued */
.metrics.stale .metric { opacity: 0.45; border-color: #7c5c1e; }
.metrics.stale::after {
  content: "parameters changed — rebuilding…";
  display: block; margin-top: 6px;
  color: #f59e0b; font-size: 12px;
}

/* ---------- charts ---------- */
.chart-panel svg { width: 100%; height: auto; display: block; }

/* ---------- table ---------- */
.table-scroll { overflow-x: auto; max-height: 420px; overflow-y: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th {
  position: sticky; top: 0; background: var(--panel);
  color: var(--muted); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  z-index: 2;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(59, 130, 246, 0.08); }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
td.layers { font-family: var(--mono); font-size: 11px; color: var(--muted); max-width: 260px; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }

/* ---------- detail ---------- */
#campaign-detail .detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 700px) { #campaign-detail .detail-grid { grid-template-columns: 1fr; } }
#campaign-detail h3 { margin: 12px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
table.mini { font-size: 12px; }
table.mini td { border-bottom: 1px dotted var(--line); }

/* ---------- about ---------- */
.about {
  margin: 30px 22px 60px; padding: 18px 22px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px;
}
.about h2 { color: var(--text); font-size: 15px; }
.about code { color: var(--accent-2); }

#drop-note { border-color: #7c5c1e; background: rgba(245, 158, 11, 0.06); font-size: 12.5px; }
