:root {
  --bg: #0e1418;
  --panel: #161f26;
  --panel-2: #1d2831;
  --line: #2b3a45;
  --text: #d7e2ea;
  --muted: #8fa4b3;
  --accent: #38b6a4;
  --accent-2: #f2a13c;
  --bad: #e05a4f;
  --good: #6ecb6e;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13px/1.45 "Segoe UI", system-ui, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
header.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
header.topbar h1 { font-size: 14px; margin: 0; font-weight: 600; letter-spacing: .3px; }
header.topbar .sub { color: var(--muted); font-size: 11.5px; }
nav.tabs { display: flex; gap: 4px; margin-left: auto; }
nav.tabs a {
  padding: 5px 12px; border-radius: 5px; color: var(--muted); border: 1px solid transparent;
}
nav.tabs a.active { background: var(--panel-2); color: var(--text); border-color: var(--line); }
select, input[type=text], input[type=number] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 3px 6px; font: inherit;
}
input[type=number] { width: 82px; }
input[type=checkbox] { accent-color: var(--accent); }
button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 4px; padding: 4px 10px; font: inherit; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #05231f; border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .5; cursor: default; }
label.ctl { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11.5px; }
.layout { display: grid; grid-template-columns: 250px 1fr 330px; gap: 10px; padding: 10px; align-items: start; }
.layout.wide { grid-template-columns: 250px 1fr; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.panel > .phead {
  padding: 6px 10px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.panel > .phead .hint { color: var(--muted); font-weight: 400; font-size: 11px; }
.pbody { padding: 8px 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list { max-height: calc(100vh - 150px); overflow: auto; }
.item {
  padding: 5px 8px; border-bottom: 1px solid #203038; cursor: pointer; display: flex;
  gap: 6px; align-items: baseline; flex-wrap: wrap;
}
.item:hover { background: var(--panel-2); }
.item.sel { background: #1c3b39; border-left: 3px solid var(--accent); }
.item .fid { font-weight: 700; }
.item .sp { color: var(--accent-2); }
.item .meta { color: var(--muted); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #46545e; align-self: center; }
.dot.ok { background: var(--good); }
table.grid { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.grid th, table.grid td { border-bottom: 1px solid #223038; padding: 3px 6px; text-align: right; white-space: nowrap; }
table.grid th { background: var(--panel-2); position: sticky; top: 0; cursor: pointer; z-index: 2; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid tr:hover td { background: #1a242c; }
table.grid tr.sel td { background: #1c3b39; }
table.grid td input { width: 62px; background: #101a20; color: var(--text); border: 1px solid var(--line); }
table.grid td.left { text-align: left; }
table.grid td input.derived { border-style: dashed; color: var(--accent-2); }
.kv { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.kv td { padding: 2px 5px; border-bottom: 1px solid #1f2b33; }
.kv td:first-child { color: var(--muted); width: 45%; }
.hex { font-family: "Cascadia Mono", Consolas, monospace; font-size: 10.5px; color: var(--muted); word-break: break-all; }
canvas { display: block; width: 100%; }
.plotwrap { position: relative; }
.zonebox { position: absolute; display: none; border: 1px dashed #f2d433; background: rgba(242,212,51,.10); pointer-events: none; z-index: 3; }
.zonebox .zlab {
  position: absolute; left: -1px; top: -14px; padding: 0 4px; border-radius: 2px;
  font: 700 9.5px/13px "Segoe UI", sans-serif; color: #0e1418;
}
/* popup spektrum zona (dibuat zone.js di dalam .plotwrap) */
.zonepop {
  position: absolute; z-index: 7; width: 420px; display: none;
  background: rgba(14,21,26,.96); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 26px rgba(0,0,0,.5);
}
.zonepop.on { display: block; }
.zonepop .zph { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--line); cursor: move; font-size: 11.5px; }
.zonepop .zph b { font-weight: 600; }
.zonepop .zph .hint { color: var(--muted); font-size: 10.5px; margin-left: 2px; flex: 1; }
.zonepop .zph button, .zonepop [data-del] { padding: 0 6px; font-size: 11px; cursor: pointer; }
.zonepop .zph button.on { border-color: var(--accent); color: var(--accent); }
.zonepop .zpb { padding: 5px 6px 6px; }
.zonepop table.grid { margin-top: 4px; }
.zonepop table.grid th, .zonepop table.grid td { padding: 1px 4px; font-size: 10.5px; }
.zonepop .note { font-size: 10.5px; margin-top: 3px; }
.readout {
  position: absolute; right: 8px; top: 6px; background: rgba(14, 20, 24, .85);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px; font-size: 11px; color: var(--muted);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge { font-size: 10.5px; padding: 1px 6px; border-radius: 10px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.warn { color: var(--accent-2); border-color: #57402a; }
.badge.bad { color: var(--bad); border-color: #5a2f2b; }
.badge.good { color: var(--good); border-color: #33513a; }
.progress { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; min-width: 140px; }
.progress > div { height: 100%; background: var(--accent); width: 0%; transition: width .2s; }
.note { color: var(--muted); font-size: 11.5px; }
.scroll { max-height: 320px; overflow: auto; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--muted); padding: 2px 10px 8px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 10px; height: 3px; display: inline-block; border-radius: 2px; }
.mt { margin-top: 10px; }
.warnline { color: var(--bad); }
.twocol { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding: 10px; align-items: start; }
@media (max-width: 1500px) { .twocol { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------- S/N ratio page */
.snstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 10px; }
.snstat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
.snstat .k { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.snstat .v { font-size: 19px; font-weight: 700; font-family: "Cascadia Mono", Consolas, monospace; }
.snstat .u { color: var(--muted); font-size: 11px; margin-left: 3px; }
.snstat .sub { color: var(--muted); font-size: 10.5px; margin-top: 1px; }
.verdict { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); }
.verdict .cls { font-size: 17px; font-weight: 700; padding: 4px 12px; border-radius: 6px; color: #0e1418; }
.chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 10px; padding: 0 10px; }
.bandkey { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); padding: 4px 10px 8px; }
.bandkey i { display: inline-block; width: 14px; height: 9px; margin-right: 4px; border-radius: 2px; }
.wrapall { padding: 10px; }
