:root {
  --ink: #1f2328; --muted: #5b6672; --line: var(--line); --soft: #f3f5f8; --card: #fff;
  --navy: #12202f; --accent: #f2b134; --accent-ink: #1a1406; --teal: #0f766e;
  --good: #14532d; --good-bg: #e7f6ef; --warn: #6b4300; --warn-bg: #fdecc8; --bad: #b42318; --bad-bg: #fdecea;
  --link: #0f5f8a; --radius: 12px;
  --surface: #fff; --surface-2: #f7f9fb; --hover: #e9edf2; --line-2: #edf0f3; --input-line: #cfd6de;
  --ink-2: #2b333c; --ink-3: #3c4650; --plain-bg: #eef1f4; --bad-ink: #8a1c12; --link-hover: #0a4566;
  --tint-good: #eefaf3; --tint-me: #fff4dc; --tint-call: #fff7e6; --tint-warm: #fffaf0; --upd-line: #f2d18a;
  --sep-ink: #8e9aa6; --calling-ink: #7a4b00;
  color-scheme: light;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--soft);
}
:root[data-theme="dark"] {
  --ink: #e6e9ee; --muted: #9aa5b1; --line: #2c353f; --soft: #0e1318; --card: #161c23;
  --navy: #26384f; --teal: #2fb3a3;
  --good: #7ee2a8; --good-bg: #12301f; --warn: #f5c26b; --warn-bg: #3a2c0f; --bad: #d92d20; --bad-bg: #3a1714;
  --link: #74bde8; --link-hover: #a4d4f2;
  --surface: #1b222a; --surface-2: #131920; --hover: #26303a; --line-2: #232b34; --input-line: #3d4855;
  --ink-2: #d5dae1; --ink-3: #b9c2cc; --plain-bg: #29323c; --bad-ink: #ff9d92;
  --tint-good: #10261a; --tint-me: #33270f; --tint-call: #33270f; --tint-warm: #2c2412; --upd-line: #5c4714;
  --sep-ink: #7d8995; --calling-ink: #f5c26b;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6e9ee; --muted: #9aa5b1; --line: #2c353f; --soft: #0e1318; --card: #161c23;
    --navy: #26384f; --teal: #2fb3a3;
    --good: #7ee2a8; --good-bg: #12301f; --warn: #f5c26b; --warn-bg: #3a2c0f; --bad: #d92d20; --bad-bg: #3a1714;
    --link: #74bde8; --link-hover: #a4d4f2;
    --surface: #1b222a; --surface-2: #131920; --hover: #26303a; --line-2: #232b34; --input-line: #3d4855;
    --ink-2: #d5dae1; --ink-3: #b9c2cc; --plain-bg: #29323c; --bad-ink: #ff9d92;
    --tint-good: #10261a; --tint-me: #33270f; --tint-call: #33270f; --tint-warm: #2c2412; --upd-line: #5c4714;
    --sep-ink: #7d8995; --calling-ink: #f5c26b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
.mono { font-family: var(--mono); }
.small { font-size: 12.5px; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--navy); color: var(--accent); }
.brand-name { font-weight: 800; font-size: 18px; }
.brand-name span { font-weight: 600; color: var(--muted); }
.band-pick { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.band-pick select { font: 700 13px var(--mono); height: 34px; border-radius: 999px; padding: 0 12px; border: 0; background: var(--navy); color: #fff; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-on { background: var(--good-bg); color: var(--good); }
.pill-off { background: var(--plain-bg); color: var(--ink-3); }
.pill-bad { background: var(--bad-bg); color: var(--bad-ink); }
.pill-tx { background: var(--bad-bg); color: var(--bad-ink); }
.pill-demo { background: var(--warn-bg); color: var(--warn); }
.spacer { flex: 1; }
.utc { font-size: 13px; color: var(--muted); }
.utc strong { font-family: var(--mono); color: var(--ink); }
.avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--hover); font-size: 11px; font-weight: 800; }

/* ---------- layout */
.layout { display: flex; flex-wrap: wrap; gap: 22px; max-width: 1440px; margin: 0 auto; padding: 22px; }
.side { flex: 1 1 200px; max-width: 240px; display: flex; flex-direction: column; gap: 4px; }
main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; outline: none; }
.nav { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav.active { background: var(--navy); color: #fff; }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
.side-card { margin-top: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 820px) {
  .side { max-width: none; flex-direction: row; flex-wrap: wrap; }
  .side .nav { flex: 1 1 140px; }
  .side-card { flex: 1 1 100%; }
}

/* ---------- pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.card-pad { padding: 18px; }
.card h2 { margin: 0; font-size: 17px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { margin: 0; font-size: 26px; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 760px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.btn { font: 600 14px inherit; font-family: inherit; border-radius: 8px; min-height: 44px; padding: 0 16px; cursor: pointer; border: 1px solid var(--input-line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #e0a020; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f1c13; }
.btn-on { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-station { min-height: 40px; }
.seg { display: flex; gap: 4px; background: var(--soft); border-radius: 8px; padding: 4px; }
.seg button { flex: 1; font: 600 13px inherit; font-family: inherit; min-height: 36px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.meter { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--teal); transition: width .2s linear; }
.meter.tx > div { background: var(--bad); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.input, select.input, textarea.input { font: 400 14px inherit; font-family: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--input-line); border-radius: 8px; min-height: 44px; padding: 0 12px; min-width: 0; }
textarea.input { padding: 10px 12px; min-height: 90px; resize: vertical; }
.input.mono { font-family: var(--mono); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; }
.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px; }
.tag-good { background: var(--good-bg); color: var(--good); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad-ink); }
.tag-plain { background: var(--plain-bg); color: var(--ink-3); }
.empty { padding: 18px 16px; color: var(--muted); font-size: 14px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.stat strong { font-family: var(--mono); font-size: 19px; }
.stat span { font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.notice-bad { background: var(--bad-bg); color: var(--bad-ink); }
.notice-good { background: var(--good-bg); color: var(--good); }

/* ---------- waterfall */
.wf-card { padding: 14px; background: #0f1720; border-color: #0f1720; color: #c9d2db; }
.wf-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.wf-head strong { letter-spacing: .05em; text-transform: uppercase; }
.wf-wrap { position: relative; height: 170px; border-radius: 8px; overflow: hidden; background: #081634; cursor: crosshair; }
.wf-wrap canvas { width: 100%; height: 100%; display: block; image-rendering: auto; }
.wf-mark { position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; }
.wf-mark.rx { border-left: 2px solid #58d68d; }
.wf-mark.tx { border-left: 2px dashed #ff8a65; }
.wf-band { position: absolute; top: 0; bottom: 0; pointer-events: none; background: rgba(255,138,101,.12); }
.wf-scale { display: flex; justify-content: space-between; font: 11px var(--mono); color: #9aa7b4; padding-top: 4px; }
.legend-rx { color: #58d68d; } .legend-tx { color: #ff8a65; }

/* ---------- decodes */
.decodes { font-family: var(--mono); font-size: 13px; max-height: 420px; overflow-y: auto; }
.drow { display: grid; grid-template-columns: 70px 44px 44px 54px minmax(0,1fr) auto; gap: 8px; align-items: center; padding: 4px 14px; border-top: 1px solid var(--line-2); }
@media (max-width: 640px) {
  .drow { grid-template-columns: 62px 34px minmax(0,1fr) auto; padding: 4px 10px; }
  .drow > :nth-child(3), .drow > :nth-child(4) { display: none; }
}
.drow.head { color: var(--muted); font-size: 11.5px; position: sticky; top: 0; background: var(--surface); border-top: 0; }
.drow.cq { background: var(--tint-good); }
.drow.me { background: var(--tint-me); }
.drow.tx { background: var(--bad-bg); color: var(--bad-ink); }
.drow.sep { color: var(--sep-ink); font-size: 11px; padding: 2px 14px; background: var(--surface-2); }
.drow button { font: 600 12px inherit; font-family: inherit; min-height: 28px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--input-line); background: var(--surface); cursor: pointer; }
.st { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.st.calling { background: var(--tint-call); }
.st .sub { font-family: var(--mono); font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- QSO */
.qso { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.steps { flex: 3 1 480px; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; font: 12.5px var(--mono); }
.steps li { padding: 10px; border-radius: 8px; background: var(--soft); color: var(--muted); }
.steps li.done { background: var(--good-bg); color: var(--good); }
.steps li.now { background: var(--tint-call); border: 1px solid var(--accent); color: var(--warn); }

/* ---------- messages */
.msgs { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); min-height: 520px; }
@media (max-width: 760px) { .msgs { grid-template-columns: 1fr; } }
.threads { border-right: 1px solid var(--line-2); display: flex; flex-direction: column; }
.thread { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--surface); cursor: pointer; text-align: left; font: inherit; min-height: 56px; }
.thread[aria-current="true"] { background: var(--soft); }
.thread .who { font-family: var(--mono); font-weight: 700; }
.thread .last { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.thread .unread { margin-left: auto; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.convo { display: flex; flex-direction: column; min-width: 0; }
.bubbles { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--surface-2); overflow-y: auto; max-height: 520px; }
.bubble { max-width: 85%; padding: 10px 12px; border-radius: 12px; }
.bubble .txt { font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.bubble .meta { font-size: 11.5px; margin-top: 4px; }
.bubble.in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.bubble.in .meta { color: var(--muted); }
.bubble.out { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-right-radius: 3px; }
.bubble.out .meta { color: #c9d2db; }
.bubble.partial { border-style: dashed; border-color: #9fb0c0; }
.segs { display: flex; gap: 4px; margin-top: 8px; }
.segs span { flex: 1; height: 6px; border-radius: 3px; background: var(--line); min-width: 6px; }
.segs span.on { background: var(--teal); }
.compose { padding: 14px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 8px; }

/* ---------- files */
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.opt strong { display: block; color: var(--ink); font-size: 14px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--tint-warm); }
.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px; border: 2px dashed var(--input-line); border-radius: 12px; background: var(--surface-2); text-align: center; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--tint-warm); }
.blockmap { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.brow { display: grid; grid-template-columns: 64px minmax(260px,1fr) 110px; gap: 10px; align-items: center; font-size: 12px; }
.cells { display: grid; gap: 2px; }
.cell { aspect-ratio: 1; border-radius: 2px; background: var(--hover); }
.cell.ok { background: var(--teal); }
.cell.sent { background: #7fb7b1; }
.cell.resend { background: repeating-linear-gradient(45deg, #d92d20 0 3px, #fbd5d1 3px 6px); }
.rx { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 13px; align-items: center; }
pre.preview { margin: 0; padding: 12px; border-radius: 10px; background: #0f1720; color: #d7dee6; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; max-height: 320px; overflow: auto; }

/* ---------- connect */
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.way { display: flex; flex-direction: column; gap: 10px; padding: 18px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.way h3 { margin: 0; font-size: 16px; }
.way p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.way:has(input:checked) { border-color: var(--accent); background: var(--tint-warm); box-shadow: 0 0 0 3px rgba(242,177,52,.25); }
.way.disabled { opacity: .6; cursor: default; }
.chk { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); font-size: 14px; }
.code { font: 700 28px var(--mono); letter-spacing: .18em; }
table.uploads { width: 100%; border-collapse: collapse; font-size: 13px; }
table.uploads th, table.uploads td { text-align: left; padding: 8px 14px; border-top: 1px solid var(--line-2); }
table.uploads th { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------- toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: #8a1c12; }

/* download page */
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 16px; }
.code { background: var(--soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: .92em; }
.howto { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 12px; }
.howto li { line-height: 1.55; padding-left: 2px; }
.howto li::marker { font-weight: 700; color: var(--muted); }
.howto li p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.howto.plain { padding-left: 18px; font-size: 14px; }
.dl-main { border-color: var(--accent); }
details summary { cursor: pointer; }
.dl-top[hidden] { display: none !important; }
@media (max-width: 820px) { .dl-top { display: none; } }

/* home page */
body.is-home .band-pick, body.is-home #conn-pill, body.is-home #demo-pill, body.is-home .utc,
body.is-home #station-btn, body.is-home .side-card { display: none !important; }
.nav[hidden] { display: none !important; }
.hero { display: flex; flex-direction: column; gap: 14px; max-width: 860px; padding: 18px 0 6px; }
.hero h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; font-weight: 800; letter-spacing: -.01em; }
.hero .lead { margin: 0; font-size: 17px; line-height: 1.6; color: var(--ink-3); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.fact { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.fact strong { font-size: 22px; font-weight: 800; color: var(--accent); }
.fact span { font-size: 13px; color: #c9d3dd; line-height: 1.4; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.feat h3 { margin: 0; font-size: 16px; }
.feat p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.bands { width: 100%; border-collapse: collapse; font-size: 14px; }
table.bands th, table.bands td { text-align: left; padding: 9px 18px; border-top: 1px solid var(--line); }
table.bands th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--soft); }
.home-foot { padding: 8px 0 24px; }

/* ---------- forms */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 16px; }
.tab { font: 600 14px inherit; font-family: inherit; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 8px; }
.form-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.form-card { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; font: inherit; color: var(--ink); }
.form-card:hover { border-color: var(--accent); background: var(--tint-warm); }
.form-card strong { font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .span2 { grid-column: 1 / -1; }
.form-sec { grid-column: 1 / -1; margin: 8px 0 -4px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.req { color: var(--bad); }
.form-send { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px 18px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .form-grid, .form-send { grid-template-columns: 1fr; } }
.inbox-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line-2); cursor: pointer; }
.inbox-row:first-child { border-top: 0; }
.inbox-row:hover { background: var(--soft); }
.inbox-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.inbox-row.unread .dot { background: var(--accent); }
.inbox-row.unread strong, .inbox-row.unread .inbox-subj { font-weight: 800; }
.inbox-subj { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- reader */
dialog.reader { width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(16,24,40,.3); display: flex; flex-direction: column; }
dialog.reader:not([open]) { display: none; }
dialog.reader::backdrop { background: rgba(18,32,47,.45); }
.rd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.rd-head h2 { margin: 2px 0; font-size: 19px; }
.rd-subject { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.rd-body { padding: 16px 18px; overflow: auto; flex: 1; }
.rd-foot { padding: 12px 18px; border-top: 1px solid var(--line); }
.rd-form { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rd-row { display: contents; }
.rd-label, .rd-val { padding: 9px 12px; border-top: 1px solid var(--line-2); font-size: 14px; }
.rd-label { background: var(--soft); color: var(--muted); font-weight: 600; font-size: 13px; }
.rd-val { white-space: pre-wrap; overflow-wrap: anywhere; }
.rd-row:first-child .rd-label, .rd-row:first-child .rd-val { border-top: 0; }
.rd-long .rd-val { line-height: 1.5; }
.rd-sec { grid-column: 1 / -1; margin: 0; padding: 8px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--hover); color: var(--ink-3); }
.rd-pre { grid-column: 1 / -1; padding: 10px 12px; background: var(--navy); color: #fff; font-size: 14px; }
.rd-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13.5px/1.5 var(--mono); background: var(--soft); padding: 14px; border-radius: 10px; }
@media (max-width: 560px) { .rd-form { grid-template-columns: 1fr; } .rd-label { border-top: 1px solid var(--line); padding-bottom: 2px; } .rd-val { border-top: 0; } }
@media print {
  body.reader-open > *:not(dialog) { display: none !important; }
  body.reader-open dialog.reader { position: static; width: auto; max-height: none; border: 0; box-shadow: none; }
  body.reader-open .rd-foot, body.reader-open .rd-head button { display: none; }
  body.reader-open .rd-body { overflow: visible; }
}

/* ---------- call sign switcher */
.station-menu { position: absolute; right: 20px; top: calc(100% - 4px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.18); padding: 4px; z-index: 20; }
.station-item { display: grid; grid-template-columns: 1fr auto 18px; gap: 10px; align-items: center; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none; }
a.station-item { display: flex; color: var(--link); }
.station-item:hover, .station-item:focus-visible { background: var(--soft); }
.station-list { display: flex; flex-direction: column; }
.station-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.station-row:first-child { border-top: 0; }

/* ---------- form groups and tables */
.form-group + .form-group { margin-top: 22px; }
.form-group-h { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.tbl-wrap { overflow-x: auto; }
.tbl-row { display: grid; gap: 6px; margin-top: 6px; min-width: 520px; }
.tbl-row .input { min-height: 40px; padding: 0 8px; font-size: 13.5px; }
.tbl-head { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 0; }
.tbl-del { min-height: 40px; padding: 0; }
.rd-table { grid-column: 1 / -1; display: flex; flex-direction: column; border-top: 1px solid var(--line-2); }
.rd-table > .rd-label { border-top: 0; }
.rd-tbl-scroll { overflow-x: auto; }
.rd-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rd-table th { text-align: left; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rd-table td { padding: 7px 12px; border-top: 1px solid var(--line-2); vertical-align: top; overflow-wrap: anywhere; }
.rd-table tr:first-child td { border-top: 0; }

/* ---------- call sign picker */
.callpick { position: relative; display: flex; flex-direction: column; }
.callpick > .input { width: 100%; }
.callpick-list { position: absolute; top: calc(100% + 4px); left: 0; min-width: max(100%, 300px); max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16,24,40,.18); padding: 4px; z-index: 30; }
.callpick-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px 4px; }
.callpick-opt { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-height: 40px; padding: 0 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.callpick-opt.active, .callpick-opt:hover { background: var(--tint-warm); outline: 1px solid var(--accent); }
.callpick-opt.stale .mono { color: var(--muted); }
.callpick-status { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.callpick-status.bad { color: var(--warn); }
.callpick-list.up { top: auto; bottom: calc(100% + 4px); }

/* "Update available" bar under the top bar: a pulsing dot draws the eye; text and button stay still */
.update-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 20px;
  background: var(--tint-call); border-bottom: 1px solid var(--upd-line); color: var(--accent-ink); font-size: 14px; }
.update-bar .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none;
  box-shadow: 0 0 0 0 rgba(242, 177, 52, .7); animation: upd-pulse 1.6s ease-out infinite; }
@keyframes upd-pulse { 0% { box-shadow: 0 0 0 0 rgba(242, 177, 52, .7); } 100% { box-shadow: 0 0 0 10px rgba(242, 177, 52, 0); } }
@media (prefers-reduced-motion: reduce) { .update-bar .pulse { animation: none; } }
.update-bar .notes { color: var(--muted); }
.update-bar .spacer { flex: 1; }
.update-bar progress { width: 160px; }

/* dark mode: dialogs and native bits that default to white */
dialog.reader { background: var(--card); color: var(--ink); }
.card { box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Band activity fits the window (desktop): waterfall, then the contact, then decodes and
   stations side by side, each scrolling inside itself instead of the page */
.nav .short { display: none; }
.act-qso { padding: 12px 16px; }
.act-qso .steps li { padding: 7px 10px; }
details.hb-fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; cursor: pointer; }
details.hb-fold > summary::-webkit-details-marker { display: none; }
details.hb-fold > summary h2 { margin: 0; font-size: 17px; }
details.hb-fold > summary::after { content: "▸"; color: var(--muted); }
details.hb-fold[open] > summary::after { content: "▾"; }
@media (min-width: 900px) and (min-height: 560px) {
  main.fit { height: calc(100vh - var(--top-h, 61px) - 48px); min-height: 500px; gap: 12px; }
  main.fit .page-head h1 { font-size: 22px; }
  main.fit .act-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 12px; }
  main.fit .act-grid > * { min-height: 0; }
  main.fit .act-dec { display: flex; flex-direction: column; overflow: hidden; }
  main.fit .act-dec .decodes { flex: 1; max-height: none; }
  main.fit .act-side { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
}
@media (min-width: 900px) and (max-height: 860px) {
  main.fit .wf-wrap { height: 110px; }
  main.fit .wf-card { padding: 10px 12px; }
  /* the menu column too, so it isn't taller than the window */
  .side .nav { min-height: 36px; }
  .side-card { margin-top: 8px; padding: 10px 12px; gap: 6px; }
  .side-card .seg button { min-height: 30px; }
  .layout { padding-top: 14px; padding-bottom: 14px; }
  main.fit { height: calc(100vh - var(--top-h, 61px) - 28px); }
}

/* ---------- phones: slim top bar, menu along the bottom, submode and slot on one line */
@media (max-width: 640px) {
  .top { padding: 6px 10px; gap: 6px 10px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { display: none; }
  .top { flex-wrap: nowrap; }
  .top .spacer { flex: 1 1 0; min-width: 0; }
  #conn-pill { min-width: 0; flex: 0 1 auto; }
  .band-pick { font-size: 0; gap: 0; }
  .band-pick select { height: 30px; font-size: 12px; padding: 0 8px; }
  .pill { min-height: 26px; font-size: 12px; padding: 0 9px; }
  #conn-text { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .utc { display: none; }
  .btn-station { min-height: 34px; padding: 0 8px; }
  #station-label { font-size: 13px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .btn-station .avatar { display: none; }
  .layout { padding: 10px 10px 76px; gap: 10px; }
  main { gap: 12px; }
  /* the menu: a fixed bar of icons with short labels */
  .side { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; max-width: none; flex-direction: row; flex-wrap: nowrap;
          display: flex; gap: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--surface);
          border-top: 1px solid var(--line); overflow-x: auto; }
  .side .nav { position: relative; flex: 1 0 58px; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 2px;
               font-size: 10.5px; font-weight: 600; border-radius: 8px; text-align: center; }
  .side .nav svg { width: 20px; height: 20px; }
  .side .nav .full { display: none; }
  .side .nav[data-view="download"] { display: none; }    /* the Windows download is no use on a phone */
  .side .nav .short { display: inline; }
  .side .nav .badge { position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; font-size: 10.5px; margin: 0; }
  /* submode + slot: one compact strip at the top of the content */
  .side-card { position: fixed; left: 0; right: 0; top: var(--top-h, 48px); z-index: 4; margin: 0; border-radius: 0; border-width: 0 0 1px;
               flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 10px; }
  .side-card .eyebrow { display: none; }
  .side-card .seg { padding: 2px; }
  .side-card .seg button { min-height: 28px; font-size: 12px; padding: 0 10px; }
  .side-card .meter { flex: 1 1 80px; }
  .side-card .small { font-size: 11.5px; }
  #level-text { flex-basis: 100%; }
  .layout { padding-top: calc(var(--strip-h, 60px) + 10px); }
  .page-head h1 { font-size: 21px; }
  .page-head p { font-size: 13px; }
  .card-pad { padding: 12px; }
  .card-head { padding: 10px 12px; }
  .btn { min-height: 40px; padding: 0 12px; }
  .wf-wrap { height: 100px; }
  .wf-card { padding: 10px; }
  .grid2 { grid-template-columns: 1fr; gap: 12px; }
  .qso { gap: 10px; }
  .steps { grid-template-columns: repeat(2, minmax(0,1fr)); flex-basis: 100%; }
  .msgs { min-height: 0; }
  .bubbles { max-height: 55vh; }
  #toasts { bottom: 76px; }
  body.is-home .layout { padding-top: 10px; }
}

/* Practice band: call sign prompt on the first visit (askDemoStation in settings.js) */
dialog.callask { width: min(440px, calc(100vw - 24px)); padding: 22px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(16,24,40,.3); }
dialog.callask::backdrop { background: rgba(18,32,47,.45); }
dialog.callask .input { width: 100%; box-sizing: border-box; font-size: 16px; }
/* a file transfer folded into one row per burst (activity.js fileRow) */
.drow.file > :nth-child(5) { font-weight: 600; }
.drow.sub { font-size: 12px; opacity: .8; padding-left: 28px; }

/* nothing wider than its column: a select sizes itself to its longest choice (radio models, PTT
   methods, sound card names), which on a phone made the whole page wider than the screen, so the
   browser zoomed out and the bottom menu ended up below the visible area */
.input, select.input, textarea.input { max-width: 100%; }
.field { min-width: 0; }
.field > .input, .field > select.input, .field > input[type="range"] { width: 100%; }
select.input { text-overflow: ellipsis; }
.grid2 > *, .stack > *, .ways > *, main > * { min-width: 0; }
.hint, .small { overflow-wrap: anywhere; }
