/* Visual language of rlhv-demo (stats page): dark panels, lime accent. */
:root {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  font-synthesis: none;
  color: #e6edf5;
  background: #10151d;
  --muted: #8a98aa;
  --line: #283240;
  --panel: #181f29;
  --accent: #c1f27b;
  --green: #8dd7ac;
  --red: #f1959b;
  --amber: #e6c38a;
  --blue: #87b6ee;
  /* chart series: validated against the panel surface (dataviz palette, dark steps) */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
code { font: 0.92em ui-monospace, SFMono-Regular, monospace; color: #c8d7e7; }
a { color: var(--accent); }

button {
  font: inherit; color: inherit; background: #202a37; border: 1px solid #354252; border-radius: 7px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; transition: background .14s, border-color .14s;
}
button:hover:not(:disabled) { background: #2d3a4b; border-color: #607187; }
button:disabled { opacity: .35; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #172219; font-weight: 650; }
button.primary:hover:not(:disabled) { background: #d5ff9f; border-color: #d5ff9f; }
button.danger { border-color: #7a4d4d; color: #f3b9bd; }
button.danger:hover:not(:disabled) { background: #46292f; border-color: #c97884; }
button.small { padding: 3px 9px; font-size: 12px; border-radius: 5px; }

/* --- top bar --- */
.topbar {
  height: 58px; display: flex; align-items: center; gap: 28px; padding: 0 26px;
  border-bottom: 1px solid var(--line); background: #131923;
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 19px; letter-spacing: -.4px; }
.brand-mark {
  height: 32px; width: 32px; background: var(--accent); border-radius: 8px; color: #18251c; display: flex;
  align-items: center; justify-content: center; font-family: monospace; font-size: 22px; font-weight: bold;
  letter-spacing: -6px; padding-right: 6px;
}
.brand-mark span { color: #506d32; }
.brand b { font-weight: 450; color: #abb8c9; }
.brand small { display: block; font-size: 9px; letter-spacing: 1.3px; margin-top: 3px; color: #8998a9; }
.eyebrow { font-size: 10px; letter-spacing: 1.6px; font-weight: 600; color: #a2be8a; }
.phase-badge {
  display: flex; flex-direction: column; gap: 2px; padding: 5px 14px; border: 1px solid #3b4a34;
  border-radius: 8px; background: #c1f27b0a;
}
.phase-badge strong { font-size: 17px; font-weight: 600; color: var(--accent); }
.phase-badge[data-phase="paused"] { border-color: #6b5a36; background: #e6c38a0d; }
.phase-badge[data-phase="paused"] strong { color: var(--amber); }
.phase-badge[data-phase="idle"] strong { color: #c4d0de; }
.run-caption { color: var(--muted); font-size: 13px; line-height: 1.45; }
.indicators { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 13px; color: var(--muted); }
.indicator { display: flex; align-items: center; gap: 7px; }
.status-dot { height: 8px; width: 8px; background: #738297; border-radius: 50%; display: inline-block; }
.indicator.ok .status-dot { background: #9ed17b; box-shadow: 0 0 0 4px #9ed17b14; }
.indicator.bad .status-dot { background: var(--red); box-shadow: 0 0 0 4px #f1959b14; }
.indicator.bad { color: #f3b9bd; }
.muted { color: var(--muted); font-size: 13px; }

/* --- page --- */
.monitor { max-width: 1880px; margin: auto; padding: 14px 22px 18px; display: flex; flex-direction: column; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; min-width: 0; }
.section-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-line h2 { font-weight: 550; font-size: 16px; margin: 0; letter-spacing: -.15px; }
.section-line h3 { font-weight: 550; font-size: 13px; margin: 0; color: #b1bdcc; }
.section-line.sub { margin-top: 14px; margin-bottom: 6px; }
.panel-description { color: var(--muted); margin: 0 0 12px; font-size: 13px; line-height: 1.55; max-width: 1100px; }
.alert {
  border: 1px solid #7a4d4d; background: #36232a; color: #f0c2c6; padding: 10px 14px; border-radius: 8px;
  font-size: 14px; line-height: 1.5; overflow-wrap: anywhere;
}
.alert.warning { border-color: #6b5a36; background: #2f2a20; color: #ecd3a6; }
.alert b { font-weight: 650; }
#alerts { display: flex; flex-direction: column; gap: 8px; }
#alerts:empty { display: none; }

/* --- controls --- */
.controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 10px 18px; }
.settings { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.settings label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.settings label.check { flex-direction: row; align-items: center; gap: 7px; padding-bottom: 8px; color: #c4d0de; font-size: 13px; }
.settings input[type="number"] {
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; width: 118px; padding: 5px 9px;
  color: #e6edf5; background: #111923; border: 1px solid #354252; border-radius: 6px;
}
.settings input:disabled { opacity: .55; }
.settings .muted { padding-bottom: 8px; }
.settings.test-review { margin: 4px 0 12px; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- human feedback --- */
.hf { display: flex; flex-direction: column; gap: 12px; }
.hf .section-line { margin-bottom: 0; }
.hf .metric { background: #141b24; }
.hf-tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.hf-tables .table-scroll { max-height: 230px; }
.settings select {
  font: inherit; font-size: 14px; min-width: 250px; padding: 6px 9px; color: #e6edf5; background: #111923;
  border: 1px solid #354252; border-radius: 6px;
}
.hf-settings { padding-top: 10px; border-top: 1px solid var(--line); }
.hf-settings button, .hf-switch button { margin-bottom: 1px; }
.hf-settings input[type="number"] { width: 132px; }
.hf-weights {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 0; padding: 4px 12px 8px;
  border: 1px solid var(--line); border-radius: 8px;
}
.hf-weights legend { padding: 0 6px; font-size: 12px; color: var(--muted); }
.hf-weights input[type="number"] { width: 96px; }
.hf-mix-hint { flex-basis: 100%; padding-bottom: 0; }
/* A task below the F1 threshold: the banner with the three ways out. */
.hf-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 9px 14px; font-size: 15px;
  background: #162130; border: 1px solid #2c3d55; border-radius: 8px; }
.hf-now[hidden] { display: none; }
.hf-now-label { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: #a6bbd3; }
.hf-now b { color: #edf4ff; font-weight: 600; }
#hf-now-eta { color: var(--accent); font-variant-numeric: tabular-nums; }
.hf-attention { display: flex; flex-direction: column; gap: 10px; }
.hf-attention[hidden] { display: none; }
.hf-attention .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hf-attention-actions { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.hf-attention-actions label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #f0c2c6; }
.hf-attention-actions input[type="number"] {
  font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; width: 96px; padding: 5px 9px;
  color: #e6edf5; background: #111923; border: 1px solid #7a4d4d; border-radius: 6px;
}
.hf-attention-actions span { padding-bottom: 7px; font-size: 13px; }
#hf-live { display: flex; flex-direction: column; gap: 10px; }
.hf .metric small { white-space: normal; overflow: visible; }
.metric-grid.hf-tiles { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: stretch; }
#hf-rounds-table tr[title], #hf-batches-table td[title], #hf-batches-table th[title], #hf-rounds-table th[title],
#hf-acceptance-table td[title], #hf-acceptance-table th[title] { cursor: help; }

/* --- key numbers --- */
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 0; }
.metric-title { color: #b1bdcc; font-size: 13px; }
.metric strong {
  display: block; font-size: 30px; font-weight: 500; letter-spacing: -1.2px; margin: 6px 0 6px;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric strong em { font-style: normal; font-size: 14px; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.metric small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.55; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric small b { color: #d5dee9; font-weight: 500; }
.bar { height: 6px; background: #293341; border-radius: 4px; overflow: hidden; margin: 2px 0 7px; }
.bar i { display: block; height: 100%; width: 0; background: #a6d87f; border-radius: 4px; transition: width .5s; }
.bar.tall { height: 10px; margin: 8px 0 10px; }
.bar.tall i { background: #80a9db; }

/* --- status row --- */
.status-columns { display: grid; grid-template-columns: 1fr 1.55fr 1.25fr; gap: 12px; }
.job-tag { font: 15px ui-monospace, SFMono-Regular, monospace; color: #d6e1ed; overflow-wrap: anywhere; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 13px; color: #9eacbe; line-height: 1.7; }
.kv b { color: #d6e1ed; font-weight: 450; font-variant-numeric: tabular-nums; }
.tensorboard { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; color: #9eacbe; }
.tensorboard b { color: #d6e1ed; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 12px ui-monospace, SFMono-Regular, monospace; padding: 3px 7px; border-radius: 5px; border: 1px solid #354252; color: #b6c2d0; }
.chip.pinned { border-color: #4f6a3a; color: #cfe8b0; background: #c1f27b0a; }
.chip.latest { border-color: #87b6ee80; color: #c5dcf7; }

table.compact { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
table.compact th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--muted); padding: 4px 8px 5px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.compact td { padding: 5px 8px 5px 0; border-bottom: 1px solid #28324080; color: #c8d3df; white-space: nowrap; vertical-align: middle; }
table.compact tr:last-child td { border-bottom: 0; }
table.compact td.num, table.compact th.num { text-align: right; }
table.compact td.wrap { white-space: normal; overflow-wrap: anywhere; }
table.compact td.mono { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
table.compact tr.best td { background: #c1f27b10; color: #e9f6d6; }
table.compact tr.clickable { cursor: pointer; }
table.compact tr.clickable:hover td { background: #ffffff08; }
.table-scroll { max-height: 330px; overflow: auto; }
.table-scroll.tall { max-height: 60dvh; }
.table-scroll thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.cell-actions { display: flex; gap: 5px; justify-content: flex-end; }
.mini-bar { display: inline-block; width: 70px; height: 5px; background: #2c3845; border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 7px; }
.mini-bar i { display: block; height: 100%; background: #6c869d; }

/* status words: colour plus text, never colour alone */
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; border: 1px solid #3a4758; color: #b6c2d0; }
.tag.ok { border-color: #3f6a55; color: #a9e3c2; background: #8dd7ac0d; }
.tag.run { border-color: #3f5f86; color: #b3d1f5; background: #87b6ee0d; }
.tag.wait { border-color: #5d5438; color: #e6cf9f; background: #e6c38a0a; }
.tag.bad { border-color: #7a4d55; color: #f3b9bd; background: #f1959b0d; }
.tag.star { border-color: #7d9a55; color: #dff5bd; background: #c1f27b14; margin-left: 6px; }

/* --- charts --- */
.chart-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.plot { width: 100%; height: 210px; position: relative; }
.plot.tall { height: 330px; }
.plot .empty { position: absolute; inset: 0; display: grid; place-content: center; color: var(--muted); font-size: 13px; }
.tests-layout { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.tests-layout.wide-table { grid-template-columns: minmax(0, 0.55fr) minmax(0, 1.45fr); }
.uplot { font-family: inherit; }
.u-legend { font-size: 12px; color: #b6c2d0; text-align: left; margin: 2px 0 0; }
.u-legend th { font-weight: 450; }
.u-legend .u-marker { width: 10px; height: 3px; border-radius: 2px; }
.u-legend .u-value { font-variant-numeric: tabular-nums; color: #e6edf5; }
.u-select { background: #c1f27b18; }
.u-hz .u-cursor-x, .u-vt .u-cursor-y { border-right-color: #8a98aa; }
.u-hz .u-cursor-y, .u-vt .u-cursor-x { border-bottom-color: #8a98aa55; }

/* --- bottom --- */
.bottom-columns { display: grid; grid-template-columns: 1.35fr 1fr; gap: 12px; }
.events { max-height: 330px; overflow: auto; font-size: 13px; }
.event { display: grid; grid-template-columns: max-content 74px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid #28324080; line-height: 1.45; }
.event:last-child { border-bottom: 0; }
.event time { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.event p { margin: 0; color: #c8d3df; overflow-wrap: anywhere; }
.event.error p { color: #f0c2c6; }
.stats-footer { display: flex; justify-content: space-between; color: #617185; font-size: 12px; margin: 2px; }

/* --- dialogs, toast --- */
dialog {
  color: #d4e0ed; background: #18222e; border: 1px solid #455367; border-radius: 12px; box-shadow: 0 20px 100px #0008;
  padding: 22px 26px; max-width: 900px; width: calc(100vw - 40px);
}
dialog::backdrop { background: #04080dbb; backdrop-filter: blur(3px); }
#confirm-dialog { max-width: 560px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.dialog-heading h2 { font-size: 19px; font-weight: 550; margin: 0; }
.dialog-heading button { padding: 0 10px; font-size: 22px; background: transparent; border-color: transparent; }
.rubric { font-size: 14px; color: #a9b8c9; line-height: 1.7; margin: 14px 0 18px; white-space: pre-line; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #2d3b34; border: 1px solid #5d866a;
  border-radius: 7px; padding: 11px 18px; color: #c8e4c5; box-shadow: 0 10px 40px #0006; z-index: 10; font-size: 14px;
  max-width: 85vw; text-align: center;
}
.toast.error { background: #412c32; border-color: #965260; color: #f1bac4; }
.stale .metric, .stale .panel { opacity: .6; }

@media (max-width: 1500px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-columns { grid-template-columns: 1fr 1fr; }
  .tests-layout, .tests-layout.wide-table, .bottom-columns { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 12px; }
  .indicators { margin-left: 0; flex-wrap: wrap; gap: 12px; }
  .monitor { padding: 12px; }
  .metric-grid, .chart-grid, .status-columns { grid-template-columns: 1fr; }
}
