/*
 * EngCalc: the tool's own components, styled in the site's design language (9 Nov 2026, on the UltraCompress Pro template,
 * after HomeCalc and AutoCalc, whose shared block the first part of this file copies).
 * Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus rings) and /libs/shared-nav.css
 * (the site's header and footer). The second part is the original's components (the inputs and the answer side by side, the
 * strip of calculators, boxes with their unit list, rows of loads and bars, the All list, colour bands and the drawings) on
 * the site's tokens, each part of a view a card. Light is the default; dark applies when <html> has no data-theme.
 * Assembled once from AutoCalc's file and the original's style.css, then edited by hand: this file is the source.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --radius-lg: 16px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --stage: #f3f4f8;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --stage: #1c1c2b;
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden] { display: none !important; } /* the script hides fields that carry their own display */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.9rem; }
.block { display: block; }
.hint { color: var(--text-3); font-size: 0.8rem; font-weight: 400; line-height: 1.45; }
.err { color: var(--bad); font-size: 0.85rem; font-weight: 600; }
.err:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
code { font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: inherit; font-size: 0.72rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); }

/* ----- Buttons ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9999px; font-family: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; padding: 12px 24px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn-secondary:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid rgba(185, 28, 28, 0.35); padding: 11px 23px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; transform: translateY(-2px); }
.btn-sm { font-size: 0.85rem; padding: 9px 16px; }
.btn-secondary.btn-sm, .btn-danger.btn-sm { padding: 8px 15px; }
.btn-stack { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.icon-btn:hover { border-color: var(--brand); color: var(--link); background: var(--surface); }
.icon-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.icon-btn:focus-visible, .link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Toolbar ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin: 0 0 1.25rem; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-pill { display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; border-radius: 9999px; border: 1px solid var(--tint-brand-border); background: var(--tint-brand); min-width: 220px; max-width: 100%; }
.status-icon { font-size: 1.3rem; line-height: 1; }
.status-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.status-main { font-weight: 700; font-size: 0.85rem; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sub { font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--surface-2); max-width: 100%; }
.view-tab { padding: 8px 16px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.view-tab:hover { color: var(--link); }
.view-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.view-tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.view[hidden] { display: none; }
.shell-hint { margin-top: 14px; }

/* ----- Cards ----- */
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-grid:empty { display: none; }
.card--wide { grid-column: span 2; }
.card--full { grid-column: 1 / -1; }
.card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); overflow: hidden; display: flex; flex-direction: column; min-width: 0; margin-bottom: 0; }
.view > .card { margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 0.8125rem; color: var(--text-3); }
.card-body { padding: 16px 20px 20px; flex: 1; min-width: 0; }
.card-body > * + * { margin-top: 16px; }
.form-hint { font-size: 0.8rem; color: var(--text-3); margin: 10px 0 0; line-height: 1.5; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.85rem; color: var(--text-strong); }
.input, .select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type="time"].input { color-scheme: light; width: 9em; }
:root:not([data-theme="light"]) input[type="time"].input { color-scheme: dark; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.num-input { width: 7.5em; }
.num-input.wide { width: 10em; }
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex-shrink: 0; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.seg button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .ico { width: 15px; height: 15px; color: var(--link); }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Windows ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog--narrow { width: min(420px, calc(100vw - 16px)); }
.dialog--wide { width: min(680px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-title { margin: 0; font-size: 1.15rem; }
.dialog-close { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--chip-border); background: var(--chip); color: var(--text-strong); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; transition: border-color 0.2s ease, color 0.2s ease; }
.dialog-close:hover { border-color: var(--brand); color: var(--link); }
.dialog-body { padding: 20px; overflow-y: auto; max-height: calc(100vh - 210px); display: flex; flex-direction: column; gap: 14px; }
.dialog-actions { padding: 14px 20px; border-top: 1px solid var(--surface-border); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.confirm-message { margin: 0; color: var(--text); }
.help-body h3 { margin: 6px 0 0; font-size: 1rem; }
.help-body p { margin: 0; color: var(--text-2); }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 420px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.toast.good { border-left-color: #4ade80; }
.toast.bad { border-left-color: #f87171; }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== EngCalc components ===== */

/* ----- The site's text rules (p, ul, li, table) must not reach the tool: same weight as the site's, loaded later ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.app-shell) dl,
:where(.app-shell) dd, :where(.app-shell) figure, :where(.dialog) p, :where(.dialog) ul { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) table, :where(.dialog) table { margin: 0; background: none; border-radius: 0; overflow: visible; }
:where(.app-shell) th, :where(.app-shell) td, :where(.dialog) th, :where(.dialog) td { border: 0; padding: 0; }
.num, .input.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; gap: 8px 20px; }
.row.small { gap: 16px; font-size: 0.85rem; }
.hint:empty { display: none; }
.hint.sub { display: block; margin-top: 2px; }
.hint.err { color: var(--bad); font-weight: 600; }
.field > .seg { align-self: flex-start; }

/* ----- The scripts write the original's button classes (btn, btn primary, btn danger, small-btn) ----- */
.btn { background: var(--surface); color: var(--text-strong); border: 1px solid var(--surface-border); padding: 11px 23px; }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn.primary { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.btn.danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; }
.btn.small-btn { font-size: 0.85rem; padding: 8px 15px; }
.btn:focus-visible, .chip:focus-visible, details.more > summary:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.chip[aria-pressed="true"], .chip[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chip[aria-pressed="true"] small { color: rgba(255, 255, 255, 0.85); }
.chip small { color: var(--text-3); font-weight: 500; }
.chip.bad { border-style: dashed; color: var(--text-3); }
.chip:disabled { cursor: not-allowed; transform: none; }

/* ----- Selects, including the ones the scripts build ----- */
select.input { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; cursor: pointer; }
select.input option { color: #0a0a14; background: #fff; }

/* ----- Toolbar and tabs ----- */
.status-pill .status-main { font-size: 0.95rem; }
.units-seg button { padding: 8px 16px; }
.app-shell > .view-tabs { margin: 0 0 1.25rem; display: flex; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }

/* ----- Views ----- */
.view > * + * { margin-top: 20px; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.view-title { margin: 0; font-size: 1.35rem; }
.view-title:focus { outline: none; }
.lead { margin-top: 4px; color: var(--text-2); max-width: 72ch; }
.view-body { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* The inputs on the left, the answer on the right (one column below 1024 px). */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1024px) { .bench { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); } }
.inputs { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.out { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ----- Cards: each part of a view is the site's white card ----- */
.bench > .inputs, .hero, .section, .out > details.more, .out > .readouts > .ro {
    background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); min-width: 0;
}
.bench > .inputs { padding: 20px; }
.section { display: flex; flex-direction: column; gap: 14px; padding: 0 20px 20px; }
.section > :first-child:not(.section-head) { margin-top: 20px; }
.section-head { margin: 0 -20px; padding: 14px 20px; border-bottom: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.section-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.section-head p { color: var(--text-3); font-size: 0.8125rem; }
.empty { color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 22px 12px; text-align: center; font-size: 0.925rem; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--surface); }
.empty .chips { justify-content: center; }

/* groups of fields inside the inputs card */
.group { display: flex; flex-direction: column; gap: 14px; border-top: 1px solid var(--surface-border); padding-top: 16px; }
.bench > .inputs > .field.mode + .group, .bench > .inputs > .group:first-child { border-top: 0; padding-top: 0; }
.group-title { font-weight: 700; font-size: 0.95rem; color: var(--text-strong); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pair.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 399px) { .pair.three { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .pair.three > :last-child:nth-child(3) { grid-column: 1 / -1; } }
.suffix-wrap { position: relative; display: block; }
.suffix-wrap .input { padding-right: 64px; }
.suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; font-size: 0.85rem; }
.check-row .sub { display: block; }

/* "More" panels: tin sizes and prices, how it is worked out */
details.more { border-top: 1px solid var(--surface-border); padding-top: 12px; }
details.more > summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; color: var(--text-strong); list-style: none; display: flex; align-items: center; gap: 10px; min-height: 32px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--link); border-bottom: 2px solid var(--link); transform: rotate(-45deg); transition: transform 0.15s; margin: 0 2px; flex: none; }
details.more[open] > summary::before { transform: rotate(45deg); }
.more-body { display: flex; flex-direction: column; gap: 16px; padding-top: 12px; }
.out > details.more { border-top: 1px solid var(--surface-border); padding: 4px 20px; }
.out > details.more > summary { min-height: 48px; }
.out > details.more[open] { padding-bottom: 18px; }

/* ----- Phones and tablets: a one-line answer that stays in view while typing, under the site header ----- */
.mini { display: none; }
@media (max-width: 1023px) {
    .mini { display: flex; position: sticky; top: 81px; z-index: 15; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--tint-brand-border); box-shadow: var(--surface-shadow); font-size: 0.9rem; }
    .mini[hidden] { display: none !important; }
    .mini span { color: var(--text-2); }
    .mini b { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--text-strong); }
}
@media (max-width: 639.98px) { .mini { top: 65px; } }

/* ----- The answer at the top ----- */
.hero { display: flex; flex-direction: column; gap: 8px; padding: 20px; }
.hero-num { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(2.4rem, 6vw, 3.8rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.hero-num small { font-family: 'Inter', sans-serif; font-size: 0.34em; font-weight: 600; letter-spacing: 0; color: var(--text-2); margin-left: 6px; }
.hero-sentence { font-size: 1.05rem; line-height: 1.6; max-width: 64ch; color: var(--text); }
.hero-sentence b { white-space: nowrap; color: var(--text-strong); }
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.readouts.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ro { border-top: 1px solid var(--surface-border); padding: 12px 0 14px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ro-label { color: var(--text-2); font-size: 0.85rem; font-weight: 600; }
.ro-val { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 700; letter-spacing: -0.01em; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.ro-val.good { color: var(--good); }
.ro-val.bad { color: var(--bad); }
.ro-sub { color: var(--text-3); font-size: 0.82rem; }
/* the four figures under the answer are small cards of their own */
.out > .readouts { gap: 16px; }
.out > .readouts > .ro { border-top: 1px solid var(--surface-border); padding: 14px 16px; }
@media (min-width: 1280px) { .out > .readouts:not(.three) { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; padding: 3px 10px; border-radius: 9999px; white-space: nowrap; align-self: flex-start; }
.pill .ico { width: 14px; height: 14px; }
.pill.good { background: var(--ok-soft); color: var(--ok); }
.pill.fair { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }

/* ----- One bar for 100% of something, and its key ----- */
.stack { display: flex; gap: 2px; height: 14px; width: 100%; }
.stack.tall { height: 28px; }
.stack i { display: block; height: 100%; background: var(--k); min-width: 2px; }
.stack i:first-child { border-radius: 6px 0 0 6px; }
.stack i:last-child { border-radius: 0 6px 6px 0; }
.stack i:only-child { border-radius: 6px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 4px 24px; }
.lg { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid var(--surface-border); align-items: baseline; }
.lg .key { width: 12px; height: 12px; align-self: center; border-radius: 3px; background: var(--k); }
.lg-name { font-weight: 600; font-size: 0.9rem; color: var(--text-strong); }
.lg-val { grid-column: 2; font-variant-numeric: tabular-nums; font-size: 0.925rem; color: var(--text); }
.lg-val .muted { font-size: 0.82rem; margin-left: 6px; }
.k1 { --k: var(--c-blue); } .k2 { --k: var(--c-orange); } .k3 { --k: var(--c-aqua); } .k4 { --k: var(--c-yellow); }
.k5 { --k: var(--c-magenta); } .k6 { --k: var(--c-violet); } .k7 { --k: var(--c-green); } .k8 { --k: var(--c-grey); }
.k-left { --k: var(--line-strong); }

/* ----- Tables ----- */
.tbl-wrap { overflow-x: auto; min-width: 0; position: relative; } /* holds a hidden header label inside the scroll box */
.tbl-wrap:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.925rem; }
.tbl th { text-align: left; font-size: 0.8rem; color: var(--text-2); font-weight: 600; padding: 8px 10px 8px 0; border-bottom: 2px solid var(--text-strong); white-space: nowrap; }
.tbl td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--surface-border); vertical-align: top; color: var(--text); }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td.r { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--text-strong); color: var(--text-strong); }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }

/* ----- Good to know, and how it is worked out ----- */
.ideas { display: flex; flex-direction: column; }
.idea { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--surface-border); align-items: start; }
.idea:last-child { border-bottom: 0; }
.idea:first-child { padding-top: 0; }
.idea > .ico { width: 22px; height: 22px; margin-top: 1px; }
.idea-title { font-weight: 600; color: var(--text-strong); }
.idea-text { color: var(--text-2); font-size: 0.9rem; grid-column: 2; max-width: 80ch; }
.idea.good > .ico { color: var(--ok); }
.idea.fair > .ico { color: var(--warn); }
.idea.bad > .ico { color: var(--bad); }
.idea.info > .ico { color: var(--info); }
.formula { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--text-2); }
.formula b { color: var(--text-strong); font-weight: 600; }

/* ----- One layer of cards: a section that holds the inputs and the answer is only a heading over
   them, and the parts of an answer are each a card of their own ----- */
.section:has(> .bench), .section:has(> .out) { background: none; border: 0; box-shadow: none; padding: 0; }
.section:has(> .bench) > .section-head, .section:has(> .out) > .section-head { margin: 0; padding: 0 0 2px; border-bottom: 0; }
.section:has(> .bench) > .section-head h2 { font-size: 1.15rem; }
.section:has(> .bench) > :first-child:not(.section-head), .section:has(> .out) > :first-child:not(.section-head) { margin-top: 0; }
.out > .ideas, .out > .tbl-wrap, .out > .inputs { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); min-width: 0; }
.out > .ideas { padding: 16px 20px; }
.out > .tbl-wrap { padding: 8px 20px; }
.out > .inputs { padding: 16px 20px; }
.out > .inputs h2 { font-size: 1.05rem; margin: 0; }

.figure { margin: 0; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.out > .figure { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 18px 20px; }

/* ----- The original's colours (both themes): blueprint blue draws the beams, sections and curves, orange the loads, and the
   tank and the dig have water and soil; and its names for the site's tokens ----- */
:root {
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --faint: var(--text-3);
    --border: var(--surface-border);
    --border-strong: var(--line-strong);
    --good: var(--ok);
    --info: #1d4ed8;
    --eng: #1f5fae;
    --eng-soft: #e5eef9;
    --eng-line: #a9c3e6;
    --load: #c8531b;
    --load-soft: #fbe6da;
    --neg-soft: #fbe3d6;
    --water: #bfdcf5;
    --soil: #ead9bf;
    --c-orange: #eb6834;
}
:root:not([data-theme="light"]) {
    --info: #93b4ff;
    --eng: #7fb2f0;
    --eng-soft: #1a2a40;
    --eng-line: #335a8a;
    --load: #f29a64;
    --load-soft: #3a2419;
    --neg-soft: #3a2419;
    --water: #1c3d5c;
    --soil: #3d3122;
    --c-orange: #d95926;
}

/* ----- The strip of calculators in each kind ----- */
.strip { display: flex; gap: 8px; flex-wrap: wrap; }
.tool-chip { text-decoration: none; }
.tool-chip[aria-current="page"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.tool-chip[aria-current="page"] .ico { color: #fff; }
@media (max-width: 1023px) {
    .strip { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
    .strip::-webkit-scrollbar { display: none; }
    .tool-chip { flex: none; }
}
.tool-host { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.star-btn { border-color: var(--chip-border); background: var(--surface); }
.star-btn[aria-pressed="true"] { color: var(--link); border-color: var(--brand); }
.star-btn .ico { width: 18px; height: 18px; }

/* ----- An entry that points to another tool (concrete, cement and bricks are in HomeCalc) ----- */
.link-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 20px; display: flex; flex-direction: column; gap: 16px; max-width: 72ch; }
.link-card p { color: var(--text); }
a.btn.primary { text-decoration: none; }
.link-card .btn { white-space: normal; text-align: center; }

/* ----- Fields: a number with its unit list beside it ----- */
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.label-val { color: var(--text-2); font-weight: 500; margin-left: 8px; }
.tip { border: 0; background: none; padding: 2px; color: var(--text-3); display: inline-grid; place-items: center; border-radius: 6px; cursor: pointer; }
.tip:hover { color: var(--link); }
.tip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tip .ico { width: 16px; height: 16px; }
.qbox { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; }
.qbox.solo { grid-template-columns: minmax(0, 1fr); }
.qbox .input.num { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.qbox.solo .input.num { border-radius: 12px; }
.qbox .unit, .qbox .unit-fixed { width: auto; max-width: 9.5rem; min-width: 4.2rem; min-height: 44px; border: 1px solid var(--field-border); border-left: 0; border-radius: 0 12px 12px 0; background-color: var(--surface-2); color: var(--text-strong); font-weight: 600; font-size: 0.875rem; padding-left: 12px; }
.qbox .unit:focus { outline: 2px solid var(--brand); outline-offset: 1px; box-shadow: none; }
.qbox .unit-fixed { display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; min-width: 0; }
.qbox .unit-fixed + * { display: none; }
.form-note { color: var(--text-2); font-size: 0.875rem; }
.list { display: flex; flex-direction: column; gap: 12px; }
.rows { display: flex; flex-direction: column; gap: 12px; }
.row-item { display: flex; flex-direction: column; gap: 10px; border-left: 3px solid var(--eng-line); padding-left: 12px; min-width: 0; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; }
.row-title { font-weight: 700; font-size: 0.9rem; color: var(--text-strong); }
.row-body { display: flex; flex-direction: column; gap: 12px; }
.icon-btn.small { width: 32px; height: 32px; border-radius: 8px; border-color: var(--chip-border); }
.icon-btn.small .ico { width: 16px; height: 16px; }
.icon-btn.small:hover { border-color: var(--danger); color: var(--danger); }
.inputs .group { gap: 16px; }
.inputs .group-title { font-size: 1rem; }
.bench > .inputs > .group:first-child { border-top: 0; padding-top: 0; }
.seg.fit { gap: 6px; }

/* ----- The answer ----- */
.hero-label { color: var(--text-2); font-weight: 600; font-size: 0.95rem; }
.hero-sub { color: var(--text-2); font-size: 0.95rem; }
.hero-num.bad { color: var(--bad); }
.readouts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ro-val.fair { color: var(--warn); }
.notes { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 0.875rem; max-width: 90ch; }
.steps { list-style: decimal; margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.steps li { padding-left: 4px; }
.step-what { font-weight: 600; margin-right: 8px; color: var(--text-strong); }
.step-math { padding: 2px 6px; font-size: 0.86em; overflow-wrap: anywhere; }
.step-res { margin-left: 8px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-strong); }
.tbl tr.pick td { background: var(--tint-brand); font-weight: 700; color: var(--text-strong); }
.tbl-wrap { max-height: 440px; overflow: auto; }
.tbl-wrap thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.section .btn { align-self: flex-start; }
.empty { flex-direction: row; justify-content: center; text-align: left; padding: 22px 16px; }
.empty .ico { width: 22px; height: 22px; color: var(--info); }
.empty p { color: var(--text-2); }
.out > .actions { margin-top: -6px; }

/* ----- All: search, favourites and recent, the five kinds ----- */
.search-box { position: relative; display: block; max-width: 720px; }
.search-box .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 20px; height: 20px; pointer-events: none; }
.big-input { min-height: 52px; font-size: 1.05rem; padding-left: 44px; }
.dialog .big-input { padding-left: 14px; }
.home-body { display: flex; flex-direction: column; gap: 20px; }
.quick { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 16px 20px; }
.quick-row { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; }
.quick-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.9rem; min-width: 7.5rem; color: var(--text-strong); }
.quick-label .ico { width: 16px; height: 16px; color: var(--link); }
a.chip { text-decoration: none; }
.cat-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 900px) { .cat-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .cat-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cat-block { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 18px 20px 8px; min-width: 0; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.cat-block:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.cat-block h3 { font-size: 1.1rem; margin: 0; }
.cat-link { color: var(--text-strong); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.cat-link:hover { color: var(--link); }
.cat-link .ico { color: var(--link); width: 20px; height: 20px; }
.cat-lead { color: var(--text-2); font-size: 0.875rem; }
.tool-list { display: flex; flex-direction: column; }
.home-body > .tool-list { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 4px 20px; }
.tool-link { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-border); text-decoration: none; color: var(--text); align-items: start; }
.tool-link:last-child { border-bottom: 0; }
.tool-link b { color: var(--text-strong); }
.tool-link:hover b { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.tool-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.tl-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--tint-brand); color: var(--link); display: grid; place-items: center; }
.tl-ico .ico { width: 20px; height: 20px; }
.tl-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tl-text small { color: var(--text-2); font-size: 0.85rem; line-height: 1.4; }
.pal-list { display: flex; flex-direction: column; gap: 2px; max-height: min(60vh, 520px); overflow: auto; }
.pal-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 8px; border-radius: 10px; text-decoration: none; color: var(--text); }
.pal-item span { display: flex; flex-direction: column; }
.pal-item b { color: var(--text-strong); }
.pal-item small { color: var(--text-2); }
.pal-item .ico { color: var(--link); }
.pal-item[aria-selected="true"], .pal-item:hover { background: var(--tint-brand); }

/* ----- Colour bands ----- */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--c); padding: 0; position: relative; cursor: pointer; }
.sw.none { background: repeating-linear-gradient(45deg, transparent 0 5px, var(--line-strong) 5px 6px); }
.sw[aria-checked="true"] { outline: 3px solid var(--text-strong); outline-offset: 2px; }
.sw:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.res-wrap { display: flex; flex-direction: column; gap: 8px; align-items: center; }
.band-names { color: var(--text-2); font-size: 0.9rem; text-align: center; }

/* ----- Drawings ----- */
.sketch { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; overflow: visible; }
.sketch.leds { max-width: 640px; }
.plot { display: block; max-width: 100%; touch-action: pan-y; }
.d-text { fill: var(--text); font-size: 12.5px; font-family: 'Inter', sans-serif; }
.d-lab { fill: var(--text); font-weight: 600; }
.d-dimt { fill: var(--text-2); font-size: 12px; font-weight: 600; }
.d-title { fill: var(--text-2); font-size: 12.5px; font-weight: 700; }
.d-val { fill: var(--text-strong); font-size: 12.5px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.d-react { fill: var(--eng); font-size: 12px; font-weight: 700; }
.d-tick { fill: var(--text-2); font-size: 11.5px; }
.d-axlab { fill: var(--text-2); font-size: 12px; font-weight: 600; }
.d-key { fill: var(--text); font-size: 12px; }
.d-axt { fill: var(--text-2); font-size: 13px; font-style: italic; font-weight: 600; }
.d-angle { fill: var(--eng); font-weight: 700; font-size: 13px; }
.d-line, .d-dim, .d-axis, .d-grid, .d-curline, .d-wall, .d-hatch, .d-ground, .d-floor, .d-wire, .d-lead, .d-guide, .d-axis2, .d-level, .d-beltl { fill: none; stroke-linecap: round; }
.d-line { stroke: var(--text); stroke-width: 1.5; }
.d-dim { stroke: var(--text-2); stroke-width: 1; }
.d-axis { stroke: var(--line-strong); stroke-width: 1.2; }
.d-axis2 { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 5 4; }
.d-grid { stroke: var(--surface-border); stroke-width: 1; }
.d-beam { fill: var(--eng-soft); stroke: var(--text); stroke-width: 1.5; }
.d-udl { fill: var(--load-soft); stroke: var(--load); stroke-width: 1.2; }
.d-load .d-arrow { stroke: var(--load); stroke-width: 1.6; }
.d-load .d-head { fill: var(--load); }
.d-load.pt .d-arrow { stroke-width: 2.4; }
.d-mom { fill: none; stroke: var(--load); stroke-width: 2; }
.d-sup { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
.d-wall { stroke: var(--text); stroke-width: 3; }
.d-hatch { stroke: var(--text-2); stroke-width: 1.2; }
.d-ground, .d-floor { stroke: var(--text-2); stroke-width: 1.5; }
.band.v .d-area.pos, .band.m .d-area.pos, .band.y .d-area.pos { fill: var(--eng-soft); }
.band .d-area.neg { fill: var(--neg-soft); }
.band .d-area { stroke: none; }
.d-curve { fill: none; stroke: var(--eng); stroke-width: 2; stroke-linejoin: round; }
.d-dot { fill: var(--text); }
.d-dot.big { fill: var(--eng); stroke: var(--surface); stroke-width: 2; }
.d-curline { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
.d-hit { fill: transparent; cursor: crosshair; outline: none; }
.d-hit:focus-visible { stroke: var(--brand); stroke-width: 3; }
.d-series { fill: none; stroke-width: 2.2; }
.d-series.s1 { stroke: var(--eng); }
.d-series.s2 { stroke: var(--c-orange); stroke-dasharray: 6 4; }
.d-guide { stroke: var(--text-2); stroke-dasharray: 3 3; }
.cursor-read { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 0.9rem; padding: 10px 0 0; min-height: 2.4em; font-variant-numeric: tabular-nums; color: var(--text); }
.cursor-read b { font-weight: 700; color: var(--text-strong); }
.cursor-read .muted { color: var(--text-2); }
.d-shape { fill: var(--eng-soft); stroke: var(--eng); stroke-width: 1.5; }
.d-hole { fill: var(--surface); stroke: var(--eng); stroke-width: 1.5; }
.d-centroid { fill: var(--load); }
.d-stair { fill: var(--eng-soft); stroke: var(--eng); stroke-width: 1.5; stroke-linejoin: round; }
.d-tri { fill: var(--eng-soft); stroke: var(--eng); stroke-width: 1.8; stroke-linejoin: round; }
.d-arc { fill: none; stroke: var(--eng); stroke-width: 1.5; }
.d-tank { fill: none; stroke: var(--text); stroke-width: 2; }
.d-liquid { fill: var(--water); }
.d-level { stroke: var(--eng); stroke-width: 1.2; stroke-dasharray: 5 4; }
.d-lead { stroke: var(--text-2); stroke-width: 4; }
.d-body { fill: #e3cfa6; stroke: #a98c5a; stroke-width: 1.5; }
:root:not([data-theme="light"]) .d-body { fill: #c9b285; stroke: #8f7748; }
.d-band { stroke: rgba(0, 0, 0, 0.25); stroke-width: 1; }
.d-band.none { stroke: none; }
.d-wire { stroke: var(--text); stroke-width: 1.6; }
.d-res { fill: var(--surface); stroke: var(--text); stroke-width: 1.6; }
.d-led { fill: var(--load-soft); stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.d-glow .d-arrow { stroke: var(--load); stroke-width: 1.3; }
.d-glow .d-head { fill: var(--load); }
.d-pulley { fill: var(--eng-soft); stroke: var(--eng); stroke-width: 2; }
.d-hub { fill: var(--text); }
.d-beltl { stroke: var(--text); stroke-width: 2.5; }
.d-pit { fill: var(--soil); stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.fig-cap { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.caption { color: var(--text-2); font-size: 0.875rem; text-align: center; }
.stack-wrap { display: flex; flex-direction: column; gap: 12px; }
.out > .stack-wrap { background: var(--surface); border: 1px solid var(--surface-border); border-radius: var(--radius-lg); box-shadow: var(--surface-shadow); padding: 18px 20px; }
.lg-val { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

/* ----- Windows ----- */
.dialog.wide { width: min(680px, calc(100vw - 16px)); }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.help-body section { display: flex; flex-direction: column; gap: 8px; }
.help-body p { max-width: 76ch; }
.help-body .btn.danger { align-self: flex-start; }

@media (forced-colors: active) {
    .sw, .d-band, .stack i, .key { forced-color-adjust: none; }
}

/* ----- The printed sheet: only the sheet, in black on white, while it prints ----- */
.print-sheet { display: none; }
@media print {
    @page { margin: 14mm; }
    body.printing-sheet { background: #fff; color: #000; }
    body.printing-sheet > *:not(#printSheet) { display: none !important; }
    body.printing-sheet .print-sheet { display: block !important; font-family: 'Inter', sans-serif; font-size: 10.5pt; color: #000; }
    .print-sheet h1 { font-size: 17pt; margin: 0 0 2pt; color: #000; }
    .print-sheet h2 { font-size: 12pt; margin: 12pt 0 4pt; color: #000; }
    .print-sheet .sub { color: #444; margin: 0 0 12pt; }
    .print-sheet table { width: 100%; border-collapse: collapse; margin: 0; background: none; }
    .print-sheet th { text-align: left; font-size: 9pt; color: #444; border: 0; border-bottom: 1pt solid #000; padding: 3pt 6pt 3pt 0; background: none; }
    .print-sheet td { padding: 3pt 6pt 3pt 0; border: 0; border-bottom: 0.5pt solid #ccc; vertical-align: top; color: #000; }
    .print-sheet .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .print-sheet .note { margin-top: 14pt; color: #555; font-size: 9pt; }
    .print-sheet .fig svg { max-width: 100%; height: auto; }
    .print-sheet .steps { font-size: 9.5pt; }
    .print-sheet .tbl-wrap { max-height: none; overflow: visible; }
}

/* ----- Tablets ----- */
@media (max-width: 1023px) {
    .info-section .info-grid { grid-template-columns: repeat(2, 1fr); }
    .info-three { grid-template-columns: 1fr; }
}

/* ----- Phones ----- */
@media (max-width: 560px) {
    .hide-sm { display: none; }
}
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .app-toolbar { gap: 10px; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .status-pill { flex: 1 1 100%; min-width: 0; }
    .toolbar-right .btn { flex: 1 1 auto; }
    .units-seg { flex: 1 1 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .units-seg button { white-space: nowrap; }
    /* six tabs: two rows of three */
    .app-shell > .view-tabs { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: 22px; }
    .app-shell > .view-tabs .view-tab { justify-content: center; padding: 8px 6px; font-size: 0.85rem; }
    .pair:has(> .field .qbox:not(.solo)), .pair.three:has(> .field .qbox:not(.solo)) { grid-template-columns: minmax(0, 1fr); } /* a number with its unit list needs the whole row */
    .pair.three > :last-child:nth-child(3) { grid-column: auto; }
    .view-head .actions { width: 100%; }
    .view-head .tool-actions .btn { flex: 1 1 0; padding: 9px 8px; }
    .bench > .inputs, .hero, .link-card { padding: 16px; }
    .out > .figure, .out > .stack-wrap, .quick, .cat-block { padding: 16px; }
    .home-body > .tool-list { padding: 4px 16px; }
    .section { padding: 0 16px 16px; }
    .section-head { margin: 0 -16px; padding: 12px 16px; }
    .section > :first-child:not(.section-head) { margin-top: 16px; }
    .out > details.more { padding: 4px 16px; }
    .out > .readouts { gap: 12px; }
    .out > .readouts > .ro { padding: 12px 14px; }
    .out > .ideas { padding: 14px 16px; }
    .out > .tbl-wrap { padding: 8px 16px; }
    .readouts.three, .readouts.two { grid-template-columns: minmax(0, 1fr); }
    .toasts { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body, .dialog-head, .dialog-actions { padding-left: 16px; padding-right: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .info-card, .cat-block, .dialog, .toast, .chip, .seg button, .view-tab, details.more > summary::before { transition: none; animation: none; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). The drawings keep their own sizes; buttons inside a
   sentence read as links (WCAG 2.5.8). */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .chip, main .seg button, main .view-tab, main .icon-btn { min-height: 44px; min-width: 44px; }
    main .icon-btn, main .icon-btn.small { width: 44px; height: 44px; }
    main .tip { min-width: 44px; min-height: 44px; }
    main .sw { width: 44px; height: 44px; }
    main .check-row, .dialog .check-row { min-height: 44px; align-items: center; }
    main details.more > summary { min-height: 44px; }
    main .check-row input, .dialog .check-row input { width: 24px; height: 24px; }
    main .qbox .unit, main .qbox .unit-fixed { min-height: 44px; }
    main .tool-link { min-height: 44px; }
    main .cat-link { min-height: 44px; }
    main :is(p:not(.hero-num), li, td, th, .hint, .muted, .small, .label, .lead, .ro-label, .ro-sub, .section-head p, .status-sub,
        .form-hint, .input, kbd, .chip, .chip small, .lg-name, .lg-val, .lg-val .muted, .formula, .idea-text, .pill, .seg button,
        .view-tab, .mini, .tbl, .group-title, .unit, .unit-fixed, .label-val, .row-title, .form-note, .hero-label, .hero-sub,
        .step-what, .step-math, .step-res, .notes, .tl-text small, .quick-label, .cat-lead, .caption, .band-names, .cursor-read) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog select, .dialog input:not([type="checkbox"]), .dialog summary { min-height: 44px; }
    .dialog .dialog-close { width: 44px; height: 44px; }
    .dialog .icon-btn { width: 44px; height: 44px; }
    .dialog :is(p, li, .hint, .input, .label, .seg button, .check-row, .group-title, .pal-item small, .chip) { font-size: 1rem; }
    .dialog .pal-item { min-height: 44px; }
}
