:root {
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --accent: #334155;
  --bg: #f8fafc;
  --side: #f1f5f9;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: ui-sans-serif, system-ui, sans-serif; color: var(--ink); background: var(--bg); }
body { display: flex; min-height: 100vh; }
.side {
  width: 280px; flex-shrink: 0; background: var(--side); border-right: 2px solid #cbd5e1;
  padding: 1rem 0.85rem; overflow-y: auto; position: sticky; top: 0; height: 100vh;
}
.side h2 { margin: 0 0 0.5rem; font-size: 1.05rem; color: #1e293b; }
#filter { width: 100%; margin-bottom: 0.75rem; padding: 0.4rem 0.5rem; border: 1px solid #cbd5e1; border-radius: 0.35rem; }
.pkg-group { background: #fff; border: 1px solid #cbd5e1; border-radius: 0.45rem; padding: 0.45rem; margin-bottom: 0.5rem; }
.pkg-head { font-size: 0.75rem; font-weight: 700; color: #1e293b; margin-bottom: 0.3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkg-btns { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pick {
  font-size: 0.78rem; padding: 0.35rem 0.45rem; border: 1px solid var(--accent);
  border-radius: 0.3rem; background: #fff; color: #1e293b; cursor: pointer;
}
.pick:hover { background: #e2e8f0; }
.pick.active { background: var(--accent); color: #fff; font-weight: 700; }
.pkg-group.hidden { display: none; }
.now { font-size: 0.8rem; color: #1e293b; }
.main { flex: 1; padding: 1.25rem 1.5rem 3rem; min-width: 0; }
.top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
h1 { font-size: 1.45rem; margin: 0 0 0.35rem; }
.caption { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.75rem; line-height: 1.45; }
.controls { display: flex; gap: 1rem; align-items: center; background: #fff; border: 1px solid var(--line); padding: 0.6rem 0.8rem; border-radius: 0.5rem; }
[hidden] { display: none !important; }
.controls select { margin-left: 0.35rem; }
.check { display: flex; gap: 0.35rem; align-items: center; font-size: 0.9rem; }
.status { color: #1e293b; font-size: 0.9rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.chart { width: 100%; height: 560px; background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; }
.chart.wide { margin-top: 0.75rem; }
.notes { margin: 0.85rem 0 1.5rem; font-size: 0.95rem; line-height: 1.5; }
.notes p { margin: 0.35rem 0; }
.tabs { display: flex; gap: 0.4rem; margin: 0.75rem 0 1rem; flex-wrap: wrap; }
.tab {
  font-size: 0.9rem; padding: 0.45rem 0.75rem; border: 1px solid var(--accent);
  border-radius: 0.35rem; background: #fff; color: #1e293b; cursor: pointer;
}
.tab:hover { background: #e2e8f0; }
.tab.active { background: var(--accent); color: #fff; font-weight: 700; }
.err-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 0.75rem 0 1.5rem; }
.err-card { background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.75rem; }
.err-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.err-card img { width: 100%; height: auto; display: block; background: #fff; }
.err-empty { color: var(--muted); }
.err-plot { width: 100%; height: 680px; background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; }
.err-plot.heat { height: 920px; }
.err-plot.resid { height: 440px; }
.err-quad-note { font-size: 0.9rem; color: var(--ink); line-height: 1.45; margin: 0.35rem 0 0.75rem; }
.err-quad-note p { margin: 0.25rem 0; }
body.cmp-mode .side { display: none; }
.cmp-pick { flex-wrap: wrap; }
.cmp-pick select { min-width: 16rem; max-width: 100%; }
.cmp-heads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding: 0.35rem 0 0.5rem;
}
.cmp-heads h3 { margin: 0; font-size: 1rem; color: #1e293b; }
.cmp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0.75rem 0 1.5rem; }
.faq { background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.75rem 1rem; }
.faq table { border-collapse: collapse; width: 100%; font-size: 0.85rem; margin: 0.75rem 0; }
.faq th, .faq td { border: 1px solid var(--line); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }
@media (max-width: 960px) {
  body { flex-direction: column; }
  .side { width: 100%; height: auto; max-height: 40vh; position: relative; }
  .grid2, .cmp-row, .cmp-heads { grid-template-columns: 1fr; }
}
