/*
 * National STR Map — Deal calculator, KPI scorecard and Compare tray (str-deal.js).
 * Everything is namespaced .sd-* and inherits the .sm design tokens.
 */
.sd, .sd-modal, .sm-compare {
    --sd-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Consolas, monospace;
    --sd-up: #34D399;
    --sd-down: #F87171;
    --sd-mid: #FBBF24;
    --sd-info: #60A5FA;
}
.sd { margin-top: 18px; font-variant-numeric: tabular-nums; min-width: 0; }
.sd *, .sd-modal *, .sm-compare * { box-sizing: border-box; }
.sd-sr {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sd-up { color: var(--sd-up) !important; }
.sd-down { color: var(--sd-down) !important; }
.sd-mid { color: var(--sd-mid) !important; }

.sd button, .sd-modal button, .sm-compare button { font-family: inherit; }
.sd :focus-visible, .sd-modal :focus-visible, .sm-compare :focus-visible {
    outline: 2px solid var(--sm-accent); outline-offset: 2px; border-radius: 6px;
}

/* ---- Compare pin bar ------------------------------------- */
.sd-pinbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sd-pin {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
    background: var(--sm-bg); color: var(--sm-text); border: 1px solid var(--sm-line);
    border-radius: 9px; padding: 8px 12px; font-size: .8rem; font-weight: 700;
    transition: border-color .15s, background .15s, color .15s;
}
.sd-pin span { font-family: var(--sd-mono); color: var(--sm-accent); font-weight: 800; }
.sd-pin:hover { border-color: var(--sm-faint); background: var(--sm-raise); }
.sd-pin[aria-pressed="true"] { border-color: rgba(52,211,153,.5); background: rgba(52,211,153,.1); color: #D1FAE5; }
.sd-pin:disabled { opacity: .5; cursor: not-allowed; }
.sd-pin-note { font-size: .72rem; color: var(--sm-faint); }

/* ---- Collapsible sections -------------------------------- */
.sd-sec { border-top: 1px solid var(--sm-line); margin-top: 14px; }
.sd-sec-h {
    list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 9px;
    padding: 12px 0 10px; user-select: none;
}
.sd-sec-h::-webkit-details-marker { display: none; }
.sd-sec-k {
    font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--sm-accent); white-space: nowrap;
}
.sd-sec-t { font-size: .78rem; color: var(--sm-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-chev {
    margin-left: auto; flex: 0 0 auto; width: 7px; height: 7px; align-self: center;
    border-right: 1.5px solid var(--sm-faint); border-bottom: 1.5px solid var(--sm-faint);
    transform: rotate(-45deg); transition: transform .15s;
}
.sd-sec[open] > .sd-sec-h .sd-chev { transform: rotate(45deg); }
.sd-sec-h:hover .sd-chev { border-color: var(--sm-text); }
.sd-sec-b { padding-bottom: 4px; }
.sd-sub-h { font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sm-faint); }
.sd-fine { font-size: .7rem; line-height: 1.5; color: var(--sm-faint); margin: 10px 0 0; }
.sd-fine b { color: var(--sm-dim); font-weight: 700; }
.sd-tag {
    display: inline-block; vertical-align: 1px; font-size: .58rem; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; padding: 1px 5px; border-radius: 4px;
    color: var(--sm-dim); background: rgba(150,163,188,.14); border: 1px solid rgba(150,163,188,.25);
}
.sd-tag-amber { color: var(--sd-mid); background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.35); }

/* ---- Scorecard ------------------------------------------- */
.sd-kpis { display: grid; }
.sd-kpi { padding: 9px 0 10px; border-bottom: 1px solid rgba(38,51,76,.6); --tone: var(--sd-info); }
.sd-kpi:first-child { padding-top: 2px; }
.sd-kpi:last-child { border-bottom: 0; }
.sd-tone-up { --tone: var(--sd-up); }
.sd-tone-mid { --tone: var(--sd-mid); }
.sd-tone-down { --tone: var(--sd-down); }
.sd-tone-info { --tone: var(--sd-info); }
.sd-kpi-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sd-kpi-l { font-size: .78rem; font-weight: 600; color: var(--sm-dim); }
.sd-kpi-v { font-family: var(--sd-mono); font-size: .9rem; font-weight: 700; color: #fff; white-space: nowrap; }
.sd-bar {
    position: relative; height: 6px; margin: 8px 0 7px; border-radius: 3px;
    background: var(--sm-bg); box-shadow: inset 0 0 0 1px var(--sm-line);
}
.sd-bar-fill {
    position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px;
    background: linear-gradient(90deg, transparent, var(--tone)); opacity: .55;
    transform-origin: left center; animation: sd-grow .5s ease-out both;
}
.sd-bar-med { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--sm-dim); opacity: .8; }
.sd-bar-dot {
    position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
    background: var(--tone); box-shadow: 0 0 0 2px var(--sm-panel), 0 0 8px var(--tone);
}
.sd-bar-plain .sd-bar-fill { background: var(--tone, var(--sd-up)); opacity: .75; }
.sd-kpi-sub { display: flex; justify-content: space-between; gap: 10px; font-size: .7rem; color: var(--sm-faint); line-height: 1.35; }
.sd-kpi-sub b { color: var(--tone); font-weight: 700; }
.sd-kpi-med { font-family: var(--sd-mono); white-space: nowrap; font-size: .66rem; align-self: flex-end; }
@keyframes sd-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---- Opportunity breakdown ------------------------------- */
.sd-break {
    margin-top: 14px; padding: 12px; border-radius: 10px;
    background: var(--sm-bg); border: 1px solid var(--sm-line);
}
.sd-break-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.sd-break-score { font-family: var(--sd-mono); font-size: 1.15rem; font-weight: 800; color: #fff; letter-spacing: -.02em; white-space: nowrap; }
.sd-break-score small { font-size: .68rem; font-weight: 600; color: var(--sm-faint); letter-spacing: 0; }
.sd-part { padding: 8px 0; border-top: 1px solid rgba(38,51,76,.6); --tone: var(--sd-up); }
.sd-part.is-assumed { --tone: var(--sd-mid); }
.sd-part.is-zero { --tone: var(--sm-faint); }
.sd-part-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sd-part-l { font-size: .78rem; font-weight: 600; color: var(--sm-text); }
.sd-part-pts { font-family: var(--sd-mono); font-size: .78rem; font-weight: 700; color: var(--tone); white-space: nowrap; }
.sd-part .sd-bar { margin: 6px 0 5px; height: 4px; }
.sd-part-sub { display: flex; justify-content: space-between; gap: 10px; font-size: .68rem; color: var(--sm-faint); line-height: 1.4; }
.sd-part-sub b { color: var(--sm-dim); font-family: var(--sd-mono); }
.sd-part-sub i { font-style: normal; opacity: .8; }
.sd-part-sub span:last-child { white-space: nowrap; }
.sd-part.is-missing .sd-part-l { color: var(--sm-faint); }
.sd-part.is-missing .sd-part-pts { color: var(--sm-faint); font-weight: 600; }
.sd-part.is-missing .sd-part-sub { margin-top: 4px; }
.sd-part.is-missing .sd-part-sub span:last-child { white-space: normal; }

/* ---- Calculator inputs ----------------------------------- */
.sd-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 10px; }
.sd-f { min-width: 0; position: relative; }
.sd-f-wide { grid-column: 1 / -1; }
.sd-f-l { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; min-height: 16px; }
.sd-f-l label { font-size: .7rem; font-weight: 600; color: var(--sm-dim); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-in {
    display: flex; align-items: stretch; height: 36px; border-radius: 8px; overflow: hidden;
    background: var(--sm-bg); border: 1px solid var(--sm-line); transition: border-color .15s, box-shadow .15s;
}
.sd-in:focus-within { border-color: var(--sm-accent-deep); box-shadow: 0 0 0 2px rgba(16,185,129,.18); }
.sd-in input {
    flex: 1 1 auto; min-width: 0; width: 100%; border: 0; background: transparent; color: #fff; outline: none;
    font-family: var(--sd-mono); font-size: .86rem; font-weight: 600; text-align: right; padding: 0 4px;
    font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.sd-in input::-webkit-outer-spin-button, .sd-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.sd-in input::placeholder { color: var(--sm-faint); font-weight: 500; font-family: 'Inter', system-ui, sans-serif; font-size: .74rem; }
.sd-in input[aria-invalid="true"] { color: var(--sd-down); }
.sd-in:has(input[aria-invalid="true"]) { border-color: rgba(248,113,113,.7); }
.sd-affix { display: flex; align-items: center; font-family: var(--sd-mono); font-size: .76rem; color: var(--sm-faint); padding-left: 6px; flex: 0 0 auto; }
.sd-affix-r { padding: 0 6px 0 1px; }
.sd-step {
    flex: 0 0 26px; border: 0; background: transparent; color: var(--sm-faint); cursor: pointer;
    font-family: var(--sd-mono); font-size: .95rem; line-height: 1; padding: 0;
    transition: background .12s, color .12s;
}
.sd-step:first-child { border-right: 1px solid var(--sm-line); }
.sd-step:last-child { border-left: 1px solid var(--sm-line); }
.sd-step:hover { background: var(--sm-raise); color: #fff; }
.sd-step:active { background: var(--sm-accent-deep); color: #05231A; }
.sd-hint { font-size: .68rem; line-height: 1.4; color: var(--sm-faint); margin-top: 4px; }
.sd-hint b { color: var(--sm-text); font-family: var(--sd-mono); }
.sd-prompt { color: var(--sd-mid); font-weight: 600; }
.sd-link { background: none; border: 0; padding: 0; color: var(--sm-accent); font-size: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

.sd-tip {
    flex: 0 0 auto; width: 15px; height: 15px; border-radius: 50%; padding: 0; cursor: help;
    border: 1px solid var(--sm-faint); background: transparent; color: var(--sm-dim);
    font-size: .6rem; font-weight: 800; line-height: 1;
}
.sd-tip:hover, .sd-tip[aria-expanded="true"] { color: #fff; border-color: var(--sm-accent); }
.sd-tip-b {
    display: none; position: absolute; z-index: 6; left: 0; bottom: calc(100% - 14px); width: min(260px, 78vw);
    background: #0F1A2E; border: 1px solid var(--sm-faint); border-radius: 8px; padding: 9px 10px;
    font-size: .72rem; line-height: 1.45; color: var(--sm-text); font-weight: 400;
    box-shadow: 0 10px 28px rgba(0,0,0,.5);
}
.sd-tip:hover + .sd-tip-b, .sd-tip:focus-visible + .sd-tip-b, .sd-tip[aria-expanded="true"] + .sd-tip-b { display: block; }

.sd-mode {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 2px; border-radius: 8px;
    background: var(--sm-bg); border: 1px solid var(--sm-line); margin-top: 2px;
}
.sd-mode-b {
    border: 0; background: transparent; color: var(--sm-dim); cursor: pointer; border-radius: 6px;
    font-size: .72rem; font-weight: 700; padding: 6px 4px; letter-spacing: .02em;
}
.sd-mode-b:hover { color: #fff; }
.sd-mode-b[aria-pressed="true"] { background: var(--sm-raise); color: var(--sm-accent); box-shadow: inset 0 0 0 1px var(--sm-line); }
.sd-mode-pane[hidden] { display: none; }

.sd-taxnote {
    display: flex; gap: 10px; margin-top: 12px; padding: 8px 10px; border-radius: 8px;
    font-size: .72rem; line-height: 1.45; color: var(--sm-dim);
    background: rgba(96,165,250,.06); border: 1px solid rgba(96,165,250,.22);
}
.sd-taxnote-l { flex: 0 0 auto; font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sd-info); padding-top: 2px; }
.sd-taxnote i { display: block; color: var(--sm-faint); font-style: normal; font-size: .68rem; margin-top: 2px; }

.sd-warn {
    display: flex; gap: 9px; align-items: flex-start; margin-top: 12px; padding: 9px 11px; border-radius: 9px;
    font-size: .76rem; line-height: 1.45; color: #FDE68A; text-decoration: none;
    background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.4);
}
a.sd-warn:hover { background: rgba(251,191,36,.14); border-color: var(--sd-mid); }
.sd-warn b { color: #fff; font-weight: 700; }
.sd-warn-i {
    flex: 0 0 auto; width: 17px; height: 17px; border-radius: 50%; margin-top: 1px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--sd-mid); color: #1F1300; font-weight: 900; font-size: .72rem; font-family: var(--sd-mono);
}
.sd-warn-go { color: var(--sd-mid); font-weight: 700; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }

/* ---- Results --------------------------------------------- */
.sd-results { margin-top: 14px; border: 1px solid var(--sm-line); border-radius: 12px; background: var(--sm-bg); overflow: hidden; }
.sd-fin, .sd-hero { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sd-fin[hidden], [data-returns][hidden], .sd-need[hidden], .sd-l[hidden] { display: none; }
.sd-out, .sd-hero-c { padding: 10px 10px 9px; min-width: 0; border-right: 1px solid var(--sm-line); }
.sd-out:last-child, .sd-hero-c:last-child { border-right: 0; }
.sd-out-l { display: block; font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sm-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-out-v { display: block; margin-top: 3px; font-family: var(--sd-mono); font-size: .88rem; font-weight: 700; color: #fff; white-space: nowrap; }
.sd-hero { border-top: 1px solid var(--sm-line); background: linear-gradient(180deg, rgba(27,39,64,.55), rgba(27,39,64,.15)); }
.sd-hero-v { display: block; margin-top: 3px; font-family: var(--sd-mono); font-size: 1.32rem; font-weight: 800; letter-spacing: -.03em; color: #fff; white-space: nowrap; line-height: 1.15; }
.sd-need {
    border-top: 1px solid var(--sm-line); padding: 12px; font-size: .78rem; line-height: 1.5;
    color: #FDE68A; background: rgba(251,191,36,.06);
}
.sd-fin[hidden] + .sd-need { border-top: 0; }
.sd-ledger { border-top: 1px solid var(--sm-line); padding: 4px 12px 6px; }
.sd-l { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; font-size: .76rem; color: var(--sm-dim); border-bottom: 1px solid rgba(38,51,76,.55); }
.sd-l:last-child { border-bottom: 0; }
.sd-l > span { min-width: 0; }
.sd-l i { font-style: normal; color: var(--sm-faint); font-size: .68rem; margin-left: 3px; }
.sd-l b { font-family: var(--sd-mono); font-size: .82rem; font-weight: 600; color: var(--sm-text); white-space: nowrap; }
.sd-l-sum { color: var(--sm-text); font-weight: 600; }
.sd-l-sum b { color: #fff; font-weight: 800; }
.sd-l-total { border-bottom: 1px solid var(--sm-line); }
.sd-l-total b { font-size: .95rem; }
.sd-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid transparent; }
.sd-chip-up { color: var(--sd-up); background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); }
.sd-chip-mid { color: var(--sd-mid); background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.4); }
.sd-chip-down { color: var(--sd-down); background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.45); }
.sd-results .sd-fine { margin: 0; padding: 0 12px 10px; }
.sd-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.sd-reset {
    background: transparent; border: 1px solid var(--sm-line); color: var(--sm-dim); cursor: pointer;
    border-radius: 8px; padding: 6px 10px; font-size: .72rem; font-weight: 700;
}
.sd-reset:hover { color: #fff; border-color: var(--sm-faint); background: var(--sm-raise); }
.sd-honest { margin-top: 8px; }

/* ---- Sensitivity grid ------------------------------------ */
.sd-sens-wrap { border: 1px solid var(--sm-line); border-radius: 10px; overflow: hidden; background: var(--sm-bg); }
.sd-sens { display: table; width: 100%; border-collapse: collapse; table-layout: fixed; font-family: var(--sd-mono); font-size: .74rem; }
.sd-sens th.sd-sens-ax { padding: 3px 2px; }
.sd-sens th, .sd-sens td { padding: 7px 2px; text-align: center; border: 1px solid rgba(11,18,32,.9); }
.sd-sens th { font-weight: 700; color: var(--sm-dim); background: var(--sm-panel); font-size: .68rem; }
.sd-sens th.sd-sens-ax { font-family: 'Inter', system-ui, sans-serif; font-size: .56rem; letter-spacing: .02em; color: var(--sm-faint); font-weight: 600; white-space: nowrap; }
.sd-sens th.sd-sens-ax span { display: block; line-height: 1.35; }
.sd-sens th.sd-sens-ax span:first-child { text-align: right; padding-right: 5px; }
.sd-sens th.sd-sens-ax span:last-child { text-align: left; padding-left: 5px; }
.sd-sens td { color: #fff; font-weight: 700; }
.sd-sens td.is-base { box-shadow: inset 0 0 0 2px #fff; }

/* ---- Compare tray ---------------------------------------- */
.sm-compare { display: none; }
.sm-compare.is-on {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    background: rgba(11,18,32,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--sm-line); box-shadow: 0 -10px 30px rgba(0,0,0,.35);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: sd-rise .22s ease-out both;
}
@keyframes sd-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sd-tray { height: 56px; max-width: 1880px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 10px; }
.sd-tray-l { font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sm-accent); flex: 0 0 auto; }
.sd-tray-chips { display: flex; gap: 7px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding: 3px 1px; }
.sd-tray-chips::-webkit-scrollbar { display: none; }
.sd-tchip { display: inline-flex; flex: 0 0 auto; align-items: stretch; border: 1px solid var(--sm-line); border-radius: 8px; background: var(--sm-panel); overflow: hidden; }
.sd-tchip-open { border: 0; background: transparent; color: #fff; cursor: pointer; font-size: .8rem; font-weight: 700; padding: 6px 4px 6px 10px; white-space: nowrap; }
.sd-tchip-open small { font-family: var(--sd-mono); font-size: .66rem; color: var(--sm-faint); font-weight: 600; margin-left: 2px; }
.sd-tchip-open:hover { color: var(--sm-accent); }
.sd-tchip-x { border: 0; background: transparent; color: var(--sm-faint); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 9px 1px 6px; }
.sd-tchip-x:hover { color: var(--sd-down); }
.sd-tray-n { font-family: var(--sd-mono); font-size: .72rem; color: var(--sm-faint); flex: 0 0 auto; }
.sd-tray-clear { flex: 0 0 auto; background: transparent; border: 0; color: var(--sm-dim); cursor: pointer; font-size: .76rem; font-weight: 600; padding: 6px 4px; text-decoration: underline; text-underline-offset: 3px; }
.sd-tray-clear:hover { color: #fff; }
.sd-tray-go {
    flex: 0 0 auto; cursor: pointer; border-radius: 9px; padding: 9px 16px; font-size: .84rem; font-weight: 800;
    background: var(--sm-accent-deep); border: 1px solid var(--sm-accent-deep); color: #05231A; white-space: nowrap;
}
.sd-tray-go span { font-family: var(--sd-mono); }
.sd-tray-go:hover { background: var(--sm-accent); border-color: var(--sm-accent); }

/* Room for the tray only while it is showing. */
body.sd-tray-on main { padding-bottom: 64px; }
body.sd-tray-on footer { padding-bottom: 64px; }
@media (min-width: 1181px) {
    body.sd-tray-on .sm-drawer { max-height: calc(100vh - 104px - 52px); }
}

/* ---- Compare modal --------------------------------------- */
.sd-modal {
    position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: transparent; font-variant-numeric: tabular-nums;
}
.sd-modal-back { position: absolute; inset: 0; background: rgba(4,8,16,.74); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: sd-fade .18s ease-out both; }
.sd-modal-box {
    position: relative; width: min(1320px, 100%); max-height: 100%; display: flex; flex-direction: column;
    background: var(--sm-panel); border: 1px solid var(--sm-line); border-radius: 16px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: sd-pop .2s ease-out both; color: var(--sm-text);
}
@keyframes sd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sd-pop { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.sd-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--sm-line); flex: 0 0 auto; }
.sd-modal-t { margin: 2px 0 0; font-size: 1.12rem; font-weight: 800; color: #fff; letter-spacing: -.01em; line-height: 1.2; }
.sd-modal-t span { font-size: .8rem; font-weight: 600; color: var(--sm-faint); letter-spacing: 0; }
.sd-modal-x {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; font-size: 1.15rem; line-height: 1;
    background: transparent; border: 1px solid var(--sm-line); color: var(--sm-dim);
}
.sd-modal-x:hover { color: #fff; border-color: var(--sm-faint); }
.sd-modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 18px 16px; min-height: 0; }
.sd-cmp-wrap { position: relative; overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.sd-cmp { display: table; width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; min-width: calc(150px + var(--cols, 3) * 170px); }
.sd-cmp[data-cols="1"] { --cols: 1; } .sd-cmp[data-cols="2"] { --cols: 2; }
.sd-cmp[data-cols="3"] { --cols: 3; } .sd-cmp[data-cols="4"] { --cols: 4; }
.sd-cmp td { position: relative; }
.sd-cmp th, .sd-cmp td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid rgba(38,51,76,.7); }
.sd-cmp thead th { position: sticky; top: 0; z-index: 3; background: var(--sm-panel); border-bottom: 1px solid var(--sm-line); padding-top: 14px; }
.sd-cmp-corner { width: 150px; }
.sd-cmp tbody th[scope="row"] {
    width: 150px; position: sticky; left: 0; z-index: 2; background: var(--sm-panel);
    font-size: .74rem; font-weight: 600; color: var(--sm-dim); border-right: 1px solid var(--sm-line);
}
.sd-cmp thead th.sd-cmp-corner { left: 0; z-index: 4; border-right: 1px solid var(--sm-line); }
.sd-cmp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sd-cmp-city { font-size: 1rem; font-weight: 800; color: #fff; text-decoration: none; line-height: 1.2; }
.sd-cmp-city span { font-size: .72rem; color: var(--sm-accent); font-weight: 700; }
.sd-cmp-city:hover { color: var(--sm-accent); text-decoration: underline; text-underline-offset: 3px; }
.sd-cmp-state { font-size: .72rem; color: var(--sm-faint); font-weight: 500; margin-top: 2px; }
.sd-cmp-x { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--sm-line); background: transparent; color: var(--sm-faint); cursor: pointer; line-height: 1; font-size: .9rem; padding: 0; }
.sd-cmp-x:hover { color: var(--sd-down); border-color: var(--sd-down); }
.sd-cmp-g th { padding: 16px 12px 7px; background: var(--sm-panel); border-bottom: 1px solid var(--sm-line); }
.sd-cmp-g th span { position: sticky; left: 12px; font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--sm-accent); }
.sd-cmp-num { font-family: var(--sd-mono); font-size: .86rem; font-weight: 600; color: var(--sm-text); }
.sd-cmp-v { white-space: nowrap; }
.sd-cmp-num.is-best { background: rgba(52,211,153,.07); box-shadow: inset 2px 0 0 var(--sm-accent); }
.sd-cmp-num.is-best .sd-cmp-v { color: var(--sd-up); font-weight: 800; }
.sd-best {
    display: inline-block; vertical-align: 1px; margin-left: 4px; font-family: 'Inter', system-ui, sans-serif;
    font-size: .56rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
    color: #05231A; background: var(--sm-accent); border-radius: 4px; padding: 1px 5px;
}
.sd-cmp-text { font-size: .76rem; line-height: 1.5; color: var(--sm-dim); overflow-wrap: anywhere; }
.sd-cmp-text.is-warn { color: #FDE68A; }
.sd-cmp td.is-none { color: var(--sm-faint); }
.sd-cmp tbody tr:hover td { background-color: rgba(27,39,64,.55); }
.sd-cmp tbody tr:hover th[scope="row"] { background-color: #172236; color: var(--sm-text); }
.sd-cmp tbody tr:hover td.is-best { background-color: rgba(52,211,153,.12); }
.sd-cmp-fine { margin-top: 14px; max-width: 110ch; }
.sd-cmp-fine .sd-best { margin: 0 3px 0 0; }

/* ---- Narrow screens -------------------------------------- */
@media (max-width: 720px) {
    .sd-in { height: 40px; }
    .sd-in input { font-size: 16px; }              /* stops iOS zooming into the field */
    .sd-step { flex-basis: 32px; }
    .sd-out, .sd-hero-c { padding-left: 8px; padding-right: 6px; }
    .sd-out-l { letter-spacing: .03em; }
    .sd-tray { padding: 0 12px; gap: 8px; }
    .sd-tray-l, .sd-tray-n { display: none; }
    .sd-tray-go { padding: 9px 12px; }
    .sd-modal { padding: 0; align-items: stretch; }
    .sd-modal-box { border-radius: 0; border: 0; width: 100%; }
    .sd-modal-head { padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
    .sd-modal-body { padding: 0 14px 16px; }
    .sd-cmp-wrap { margin: 0 -14px; padding: 0; }
    .sd-cmp { min-width: calc(104px + var(--cols, 3) * 150px); }
    .sd-cmp-corner, .sd-cmp tbody th[scope="row"] { width: 104px; }
    .sd-cmp th, .sd-cmp td { padding: 8px 9px; }
    .sd-cmp-g th span { left: 9px; }
}
@media (max-width: 380px) {
    .sd-hero-v { font-size: 1.12rem; }
    .sd-out-v { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
    .sd-bar-fill, .sm-compare.is-on, .sd-modal-back, .sd-modal-box { animation: none; }
    .sd-chev, .sd-pin, .sd-in, .sd-step { transition: none; }
}
