* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.4 system-ui, sans-serif;
  color: #d8dce2;
  background: #14161a;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 8px 14px;
  border-bottom: 1px solid #2a2e35;
}
h1 { font-size: 20px; margin: 0; }
.sub { color: #8a919c; font-size: 13px; }

#viewtabs {
  display: flex;
  border: 1px solid #3a404a;
  border-radius: 6px;
  overflow: hidden;
}
#viewtabs a {
  padding: 3px 12px;
  font-size: 13px;
  color: #d8dce2;
  text-decoration: none;
  background: #1e2228;
}
#viewtabs a + a { border-left: 1px solid #3a404a; }
#viewtabs a:hover { background: #2a3038; }
#viewtabs a.on { background: #2e4a68; color: #fff; }

#legend { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; }
#legend span { display: inline-flex; align-items: center; gap: 5px; }
#legend [data-keys] {
  cursor: pointer;
  user-select: none;
  padding: 1px 5px;
  border-radius: 4px;
}
#legend [data-keys]:hover { background: #2a3038; }
.legend-off { opacity: .35; }
#legend .lgroup {
  color: #6a7280;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-left: 8px;
}

#bandfilter { display: flex; gap: 4px; }
#bandfilter button {
  font: 12px system-ui, sans-serif;
  padding: 2px 8px;
  border: 1px solid #3a404a;
  border-radius: 4px;
  background: #1e2228;
  color: #d8dce2;
  cursor: pointer;
}
#bandfilter button.on { background: #2e4a68; border-color: #4a6a8a; }

#colorscheme {
  font: 12px system-ui, sans-serif;
  padding: 2px 6px;
  border: 1px solid #3a404a;
  border-radius: 4px;
  background: #1e2228;
  color: #d8dce2;
  cursor: pointer;
}
.chip { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid rgba(255,255,255,.3); }

#zoomctl button, #bands button {
  font: 12px system-ui, sans-serif;
  padding: 2px 8px;
  border: 1px solid #3a404a;
  border-radius: 4px;
  background: #1e2228;
  color: #d8dce2;
  cursor: pointer;
}
#zoomctl button:hover, #bands button:hover { background: #2a3038; }
#bands { display: flex; flex-wrap: wrap; gap: 4px; }

#layers { font-size: 13px; position: relative; }
#layers summary { cursor: pointer; user-select: none; }
#layerlist {
  position: absolute;
  z-index: 10;
  background: #1c2026;
  border: 1px solid #3a404a;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 180px;
}
.layergroup { font-weight: 600; margin-top: 6px; }
.layergroup:first-child { margin-top: 0; }
#layerlist label { cursor: pointer; white-space: nowrap; }

#chartwrap { position: relative; }
#chart {
  display: block;
  width: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
#chart:active { cursor: grabbing; }

.axisline { stroke: #4a505a; }
.grid { stroke: #23262d; }
.groupsep { stroke: #343a44; }
.ticklabel { font-size: 10.5px; fill: #8a919c; text-anchor: middle; }
.lanelabel { font-size: 12px; font-weight: 600; fill: #c4cad4; }
.seglabel { font-size: 10.5px; fill: #14161a; text-anchor: middle; pointer-events: none; }

.seg { stroke: rgba(255,255,255,.25); stroke-width: 0.5; }
.seg:hover { stroke: #fff; stroke-width: 1; }
.mode-cw    { fill: #7da7e0; }
.mode-data  { fill: #74c4c4; }
.mode-phone { fill: #f0b169; }
.mode-all   { fill: #94c97f; }
.mode-chan  { fill: #b895e0; }

/* FCC allocation categories (shared by chart and band plan views) */
.cat-amateur   { fill: #94c97f; }
.cat-broadcast { fill: #e08585; }
.cat-satellite { fill: #b895e0; }
.cat-mobile    { fill: #f0b169; }
.cat-aviation  { fill: #7da7e0; }
.cat-maritime  { fill: #74c4c4; }
.cat-radar     { fill: #d295b8; }
.cat-science   { fill: #8fa3b8; }
.cat-fixed     { fill: #a3a89a; }
.cat-none      { fill: #4a4f58; }
.fedseg { opacity: .45; }
.noteseg { fill: #e0c76b; }
.callseg { fill: #e8ecf2; }
.partseg { fill: #3a404a; stroke: rgba(255,255,255,.15); }
.partlabel { fill: #d8dce2; }

footer {
  padding: 8px 14px;
  color: #8a919c;
  font-size: 12px;
  border-top: 1px solid #2a2e35;
}

/* note items (sidenotes and modals) */
.noteitem { margin-bottom: 7px; }
.noteitem + .noteitem { border-top: 1px solid #2a2e35; padding-top: 8px; margin-top: 9px; }
.noteitem .range { color: #6a7280; font-size: 10.5px; }
#notemodalbody a { color: #e0c76b; }

/* modal (notes chooser, rule-part chooser) */
#notemodal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
#notemodal[hidden] { display: none; }
.modalbox {
  background: #1c2026;
  border: 1px solid #3a404a;
  border-radius: 8px;
  max-width: 440px;
  width: calc(100% - 40px);
  padding: 12px 16px 14px;
  font-size: 13px;
}
.modalhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  margin-bottom: 8px;
}
#notemodalclose {
  border: none;
  background: none;
  color: #8a919c;
  font-size: 18px;
  cursor: pointer;
}

#tip {
  position: absolute;
  pointer-events: none;
  background: #1e2228;
  border: 1px solid #3a404a;
  border-radius: 5px;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
  padding: 6px 9px;
  font-size: 12px;
  max-width: 300px;
  z-index: 20;
}
