/* ===== MySolarModel — design tokens ===== */
:root {
    --ink: #0f2742;
    --ink-2: #33475e;
    --muted: #64748b;
    --line: #e3e8ef;
    --bg: #f5f7fb;
    --card: #ffffff;
    --sun: #f5a524;
    --sun-2: #ffd166;
    --sun-ink: #4a2f00;
    --cash: #e8920c;
    --fin: #119e8a;
    --sum: #3b6fd8;
    --pos: #1c8a5a;
    --neg: #c2413b;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 39, 66, .06), 0 8px 24px rgba(15, 39, 66, .06);
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-head: "Sora", "Inter", system-ui, sans-serif;
}
/* ===== Theme tokens (Light / Dark mode, 2026-11-13) =====
   Light values are the original colours; css/theme-dark.css swaps them. App.razor sets that sheet's media from the
   "mySolar.theme" cookie (dark → always, light → never, no choice yet → when the device is in dark mode), and the
   Light / Dark / Auto button in NavMenu (mySolar.cycleTheme) changes it. Its media is screen-only, so printing stays light. */
:root {
    --on-ink: #fff;
    --tip-bg: #0f2742;
    --tip-ink: #f3f6fa;
    --topbar-bg: rgba(255, 255, 255, .92);
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --hover: #f1f4f9;
    --row-hover: #fbfcfe;
    --track: #e7ecf3;
    --disabled-bg: #f1f3f5;
    --note-bg: #f3f5f8;
    --chip-bg: #eef1f5;
    --chip-ink: #5b6576;
    --line-strong: #b9c6d6;
    --link: #1d5fb8;
    --amber-bg-1: #fffaf0;
    --amber-bg-2: #fff7e6;
    --amber-bg-3: #fff6e0;
    --amber-bg-4: #fff6dc;
    --amber-bg-5: #fff4e0;
    --amber-bg-6: #fff4dc;
    --amber-bg-7: #fff1d1;
    --amber-bg-8: #fdebc8;
    --amber-line-1: #f6dfb0;
    --amber-line-2: #f0d49b;
    --amber-line-3: #f1c97a;
    --amber-ink-1: #8a5a06;
    --amber-ink-2: #6b4a07;
    --amber-ink-3: #6b4705;
    --amber-ink-4: #6b4a00;
    --amber-ink-5: #7a5208;
    --amber-ink-6: #5a3d03;
    --red-bg-1: #fdecea;
    --red-bg-2: #fdf1f0;
    --red-bg-3: #fff8f7;
    --red-bg-4: #f8d4d1;
    --red-line-1: #f3c7c3;
    --red-line-2: #eab0ac;
    --red-ink-1: #8b2520;
    --red-ink-2: #6e2420;
    --red-ink-3: #8f2620;
    --green-bg-1: #e6f6ee;
    --green-bg-2: #e7f6ee;
    --green-bg-3: #eaf7f0;
    --teal-bg: #dcf5ef;
    --green-ink-1: #135c3c;
    --green-ink-2: #1a7f4b;
    --green-ink-3: #14583a;
    --blue-bg-1: #e3effd;
    --blue-bg-2: #e3ecfd;
    --blue-bg-3: #f0f6ff;
    --blue-bg-4: #eef4fb;
    --purple-bg: #f4f2fd;
}


*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
/* Phones: keep iOS from inflating text in landscape; let long words / emails / URLs wrap instead of widening the page. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-wrap: break-word; }
img, video, canvas { max-width: 100%; }
body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: .85em; background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.center { text-align: center; }
h1:focus { outline: none; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; }

/* ===== Top bar ===== */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 1.5rem;
    padding: .6rem clamp(16px, 3vw, 32px);
    background: var(--topbar-bg);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none !important; }
.brand-mark { width: 34px; height: 34px; }
.brand-name { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; }
.brand-name b { color: var(--sun); font-weight: 800; }
.nav-links { display: flex; align-items: center; gap: .25rem; flex: 1; }
.nav-links > a {
    padding: .45rem .75rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: .92rem;
    text-decoration: none;
}
.nav-links > a:hover { background: var(--surface-3); }
.nav-links > a.active { background: var(--ink); color: var(--on-ink); }
.nav-account { margin-left: auto; display: flex; align-items: center; gap: .6rem; font-size: .88rem; }
.nav-email { color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-signin { font-weight: 600; }
.inline-form { display: inline; margin: 0; }
.nav-toggle, .nav-burger { display: none; }
/* Short page name in the bar — narrow screens only (wide screens highlight the page in the menu instead). */
.topbar-title { display: none; }

@media (max-width: 1280px) {
    .nav-burger {
        display: block; margin-left: auto; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
        position: relative; border: 1px solid var(--line); background: var(--card);
    }
    .nav-burger span, .nav-burger span::before, .nav-burger span::after {
        position: absolute; left: 10px; right: 10px; height: 2px; background: var(--ink); content: ""; border-radius: 2px;
    }
    .nav-burger span { top: 19px; }
    .nav-burger span::before { top: -6px; left: 0; right: 0; }
    .nav-burger span::after { top: 6px; left: 0; right: 0; }
    .topbar { flex-wrap: wrap; }
    .nav-links { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: .5rem; }
    .nav-toggle:checked ~ .nav-links { display: flex; }
    .nav-account { margin-left: 0; flex-wrap: wrap; padding: .5rem .75rem 0; }
}
/* Phones only (iPad and desktop keep the layout above): page name on its own line under the logo,
   ✕ while the menu is open, bigger touch targets in the drop-down. */
@media (max-width: 640px) {
    .topbar { gap: .4rem 1rem; padding-top: .5rem; padding-bottom: .5rem; }
    .brand { order: 1; }
    .nav-burger { order: 2; margin-left: auto; flex: none; }
    .topbar-title {
        display: block; order: 3; flex-basis: 100%; min-width: 0;
        font: 700 1.15rem/1.2 var(--font-head); color: var(--ink);
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .topbar-title:empty { display: none; }   /* pages without a banner */
    .nav-links { order: 4; max-height: calc(100dvh - 120px); overflow-y: auto; }
    .nav-links > a { padding: .7rem .9rem; font-size: 1rem; border-radius: 12px; }
    .nav-burger span, .nav-burger span::before, .nav-burger span::after { transition: transform .18s ease, background .18s ease; }
    .nav-toggle:checked + .nav-burger span { background: transparent; }
    .nav-toggle:checked + .nav-burger span::before { transform: translateY(6px) rotate(45deg); }
    .nav-toggle:checked + .nav-burger span::after { transform: translateY(-6px) rotate(-45deg); }
    .nav-toggle:focus-visible + .nav-burger { box-shadow: 0 0 0 3px rgba(245, 165, 36, .35); }
}

/* ===== Buttons & badges ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid transparent;
    font: 600 .92rem var(--font); cursor: pointer; text-decoration: none !important;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sun { background: linear-gradient(180deg, var(--sun-2), var(--sun)); color: var(--sun-ink); box-shadow: 0 4px 14px rgba(245, 165, 36, .35); }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-sm { padding: .38rem .8rem; font-size: .84rem; }
.field-input-action { padding-right: 4px; }
.field-input-action .field-action { flex: none; margin: 3px 0; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-link, .btn-link-danger { background: none; border: 0; padding: 0; font: 600 .9rem var(--font); cursor: pointer; color: var(--link); }
.btn-link-danger { color: var(--neg); padding: .38rem .4rem; }

.tier-badge {
    display: inline-block; padding: .18rem .6rem; border-radius: 999px;
    font: 700 .72rem var(--font); letter-spacing: .04em; text-transform: uppercase;
}
.tier-free { background: var(--surface-3); color: var(--ink-2); }
.tier-registered { background: var(--blue-bg-1); color: var(--link); }
.tier-subscriber { background: var(--amber-bg-7); color: var(--amber-ink-1); }

/* ===== Banner ===== */
.banner { position: relative; min-height: 240px; overflow: hidden; color: #fff; display: flex; align-items: flex-end; }
.banner-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.banner::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, rgba(6, 16, 32, .62) 0%, rgba(6, 16, 32, .25) 45%, transparent 70%);
    pointer-events: none;
}
.banner-text { position: relative; z-index: 1; padding: 2.4rem clamp(16px, 4vw, 48px) 2.2rem; max-width: 720px; }
.banner-text h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 800; margin-bottom: .4rem; text-shadow: 0 2px 18px rgba(0, 0, 0, .25); }
.banner-text p { margin: 0; font-size: 1.04rem; opacity: .92; max-width: 560px; }
.banner-eyebrow {
    display: inline-block; margin-bottom: .6rem; padding: .2rem .7rem; border-radius: 999px;
    background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
    font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}

/* ===== Page layout ===== */
.page { max-width: 1240px; margin: 0 auto; padding: 1.5rem clamp(16px, 3vw, 32px) 3rem; display: grid; gap: 1.25rem;
        /* minmax(0, …): the column may shrink below its content's width, so a wide table scrolls inside its card
           instead of stretching the whole page past the phone screen (2026-11-05). */
        grid-template-columns: minmax(0, 1fr); }
.page > *, .layout-2col > *, .chart-grid > *, .feature-grid > *, .tiers > *, .field-grid > *, .kpis > *, .model-list > * { min-width: 0; }
.page.narrow { max-width: 620px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem 1.35rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.card-head.sub { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px dashed var(--line); }
.card-head h3 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.card-head small { color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-sun { background: var(--sun); box-shadow: 0 0 0 4px rgba(245, 165, 36, .18); }
.dot-bolt { background: var(--sum); box-shadow: 0 0 0 4px rgba(59, 111, 216, .15); }
.dot-coin { background: var(--cash); box-shadow: 0 0 0 4px rgba(232, 146, 12, .18); }
.dot-cal { background: var(--fin); box-shadow: 0 0 0 4px rgba(17, 158, 138, .18); }
.dot-grid { background: var(--ink); box-shadow: 0 0 0 4px rgba(15, 39, 66, .1); }
.accent-cash { border-top: 4px solid var(--cash); }
.accent-finance { border-top: 4px solid var(--fin); }
/* Home battery card (2026-11-05) */
.dot-battery { background: #6d5bd0; box-shadow: 0 0 0 4px rgba(109, 91, 208, .18); }
.battery-card { border-top: 4px solid #6d5bd0; }
.battery-toggle { margin-top: 0; font-weight: 600; color: var(--ink); }
.battery-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.6rem; margin-top: 1.1rem; }
.battery-group h4 { margin: 0 0 .65rem; font: 700 .95rem var(--font-head); color: var(--ink-2); display: flex; align-items: center; gap: .35rem; }
.battery-span { grid-column: 1 / -1; }
.battery-note { margin: .7rem 0 0; padding: .6rem .75rem; border-radius: 10px; background: var(--purple-bg); color: var(--ink-2); font-size: .82rem; line-height: 1.45; }
@media (max-width: 900px) { .battery-groups { grid-template-columns: minmax(0, 1fr); } }
/* Battery + high net-metering credit: they compete for the same exported solar (2026-11-11) */
.battery-note.battery-conflict { background: var(--amber-bg-2); border: 1px solid var(--amber-line-3); border-left: 4px solid #e0a020; color: var(--amber-ink-3); }
.battery-conflict-title { color: var(--amber-ink-1); }
.accent-summary { border-top: 4px solid var(--sum); }

.layout-2col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .layout-2col { grid-template-columns: minmax(0, 1fr); } }

/* ===== Fields ===== */
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem 1rem; }
.field-grid.one { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field-input {
    display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
    transition: border-color .12s, box-shadow .12s;
}
.field-input:focus-within { border-color: var(--sun); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); background: var(--card); }
.field-input input {
    flex: 1; min-width: 0; border: 0; background: transparent; padding: .55rem .7rem;
    font: 500 .95rem var(--font); color: var(--ink); outline: none;
}
.affix { padding: 0 .65rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.field-hint { color: var(--muted); font-size: .76rem; }

.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1.1rem; }
.mini-stats > div { background: var(--surface-2); border-radius: 10px; padding: .6rem .7rem; display: flex; flex-direction: column; }
.mini-stats span { font-size: .72rem; color: var(--muted); }
.mini-stats b { font-family: var(--font-head); font-size: 1rem; }

/* ===== Model switcher ===== */
.model-switcher { display: inline-flex; gap: .3rem; padding: .3rem; background: var(--card); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); justify-self: start; flex-wrap: wrap; }
.model-switcher .seg { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1rem; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: .9rem; text-decoration: none; }
.model-switcher .seg svg { width: 18px; height: 18px; }
.model-switcher .seg:hover { background: var(--hover); }
.model-switcher .seg.active { background: var(--ink); color: var(--on-ink); }

/* ===== Save bar ===== */
.savebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; padding: .85rem 1rem; border-radius: var(--radius); background: var(--amber-bg-1); border: 1px solid var(--amber-line-1); }
.savebar-msg { font-size: .9rem; }
.savebar-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem; flex: 1; }
.savebar-name { display: flex; flex-direction: column; gap: .2rem; flex: 1; min-width: 220px; font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.savebar-name input { padding: .55rem .75rem; border: 1px solid var(--amber-line-2); border-radius: 10px; font: 500 .95rem var(--font); background: var(--card); }
.savebar-meta { display: flex; align-items: center; gap: .6rem; font-size: .84rem; color: var(--muted); flex-wrap: wrap; }
.savebar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; flex-basis: 100%; }
.savebar-all { margin-left: auto; font-size: .86rem; font-weight: 600; }
.savebar-confirm, .savebar .toast { flex-basis: 100%; }
.toast { flex-basis: 100%; padding: .6rem .85rem; border-radius: 10px; font-size: .9rem; font-weight: 500; }
.toast-ok { background: var(--green-bg-1); color: var(--green-ink-1); }
.toast-warn { background: var(--red-bg-1); color: var(--red-ink-1); }
/* Neutral notice, e.g. "You've already used your free trial" on the Subscribe page. */
.toast-info { background: var(--amber-bg-3); color: var(--amber-ink-4); border-left: 4px solid #f2a71c; }
.subscribe-card .trial-used { margin-bottom: 1rem; }

/* ===== KPI cards ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .15rem; box-shadow: var(--shadow); }
.kpi-label { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; }
.kpi-value.pos { color: var(--pos); }
.kpi-value.neg { color: var(--neg); }
.kpi-sub { font-size: .76rem; color: var(--muted); }
.kpi-hero { background: linear-gradient(135deg, #0f2742, #1d4e89); color: #fff; border: 0; }
.kpi-hero .kpi-label, .kpi-hero .kpi-sub { color: rgba(255, 255, 255, .75); }
.kpi-hero .kpi-value, .kpi-hero .kpi-value.pos { color: var(--sun-2); font-size: 1.7rem; }

/* ===== Tables ===== */
.table-scroll { overflow-x: auto; margin: 0 -1.35rem; padding: 0 1.35rem; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.projection { font-size: .84rem; min-width: 1080px; }
.projection th, .projection td { padding: .5rem .6rem; text-align: right; border-bottom: 1px solid var(--surface-3); white-space: nowrap; }
.projection th:nth-child(-n+2), .projection td:nth-child(-n+2) { text-align: left; }
.projection thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; }
.projection tbody tr:hover { background: var(--row-hover); }
.projection tr.payback td { background: var(--amber-bg-4); }
.projection tfoot td { font-weight: 700; border-top: 2px solid var(--ink); border-bottom: 0; }
td.neg { color: var(--neg); }
.table-note { font-size: .8rem; color: var(--muted); margin: .7rem 0 0; display: flex; align-items: center; gap: .4rem; }
.swatch-payback { width: 14px; height: 10px; background: var(--amber-bg-4); border: 1px solid var(--amber-line-2); border-radius: 2px; display: inline-block; }

.compare th, .compare td { padding: .65rem .8rem; text-align: right; border-bottom: 1px solid var(--surface-3); }
.compare th:first-child, .compare td:first-child { text-align: left; }
.compare thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.compare .col-cash { color: var(--cash); }
.compare .col-fin { color: var(--fin); }
.compare td.best { font-weight: 700; color: var(--pos); }
.compare td.best::after { content: " ★"; color: var(--sun); }

.assumptions summary { cursor: pointer; font-weight: 600; }
.assumptions ol { padding-left: 1.2rem; color: var(--ink-2); font-size: .9rem; }
.compare-how summary { cursor: pointer; font-weight: 600; }
.compare-how p { color: var(--ink-2); margin: .75rem 0 0; }
.compare-how ul { margin: .75rem 0 0; padding-left: 1.2rem; display: grid; gap: .5rem; color: var(--ink-2); }

/* ===== Summary ===== */
.verdict { display: flex; gap: 1rem; align-items: center; background: linear-gradient(135deg, var(--amber-bg-1), #fff); }
.verdict-icon svg { width: 56px; height: 56px; }
.verdict h2 { margin-bottom: .2rem; }
.verdict p { margin: 0; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } }
.chart-card h3 { margin-bottom: .1rem; }
.chart-card p { margin: 0 0 .8rem; font-size: .84rem; }
.chart-box { position: relative; height: 290px; }

/* ===== Home ===== */
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }
.feature { color: var(--ink); text-decoration: none !important; display: flex; flex-direction: column; gap: .4rem; transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15, 39, 66, .12); }
.feature p { color: var(--ink-2); margin: 0; flex: 1; }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font: 800 1.3rem var(--font-head); }
.feature-icon svg { width: 24px; height: 24px; }
.feature-icon.cash { background: var(--amber-bg-7); color: var(--cash); }
.feature-icon.fin { background: var(--teal-bg); color: var(--fin); }
.feature-icon.sum { background: var(--blue-bg-2); color: var(--sum); }
.feature-stat { font-size: .84rem; color: var(--muted); margin-top: .4rem; }
.feature-stat b { color: var(--ink); }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .5rem; color: var(--ink-2); }

/* ===== Tiers ===== */
.tiers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: stretch; }
@media (max-width: 900px) { .tiers { grid-template-columns: minmax(0, 1fr); } }
.tier { position: relative; display: flex; flex-direction: column; gap: 1rem; overflow: hidden; }
.tier-top p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.tier-price { font: 800 2rem var(--font-head); margin-top: .5rem; }
.tier-price span { font-size: .9rem; font-weight: 500; color: var(--muted); }
.tier ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; flex: 1; }
.tier li { padding-left: 1.5rem; position: relative; font-size: .92rem; }
.tier li::before { content: "☀"; position: absolute; left: 0; color: var(--sun); }
.tier li.no { color: var(--muted); }
.tier li.no::before { content: "—"; color: var(--muted); }
.tier-featured { border: 2px solid var(--sun); box-shadow: 0 16px 40px rgba(245, 165, 36, .18); }
.tier-ribbon { position: absolute; top: 14px; right: -36px; transform: rotate(35deg); background: var(--sun); color: var(--sun-ink); font: 700 .7rem var(--font); padding: .25rem 2.6rem; letter-spacing: .05em; text-transform: uppercase; }
.tier.is-current { outline: 3px solid rgba(59, 111, 216, .35); outline-offset: 2px; }
.tier.is-current::after { content: "Your plan"; position: absolute; top: 14px; left: 14px; font-size: .7rem; font-weight: 700; color: var(--sum); }
.tier.is-current .tier-top { padding-top: 1rem; }
.faq details { border-top: 1px solid var(--line); padding: .75rem 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--ink-2); margin: .5rem 0 0; }

/* ===== Models ===== */
.models-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.usage { margin-left: .5rem; color: var(--muted); font-size: .9rem; }
.usage-bar { margin-top: .5rem; width: 240px; max-width: 100%; height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--sun-2), var(--sun)); }
.model-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.1rem; }
.model-card { display: flex; flex-direction: column; gap: .8rem; }
.model-card-head small { color: var(--muted); }
.model-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.model-card-stats > div { background: var(--surface-2); border-radius: 10px; padding: .5rem .6rem; display: flex; flex-direction: column; }
.model-card-stats span { font-size: .7rem; color: var(--muted); }
.model-card-stats b { font-family: var(--font-head); }
.c-cash b { color: var(--cash); }
.c-fin b { color: var(--fin); }
.row-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.confirm-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .85rem; background: var(--red-bg-1); padding: .3rem .5rem; border-radius: 10px; }
.new-model-form { display: flex; flex-direction: column; gap: .8rem; }
.new-model-form .savebar-name input { border-color: var(--line); }
.rename-row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.rename-row input { flex: 1 1 14rem; min-width: 0; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 10px; font: 600 1rem var(--font); }
.open-badge { margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px; background: var(--green-bg-2); color: var(--green-ink-2); font: 700 .68rem var(--font); text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
.model-tools { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.battery-locked { padding: .8rem .9rem; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); }
.battery-locked p { margin: 0 0 .7rem; color: var(--ink-2); font-size: .88rem; line-height: 1.5; }
.readonly-badge { margin-left: .4rem; padding: .1rem .5rem; border-radius: 999px; background: var(--chip-bg); color: var(--chip-ink); font: 700 .68rem var(--font); text-transform: uppercase; letter-spacing: .04em; vertical-align: middle; }
/* Locked inputs of a read-only model (SaveModelBar → ScenarioState.IsReadOnly). The fieldset takes the .page grid's place
   (same gap), so the layout is unchanged; <fieldset disabled> disables every input, select and button inside it. */
.ro-lock { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
.ro-lock:disabled input, .ro-lock:disabled select, .ro-lock:disabled textarea { background: var(--disabled-bg); color: var(--ink-2); cursor: not-allowed; }
.ro-lock:disabled button { opacity: .55; cursor: not-allowed; }
.readonly-note { flex-basis: 100%; margin: .25rem 0 .75rem; padding: .6rem .8rem; border-radius: 10px; background: var(--note-bg); border: 1px solid var(--line); color: var(--ink-2); font-size: .86rem; line-height: 1.45; }
.empty { text-align: center; padding: 2rem 1.5rem; }
.empty .row-actions { justify-content: center; }

/* ===== Account / subscription ===== */
.auth-card { padding: 1.6rem; }
.auth-form { display: grid; gap: .9rem; margin-bottom: 1rem; grid-template-columns: minmax(0, 1fr); }
.subscribe-card { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); }
.subscribe-summary ul { padding-left: 1.1rem; color: var(--ink-2); }
.paypal-box { min-height: 160px; }
.sub-details { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0 0 1.2rem; }
.sub-details dt { color: var(--muted); font-size: .88rem; }
.sub-details dd { margin: 0; font-weight: 600; }
.status { padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; background: var(--surface-3); }
.status-active, .status-trial { background: var(--green-bg-1); color: var(--green-ink-1); }
.status-cancelled, .status-suspended { background: var(--amber-bg-7); color: var(--amber-ink-1); }
.status-expired { background: var(--red-bg-1); color: var(--red-ink-1); }
.confirm-panel { background: var(--red-bg-3); border: 1px solid var(--red-line-1); border-radius: 12px; padding: 1rem; }
.confirm-panel p { margin-top: 0; }

/* ===== Panels & PVWatts pages ===== */
.check { display: flex; align-items: flex-start; gap: .55rem; margin-top: 1rem; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: .2rem; accent-color: var(--sun); width: 16px; height: 16px; }
.check.inline { display: inline-flex; margin: 0 .6rem 0 0; align-items: center; }
.check.inline input { margin-top: 0; }
.linked-note { margin: .9rem 0 0; font-size: .84rem; color: var(--ink-2); background: var(--blue-bg-3); border-radius: 10px; padding: .55rem .75rem; }
.linked-note .btn-link { font-size: .84rem; margin-left: .3rem; }
.linked-note .link-toggle { margin: 0; font-weight: 600; }
.linked-note small { display: block; margin: .3rem 0 0 1.6rem; color: var(--muted); font-size: .8rem; }
.field-input input:disabled { color: var(--ink-2); cursor: not-allowed; }
.field-input select { flex: 1; min-width: 0; border: 0; background: transparent; padding: .55rem .6rem; font: 500 .92rem var(--font); color: var(--ink); outline: none; }
.span-2 { grid-column: span 2; }
@media (max-width: 600px) { .span-2 { grid-column: auto; } }
.stat-card { display: flex; align-items: stretch; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; width: 100%; }
.stat-grid > div { background: var(--surface-2); border-radius: 12px; padding: .7rem .85rem; display: flex; flex-direction: column; }
.stat-grid > div:last-child { grid-column: span 2; }
.stat-grid span { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-grid b { font-family: var(--font-head); font-size: 1.2rem; }
.stat-grid small { color: var(--muted); font-size: .76rem; }
.stat-grid .warn { background: var(--amber-bg-5); }
.arrays-table { min-width: 860px; }
.arrays-table td { vertical-align: middle; }
input.cell { width: 84px; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 8px; font: 500 .88rem var(--font); text-align: right; background: var(--card); }
input.cell.wide { width: 110px; }
input.cell:focus { outline: none; border-color: var(--sun); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); }
input.cell:disabled { background: var(--hover); color: var(--muted); }
.cell-select { padding: .38rem .5rem; border: 1px solid var(--line); border-radius: 8px; font: 500 .88rem var(--font); background: var(--card); }
.arrays-table tr.row-stale td { background: var(--amber-bg-1); }
.arrays-table tr.row-failed td { background: var(--red-bg-1); }
.arrays-table tr.row-error td { color: var(--red-ink-1); font-size: .8rem; text-align: left; padding-top: 0; background: var(--red-bg-1); }
.facing { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; color: var(--ink-2); }
.facing-arrow { display: inline-block; color: var(--sun); font-weight: 800; transition: transform .2s ease; }
.warn-note { color: var(--amber-ink-1); }
/* Arrays changed since PVWatts ran (Panel arrays page and the model pages) */
.stale-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; margin: 0 0 .9rem;
    padding: .7rem .9rem; border: 1px solid var(--amber-line-3); border-left: 4px solid #e0a020; border-radius: 10px; background: var(--amber-bg-2);
    color: var(--amber-ink-2); font-size: .88rem; line-height: 1.45; }
.stale-banner > div { flex: 1 1 18rem; }
.stale-banner b { color: var(--amber-ink-6); }
.stale-banner .btn { flex: none; }
/* ---- Summary: how to read the results + sensitivity check (2026-11-10) ---- */
.read-list { margin: 0 0 1rem; padding-left: 1.1rem; display: grid; gap: .35rem; color: var(--ink-2); font-size: .92rem; }
.read-list b { color: var(--ink); }
.holds-up-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .6rem; }
.holds-up-head .btn { margin-left: auto; }
.sens-table tr.sens-expected td { font-weight: 600; }
.sens-conclusion { margin: .7rem 0 0; padding: .6rem .8rem; border-radius: 10px; font-size: .92rem; }
.sens-conclusion.holds { background: var(--green-bg-3); color: var(--green-ink-3); }
.sens-conclusion.flips { background: var(--amber-bg-2); color: var(--amber-ink-2); }

/* ---- Input checks (InputWarnings.razor, 2026-11-10) ---- */
.input-warnings { margin: 0 0 1rem; padding: .8rem 1rem; border: 1px solid var(--amber-line-3); border-left: 4px solid #e0a020; border-radius: 10px;
    background: var(--amber-bg-2); color: var(--amber-ink-2); font-size: .88rem; line-height: 1.45; }
.input-warnings.has-problem { border-color: var(--red-line-2); border-left-color: var(--neg); background: var(--red-bg-2); color: var(--red-ink-2); }
.input-warnings h3 { margin: 0 0 .45rem; font-size: .98rem; color: inherit; }
.input-warnings ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.input-warnings li { display: flex; gap: .55rem; align-items: baseline; }
.input-warnings .iw-tag { flex: none; min-width: 3.1rem; text-align: center; padding: .05rem .4rem; border-radius: 999px; background: var(--amber-bg-8); color: var(--amber-ink-5);
    font: 700 .66rem var(--font); text-transform: uppercase; letter-spacing: .03em; }
.input-warnings .iw-problem .iw-tag { background: var(--red-bg-4); color: var(--red-ink-3); }
.input-warnings .iw-foot { margin: .55rem 0 0; font-size: .82rem; }
.stale-badge { display: inline-block; margin-left: .4rem; padding: .08rem .45rem; border-radius: 999px; background: var(--amber-bg-8); color: var(--amber-ink-5);
    font: 700 .66rem var(--font); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; vertical-align: middle; }
.ref-table { width: 100%; font-size: .9rem; }
.ref-table th { text-align: left; font-weight: 600; color: var(--ink-2); padding: .55rem .8rem .55rem 0; white-space: nowrap; vertical-align: middle; width: 1%; }
.ref-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
.ref-table td.muted { font-size: .8rem; }
.ref-table.compact td, .ref-table.compact th { padding-top: .3rem; padding-bottom: .3rem; }
.ref-table tfoot th, .ref-table tfoot td { border-top: 2px solid var(--ink); padding-top: .6rem; }
textarea.notes { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; font: 400 .88rem var(--font); background: var(--surface-2); resize: vertical; }
.info-card p { color: var(--ink-2); }
.formula { font-family: var(--font-head); font-weight: 600; background: var(--blue-bg-3); border-radius: 10px; padding: .7rem 1rem; color: var(--ink) !important; }
.plain-list { margin: .4rem 0 .8rem; padding-left: 1.1rem; color: var(--ink-2); display: grid; gap: .3rem; font-size: .9rem; }
.small { font-size: .8rem; }
.model-switcher .seg-sep { width: 1px; align-self: stretch; background: var(--line); margin: .2rem .2rem; }
.model-switcher .seg-setup:not(.active) { color: var(--muted); }

/* ===== Sign-in (developer-mode code) ===== */
.devcode { background: var(--amber-bg-6); border: 1px dashed var(--sun); border-radius: 10px; padding: .7rem .9rem; font-size: .88rem; color: var(--sun-ink); }
.devcode .code { font: 800 1.15rem/1 Consolas, "Courier New", monospace; letter-spacing: .25em; background: var(--card); padding: .15rem .45rem; border-radius: 6px; margin-left: .2rem; }

/* ===== Preset choice chips (tax credit) ===== */
.choice-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: -.35rem; }
.choice {
    padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
    font: 500 .8rem var(--font); cursor: pointer;
}
.choice b { font-weight: 700; }
.choice:hover { background: var(--hover); }
.choice:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245, 165, 36, .3); }
.choice.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
/* Lease / Finance: Loan or Lease */
.plan-choice { margin: 0 0 .75rem; }
.plan-choice .choice { flex: 1 1 12rem; text-align: center; }
.plan-note { margin: 0 0 .9rem; padding: .6rem .75rem; border-radius: 10px; background: var(--blue-bg-4); color: var(--ink-2); font-size: .84rem; line-height: 1.45; }
.plan-fix { justify-self: start; margin-top: -.5rem; font-size: .8rem; }

/* ===== Field tooltips ===== */
.field-label-row { display: flex; align-items: center; gap: .35rem; min-width: 0; }
.tip { position: relative; display: inline-flex; }
.tip-btn {
    text-transform: none; letter-spacing: 0; vertical-align: middle;
    width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-2);
    font: italic 700 .68rem/1 Georgia, "Times New Roman", serif; display: grid; place-items: center; cursor: help; padding: 0;
}
.tip-btn:hover, .tip-btn:focus-visible { border-color: var(--sun); color: var(--sun-ink); background: var(--amber-bg-6); outline: none; box-shadow: 0 0 0 3px rgba(245, 165, 36, .25); }
.tip-bubble {
    position: absolute; z-index: 40; left: -10px; bottom: calc(100% + 8px);
    width: max-content; max-width: min(300px, 80vw); padding: .6rem .75rem; border-radius: 10px;
    background: var(--tip-bg); color: var(--tip-ink); font: 400 .8rem/1.45 var(--font); text-align: left;
    box-shadow: 0 10px 28px rgba(15, 39, 66, .25); pointer-events: none;
    display: none;   /* hidden bubbles take no space, so they can never widen the page (2026-11-05) */
    white-space: normal; text-transform: none; letter-spacing: 0; font-style: normal;   /* not inherited from table headers */
}
.tip-bubble::after {
    content: ""; position: absolute; top: 100%; left: 12px;
    border: 6px solid transparent; border-top-color: var(--tip-bg);
}
.tip:hover .tip-bubble, .tip:focus-within .tip-bubble, .tip.open .tip-bubble { display: block; }
/* Touch screens (iPhone / iPad): tap only. iOS keeps the last-tapped element "hovered", so hover / focus would keep the
   bubble up after a second tap; here the ⓘ toggles it and tapping the bubble itself closes it (2026-11-05). */
@media (hover: none) {
    .tip:hover .tip-bubble, .tip:focus-within .tip-bubble { display: none; }
    .tip.open .tip-bubble { display: block; pointer-events: auto; cursor: pointer; }
}
@media (prefers-reduced-motion: reduce) { .tip-bubble { transition: none; } }
.cell-label { display: none; }   /* per-value labels: phone card layout only */
.arrays-table thead .tip-bubble { bottom: auto; top: calc(100% + 8px); font-weight: 400; }
.arrays-table thead .tip-bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--tip-bg); }
.arrays-table thead th:nth-child(n+5) .tip-bubble { left: auto; right: -10px; }
.arrays-table thead th:nth-child(n+5) .tip-bubble::after { left: auto; right: 12px; }
/* wide screens: the table fits, so let its tooltips overflow the scroll box instead of being clipped */
@media (min-width: 1100px) { .table-scroll:has(.arrays-table) { overflow: visible; } }
/* Summary "Key results" tips (2026-11-09). The 3-column table fits a phone, so its box needn't scroll: letting it overflow
   keeps the first row's bubble (it opens upward) from being cut off. */
.table-scroll:has(.compare) { overflow: visible; }
.compare td .tip { margin-left: .25rem; vertical-align: middle; }
/* Year-by-year projection table header tips (2026-11-09). The table scrolls sideways, so the bubbles open downward over
   the rows (never above, where the scroll box would cut them off), in normal text rather than the uppercase header style,
   and from the 7th column on they align to the right so they stay inside the table. */
.results-table thead th { z-index: 3; }
.results-table thead .tip { margin-left: .2rem; vertical-align: middle; }
.results-table thead .tip-bubble { bottom: auto; top: calc(100% + 8px); }
.results-table thead .tip-bubble::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--tip-bg); }
.results-table thead th:nth-child(n+7) .tip-bubble { left: auto; right: -10px; }
.results-table thead th:nth-child(n+7) .tip-bubble::after { left: auto; right: 12px; }

/* ===== Summary print ===== */
.summary-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.print-btn svg { width: 18px; height: 18px; }
.print-only { display: none; }

@media print {
    @page { size: letter; margin: 0.5in; }
    html, body { background: var(--card) !important; }
    body { -webkit-print-color-adjust: exact; print-color-adjust: exact; font-size: 11pt; }
    .topbar, .site-footer, .banner, .model-switcher, .savebar, .no-print, #blazor-error-ui, .nav-toggle, .nav-burger, .tip { display: none !important; }   /* .tip: no ⓘ icons on paper */
    .print-only { display: block; }
    .page { max-width: none; padding: 0; gap: .6rem; }
    .card, .kpi { box-shadow: none !important; border: 1px solid #d6dde6; break-inside: avoid; page-break-inside: avoid; }
    .table-scroll { overflow: visible; margin: 0; padding: 0; }
    .verdict { background: var(--card); }
    .chart-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .chart-card { break-inside: avoid; page-break-inside: avoid; padding: .6rem .8rem; }
    .chart-box { height: 2.6in; }
    .compare th, .compare td { padding: .35rem .6rem; }

    .print-header { border-bottom: 2px solid var(--ink); padding-bottom: .5rem; margin-bottom: .2rem; }
    .print-brand { font: 600 1rem var(--font-head); color: var(--ink); }
    .print-brand b { color: var(--sun); font-weight: 800; }
    .print-brand span { color: var(--muted); font-weight: 500; }
    .print-header h1 { font-size: 1.5rem; margin: .2rem 0 .3rem; }
    .print-meta { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; margin: 0 0 .5rem; font-size: .9rem; }
    .print-inputs { width: 100%; font-size: .8rem; border-collapse: collapse; }
    .print-inputs th { text-align: left; white-space: nowrap; padding: .15rem .8rem .15rem 0; color: var(--ink-2); vertical-align: top; width: 1%; }
    .print-inputs td { padding: .15rem 0; color: var(--ink); }
    .print-footnote { font-size: .72rem; color: var(--muted); margin-top: .4rem; }
}

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--line); background: var(--card); }
.footer-inner { max-width: 1240px; margin: 0 auto; padding: 1.1rem clamp(16px, 3vw, 32px); display: grid; gap: .75rem; font-size: .82rem; color: var(--muted); }
.footer-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .4rem 1.5rem; }
.footer-brand { color: var(--ink-2); }
.footer-notes { border-top: 1px solid var(--line); padding-top: .7rem; display: grid; gap: .3rem; font-size: .76rem; line-height: 1.45; }
.footer-notes p { margin: 0; }
.footer-links { display: flex; gap: .5rem; align-items: center; }
.footer-version { font-variant-numeric: tabular-nums; white-space: nowrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-weight: 600; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--ink, #10233d); text-decoration: underline; }

/* ---- Terms of Use / Privacy Policy ---- */
.page.narrow-legal { max-width: 860px; }
.legal { line-height: 1.65; overflow-wrap: anywhere; }
.legal .lead { font-size: 1.05rem; margin-top: 0; }
.legal h3 { margin: 1.6rem 0 .45rem; font-size: 1.05rem; }
.legal ul { padding-left: 1.25rem; margin: .4rem 0 .8rem; }
.legal li { margin: .35rem 0; }
.legal .fineprint { font-size: .82rem; color: var(--muted); }

/* ---- Contact ---- */
.contact-form { margin-bottom: 0; }
textarea.contact-message { width: 100%; min-height: 170px; resize: vertical; border: 1px solid var(--line); border-radius: 10px;
    padding: .6rem .7rem; font: 400 .95rem/1.5 var(--font); color: var(--ink); background: var(--surface-2); outline: none; }
textarea.contact-message:focus { border-color: var(--sun); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); background: var(--card); }
.contact-captcha .field-input { max-width: 160px; }
.validation-message { color: var(--red-ink-1); font-size: .8rem; font-weight: 500; }
.contact-page .toast { margin-top: 1rem; }
.contact-meta { display: grid; gap: .6rem; margin: .9rem 0; }
.contact-row { display: flex; flex-direction: column; gap: 2px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.contact-row .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.contact-row .v { color: var(--ink); overflow-wrap: anywhere; }
.fineprint { font-size: .82rem; color: var(--muted); }

/* ===== Blazor error UI ===== */
#blazor-error-ui {
    background: #fff4d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (max-width: 600px) {
    .mini-stats, .model-card-stats { grid-template-columns: 1fr 1fr; }
    .banner { min-height: 210px; }
    .banner::after { background: linear-gradient(0deg, rgba(6, 16, 32, .7) 0%, rgba(6, 16, 32, .2) 70%); }
}

/* ---- Under-construction sign (Home, Subscribe) ---- */
.construction-sign {
    margin: 1rem auto; max-width: 1176px; width: calc(100% - 2 * clamp(16px, 3vw, 32px));
    background: #fff8e1; border: 2px solid #1f1f1f; border-radius: 12px; overflow: hidden;
    box-shadow: 0 6px 18px rgba(15, 39, 66, .12);
}
.page .construction-sign { width: 100%; max-width: none; margin: 0; }
.construction-tape {
    height: 12px;
    background: repeating-linear-gradient(-45deg, #ffc400 0 14px, #1f1f1f 14px 28px);
}
.construction-body { display: flex; align-items: center; gap: .9rem; padding: .75rem 1.1rem; }
.construction-body .cone { width: 40px; height: 40px; flex: none; }
.construction-body b { display: block; font-size: 1.15rem; font-weight: 800; color: #1f1f1f; letter-spacing: .01em; }
.construction-body span { color: var(--ink-2); font-size: .93rem; }
@media print { .construction-sign { display: none; } }


/* ===================================================================================
   Small screens (2026-11-04): phone-friendly data entry and page layout.
   ================================================================================== */
@media (max-width: 640px) {
    /* 16 px text in every input: iOS Safari zooms the page when a smaller input gets focus. */
    .field-input input, .field-input select, .savebar-name input, .rename-row input, textarea.notes,
    input.cell, .cell-select, .auth-form input, .auth-form select, textarea.contact-message { font-size: 16px; }
    .field-input input, .field-input select { padding: .7rem .75rem; }   /* ≥ 44 px touch height */
    input.cell, .cell-select { padding: .55rem .6rem; }
    .affix { font-size: .9rem; }
    .field-grid { gap: .8rem; }
    .choice { padding: .5rem .8rem; font-size: .85rem; }
    .check input { width: 20px; height: 20px; }

    /* Page frame */
    .page { padding: 1rem 12px 2rem; gap: 1rem; }
    .card { padding: 1rem; border-radius: 14px; }
    .card-head { flex-wrap: wrap; gap: .3rem .75rem; }
    .table-scroll { margin: 0 -1rem; padding: 0 1rem; }
    .banner { min-height: 150px; }
    .banner-text { padding: 1.3rem 16px 1.1rem; }
    .banner-text p { font-size: .92rem; }
    .banner-eyebrow { margin-bottom: .4rem; }
    .footer-top { flex-direction: column; align-items: flex-start; }

    /* Page tabs: one swipeable row instead of wrapping */
    .model-switcher { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; justify-self: stretch; scrollbar-width: none; }
    .model-switcher::-webkit-scrollbar { display: none; }
    /* fade at the right edge = "swipe for more" */
    .model-switcher { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }

    /* Notes under tables: normal text flow (as flex items, a link inside the sentence became its own column) */
    .table-note { display: block; }
    .table-note .swatch-payback { vertical-align: -1px; margin-right: .3rem; }
    .model-switcher .seg { white-space: nowrap; padding: .5rem .8rem; }

    /* Buttons fill the row so they are easy to tap */
    .row-actions .btn, .savebar-form .btn, .hero-actions .btn { flex: 1 1 auto; }
    .savebar-name { min-width: 0; flex-basis: 100%; }

    /* KPIs: two per row, the headline value across the top */
    .kpis { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .kpi { padding: .8rem .85rem; }
    .kpi-hero { grid-column: 1 / -1; }
    .kpi-value { font-size: 1.2rem; }
    .kpi-hero .kpi-value, .kpi-hero .kpi-value.pos { font-size: 1.5rem; }

    .chart-box { height: 240px; }
    .model-list { grid-template-columns: minmax(0, 1fr); }
    .verdict { flex-direction: column; align-items: flex-start; }
    .sub-details { grid-template-columns: 1fr; gap: .1rem; }
    .sub-details dd { margin-bottom: .5rem; overflow-wrap: anywhere; }
    .toast, .devcode, .nav-email, .subscribe-summary li { overflow-wrap: anywhere; }

    /* Field tooltips: anchored to the whole field and as wide as it, so an open (or hidden) bubble never
       reaches past the right edge of the screen. */
    .field, .check, .ref-table tr { position: relative; }
    .field .tip, .check .tip, .ref-table th .tip { position: static; }
    .field .tip-bubble, .check .tip-bubble, .ref-table th .tip-bubble { left: 0; right: 0; width: auto; max-width: none; bottom: calc(100% + 6px); }
    .tip-bubble { max-width: calc(100vw - 48px); }

    /* Loss table (PVWatts): narrower inputs, labels may wrap */
    .ref-table.compact th { white-space: normal; }
    .ref-table.compact input.cell { width: 72px; }
    .construction-sign { width: calc(100% - 24px); }
    .construction-body { align-items: flex-start; }
    .stat-grid b { font-size: 1.05rem; }

    /* Year-by-year tables still scroll sideways, with the Year column pinned */
    .projection th:first-child, .projection td:first-child { position: sticky; left: 0; z-index: 1; background: var(--card); }
    .projection thead th:first-child { z-index: 2; background: var(--surface-2); }
    .projection tr.payback td:first-child { background: var(--amber-bg-4); }

    /* PVWatts reference inputs: label above its input */
    .ref-table:not(.compact), .ref-table:not(.compact) tbody, .ref-table:not(.compact) tfoot { display: block; }
    .ref-table:not(.compact) tr { display: grid; grid-template-columns: 1fr; padding: .6rem 0; border-bottom: 1px solid var(--surface-3); }
    .ref-table:not(.compact) th { width: auto; white-space: normal; padding: 0 0 .3rem; }
    .ref-table:not(.compact) td { border: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .5rem; }
    .ref-table:not(.compact) td.muted { padding-top: .3rem; }
    .ref-table:not(.compact) input.cell { flex: 1 1 120px; width: auto; }   /* unit text (%, kW) stays beside it */
    .ref-table:not(.compact) .cell-select { width: 100%; }

    /* Panel arrays: each array becomes a small card of labelled inputs */
    .arrays-table { min-width: 0; }
    .arrays-table thead { display: none; }
    .arrays-table, .arrays-table tbody, .arrays-table tfoot { display: block; }
    .arrays-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .75rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
    .arrays-table td {
        position: static; display: flex; flex-direction: column; gap: .2rem; padding: 0; border: 0;
        text-align: left !important; white-space: normal; background: transparent !important;
    }
    .arrays-table .cell-label { display: flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
    .arrays-table td.has-tip { position: relative; }
    .arrays-table td.has-tip .tip { position: static; }
    .arrays-table td.has-tip .tip-bubble { width: calc(100vw - 56px); max-width: none; bottom: calc(100% + 6px); text-transform: none; letter-spacing: 0; font-weight: 400; }
    .arrays-table td.has-tip:nth-child(even) .tip-bubble { left: 0; right: auto; }    /* left column */
    .arrays-table td.has-tip:nth-child(odd) .tip-bubble { left: auto; right: 0; }     /* right column */
    .arrays-table td.has-tip:nth-child(odd) .tip-bubble::after { left: auto; right: 12px; }
    .arrays-table td[data-label]::before { content: attr(data-label); font-size: .7rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
    .arrays-table td:empty, .arrays-table td[colspan="3"] { display: none; }
    .arrays-table td.cell-head { flex-direction: row; align-items: center; gap: .3rem; font: 700 1rem var(--font-head); color: var(--ink); }
    .arrays-table td.cell-head::before { content: "Array"; font: inherit; color: inherit; text-transform: none; letter-spacing: 0; }
    .arrays-table td.cell-total::before { content: none; }
    .arrays-table td.cell-remove { grid-row: 1; grid-column: 2; align-items: flex-end; }
    .arrays-table td.cell-remove::before { content: none; }
    .arrays-table td.cell-remove .btn-link-danger { font-size: 1.1rem; padding: .3rem .6rem; }
    .arrays-table input.cell, .arrays-table input.cell.wide { width: 100%; }
    .arrays-table tr.row-stale { background: var(--amber-bg-1); border-radius: 10px; padding-left: .6rem; padding-right: .6rem; }
    .arrays-table tr.row-failed { background: var(--red-bg-1); border-radius: 10px; padding-left: .6rem; padding-right: .6rem; }
    .arrays-table tr.row-error { display: block; padding: .5rem .6rem; margin-top: -.4rem; border-radius: 0 0 10px 10px; background: var(--red-bg-1); }
    .arrays-table tfoot tr { margin-top: .6rem; padding: .8rem; border: 0; border-radius: 10px; background: var(--surface-2); }
    .arrays-table tfoot td { font-weight: 700; border-top: 0; padding-top: 0; }
}

/* ---- Light / Dark / Auto switch (NavMenu, 2026-11-13) ----
   One button that cycles Light → Dark → Auto. Its icon and screen-reader text show the current choice, from <html data-theme>. */
.theme-toggle {
    order: 1;   /* wide screens: after the menu links, at the far right */
    flex: none; display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
    border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer;
    transition: background .12s, color .12s, border-color .12s;
}
.theme-toggle:hover { background: var(--hover); color: var(--ink); }
.theme-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(245, 165, 36, .35); }
.theme-toggle svg { width: 19px; height: 19px; display: none; }
.theme-toggle .theme-label { display: none; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html[data-theme="light"] .theme-toggle .icon-sun,
html[data-theme="dark"] .theme-toggle .icon-moon,
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-auto { display: block; }
html[data-theme="light"] .theme-toggle .theme-label-light,
html[data-theme="dark"] .theme-toggle .theme-label-dark,
html:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .theme-label-auto { display: block; }
@media (max-width: 1280px) {
    /* menu collapsed: switch sits just left of the menu button */
    .theme-toggle { order: 0; margin-left: auto; }
    .theme-toggle ~ .nav-burger { margin-left: .5rem; }
}
@media (max-width: 640px) {
    .theme-toggle { order: 2; width: 40px; height: 40px; }
    .theme-toggle ~ .nav-burger { margin-left: .5rem; }
}
@media print { .theme-toggle { display: none !important; } }
