:root {
  color-scheme: light;
  --page: #f4f7fb;
  --card: #ffffff;
  --ink: #152945;
  --muted: #54657b;
  --soft: #6c7b8f;
  --line: #dbe4ee;
  --blue: #215ca8;
  --blue-dark: #174682;
  --blue-soft: #eef5fe;
  --green: #1b6b51;
  --amber: #865200;
  --red: #a22c31;
  --wanted: #2268bd;
  --blocker: #ac690c;
  --noise: #65857f;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  font-size: 15px;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid #276dbe; outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--blue-dark); text-underline-offset: 2px; }
p, h1, h2, h3 { margin: 0; }
button { -webkit-tap-highlight-color: transparent; }

.masthead { background: var(--card); border-bottom: 1px solid var(--line); }
.masthead-inner, .workspace { max-width: 1392px; margin-inline: auto; padding-inline: 34px; }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 720; letter-spacing: -.018em; }
.brand svg { flex: none; }
.workspace { padding-top: 29px; padding-bottom: 34px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.eyebrow { font-size: .68rem; letter-spacing: .115em; font-weight: 760; color: var(--blue-dark); }
h1 { margin-top: 5px; font-size: clamp(2rem, 3.4vw, 3.1rem); line-height: 1.08; font-weight: 760; letter-spacing: -.055em; }
h2 { font-size: 1.16rem; font-weight: 720; line-height: 1.25; letter-spacing: -.024em; }
.lede { margin-top: 9px; color: var(--muted); line-height: 1.45; }
.actions { display: flex; gap: 7px; flex: none; padding-bottom: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 37px; padding: 7px 12px; white-space: nowrap; border: 1px solid transparent; border-radius: 7px; font-size: .82rem; font-weight: 690; line-height: 1.25; }
.button-primary { background: var(--blue-dark); color: white; }
.button-primary:hover { background: #102f59; }
.button-secondary { color: var(--blue-dark); background: white; border-color: #cfdeee; }
.button-secondary:hover { background: var(--blue-soft); border-color: #b7cbe2; }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: #e9eff7; color: var(--ink); }
.button:disabled { opacity: .55; cursor: default; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 15px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; }
.metric { min-width: 0; padding: 13px 17px 14px; }
.metric + .metric { border-left: 1px solid var(--line); }
.metric-label { font-weight: 660; font-size: .8rem; color: var(--muted); line-height: 1.25; }
.metric-value { margin: 2px 0 3px; font-variant-numeric: tabular-nums; font-size: 1.76rem; line-height: 1.15; font-weight: 750; letter-spacing: -.045em; }
.metric-value .unit { font-size: .86rem; font-weight: 650; letter-spacing: 0; color: var(--muted); }
.metric-note { color: var(--muted); font-size: .73rem; line-height: 1.3; }
.metric[data-tone="warn"] .metric-value { color: var(--amber); }
.metric[data-tone="limit"] .metric-value { color: var(--red); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 11px; min-width: 0; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 15px 17px 12px; }
.panel-head p:not(.eyebrow) { margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.38; }
.chain-panel { margin-bottom: 15px; }
.frequency-chip { display: inline-flex; gap: 8px; align-items: center; padding: 6px 9px; border: 1px solid #d8e4f2; border-radius: 6px; background: #f5f9fe; color: #294b75; font-size: .76rem; font-weight: 670; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip-arrow { color: #577caa; }
.chain-scroll { margin-inline: 12px; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid #e5ecf4; border-radius: 8px; background: radial-gradient(#dce5ef 0.7px, transparent 0.7px) 0 0 / 12px 12px, #fbfdff; }
.chain { width: 100%; min-width: 850px; max-height: 365px; display: block; padding: 5px 6px 4px; }
.chain text { font-family: inherit; }
.signal-wire { fill: none; stroke: #173c67; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; marker-end: url(#flow-arrow); }
.tap { fill: none; stroke: #538471; stroke-width: 1.25; stroke-dasharray: 4 3.5; marker-end: url(#tap-arrow); }
.tap-dot { fill: #538471; stroke: #fff; stroke-width: 1; }
.conversion-group { fill: #f9fbfe; stroke: #b4c7db; stroke-width: 1; }
.group-label { font-size: 12px; font-weight: 680; fill: #426385; }
.stage { cursor: pointer; outline: none; }
.stage-hit { fill: transparent; stroke: transparent; stroke-width: 1.5; }
.stage:hover .stage-hit { fill: #e9f2ff8f; stroke: #a9c3e2; }
.stage[aria-pressed="true"] .stage-hit { fill: #dcecff9c; stroke: #417abb; }
.stage[data-overload="true"] .stage-hit { stroke: #b64a46; fill: #fff0ed9c; }
.stage:focus-visible .stage-hit { stroke: #215ca8; stroke-width: 2.6; }
.stage-label { font-size: 13px; font-weight: 680; fill: #183656; }
.stage-value { font-size: 10.8px; fill: #4d6480; font-weight: 620; font-variant-numeric: tabular-nums; }
.block-symbol { fill: #fff; stroke: #254b74; stroke-width: 1.7; }
.antenna-symbol { fill: #1a4375; stroke: #173c67; stroke-width: 1.3; }
.amp-symbol { fill: #b0e2cb; stroke: #216c55; stroke-width: 1.65; }
.filter-trace, .mixer-cross, .lo-trace { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
.filter-trace { stroke: #7754a1; }
.mixer-cross { stroke: #254b74; }
.lo-trace { stroke: #2478a3; }
.adc-symbol { fill: #725695; stroke: #5f4283; stroke-width: 1.45; }
.adc-label { font-size: 12px; fill: #fff; font-weight: 730; }
.baseband-symbol { fill: #e9eff7; stroke: #547194; stroke-width: 1.35; }
.stage[aria-pressed="true"] .baseband-symbol { fill: #dcecff; }
.sampling-axis { fill: none; stroke: #bac9d9; stroke-width: 1; }
.sampling-wave { fill: none; stroke: #a492b8; stroke-width: 1.25; }
.sampling-steps { fill: none; stroke: #785e95; stroke-width: 1.15; stroke-dasharray: 2.5 2; }
.sampling text { font-size: 10px; fill: #6b7488; }
.spectrum-frame { fill: #f7fbff; stroke: #cbdced; }
.spectrum-title { font-size: 13px; font-weight: 720; fill: #214368; }
.spectrum-frequency, .spectrum-tick { font-size: 9.5px; font-variant-numeric: tabular-nums; fill: #58708e; }
.spectrum-axis { fill: none; stroke: #6381a4; stroke-width: 1; }
.spectrum-grid { stroke: #dce7f3; stroke-width: 1; stroke-dasharray: 2 3; }
.tone-wanted { fill: #3482ce; stroke: #2268bd; stroke-width: 1; }
.tone-blocker { fill: #e7aa4f; stroke: #a96308; stroke-width: 1; }
.chain-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 9px 16px 10px; }
.chain-legend, .plot-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .72rem; }
.chain-legend span, .plot-legend span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.key-wanted { background: var(--wanted); }
.key-blocker { background: #c5892c; }
.key-tap { background: transparent; width: 13px; height: 0; border-top: 1.5px dashed #538471; border-radius: 0; }
.legend-note { color: var(--soft); }
.chain-status { display: flex; align-items: center; justify-content: flex-end; gap: 6px; font-size: .75rem; font-weight: 650; color: var(--green); text-align: right; }
.chain-status::before { content: ""; width: 6px; height: 6px; flex: none; background: currentColor; border-radius: 50%; }
.chain-status[data-tone="warn"] { color: var(--amber); }
.chain-status[data-tone="limit"] { color: var(--red); }
.diagnostics { margin: 0 16px 11px; padding: 8px 12px 8px 26px; background: #fff8ec; border: 1px solid #f0dfbf; color: #71470f; border-radius: 6px; font-size: .77rem; line-height: 1.45; }
.diagnostics li + li { margin-top: 3px; }
.mobile-chain-nav { display: none; }

.detail-grid { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); gap: 15px; margin-bottom: 15px; align-items: start; }
.editor-panel { min-height: 100%; padding-bottom: 12px; }
.editor-heading .eyebrow { margin-bottom: 4px; }
.stage-tag { margin-top: 1px; white-space: nowrap; color: #315b87; background: #ecf4fd; border-radius: 5px; padding: 4px 6px; font-size: .63rem; font-weight: 730; letter-spacing: .065em; }
#stage-form { padding: 0 16px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: block; min-width: 0; }
.field-label { display: block; margin-bottom: 4px; color: #334c6b; font-size: .77rem; font-weight: 650; }
.control { position: relative; display: flex; align-items: center; }
.control input, .mobile-chain-nav select { width: 100%; min-width: 0; min-height: 36px; border: 1px solid #cbd9e9; border-radius: 6px; background: #fff; color: var(--ink); font-variant-numeric: tabular-nums; }
.control input { padding: 7px 64px 7px 9px; font-size: .87rem; font-weight: 620; appearance: textfield; }
.control input::-webkit-inner-spin-button, .control input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.control input:focus { border-color: #6d9bcc; }
.control input:disabled { color: #6f8198; background: #f5f7fa; }
.control input[aria-invalid="true"] { border-color: #bc4b4a; background: #fff7f5; }
.input-unit { position: absolute; right: 8px; color: var(--soft); font-size: .72rem; pointer-events: none; white-space: nowrap; }
.field-plain .control input { padding-right: 9px; }
.blocker-inputs { margin: 11px 0 0; border: 0; padding: 0; min-width: 0; }
.blocker-inputs legend { padding: 0; color: #334c6b; font-weight: 700; font-size: .77rem; }
.blocker-grid { display: grid; grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1fr); gap: 5px 8px; align-items: center; }
.blocker-grid .control input { min-height: 32px; padding-block: 4px; padding-right: 42px; }
.blocker-header { color: var(--soft); font-size: .68rem; font-weight: 640; }
.blocker-toggle { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; color: #334c6b; cursor: pointer; }
.blocker-toggle input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.editor-feedback { margin: 8px 16px 0; color: var(--red); font-size: .75rem; }
.stage-readout { display: flex; flex-wrap: wrap; gap: 5px 14px; margin: 10px 16px 0; padding-top: 9px; border-top: 1px solid #e9eff6; color: var(--muted); font-size: .73rem; line-height: 1.35; }
.stage-readout strong { color: #244a75; font-variant-numeric: tabular-nums; }
.plot-toggle { display: flex; gap: 2px; align-items: center; background: #eff4fa; border: 1px solid #dce6f2; border-radius: 7px; padding: 3px; white-space: nowrap; }
.plot-toggle button { min-height: 27px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 4px 8px; font-size: .74rem; font-weight: 660; }
.plot-toggle button[aria-pressed="true"] { color: var(--blue-dark); background: white; box-shadow: 0 1px 2px #193f6821; }
.plot-legend { padding-inline: 17px; padding-bottom: 3px; }
.plot-key { width: 16px; border-top: 2px solid; border-radius: 0; }
.plot-scroll { padding: 0 9px 7px; overflow-x: auto; }
#response-plot { display: block; width: 100%; min-width: 435px; max-height: 300px; font-family: inherit; }
.plot-grid-line { stroke: #e2eaf3; stroke-width: 1; }
.plot-selection { fill: #e9f2fd; }
.plot-axis-label { fill: #506780; font-size: 11px; font-variant-numeric: tabular-nums; }
.plot-stage-label { fill: #546b84; font-size: 11.5px; font-weight: 610; }
.plot-stage-label.is-current { fill: #205488; font-weight: 750; }

.budget-panel { margin-bottom: 15px; overflow: hidden; }
.bandwidth-label { color: var(--muted); background: #f2f6fb; padding: 5px 8px; border-radius: 5px; font-size: .72rem; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 696px; border-collapse: collapse; font-size: .8rem; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 14px; text-align: right; border-top: 1px solid #e7eef6; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 17px; }
thead th { font-weight: 700; color: #39526f; background: #f5f8fc; }
thead th small { font-size: .7rem; color: var(--muted); font-weight: 560; padding-left: 3px; }
tbody th { color: var(--ink); font-weight: 620; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr.is-current { background: #eef5fe; }
.table-stage { border: 0; background: transparent; color: #1e4978; font-size: inherit; font-weight: 670; padding: 2px 0; text-align: left; }
.table-stage:hover { text-decoration: underline; text-underline-offset: 3px; }
td.is-low { color: var(--amber); font-weight: 710; }
td.is-over { color: var(--red); font-weight: 710; }
td.is-empty { color: #75879d; }
.model-notes summary { padding: 13px 16px; color: #304d70; font-weight: 680; font-size: .83rem; cursor: pointer; }
.notes-content { padding: 0 16px 15px; color: var(--muted); font-size: .8rem; line-height: 1.5; max-width: 1040px; }
.notes-content p + p { margin-top: 7px; }
.notes-content strong { color: var(--ink); }

@media (max-width: 1050px) {
  .masthead-inner, .workspace { padding-inline: 23px; }
  .detail-grid { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); }
}
@media (max-width: 800px) {
  .intro { align-items: flex-start; flex-direction: column; gap: 10px; }
  .detail-grid { grid-template-columns: 1fr; }
  .chain-scroll { margin-inline: 10px; }
  .mobile-chain-nav { display: flex; align-items: center; gap: 8px; margin: 0 10px 8px; }
  .mobile-chain-nav label { font-size: .74rem; color: var(--muted); }
  .mobile-chain-nav select { width: auto; max-width: 75%; min-height: 30px; font-size: .77rem; padding: 4px 5px; }
  .chain-foot { align-items: flex-start; flex-direction: column; }
  .chain-status { text-align: left; }
}
@media (max-width: 560px) {
  .masthead-inner, .workspace { padding-inline: 12px; }
  .masthead-inner { min-height: 54px; }
  .workspace { padding-top: 20px; }
  .brand { gap: 7px; font-size: .88rem; }
  .brand svg { width: 27px; height: 27px; }
  .intro { margin-bottom: 15px; }
  .lede { font-size: .9rem; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 10px 12px 11px; }
  .metric:nth-child(3) { border-left: 0; }
  .metric:nth-child(n+3) { border-top: 1px solid var(--line); }
  .metric-value { font-size: 1.48rem; }
  .panel-head { flex-wrap: wrap; padding: 12px 12px 10px; gap: 8px; }
  .chain-foot { padding-inline: 11px; }
  .chain-legend, .plot-legend { gap: 7px 11px; }
  .plot-heading { align-items: center; }
  .plot-legend { padding-inline: 12px; }
  #stage-form { padding-inline: 12px; }
  .stage-readout { margin-inline: 12px; }
  .plot-scroll { padding-inline: 4px; }
  #response-plot { min-width: 365px; }
}

/* Match the RF calculator cards while retaining the instrument trace colors. */
:root {
  --page: #f4f7fa;
  --ink: #10213b;
  --blue-dark: #182f50;
  --blue-soft: #eef4f8;
  font-family: "DM Sans", Arial, sans-serif;
}
h1, h2, h3, summary, .brand, .button {
  font-family: Manrope, Arial, sans-serif;
}
.panel { border-top: 3px solid #bc933c; border-radius: 12px; }
.button-primary { background: #d7b761; color: #10213b; }
.button-primary:hover { background: #c9a54f; }
