/* =========================================================================
   ControlLab — page identity on top of kit.css.
   Accent is azure blue: the one gap left in the palette the other fifteen
   labs already occupy, so a ControlLab tab is recognisable by colour alone.
   ========================================================================= */
:root {
  --bp-cyan: #4dabf7;          /* primary accent */
  --bp-blue: #74c0fc;          /* secondary */
  --bp-mark: #4dabf7;
  --note-accent: #4dabf7;
  --calc-col: 340px;
  --page-max: 1420px;
}

/* A faint grid, like the sibling labs, but drawn as a time axis: the
   vertical lines are closer together, which reads as "something is being
   sampled". */
body {
  background-image:
    linear-gradient(rgba(77, 171, 247, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 171, 247, 0.045) 1px, transparent 1px);
  background-size: 96px 96px, 32px 96px;
}

.hint {
  font-size: 0.76rem; color: var(--bp-ink-dim); line-height: 1.55;
  margin-top: 0.5rem;
}
.hint b { color: var(--bp-cyan); }

/* --------------------------- segmented control --------------------------- */
.seg-row {
  display: flex; gap: 0.25rem; margin-bottom: 0.7rem;
  border: 1px solid var(--bp-line); border-radius: 8px; padding: 0.2rem;
  background: var(--bp-bg);
}
.seg-row button {
  flex: 1; font-family: var(--mono); font-size: 0.76rem; font-weight: 600;
  color: var(--bp-ink-dim); background: transparent; border: 0;
  border-radius: 6px; padding: 0.35rem 0.5rem; cursor: pointer; transition: 0.16s;
}
.seg-row button:hover { color: var(--bp-ink); }
.seg-row button.active { color: var(--bp-bg); background: var(--bp-cyan); }

/* ------------------------------ tuning rules ----------------------------- */
.tune-list { display: flex; flex-direction: column; gap: 0.35rem; }
.tune-btn {
  display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem;
  align-items: baseline; text-align: left; width: 100%;
  background: var(--bp-bg); color: inherit;
  border: 1px solid var(--bp-line); border-left: 3px solid var(--rule, var(--bp-cyan));
  border-radius: 7px; padding: 0.45rem 0.7rem; cursor: pointer; transition: 0.15s;
}
.tune-btn:hover { border-color: var(--rule, var(--bp-cyan)); background: var(--bp-panel2); }
.tune-btn .tr-name { font-family: var(--mono); font-size: 0.79rem; font-weight: 600; color: var(--rule, var(--bp-cyan)); }
.tune-btn .tr-ms { font-family: var(--mono); font-size: 0.7rem; }
.tune-btn .tr-vals { grid-column: 1 / -1; font-family: var(--mono); font-size: 0.68rem; color: var(--bp-ink-dim); }

/* --------------------------------- plots --------------------------------- */
#stepPlot svg, #bodePlot svg { display: block; width: 100%; height: auto; }

/* ------------------------------- the numbers ----------------------------- */
.metric-grid {
  display: grid; gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.metric {
  background: var(--bp-bg); border: 1px solid var(--bp-line);
  border-radius: 8px; padding: 0.55rem 0.7rem;
}
.metric .m-lab { font-size: 0.68rem; color: var(--bp-ink-dim); line-height: 1.35; }
.metric .m-val {
  font-family: var(--mono); font-size: 1.02rem; font-weight: 700;
  color: var(--bp-cyan); margin-top: 0.15rem;
}
.metric.good .m-val { color: var(--bp-green); }
.metric.warn .m-val { color: var(--bp-amber); }
.metric.bad .m-val { color: var(--bp-red); }

.verdict {
  margin-left: auto; font-family: var(--mono); font-size: 0.72rem;
  font-weight: 600; padding: 0.12rem 0.5rem; border-radius: 5px;
}
.verdict.ok { color: var(--bp-green); border: 1px solid var(--bp-green); }
.verdict.bad { color: var(--bp-red); border: 1px solid var(--bp-red); }

/* ------------------------------- the checks ------------------------------ */
.check {
  display: flex; gap: 0.5rem; align-items: flex-start;
  font-size: 0.81rem; line-height: 1.6; padding: 0.35rem 0;
  border-bottom: 1px solid var(--bp-line);
}
.check:last-child { border-bottom: 0; }
.check .c-ico { flex: none; font-family: var(--mono); font-weight: 700; }
.check.ok .c-ico { color: var(--bp-green); }
.check.warn .c-ico { color: var(--bp-amber); }
.check.bad .c-ico { color: var(--bp-red); }
.check b { color: var(--bp-ink); }

@media (max-width: 900px) {
  .metric-grid { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
}
