/* BRF Analyser in the Lav look (2026-10-25). Tokens come from /assets/tokens.css
   ([data-look="lav"]), the header and footer from /assets/chrome.css. This file only
   styles the tool: the sub-navigation, the drop zone, the report and its sections, the
   settings, FAQ, about and history views, and print. Every class the page script writes
   or toggles keeps its name; only the look changes.

   Shape of the page: a 1440 frame on the shared gutter, the tool in a left-aligned 960 px
   column. Sections are separated by hairlines, not boxes. The 28 px surface frame is
   reserved for the three things you act on: the drop zone, the apartment calculator and
   the chat. Status (green, amber, red) is matte and page-local, AA on ground and surface
   in both themes; the chart colours below are read by the page script (chartPalette). */

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; font-optical-sizing: auto; font-variant-numeric: tabular-nums; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
[data-look="lav"] {
  color-scheme: light;
  --green: #2B5538; --amber: #6E4A14; --red: #8A3426;
  --green-bg: rgba(43,85,56,0.12); --amber-bg: rgba(110,74,20,0.12); --red-bg: rgba(138,52,38,0.12);
  --brf-col: 960px;
  --brf-chart-text: #3D433D; --brf-chart-grid: rgba(22,26,22,0.10);
  --brf-c-debt: #161A16; --brf-c-sav: #2B5538; --brf-c-sav-fill: rgba(43,85,56,0.22); --brf-c-fee: #3D433D;
  --brf-c-point: #C8D0C8; --brf-c-cur: rgba(22,26,22,0.55); --brf-c-prev: rgba(61,67,61,0.26); --brf-c-prev-border: #7E867E;
}
[data-look="lav"][data-theme="dark"] {
  color-scheme: dark;
  --green: #9DBFA3; --amber: #D9B47A; --red: #E09A8C;
  --green-bg: rgba(157,191,163,0.14); --amber-bg: rgba(217,180,122,0.14); --red-bg: rgba(224,154,140,0.14);
  --brf-chart-text: #A4ACA4; --brf-chart-grid: rgba(219,226,219,0.10);
  --brf-c-debt: #DBE2DB; --brf-c-sav: #9DBFA3; --brf-c-sav-fill: rgba(157,191,163,0.22); --brf-c-fee: #A4ACA4;
  --brf-c-point: #2C332D; --brf-c-cur: rgba(219,226,219,0.50); --brf-c-prev: rgba(164,172,164,0.26); --brf-c-prev-border: #6E766E;
}
body { margin: 0; min-width: 320px; min-height: 100svh; font-size: var(--t-ui); line-height: var(--lh-ui); letter-spacing: 0; font-weight: 400; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select { font: inherit; color: inherit; }
p, h1, h2, h3, h4, ul { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--ink); color: var(--bg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
button, summary, a, input { touch-action: manipulation; }
svg { display: block; }

/* Type roles as classes, the same six as the homepage. */
.t-display { font-size: var(--t-display); line-height: var(--lh-display); letter-spacing: var(--tr-display); font-weight: 300; }
.t-title { font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; }
.t-statement { font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); font-weight: 400; }
.t-body { font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); font-weight: 400; }
.t-ui { font-size: var(--t-ui); line-height: var(--lh-ui); letter-spacing: 0; font-weight: 400; }
.t-caption { font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); font-weight: 400; }

/* Content links: accent, underlined. The only accent on the page besides the focus ring. */
.link, .key-banner a, .settings-section a, .apt-bolan-link { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover, .key-banner a:hover, .settings-section a:hover, .apt-bolan-link:hover { text-decoration-thickness: 2px; }

/* ── Page frame ── */
.page { max-width: var(--maxw); margin: 0 auto; padding: 40px var(--gutter) 160px; }
.page-title { margin: 0 0 32px var(--tr-title); color: var(--ink); }

/* ── Sub-navigation: the tool's own row under the shared header ── */
.sub-nav-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--hairline); margin-bottom: 56px; }
.sub-nav { display: flex; gap: 28px; }
.sub-nav button { position: relative; height: 44px; margin-bottom: -1px; padding: 0; color: var(--muted); border-bottom: 1px solid transparent; white-space: nowrap; transition: color .2s var(--ease), border-color .2s var(--ease); }
.sub-nav button:hover { color: var(--ink); }
.sub-nav button.active { color: var(--ink); border-bottom-color: var(--ink); }
.sub-nav button:focus-visible { outline-offset: -2px; }
.sub-nav .history-badge { margin-left: 6px; color: var(--muted); font-size: var(--t-caption); letter-spacing: var(--tr-caption); }
.sub-nav button.active .history-badge { color: var(--ink); }
/* The language switch is the homepage's segmented control. */
.lang-toggle { display: flex; gap: 2px; padding: 2px; margin-bottom: 8px; border: 1px solid var(--muted); border-radius: 999px; }
.lang-btn { padding: 3px 12px; border-radius: 999px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); transition: background-color .2s, color .2s; }
.lang-btn.active { background: var(--ink); color: var(--bg); }
.lang-btn:focus-visible { border-radius: 999px; outline-offset: 1px; }

/* ── Views ── */
.view { display: none; max-width: var(--brf-col); }
.view.active { display: block; }

/* ── Drop zone: a surface frame with a dashed hairline, the text left ── */
.upload-zone { position: relative; margin-bottom: 24px; padding: 72px 56px; border: 1px dashed var(--hairline); border-radius: 28px; background: var(--surface); cursor: pointer; transition: border-color .2s var(--ease); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--ink); }
.upload-zone.dragover { border-style: solid; }
.upload-zone .icon { display: none; }
.upload-zone h2 { margin: 0 0 16px; color: var(--ink); }
.upload-zone p { max-width: 30em; color: var(--muted); text-wrap: pretty; }
.upload-zone input { display: none; }
.upload-zone .file-info { display: none; margin-top: 24px; color: var(--ink); }

/* ── Key banner (no key for the chosen provider) ── */
.key-banner { display: flex; align-items: baseline; gap: 10px; margin-bottom: 24px; padding: 14px 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); color: var(--amber); }
.key-banner svg { display: none; }
.key-banner a { cursor: pointer; }

/* ── Processing ── */
.processing { display: none; padding: 64px 0; }
.processing.active { display: block; }
.spinner { width: 28px; height: 28px; margin: 0 0 24px; border: 1.5px solid var(--hairline); border-top-color: var(--ink); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing h2 { margin: 0 0 8px; color: var(--ink); }
.processing p { color: var(--muted); }

/* ── Errors ── */
.error-msg { display: none; margin-top: 24px; padding: 14px 0; border-top: 1px solid var(--red); color: var(--red); }
.error-msg.active { display: block; }

/* ── Buttons: ink on the primary, a muted outline on the rest, both pills ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 20px; border-radius: 999px; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); white-space: nowrap; transition: opacity .2s; }
.btn:hover { opacity: .85; }
.btn svg { display: none; }
.btn-outline, .btn.btn-outline { background: transparent; color: var(--ink); border-color: var(--muted); }
.btn-outline:hover, .btn.btn-outline:hover { opacity: 1; border-color: var(--ink); }
.btn:focus-visible { border-radius: 999px; }
.btn:disabled { opacity: .5; cursor: default; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 56px; }
.report-actions.hidden { display: none; }

/* ── Report ── */
.report { display: none; }
.report.active { display: block; }
.report-header { margin-bottom: 40px; }
.report-header h1 { margin: 0 0 12px var(--tr-title); color: var(--ink); font-size: var(--t-title); line-height: var(--lh-title); letter-spacing: var(--tr-title); font-weight: 300; text-wrap: balance; }
.report-header .year { color: var(--muted); }

/* Section names: a hairline above, the name in the body size. The report's rhythm. */
.section-label { margin: 64px 0 24px; padding-top: 20px; border-top: 1px solid var(--hairline); color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); font-weight: 400; }

/* ── Score: the report's one strong element ── */
.score-hero { display: flex; align-items: center; gap: 32px; margin-bottom: 48px; }
.score-ring { position: relative; flex: none; width: 128px; height: 128px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .bg { fill: none; stroke: var(--hairline); stroke-width: 1.5; }
.score-ring .fg { fill: none; stroke-width: 3; stroke-linecap: butt; transition: stroke-dashoffset 1.4s var(--ease); }
.score-number { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 44px; line-height: 1; letter-spacing: -0.03em; font-weight: 300; }
.score-hero-text { flex: 1; min-width: 0; }
.score-grade { margin: 0 0 8px; color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.score-verdict { margin: 0 0 6px; color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); text-wrap: pretty; }
.score-compare { color: var(--muted); text-wrap: pretty; }
/* the closing score card (longitudinal and compare views) */
.score-card { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--hairline); }
.score-card .score-ring { margin: 0 0 20px; }

/* ── Executive summary in the Body role, so the score stays the strong element ── */
.exec-summary { margin-bottom: 56px; max-width: 34em; color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); text-wrap: pretty; }
.exec-label { margin-bottom: 10px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }

/* ── Building profile: a row of figures on hairlines ── */
.building-profile { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 32px; margin-bottom: 8px; border-top: 1px solid var(--hairline); }
.profile-stat { padding: 16px 0 20px; }
.profile-stat .label { margin-bottom: 4px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.profile-stat .value { color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); }
.building-profile > div[style] { grid-column: 1 / -1; padding: 0 0 20px; }
.profile-badges { display: flex; flex-wrap: wrap; gap: 6px 24px; }
.profile-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); }
.profile-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.profile-badge-green::before { background: var(--green); }
.profile-badge-amber::before { background: var(--amber); }
.profile-badge-gold::before { background: var(--ink); }
.profile-badge-muted { color: var(--muted); }

/* ── Highlights ── */
.spotlight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.spotlight-card { position: relative; display: block; padding: 16px 0 20px; border-top: 1px solid var(--hairline); }
.spotlight-icon { display: none; }
.spotlight-card .title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--muted); }
.spotlight-card .title::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); flex: none; }
.spotlight-card.green .title::before { background: var(--green); }
.spotlight-card.amber .title::before { background: var(--amber); }
.spotlight-card .stat { margin-bottom: 6px; color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.spotlight-card .detail { color: var(--muted); text-wrap: pretty; }

/* ── Key ratios ── */
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; }
.metric-card { padding: 16px 0 24px; border-top: 1px solid var(--hairline); }
.metric-card .label { margin-bottom: 8px; color: var(--muted); }
.metric-card .value { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.metric-card .sub { margin-top: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.metric-source { display: flex; gap: 6px; margin-top: 8px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); cursor: help; }
.metric-pctl { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); cursor: help; }
.metric-pctl::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.metric-pctl.good { color: var(--green); }
.metric-pctl.good::before { background: var(--green); }
.metric-pctl.low { color: var(--amber); }
.metric-pctl.low::before { background: var(--amber); }
.benchmark-note { margin: 16px 0 0; max-width: 40em; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); text-wrap: pretty; }

/* Status words: plain text in the status colour, no pill. */
.badge { display: inline-block; margin-top: 8px; }
.badge-green { color: var(--green); }
.badge-amber { color: var(--amber); }
.badge-red { color: var(--red); }

/* The context bar under a figure: a hairline track, the fill in the status colour, the national average as a tick. */
.context-bar { position: relative; height: 3px; margin: 14px 0 28px; background: var(--hairline); }
.context-bar:last-child { margin-bottom: 20px; }
.context-bar-fill { position: absolute; left: 0; top: 0; height: 100%; transition: width .8s var(--ease); }
.context-bar-fill.green { background: var(--green); }
.context-bar-fill.amber { background: var(--amber); }
.context-bar-fill.red { background: var(--red); }
.context-bar-avg { position: absolute; top: -4px; width: 1px; height: 11px; background: var(--ink); transform: translateX(-50%); }
.context-bar-avg::after { content: attr(data-label); position: absolute; top: 13px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 11px; line-height: 14px; white-space: nowrap; }

/* ── Groups of rows (income, costs, loans, sensitivity, assessment, checklist) ── */
.card { margin-bottom: 8px; }
.card h3 { margin: 0 0 4px; padding-bottom: 12px; color: var(--muted); font-weight: 400; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.row .key { color: var(--muted); }
.row .val { color: var(--ink); text-align: right; }

.loan-header, .loan-row { display: grid; grid-template-columns: 0.8fr 1fr 1.2fr 0.9fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); }
.loan-header { color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); border-top: 0; }
.loan-row .rate { color: var(--muted); }
.loan-row .badge { margin-top: 0; }
.loan-summary { margin-top: 20px; max-width: 44em; color: var(--muted); text-wrap: pretty; }

/* ── Charts ── */
.chart-wrap { position: relative; width: 100%; height: 260px; margin: 8px 0 8px; }
.chart-wrap canvas { display: block; width: 100% !important; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.legend span, .legend i { display: inline-flex; align-items: center; gap: 8px; font-style: normal; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* ── Assessment ── */
.assessment-group { margin-bottom: 24px; }
.assessment-group:last-child { margin-bottom: 0; }
.assessment-group-header { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; color: var(--muted); }
.group-icon { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.flag { display: flex; gap: 14px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--hairline); color: var(--ink); }
.flag strong { font-weight: 400; color: var(--ink); }
.flag > div:last-child { color: var(--muted); text-wrap: pretty; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 7px; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

/* Critical warnings: a red hairline and a red title; the text stays ink. */
.critical-callout { padding: 14px 0 18px; border-top: 1px solid var(--red); }
.critical-callout-header { margin-bottom: 6px; color: var(--red); }
.critical-callout-header svg { display: none; }
.critical-callout-text { color: var(--ink); text-wrap: pretty; max-width: 44em; }

/* ── Buyer's risk checklist ── */
.risk-checklist { padding: 0; }
.risk-item { display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--hairline); }
.risk-icon { width: 20px; height: 20px; margin-top: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; line-height: 1; color: var(--bg); background: var(--muted); }
.risk-ok .risk-icon { background: var(--green); }
.risk-watch .risk-icon { background: var(--amber); }
.risk-risk .risk-icon { background: var(--red); }
.risk-na .risk-icon { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--hairline); }
.risk-title { margin-bottom: 2px; color: var(--ink); }
.risk-detail { color: var(--muted); text-wrap: pretty; }

/* ── Data cross-check ── */
.data-check { margin: 32px 0 0; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.data-check summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; color: var(--muted); list-style: none; cursor: pointer; }
.data-check summary::-webkit-details-marker { display: none; }
.data-check summary::after { content: '+'; margin-left: auto; color: var(--muted); }
.data-check[open] summary::after { content: '\2212'; }
.data-check-body { padding: 0 0 12px; }
.data-check-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--hairline); }
.data-check-row:first-child { border-top: 0; }
.dc-icon.ok { color: var(--green); }
.dc-icon.warn { color: var(--amber); }
.dc-label { color: var(--ink); }
.dc-detail { color: var(--muted); text-align: right; }

/* ── Your apartment: a surface frame, because you type into it ── */
.fee-calc { padding: 32px 36px 36px; border-radius: 28px; background: var(--surface); }
.apt-intro { max-width: 36em; margin-bottom: 24px; color: var(--muted); text-wrap: pretty; }
.fee-calc-sizes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 20px; }
.fee-size-btn { min-height: 36px; padding: 0 16px; border: 1px solid var(--muted); border-radius: 999px; color: var(--muted); transition: background-color .2s, color .2s, border-color .2s; }
.fee-size-btn:hover { color: var(--ink); border-color: var(--ink); }
.fee-size-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.fee-size-btn:focus-visible { border-radius: 999px; }
.fee-custom-input { width: 104px; min-height: 36px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--bg); color: var(--ink); text-align: center; outline: none; transition: border-color .2s; }
.fee-custom-input:focus { border-color: var(--ink); }
.fee-custom-input::placeholder { color: var(--muted); }
.fee-sqm-unit { color: var(--muted); }
.apt-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 24px; }
.apt-field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.apt-field input { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--bg); color: var(--ink); outline: none; transition: border-color .2s; }
.apt-field input:focus { border-color: var(--ink); }
.fee-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 24px; border-top: 1px solid var(--hairline); }
.fee-result-card { padding: 16px 0 4px; }
.fee-result-card .label { margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.fee-result-card .value { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.fee-result-card .sub { margin-top: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.apt-verdict { margin-top: 28px; }
.apt-verdict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; margin-bottom: 20px; border-top: 1px solid var(--hairline); }
.apt-vcard { padding: 16px 0 4px; }
.apt-vcard .label { margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.apt-vcard .value { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.apt-vcard .sub { margin-top: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.apt-note { margin-bottom: 20px; max-width: 40em; color: var(--ink); text-wrap: pretty; }
.apt-forecast { margin-bottom: 20px; padding-top: 14px; border-top: 1px solid var(--amber); max-width: 44em; }
.apt-forecast-title { margin-bottom: 4px; color: var(--amber); }
.apt-forecast-text { color: var(--ink); text-wrap: pretty; }
.apt-bolan-link { display: inline-block; margin-top: 4px; }

/* ── Energy ── */
.energy-highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 32px; margin-bottom: 24px; }
.energy-highlight-card { padding: 16px 0 20px; border-top: 1px solid var(--hairline); }
.energy-highlight-card .label { margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.energy-highlight-card .value { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.energy-breakdown { display: flex; flex-direction: column; }
.energy-row { display: grid; grid-template-columns: 160px 1fr 180px 64px; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hairline); }
.energy-row .elabel { color: var(--ink); }
.energy-row .ebar { height: 3px; background: var(--hairline); overflow: hidden; }
.energy-row .ebar-fill { display: block; height: 100%; background: var(--ink); transition: width .6s var(--ease); }
.energy-row .epct { color: var(--muted); text-align: right; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.energy-row .eyoy { text-align: right; }
.energy-row .eyoy.up { color: var(--red); }
.energy-row .eyoy.down { color: var(--green); }
.energy-notes { margin-top: 20px; max-width: 44em; color: var(--muted); text-wrap: pretty; }

/* ── Maintenance ── */
.maint-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 32px; margin-bottom: 24px; }
.maint-summary-card { padding: 16px 0 20px; border-top: 1px solid var(--hairline); }
.maint-summary-card .label { margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.maint-summary-card .value { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.maint-adequacy { display: inline-block; margin-top: 6px; font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.maint-adequacy.green { color: var(--green); }
.maint-adequacy.amber { color: var(--amber); }
.maint-adequacy.red { color: var(--red); }
.maint-timeline { position: relative; padding-left: 24px; margin-top: 4px; }
.maint-timeline::before { content: ''; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 1px; background: var(--hairline); }
.maint-item { position: relative; padding: 8px 0 8px 12px; }
.maint-item::before { content: ''; position: absolute; left: -24px; top: 14px; width: 7px; height: 7px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--muted); }
.maint-item.completed::before { background: var(--muted); box-shadow: none; }
.maint-item.in-progress::before { background: var(--ink); box-shadow: none; }
.maint-item .maint-year { margin-bottom: 2px; color: var(--ink); }
.maint-item .maint-status { color: var(--muted); font-size: var(--t-caption); letter-spacing: var(--tr-caption); }
.maint-item .maint-desc { color: var(--ink); }
.maint-item .maint-cost { margin-left: 10px; color: var(--muted); }
.maint-item.completed .maint-desc { color: var(--muted); }
.maint-note, .maint-risk { margin-top: 20px; padding-top: 14px; max-width: 44em; color: var(--muted); text-wrap: pretty; }
.maint-note.green { border-top: 1px solid var(--green); }
.maint-note.amber { border-top: 1px solid var(--amber); }
.maint-note.red, .maint-risk { border-top: 1px solid var(--red); color: var(--ink); }

/* ── Longitudinal ── */
.long-links { display: flex; flex-wrap: wrap; gap: 8px; }
.long-link { min-height: 40px; padding: 0 18px; border: 1px solid var(--muted); border-radius: 999px; color: var(--ink); transition: border-color .2s; }
.long-link:hover { border-color: var(--ink); }

/* ── Ask about this BRF: a surface frame, because you type into it ── */
.chat { padding: 32px 36px 36px; border-radius: 28px; background: var(--surface); }
.chat-intro { max-width: 36em; margin-bottom: 24px; color: var(--muted); text-wrap: pretty; }
.chat-msgs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.chat-msgs:empty { margin-bottom: 0; }
.chat-msg { max-width: 80%; padding: 12px 16px; border-radius: 18px; white-space: pre-wrap; text-wrap: pretty; }
.chat-msg.me { align-self: flex-end; background: var(--bg); color: var(--ink); border-bottom-right-radius: 6px; }
.chat-msg.ai { align-self: flex-start; color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline); border-bottom-left-radius: 6px; }
.chat-msg.ai.err { color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chat-chip { min-height: 36px; padding: 0 16px; border: 1px solid var(--muted); border-radius: 999px; color: var(--muted); transition: color .2s, border-color .2s; }
.chat-chip:hover { color: var(--ink); border-color: var(--ink); }
.chat-chip:focus-visible { border-radius: 999px; }
.chat-input-row { display: flex; gap: 10px; }
.chat-input { flex: 1; min-width: 0; min-height: 44px; padding: 0 16px; border: 1px solid var(--hairline); border-radius: 999px; background: var(--bg); color: var(--ink); outline: none; transition: border-color .2s; }
.chat-input:focus { border-color: var(--ink); }
.chat-input::placeholder { color: var(--muted); }
.chat-send { flex: none; min-height: 44px; }

/* ── About ── */
.about-hero { margin-bottom: 48px; }
.about-hero .icon-wrap { display: none; }
.about-hero h2 { margin: 0 0 16px; color: var(--ink); }
.about-hero p { max-width: 32em; color: var(--muted); text-wrap: pretty; }
.about-sub { margin: 0 0 8px; color: var(--muted); font-weight: 400; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin-bottom: 48px; }
.feature-item { padding: 16px 0 20px; border-top: 1px solid var(--hairline); }
.feature-num { display: none; }
.feature-item h4 { margin-bottom: 6px; color: var(--ink); font-weight: 400; }
.feature-item p { color: var(--muted); text-wrap: pretty; }

/* ── FAQ ── */
.faq-list { display: flex; flex-direction: column; border-bottom: 1px solid var(--hairline); }
.faq-item { border-top: 1px solid var(--hairline); }
.faq-item summary { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding: 16px 0; color: var(--ink); list-style: none; cursor: pointer; font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; flex: none; color: var(--muted); }
.faq-item[open] summary::after { content: '\2212'; }
.faq-item p { padding: 0 0 24px; max-width: 40em; color: var(--muted); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); text-wrap: pretty; }
.view-cta { margin-top: 40px; }

/* ── Settings ── */
.settings-section { margin-bottom: 56px; padding-top: 20px; border-top: 1px solid var(--hairline); }
.settings-section h3 { margin: 0 0 12px; color: var(--ink); font-size: var(--t-body); line-height: var(--lh-body); letter-spacing: var(--tr-body); font-weight: 400; }
.settings-section p { max-width: 40em; margin-bottom: 20px; color: var(--muted); text-wrap: pretty; }
.settings-section p.note { margin: 8px 0 0; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.settings-section p strong { font-weight: 400; color: var(--ink); }
.input-group { max-width: 480px; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 6px; color: var(--muted); font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.input-group input, .input-group select { width: 100%; min-height: 44px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); color: var(--ink); outline: none; transition: border-color .2s; }
.input-group input:focus, .input-group select:focus { border-color: var(--ink); }
.input-group input::placeholder { color: var(--muted); }
.input-group select { cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.input-group select option { background: var(--surface); color: var(--ink); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.toggle-row { display: flex; align-items: flex-start; gap: 12px; max-width: 40em; cursor: pointer; color: var(--ink); }
.toggle-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 20px; height: 20px; margin: 0; border: 1px solid var(--muted); border-radius: 6px; background: var(--surface); cursor: pointer; transition: background-color .2s, border-color .2s; }
.toggle-row input[type="checkbox"]:checked { background: var(--ink); border-color: var(--ink); }
.toggle-row input[type="checkbox"]:checked::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
#testResult { margin-top: 16px; }

/* ── Toast ── */
.saved-toast { position: fixed; left: var(--gutter); bottom: 24px; z-index: 200; padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease); }
.saved-toast.show { opacity: 1; transform: none; }

/* ── History ── */
.history-list { display: flex; flex-direction: column; border-bottom: 1px solid var(--hairline); }
.history-empty { padding: 40px 0; color: var(--muted); }
.history-empty svg { display: none; }
.history-empty h3 { margin: 0 0 8px; color: var(--ink); font-weight: 400; font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.history-empty p { max-width: 32em; }
.history-empty .btn { margin-top: 24px !important; }
.history-card { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; padding: 20px 0; border-top: 1px solid var(--hairline); transition: background-color .2s; }
.history-card.selected { box-shadow: inset 3px 0 0 var(--ink); padding-left: 16px; }
.history-card .hc-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.history-card .hc-name { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.history-card .hc-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); }
.history-card .hc-meta .provider-pill { color: var(--muted); }
.history-card .hc-right { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.score-mini { position: relative; width: 56px; height: 56px; }
.score-mini svg { width: 56px; height: 56px; transform: rotate(-90deg); }
.score-mini .bg { fill: none; stroke: var(--hairline); stroke-width: 1.5; }
.score-mini .fg { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 126; transition: stroke-dashoffset .8s var(--ease); }
.score-mini .grade { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.hc-actions { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 6px; }
.hc-actions button { min-height: 32px; padding: 0; color: var(--muted); border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.hc-actions button:hover { color: var(--ink); border-bottom-color: var(--ink); }
.hc-actions button.danger:hover { color: var(--red); border-bottom-color: var(--red); }
.history-compare-bar { position: sticky; bottom: 0; display: none; padding: 16px 0; background: var(--bg); border-top: 1px solid var(--hairline); }
.history-compare-bar.active { display: block; }
.history-footer { margin-top: 24px; }

/* ── Compare view ── */
.compare-header { display: grid; grid-template-columns: 1fr auto 1fr; gap: 32px; align-items: start; margin-bottom: 40px; }
.compare-side { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.compare-side .cs-name { color: var(--ink); font-size: var(--t-statement); line-height: var(--lh-statement); letter-spacing: var(--tr-statement); }
.compare-side .cs-year { color: var(--muted); }
.compare-vs { align-self: center; color: var(--muted); }
.compare-table { width: 100%; border-collapse: collapse; margin-bottom: 40px; }
.compare-table th { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--hairline); color: var(--muted); font-weight: 400; text-align: left; font-size: var(--t-caption); line-height: var(--lh-caption); letter-spacing: var(--tr-caption); }
.compare-table td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--hairline); color: var(--ink); vertical-align: top; }
.compare-table td:first-child { color: var(--muted); }
.compare-table .better { color: var(--ink); }
.compare-table .badge { display: inline; margin: 0 0 0 8px; }
.compare-assessments { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
.compare-assessments .ca-col h4 { margin: 0 0 8px; color: var(--muted); font-weight: 400; }

/* ── Phones and narrow widths ── */
@media (max-width: 860px) {
  .page { padding: 24px var(--gutter) 96px; }
  .page-title { margin-bottom: 20px; }
  .sub-nav-row { gap: 12px; margin-bottom: 36px; }
  /* the tab row scrolls sideways inside itself; the fade on its right edge says so */
  .sub-nav { flex: 1 1 auto; min-width: 0; gap: 22px; padding-right: 24px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
  .sub-nav::-webkit-scrollbar { display: none; }
  .sub-nav button { flex: 0 0 auto; }
  .lang-toggle { flex: 0 0 auto; margin-bottom: 8px; }
  .lang-btn { position: relative; min-height: 28px; padding: 0 12px; }
  .lang-btn::after { content: ''; position: absolute; inset: -8px 0; }
  .upload-zone { padding: 48px 24px; }
  .score-hero { gap: 24px; align-items: flex-start; }
  .score-ring { width: 104px; height: 104px; }
  .score-number { font-size: 36px; }
  .two-col, .spotlight-grid, .feature-list, .compare-assessments { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .energy-highlights, .maint-summary, .fee-results { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .fee-calc, .chat { padding: 24px 20px 28px; border-radius: 22px; }
  .apt-inputs { grid-template-columns: 1fr 1fr; }
  .apt-verdict-grid { grid-template-columns: 1fr; }
  .energy-row { grid-template-columns: 1fr auto; gap: 4px 12px; }
  .energy-row .elabel { grid-column: 1; grid-row: 1; }
  .energy-row .eyoy { grid-column: 2; grid-row: 1; }
  .energy-row .epct { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .energy-row .ebar { grid-column: 1 / -1; grid-row: 3; margin-top: 6px; }
  .loan-header, .loan-row { grid-template-columns: 0.8fr 1fr 1fr; }
  .loan-header span:nth-child(4), .loan-row span:nth-child(4) { display: none; }
  .history-card { grid-template-columns: 1fr; gap: 12px; }
  .history-card .hc-right { flex-direction: row; justify-content: flex-start; }
  .compare-header { grid-template-columns: 1fr; gap: 20px; }
  .compare-vs { display: none; }
  .btn, .fee-size-btn, .chat-chip, .long-link, .hc-actions button { min-height: 44px; }
  .fee-custom-input { min-height: 44px; }
  .saved-toast { right: var(--gutter); }
  .input-group input, .input-group select, .fee-custom-input, .apt-field input, .chat-input { font-size: 16px; }
}
@media (max-width: 480px) {
  .metric-grid, .energy-highlights, .maint-summary, .fee-results { grid-template-columns: 1fr 1fr; }
  .context-bar-avg::after { display: none; }
  /* two figures side by side in a 310 px frame: the Statement size wraps "kr/mo", so a step down */
  .fee-result-card .value, .apt-vcard .value { font-size: 24px; line-height: 1.15; letter-spacing: -0.015em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner { animation-duration: 2s; }
  .score-ring .fg, .score-mini .fg, .context-bar-fill, .energy-row .ebar-fill, .saved-toast, .sub-nav button, .lang-btn, .fee-size-btn, .btn, .upload-zone { transition: none; }
}

/* ── Print: white paper, dark text, the chrome and the other views gone ── */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  html, body { background: #fff; color: #111; }
  body { font-size: 12px; line-height: 1.5; }
  .site-head, .site-foot, .skip-link, .page-title, .sub-nav-row, .upload-zone, .processing, .error-msg,
  .report-actions, .key-banner, .fee-calc-sizes, .fee-custom-input, .chat,
  #view-about, #view-faq, #view-settings, #view-history, #view-example, .saved-toast, .history-compare-bar { display: none !important; }
  .page { max-width: 100%; padding: 0; margin: 0; }
  .view { max-width: none; }
  .report { display: block !important; }
  .report-header h1, .section-label, .score-number, .score-grade, .score-verdict, .exec-summary, .profile-stat .value,
  .spotlight-card .stat, .metric-card .value, .row .val, .flag, .flag strong, .critical-callout-text, .risk-title,
  .fee-result-card .value, .apt-vcard .value, .energy-highlight-card .value, .maint-summary-card .value, .maint-item .maint-desc,
  .dc-label, .energy-row .elabel, .apt-note, .compare-table td { color: #111; }
  .report-header .year, .exec-label, .profile-stat .label, .metric-card .label, .metric-card .sub, .metric-source, .benchmark-note,
  .row .key, .loan-header, .loan-summary, .legend, .spotlight-card .title, .spotlight-card .detail, .flag > div:last-child, .risk-detail,
  .assessment-group-header, .card h3, .fee-result-card .label, .fee-result-card .sub, .apt-vcard .label, .apt-vcard .sub, .apt-intro,
  .energy-highlight-card .label, .energy-row .epct, .energy-notes, .maint-summary-card .label, .maint-item .maint-cost, .maint-note,
  .dc-detail, .score-compare, .compare-table th, .compare-table td:first-child { color: #444; }
  .section-label, .metric-card, .row, .flag, .risk-item, .loan-row, .spotlight-card, .profile-stat, .energy-row, .energy-highlight-card,
  .maint-summary-card, .fee-results, .apt-verdict-grid, .data-check, .faq-item, .compare-table th, .compare-table td, .building-profile { border-color: #ccc; }
  .context-bar, .energy-row .ebar, .score-ring .bg, .score-mini .bg { background: #ddd; stroke: #ddd; }
  .context-bar-avg { background: #888; }
  .energy-row .ebar-fill { background: #333; }
  .fee-calc { background: #f5f5f5; border-radius: 8px; }
  .metric-card, .spotlight-card, .flag, .critical-callout, .assessment-group, .chart-wrap, .risk-item, .maint-item { break-inside: avoid; }
  .section-label { break-after: avoid; }
  @page { margin: 1.5cm; size: A4; }
  .report::after { content: 'Generated by BRF Analyser, maclaine.se/brf'; display: block; margin-top: 2rem; font-size: 10px; color: #999; }
}
