:root { --amber: #ffb300; --bg: #06080c; --panel: #11151c; --line: #2a3240; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: #cdd6e4;
  font: 13px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow: hidden;
  user-select: none; -webkit-user-select: none; }
#scope { display: block; width: 100vw; height: calc(100vh - 18px); cursor: crosshair; }
#footer { position: fixed; bottom: 0; left: 0; right: 0; height: 18px;
  background: #000; display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; color: #5d6b80; font-size: 10px; letter-spacing: .04em;
  border-top: 1px solid #1b2330; z-index: 20; }
#footer-version { color: #4a5566; }

.hidden { display: none !important; }

.hint { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #6b7686; pointer-events: none; letter-spacing: .04em; }

.pill { position: fixed; top: 10px; right: 12px; display: flex; gap: 7px; align-items: center;
  background: rgba(0,0,0,.45); padding: 6px 9px; border-radius: 999px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #c0392b; box-shadow: 0 0 6px #0008;
  transition: background .3s; }
.dot.up { background: #27ae60; }
.dot.warn { background: var(--amber); }

.ctx { position: fixed; background: #161b24; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px; min-width: 150px; box-shadow: 0 8px 24px #000a; z-index: 40; }
.ctx-item { padding: 7px 12px; border-radius: 5px; cursor: pointer; display: flex;
  align-items: center; justify-content: space-between; gap: 12px; }
.ctx-item:hover { background: #232c3a; }
.ctx-item.active { color: var(--amber); }
.ctx-chev { color: #6b7686; font-size: 12px; }
.ctx-manage { margin-top: 4px; padding-top: 9px; border-top: 1px solid var(--line); color: #9aa6b8; }
.ctx-danger { color: #d96666; }
.ctx-danger:hover { background: #3a2226; }
.ctx-check { color: var(--amber); font-size: 13px; min-width: 12px; text-align: right; }
.ctx-empty { color: #6b7686; cursor: default; font-style: italic; }
.ctx-empty:hover { background: transparent; }
.scope-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px;
  vertical-align: 1px; transition: opacity .15s, box-shadow .15s; }
.scope-dot.shared { background: #ffb300; }
.scope-dot.local { background: #22d3ee; }
/* `up` = bright with glow; `down` = dim, no glow. Default (no modifier) is
   the same as `up` so static contexts that don't track liveness still light up. */
.scope-dot.up, .scope-dot:not(.up):not(.down) { opacity: 1; }
.scope-dot.shared.up, .scope-dot.shared:not(.up):not(.down) { box-shadow: 0 0 6px #ffb30055; }
.scope-dot.local.up,  .scope-dot.local:not(.up):not(.down)  { box-shadow: 0 0 6px #22d3ee55; }
.scope-dot.down { opacity: 0.35; box-shadow: none; }

.overlay { position: fixed; inset: 0; background: rgba(6,8,12,.86); backdrop-filter: blur(3px);
  z-index: 30; padding: 4vh 4vw; overflow: auto; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.layout-row { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; color: #9aa6b8; font-size: 13px; }
.layout-label { color: #cdd6e4; }
.layout-num { width: 3.2em; padding: 4px 6px; background: #0b0f15; border: 1px solid var(--line);
  border-radius: 6px; color: #e6ecf5; font: inherit; text-align: center; }
.layout-hint { color: #6b7686; font-size: 12px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #131922;
  cursor: pointer; white-space: nowrap; }
.chip.active { border-color: var(--amber); color: var(--amber); }
.chip.add { border-style: dashed; color: #8b97a8; }
.chip input { background: transparent; border: none; color: inherit; font: inherit; width: 9ch; outline: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
/* Manage Layouts page: tiles are split into collapsible category sections
   (Ham / SWBC / Util / Digi …). Categories start collapsed each time the
   palette opens; clicking a header toggles its grid open or shut. */
.tile-stack { display: flex; flex-direction: column; gap: 10px; }
.tile-group { border: 1px solid var(--line); border-radius: 8px; background: #0b0f15; }
.tile-group-header { display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  cursor: pointer; user-select: none; border-radius: 8px; }
.tile-group-header:hover { background: #131922; }
.tile-group-chev { color: #8b97a8; font-size: 12px; width: 10px; text-align: center;
  transition: transform .15s ease; }
.tile-group-header.expanded .tile-group-chev { transform: rotate(90deg); }
.tile-group-name { flex: 1; color: #cdd6e4; font-weight: 600; letter-spacing: .04em; }
.tile-group-count { color: #6b7686; font-size: 12px; font-variant-numeric: tabular-nums; }
.tile-group-count b { color: var(--amber); font-weight: 600; padding-right: 2px; }
.tile-group-tiles { padding: 0 12px 12px; }
.tile { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #0e131b;
  cursor: pointer; position: relative; opacity: .55; transition: opacity .15s, border-color .15s; }
.tile.on { opacity: 1; border-color: var(--amber); }
.tile h3 { margin: 0 0 2px; font-size: 15px; }
.tile .rng { color: #7c879a; font-size: 11px; }
.tile .load { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; }
.tile canvas { width: 100%; height: 34px; margin-top: 8px; display: block; background: #05070a; border-radius: 4px; }

.panel { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(420px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; z-index: 50;
  box-shadow: 0 20px 60px #000c; }
.panel h2 { margin: 0 0 14px; font-size: 16px; }
.panel label { display: block; margin-bottom: 12px; color: #9aa6b8; }
.panel input { width: 100%; margin-top: 5px; padding: 8px; background: #0b0f15; border: 1px solid var(--line);
  border-radius: 6px; color: #e6ecf5; font: inherit; }
.panel .row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.panel button { padding: 7px 14px; background: #1d2632; border: 1px solid var(--line); color: #dfe6f0;
  border-radius: 6px; cursor: pointer; }
.panel button.danger { color: #ff7a6b; border-color: #5a2a2a; }
.panel .x { position: absolute; top: 10px; right: 12px; background: none; border: none; color: #8b97a8;
  font-size: 22px; cursor: pointer; padding: 0; }
#ubersdr-test-result { color: #8b97a8; font-size: 12px; }

/* Manage Targets panel — overlay similar to band-palette but content-shaped */
.tm-body { max-width: 720px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 24px 28px; position: relative; box-shadow: 0 20px 60px #000c; }
.tm-body h2 { margin: 0 0 4px; }
.tm-body h3 { margin: 18px 0 6px; font-size: 13px; color: #cdd6e4; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 600; }
.tm-body section { margin-bottom: 14px; }
.tm-body .muted { color: #7c879a; font-size: 12px; margin: 0 0 8px; }
.tm-body .x { position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: #8b97a8; font-size: 22px; cursor: pointer; padding: 0; }
.tm-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.tm-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #0b0f15;
  border: 1px solid var(--line); border-radius: 6px; }
.tm-row code { color: #e6ecf5; font-size: 13px; flex: 1; }
.tm-remove { background: transparent; border: none; color: #8b97a8; font-size: 18px; cursor: pointer;
  padding: 0 4px; line-height: 1; }
.tm-remove:hover { color: #ff7a6b; }
.tm-add { display: flex; gap: 8px; align-items: center; }
.tm-add input { flex: 1; padding: 7px 10px; background: #0b0f15; border: 1px solid var(--line);
  border-radius: 6px; color: #e6ecf5; font: inherit; }
.tm-add button { padding: 7px 14px; background: #1d2632; border: 1px solid var(--line);
  color: #dfe6f0; border-radius: 6px; cursor: pointer; }
.tm-add button:hover { border-color: var(--amber); color: var(--amber); }
.tm-toggle { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tm-toggle label { cursor: pointer; }
.tm-actions { display: flex; align-items: center; gap: 12px; }
.tm-actions button { padding: 8px 18px; background: #1d2632; border: 1px solid var(--amber);
  color: var(--amber); border-radius: 6px; cursor: pointer; }
.tm-actions button:hover { background: #2a3340; }
.tm-empty { color: #6b7686; font-style: italic; padding: 8px 0; }
.tm-targets { display: flex; flex-direction: column; gap: 4px; }
.tm-target { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 12px; background: #0b0f15; border: 1px solid var(--line); border-radius: 6px; }
.tm-target-dot { width: 8px; height: 8px; border-radius: 50%; background: #c0392b; }
.tm-target.up .tm-target-dot { background: #22d3ee; box-shadow: 0 0 6px #22d3ee88; }
.tm-target-label { color: #e6ecf5; }
.tm-target-label-edit { cursor: text; }
.tm-target-label-edit:hover { color: var(--amber); }
.tm-target-freq { color: #8b97a8; font-size: 12px; }
.tm-rename { background: #0b0f15; border: 1px solid var(--amber); color: #e6ecf5;
  padding: 4px 8px; border-radius: 4px; font: inherit; }

/* About panel — quick reference, intentionally short */
.about-body { max-width: 560px; margin: 0 auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 22px 28px 24px; position: relative; box-shadow: 0 20px 60px #000c;
  line-height: 1.5; }
.about-body h2 { margin: 0 0 4px; font-size: 18px; }
.about-body h3 { margin: 16px 0 4px; font-size: 11px; color: #cdd6e4; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 600; }
.about-h3-sub { color: #6b7686; text-transform: none; letter-spacing: 0; font-weight: 400;
  font-size: 10px; margin-left: 4px; }
.about-body p { margin: 4px 0; color: #b9c3d3; font-size: 13px; }
.about-body .lead { color: #cdd6e4; font-size: 13.5px; margin: 0 0 4px; }
.about-body p.muted { color: #6b7686; font-size: 11px; margin-top: 16px; }
.about-credit { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.about-body ul { margin: 4px 0 0; padding-left: 18px; color: #b9c3d3; font-size: 13px; }
.about-body li { padding: 1px 0; }
.about-body code { background: #0b0f15; border: 1px solid var(--line); border-radius: 3px;
  padding: 0 4px; font-size: 12px; color: #e6ecf5; }
.about-body em { color: #cdd6e4; font-style: italic; }
.about-body strong { color: var(--amber); font-weight: 600; }
.about-body a { color: #22d3ee; text-decoration: none; }
.about-body a:hover { text-decoration: underline; }
.about-body .x { position: absolute; top: 10px; right: 14px; background: none; border: none;
  color: #8b97a8; font-size: 20px; cursor: pointer; padding: 0; line-height: 1; }
.about-keys { list-style: none; padding-left: 0; }
.about-keys kbd { background: #0b0f15; border: 1px solid var(--line); border-radius: 4px;
  padding: 0 6px; font-size: 11px; font-family: inherit; color: #e6ecf5;
  box-shadow: 0 1px 0 #000a; margin-right: 2px; }
.dot-amber, .dot-cyan { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  vertical-align: 1px; margin: 0 2px 0 4px; }
.dot-amber { background: #ffb300; box-shadow: 0 0 5px #ffb30066; }
.dot-cyan { background: #22d3ee; box-shadow: 0 0 5px #22d3ee66; }

/* Tabs at the top of the Manage Targets panel */
.tm-tabs { display: flex; gap: 4px; margin: 6px 0 16px; border-bottom: 1px solid var(--line); }
.tm-tab { background: transparent; border: none; color: #8b97a8; padding: 8px 16px;
  font: inherit; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tm-tab:hover { color: #cdd6e4; }
.tm-tab.active { color: var(--amber); border-bottom-color: var(--amber); }
.tm-tab-content > div > section:first-child { margin-top: 0; }
