/* Taupunkt: technical, quiet, numbers first. One blue accent, near-square corners. */

/* IBM Plex, self-hosted (SIL OFL 1.1, see fonts/IBM-Plex-LICENSE.txt). No third-party font requests.
   Sources: npm @ibm/plex-sans 1.1.0 and @ibm/plex-mono 2.5.0, fonts/complete/woff2. */
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/IBMPlexSans-Regular-90cc55e6.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/IBMPlexSans-Medium-9fb7ea15.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 600; font-display: swap; src: url("/assets/IBMPlexSans-SemiBold-5326bafa.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/assets/IBMPlexMono-Regular-537ab494.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("/assets/IBMPlexMono-Medium-98c318fa.woff2") format("woff2"); }
:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --surface-tint: #F2F5FC;
  --border: #DCDFE5;
  --border-soft: #EBEDF1;
  --border-input: #C9CED7;
  --text: #16181D;
  --text-2: #3A3D44;
  --muted: #5B5E66;
  --faint: #8C8E95;
  --primary: #1F4FD1;
  --primary-strong: #14358F;
  --primary-soft: #E7EDFB;
  --warn-bg: #FFFAF0;
  --warn-border: #F1D9A6;
  --warn-text: #7A4F00;
  --error: #B42318;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 2px;
  --radius-card: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: var(--primary); }
a:hover { color: var(--primary-strong); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* App frame */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }
.crumb-sep { color: #A7ADB8; }
.crumb { display: flex; flex-direction: column; }
.crumb strong { font-weight: 600; }
.spacer { flex: 1; }
.frame { display: flex; flex-wrap: wrap; min-height: calc(100vh - 66px); }
.content { flex: 999 1 560px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.aside { flex: 1 1 320px; max-width: 400px; padding: 24px 20px; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-head h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* Step navigation */
.steps { flex: 1 1 220px; max-width: 250px; padding: 20px 12px; background: var(--surface); border-right: 1px solid var(--border); }
.steps ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.step { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); color: #4A4D55; text-decoration: none; }
a.step:hover { background: var(--bg); color: var(--text); }
.step[aria-current="page"] { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.step .mark { width: 18px; height: 18px; flex: none; border-radius: var(--radius); border: 2px solid #C1C6CF; }
.step[aria-current="page"] .mark { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--primary-soft); }
.step.planned { color: var(--faint); }
.step.planned .mark { border-style: dashed; }
.step .tag { margin-left: auto; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border-input); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: #FFFFFF; }
.input { min-height: 36px; padding: 0 8px; border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); }
.input.num { width: 84px; text-align: right; }
.input[aria-invalid="true"] { border-color: var(--error); }
.tabs { display: inline-flex; padding: 2px; background: #E5E7EB; border-radius: var(--radius); }
.tabs a { min-height: 34px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: var(--radius); color: #4A4D55; text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 500; }
.chip { display: inline-block; padding: 2px 8px; border-radius: var(--radius); font-size: 12px; font-weight: 500; background: var(--primary-soft); color: var(--primary-strong); }

/* Cards and tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.card > h2 { padding: 14px 16px; font-size: 15px; font-weight: 600; border-bottom: 1px solid var(--border); }
.card-foot { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
/* No uppercase: units like W/(mK) must keep their case. */
table.data th { padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--muted); background: #F8F9FA; }
table.data td { padding: 12px 16px; border-top: 1px solid var(--border-soft); vertical-align: middle; }
table.data .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
table.data th.n { font-family: var(--sans); font-size: 12px; }
table.data tfoot td { border-top: 1px solid var(--border); font-weight: 600; }
table.compact th, table.compact td { padding: 8px 4px; }

.result { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px; background: var(--surface-tint); border: 1px solid var(--primary-soft); border-radius: var(--radius-card); color: var(--primary-strong); }
.result .value { font-family: var(--mono); font-size: 26px; font-weight: 500; }
.result .unit { font-family: var(--sans); font-size: 13px; }
.note { padding: 12px 14px; background: var(--bg); border-radius: var(--radius-card); font-size: 13px; color: var(--text-2); }
.notice { padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--surface); font-size: 14px; }
.errors { padding: 10px 14px; border-left: 3px solid var(--error); background: #FEF3F2; color: var(--error); font-size: 14px; }
.errors ul { margin: 0; padding-left: 18px; }

/* Method picker */
fieldset.methods { margin: 0; padding: 14px 16px 16px; display: flex; flex-wrap: wrap; gap: 10px; }
fieldset.methods legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
.method { flex: 1 1 200px; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-input); border-radius: var(--radius); cursor: pointer; }
.method:has(input:checked) { border: 2px solid var(--primary); padding: 11px; background: var(--surface-tint); }
.method input { margin-top: 4px; accent-color: var(--primary); }
.method strong { display: block; font-weight: 500; }

/* Plan */
.plan { margin: 0; padding: 16px; display: flex; justify-content: center; }
.plan svg { width: 100%; max-width: 760px; height: auto; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); }
.swatch { display: inline-block; width: 12px; height: 4px; margin-right: 8px; vertical-align: middle; }

.section-cut { width: 100%; height: auto; }

@media (max-width: 760px) {
  .content { padding: 16px; }
  .steps, .aside { max-width: none; border: 0; border-bottom: 1px solid var(--border); }
  .topbar { padding: 12px 16px; }
}

/* Forms */
.form { display: flex; flex-direction: column; }
.form fieldset { margin: 0; padding: 16px; border: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; }
.form legend { float: left; width: 100%; grid-column: 1 / -1; padding: 0 0 2px; font-size: 14px; font-weight: 600; }
.form .errors { margin: 16px 16px 0; }
.form fieldset > .table-wrap { clear: both; } /* a scroll box would otherwise sit beside the floated legend at 0 px */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .label { font-size: 13px; color: var(--text-2); }
.field .input { width: 100%; min-height: 40px; }
.wide { grid-column: 1 / -1; }
textarea.input { padding: 8px; min-height: 80px; resize: vertical; }
select.input { padding-right: 24px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-form .field .input { min-height: 36px; }
.inline-form .field.xs { width: 84px; }
.inline-form .field.sm { width: 120px; }
.inline-form .field.md { width: 180px; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-link { border: 0; background: none; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }
.btn-danger { color: var(--error); }
.btn-danger:hover { border-color: var(--error); color: var(--error); }
details.add > summary { cursor: pointer; color: var(--primary); font-weight: 500; font-size: 14px; list-style: none; }
details.add > summary::-webkit-details-marker { display: none; }
details.add > summary::before { content: "+ "; }
details.add[open] > summary { margin-bottom: 10px; }
.row-actions { display: flex; gap: 12px; justify-content: flex-end; }
.wall-openings { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.wall-openings li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.warn { color: var(--warn-text); background: var(--warn-bg); border: 1px solid var(--warn-border); padding: 2px 6px; border-radius: var(--radius); font-size: 12px; }
table.points td { padding: 4px 6px 4px 0; border: 0; }
table.points .input { width: 100px; text-align: right; font-family: var(--mono); }
.card-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
