/* ============================================================
   UpgradeAirKit.com — cfm-table.html "CFM Table for Building Permit"
   The room-by-room sizing tool + the sheet a permit reviewer reads.

   LOAD ORDER: this file must be linked LAST, after design-system.css,
   shop.css, dev-enhancements.css and nav.css. Everything here is scoped
   under a .cfm-* ancestor on purpose — shared furniture (.btn, .card,
   .field, .page-band, .site-header, .site-footer) is extended, never
   redefined, so no other page can be disturbed by this stylesheet.

   Tokens only — see design-system.css. The two flow-column tints and the
   panel shadows are alpha derivations of existing tokens (--navy #0C2A4D,
   --gold, --green). No new brand colour is introduced; the only bare hex
   values are the sanctioned on-navy tints (#EAF1FB / #6BE08C / #C6D6EA, as
   used by .page-band in shop.css) and neutral greys inside @media print.
   Breakpoints: 1100px · 880px · 560px. Nothing else.

   This file also carries the site's FIRST @media print block. The printed
   page IS the permit document — treat that section as a deliverable.
   ============================================================ */


/* ============================================================
   0) UTILITIES the page needs and the design system lacks
   ============================================================ */

/* Visually hidden, still read aloud. Used by the table caption and the
   "Remove row" column header. design-system.css does not define this. */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Honeypot — same convention as plans.css. Humans never see it. */
.hp-field {
  position: absolute !important;
  left: -6000px !important; top: -6000px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* Print-only furniture: invisible on screen, the masthead in print. */
.cfm-printhead,
.cfm-printfoot { display: none; }


/* ============================================================
   1) PAGE SHELL + HERO BAND
   ============================================================ */

.cfm-band .lede { max-width: 66ch; }

.cfm-page {
  padding-block: clamp(30px, 4.5vw, 58px) clamp(48px, 7vw, 92px);
  background:
    radial-gradient(120% 60% at 50% -8%, rgba(47,168,79,.06), transparent 62%),
    var(--mist);
}


/* ============================================================
   2) LAYOUT — tool on the left, sticky numbers rail on the right
   ============================================================ */

/* This page carries a nine-column schedule AND a results rail. Inside the
   site's standard 1180px container the table is forced into a sideways scroll
   on an ordinary desktop, which is exactly where it must NOT scroll. Widen the
   container for this page only — the hero band matches so the edges line up. */
.cfm-band .container,
.cfm-page .container { max-width: 1320px; }

.cfm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(20px, 2.6vw, 34px);
  align-items: start;
}

.cfm-main {
  min-width: 0;                 /* lets the table wrapper actually scroll */
  display: grid;
  gap: clamp(18px, 2.2vw, 26px);
}

.cfm-results {
  position: sticky;
  top: 96px;                    /* clears the sticky site header + utility bar */
  align-self: start;
  min-width: 0;
}


/* ============================================================
   3) CARDS
   ============================================================ */

.cfm-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(20px, 2.8vw, 32px);
  position: relative;
  overflow: hidden;
}

.cfm-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
  font-size: clamp(1.12rem, 1.5vw, 1.35rem);
  line-height: 1.15;
  margin: 0 0 .3em;
}

.cfm-card__sub {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: .92rem;
  max-width: 62ch;
}


/* ---- 3a) Assumptions panel ---- */

.cfm-card--assume {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(18px, 3vw, 34px);
  background:
    radial-gradient(110% 130% at 0% 0%, rgba(47,168,79,.10), transparent 58%),
    var(--grad-air);
  border-color: rgba(47,168,79,.24);
}
.cfm-card--assume::before {          /* gradient hairline, like .upload-card */
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--green), var(--green-dark) 45%, var(--navy-2));
}

.cfm-assume__body { min-width: 0; }

.cfm-assume-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .5rem;
}
.cfm-assume-list li {
  position: relative;
  padding-left: 1.5em;
  font-size: .95rem;
  color: var(--ink);
  line-height: 1.45;
}
.cfm-assume-list li::before {
  content: "";
  position: absolute; left: 0; top: .48em;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--grad-green);
  box-shadow: 0 0 0 3px rgba(47,168,79,.16);
}
.cfm-assume-list b {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--green-dark);
}

/* The `hidden` attribute has to beat our own display rules. cfm.js toggles
   el.hidden on .cfm-live, .cfm-kit, .cfm-load, .cfm-status and .cfm-empty, and
   each of those also carries a display declaration that would otherwise win.
   Scoped to this page so it cannot leak into the shared sheets. */
.cfm-page [hidden], .cfm-results [hidden] { display: none !important; }

.cfm-assume-note {                    /* gentle warning — gold, never red */
  margin: 1.1rem 0 0;
  display: block;                     /* NOT flex: the <b> runs are mid-sentence */
  font-size: .9rem;
  line-height: 1.5;
  color: var(--ink);
  background: rgba(224,184,76,.12);
  border: 1px solid rgba(224,184,76,.42);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: .8em 1em;
}
.cfm-assume-note > span[aria-hidden] {
  color: var(--gold);
  font-size: 1.05rem;
  line-height: 1.25;
  margin-right: .45em;                /* inline now that the note is a block */
}
.cfm-assume-note b { color: var(--navy); font-weight: 800; }

.cfm-assume__aside {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-self: center;
}

.cfm-howto {
  justify-content: center;
  width: 100%;
  background: var(--paper);
  border-color: rgba(47,168,79,.35);
  font-size: .92rem;
  line-height: 1.25;
  white-space: normal;
  text-align: left;
  padding-block: .9em;
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease;
}
.cfm-howto:hover {
  border-color: var(--green);
  box-shadow: var(--glow-green);
  transform: translateY(-2px);
}
.cfm-howto__play {
  flex: 0 0 30px;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad-green);
  color: #fff;
  font-size: .68rem;
  padding-left: 2px;                 /* optically centres the ► glyph */
  box-shadow: var(--glow-green);
}

.cfm-assume-hint {
  margin: 0;
  font-size: .84rem;
  line-height: 1.5;
  color: var(--ink-soft);
}


/* ============================================================
   4) PROJECT FIELDS — the plans.css .field convention, scoped
   ============================================================ */

.cfm-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.2rem;
}

.cfm-page .field label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .85rem;
  color: var(--navy);
  margin-bottom: .35em;
  letter-spacing: .02em;
}

.cfm-page .field input {
  width: 100%;
  font-family: var(--font-body);
  font-size: .98rem;
  color: var(--ink);
  background: var(--mist);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: .78em 1em;
  transition: border-color .18s ease, box-shadow .2s ease, background .18s ease;
}
.cfm-page .field input:hover { border-color: rgba(12,42,77,.18); }
.cfm-page .field input:focus {
  outline: none;
  border-color: var(--green);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(47,168,79,.14);
}

.cfm-req {
  font-style: normal;
  font-weight: 800;
  color: var(--rose);
  margin-left: .12em;
}


/* ============================================================
   5) THE ROOM TABLE — the heart of the page
   ============================================================ */

.cfm-card--rooms { padding-inline: clamp(14px, 2vw, 24px); }

.cfm-rooms__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.cfm-rooms__head .cfm-card__sub { margin-bottom: 0; }

.cfm-rooms__tools {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.cfm-tablewrap {
  overflow: auto;                    /* x for narrow screens, y so thead sticks */
  max-height: min(70vh, 780px);
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  -webkit-overflow-scrolling: touch;
}

.cfm-table {
  width: 100%;
  min-width: 680px;                  /* below this the wrapper scrolls sideways */
  border-collapse: separate;         /* required — collapse breaks sticky borders */
  border-spacing: 0;
  font-size: .9rem;
  color: var(--ink);
  background: var(--paper);
}

/* ---- 5a) Header ---- */

.cfm-table thead th {
  position: sticky;
  z-index: 3;
  top: 0;
  background:
    linear-gradient(180deg, var(--mist) 0%, rgba(47,168,79,.10) 100%),
    var(--paper);
  color: var(--navy);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .72rem;
  letter-spacing: .045em;
  text-transform: uppercase;
  text-align: left;
  padding: .55rem .7rem;
  border-bottom: 1.5px solid var(--line);
  vertical-align: bottom;
  white-space: nowrap;
}
/* Second header row sits under the "Flow Rate" spanner. --cfm-h1 is that
   spanner row's fixed height so the two sticky rows stack cleanly. */
.cfm-table { --cfm-h1: 34px; }
.cfm-table thead tr:first-child th { top: 0; }
.cfm-table thead tr + tr th { top: var(--cfm-h1); z-index: 2; }

.cfm-table thead th.cfm-c-flow {
  height: var(--cfm-h1);
  padding-block: .35rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.cfm-unit {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .66rem;
  letter-spacing: .01em;
  text-transform: none;
  color: var(--ink-soft);
  margin-top: .12em;
}

/* ---- 5b) Body cells ---- */

.cfm-table tbody td {
  padding: .28rem .55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  background: transparent;
}
.cfm-table tbody tr:last-child td { border-bottom: 0; }

.cfm-table tbody tr:nth-child(even) td { background: rgba(12,42,77,.022); }

.cfm-table tbody tr:hover td { background: rgba(47,168,79,.07); }
.cfm-table tbody tr:focus-within td { background: rgba(47,168,79,.09); }

/* ---- 5c) Column roles ---- */

.cfm-c-floor { width: 9%;  min-width: 78px; }  /* "Upper" must not clip */
.cfm-c-room  { width: 22%; min-width: 124px; }
.cfm-c-num   { width: 10%; min-width: 68px; }
.cfm-c-act   { width: 40px; min-width: 40px; }

/* Numbers line up or the table is useless. */
.cfm-table td.cfm-c-num,
.cfm-table th.cfm-c-num,
.cfm-table .cfm-c-num input,
.cfm-totals td {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* The two flow columns — quiet, distinguishable at a glance.
   Supply = cool (navy alpha). Exhaust = warm (gold alpha). */
.cfm-table td.cfm-c-supply,
.cfm-table th.cfm-c-supply  { background: rgba(12,42,77,.045); }
.cfm-table td.cfm-c-exhaust,
.cfm-table th.cfm-c-exhaust { background: rgba(224,184,76,.10); }
.cfm-table thead th.cfm-c-supply {
  background: linear-gradient(180deg, var(--mist) 0%, rgba(12,42,77,.10) 100%);
}
.cfm-table thead th.cfm-c-exhaust {
  background: linear-gradient(180deg, var(--mist) 0%, rgba(224,184,76,.24) 100%);
}
/* Zebra + hover must stay readable over the flow tints. */
.cfm-table tbody tr:nth-child(even) td.cfm-c-supply  { background: rgba(12,42,77,.065); }
.cfm-table tbody tr:nth-child(even) td.cfm-c-exhaust { background: rgba(224,184,76,.15); }
.cfm-table tbody tr:hover td.cfm-c-supply            { background: rgba(12,42,77,.085); }
.cfm-table tbody tr:hover td.cfm-c-exhaust           { background: rgba(224,184,76,.20); }

/* Computed columns read as READ-ONLY: no border, mist fill, soft ink. */
.cfm-table td.cfm-calc,
.cfm-table td.cfm-c-calc {
  background: var(--mist);
  color: var(--ink-soft);
  font-weight: 600;
  border-left: 0;
  border-right: 0;
  padding-inline: .7rem;
}
.cfm-table tbody tr:nth-child(even) td.cfm-calc,
.cfm-table tbody tr:nth-child(even) td.cfm-c-calc { background: var(--mist-2); }
.cfm-table tbody tr:hover td.cfm-calc,
.cfm-table tbody tr:hover td.cfm-c-calc           { background: var(--mist-2); }
.cfm-table thead th.cfm-c-calc {
  background: linear-gradient(180deg, var(--mist) 0%, var(--mist-2) 100%);
  color: var(--ink-soft);
}

/* ---- 5d) Inputs inside the table: borderless until focus ---- */

.cfm-table input.cfm-in {
  width: 100%;
  min-width: 0;
  font-family: var(--font-body);
  font-size: .9rem;
  line-height: 1.35;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 9px;
  padding: .42em .5em;
  transition: background .16s ease, border-color .16s ease, box-shadow .18s ease;
  appearance: none;
  -moz-appearance: textfield;
}
.cfm-table input.cfm-in::-webkit-outer-spin-button,
.cfm-table input.cfm-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cfm-table input.cfm-in::placeholder { color: var(--ink-soft); opacity: .5; }
.cfm-table input.cfm-in:hover {
  background: var(--paper);
  border-color: var(--line);
}
.cfm-table input.cfm-in:focus {
  outline: none;
  background: var(--paper);
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47,168,79,.14);
}
.cfm-table input.cfm-in[readonly],
.cfm-table input.cfm-in:disabled {
  color: var(--ink-soft);
  cursor: default;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* ---- 5e) Row remove control ---- */

.cfm-rowact,
.cfm-table td.cfm-c-act { text-align: center; padding-inline: .25rem; }

.cfm-rowact button.cfm-del,
button.cfm-del {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: .22;                       /* never display:none — SR + keyboard keep it */
  transition: opacity .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.cfm-table tbody tr:hover button.cfm-del,
.cfm-table tbody tr:focus-within button.cfm-del { opacity: 1; }
button.cfm-del:hover {
  opacity: 1;
  color: var(--rose);
  background: rgba(200,36,43,.10);
  border-color: rgba(200,36,43,.25);
  transform: scale(1.06);
}
button.cfm-del:focus-visible {
  opacity: 1;
  outline: 3px solid rgba(47,168,79,.55);
  outline-offset: 2px;
}

/* ---- 5f) Totals ---- */

.cfm-table tfoot .cfm-totals td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, var(--mist) 0%, var(--mist-2) 100%);
  border-top: 2px solid var(--navy);
  padding: .6rem .7rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .98rem;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.cfm-totals__label {
  text-align: left !important;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-size: .74rem !important;
  color: var(--ink-soft) !important;
}

/* ---- 5g) Table footer controls ---- */

.cfm-rooms__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1rem;
  margin-top: 1rem;
}
.cfm-rowcount {
  margin: 0;
  font-size: .85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.cfm-rowcount span {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--navy);
}


/* ============================================================
   6) RESULTS RAIL — the showpiece
   ============================================================ */

.cfm-results__inner {
  position: relative;
  overflow: hidden;
  background: var(--grad-navy);
  color: #EAF1FB;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(20px, 2.4vw, 26px);
}
.cfm-results__inner::after {          /* soft airflow glow, house convention */
  content: "";
  position: absolute; inset: auto -20% -35% 30%;
  height: 70%;
  background: radial-gradient(closest-side, rgba(47,168,79,.30), transparent 70%);
  filter: blur(26px);
  pointer-events: none;
}
.cfm-results__inner > * { position: relative; z-index: 1; }

.cfm-results__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #6BE08C;
  margin: 0 0 1rem;
}

.cfm-empty {
  margin: 0;
  padding: 1.4em 1.1em;
  border: 1.5px dashed rgba(198,214,234,.32);
  border-radius: var(--radius);
  text-align: center;
  font-size: .92rem;
  line-height: 1.5;
  color: #C6D6EA;
  background: rgba(255,255,255,.04);
}

.cfm-live { display: grid; gap: 1rem; }

/* ---- 6a) Verdict ---- */

.cfm-verdict {
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  padding: 1em 1.1em 1.05em;
  text-align: center;
  transition: background .2s ease, border-color .2s ease;
}
.cfm-verdict__label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #C6D6EA;
}
.cfm-verdict__value {
  display: block;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.5rem, 5.2vw, 3.3rem);
  line-height: 1;
  letter-spacing: -.02em;
  color: #6BE08C;
  margin-top: .12em;
  text-shadow: 0 6px 26px rgba(47,168,79,.45);
  font-variant-numeric: tabular-nums;
}
.cfm-verdict__msg {
  margin: .6em 0 0;
  font-size: .85rem;
  line-height: 1.45;
  color: #C6D6EA;
}

.cfm-verdict.is-error {
  background: rgba(200,36,43,.18);
  border-color: rgba(224,74,80,.55);
  box-shadow: 0 0 0 1px rgba(224,74,80,.18) inset;
}
.cfm-verdict.is-error .cfm-verdict__value {
  color: var(--rose-soft);
  text-shadow: 0 6px 26px rgba(200,36,43,.42);
}
.cfm-verdict.is-error .cfm-verdict__label { color: var(--rose-soft); }
.cfm-verdict.is-error .cfm-verdict__msg   { color: #EAF1FB; }

.cfm-balance-fix {
  margin-top: .55em;
  border: 0;
  background: transparent;
  padding: .2em .1em;
  font-family: var(--font-body);
  font-size: .84rem;
  font-weight: 600;
  color: #C6D6EA;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(198,214,234,.45);
  cursor: pointer;
  transition: color .16s ease, text-decoration-color .16s ease;
}
.cfm-balance-fix:hover { color: #fff; text-decoration-color: #fff; }
.cfm-balance-fix:focus-visible {
  outline: 3px solid rgba(47,168,79,.55);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---- 6b) Stats list ---- */

.cfm-stats { margin: 0; }

.cfm-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  padding: .58em 0;
  border-bottom: 1px solid rgba(198,214,234,.16);
}
.cfm-stat:first-child { border-top: 1px solid rgba(198,214,234,.16); }

.cfm-stat dt {
  font-size: .85rem;
  color: #C6D6EA;
  line-height: 1.35;
}
.cfm-stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: #EAF1FB;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- 6c) ERV sub-panel ---- */

.cfm-erv {
  border-radius: var(--radius);
  padding: .95em 1.05em 1.05em;
  background:
    linear-gradient(140deg, rgba(47,168,79,.22), rgba(47,168,79,.06) 70%),
    rgba(255,255,255,.05);
  border: 1px solid rgba(107,224,140,.34);
  box-shadow: 0 0 26px rgba(47,168,79,.16) inset;
}
.cfm-erv__label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6BE08C;
}
.cfm-erv__value {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.22rem;
  line-height: 1.2;
  color: #fff;
  margin-top: .2em;
}

/* ---- 6d) Load bar ---- */

.cfm-load { margin-top: .8em; }

.cfm-load__bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(8,28,54,.55);
  border: 1px solid rgba(198,214,234,.22);
  overflow: hidden;
}
.cfm-load__fill {
  display: block;
  height: 100%;
  width: 0%;                          /* JS sets this inline */
  border-radius: var(--radius-pill);
  background: var(--grad-green);
  box-shadow: 0 0 14px rgba(47,168,79,.65);
  transition: width .35s ease, background .25s ease;
}
.cfm-load.is-over .cfm-load__fill {
  background: linear-gradient(90deg, var(--rose-soft), var(--rose));
  box-shadow: 0 0 14px rgba(200,36,43,.6);
}
.cfm-load.is-under .cfm-load__fill {
  background: linear-gradient(90deg, rgba(224,184,76,.75), var(--gold));
  box-shadow: 0 0 14px rgba(224,184,76,.55);
}
.cfm-load__msg {
  margin: .45em 0 0;
  font-size: .8rem;
  line-height: 1.4;
  color: #C6D6EA;
}
.cfm-load.is-over  .cfm-load__msg { color: #EAF1FB; }
.cfm-load.is-under .cfm-load__msg { color: var(--gold); }

/* ---- 6e) Recommended kit ---- */

.cfm-kit {
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.16);
  padding: .9em 1em 1em;
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease, background .2s ease;
}
.cfm-kit:hover,
.cfm-kit:focus-within {
  transform: translateY(-3px);
  background: rgba(255,255,255,.09);
  border-color: rgba(107,224,140,.45);
  box-shadow: var(--glow-green);
}
.cfm-kit__eyebrow {
  margin: 0 0 .7em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #6BE08C;
}
/* A vertical stack of cards. Each CARD owns its own two-column grid — the
   body must not, or `display: contents` scatters an anchor's children across
   the parent's cells. */
.cfm-kit__body {
  display: grid;
  gap: .7em;
}
.cfm-kit__card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: .85em;
  align-content: center;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}
.cfm-kit__card img,
.cfm-kit__card .cfm-kit__img { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.cfm-kit__card .cfm-kit__name  { grid-column: 2; align-self: end; }
.cfm-kit__card .cfm-kit__price { grid-column: 2; align-self: start; }
/* the distro card has no image */
.cfm-kit__card--sm {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .6em;
  padding-top: .7em;
  border-top: 1px solid rgba(255,255,255,.14);
}
.cfm-kit__card--sm .cfm-kit__name  { grid-column: 1; grid-row: 1; font-size: .85rem; }
.cfm-kit__card--sm .cfm-kit__price { grid-column: 2; grid-row: 1; margin-top: 0; font-size: .92rem; }
.cfm-kit__card:hover .cfm-kit__name { color: #6BE08C; }
/* Honest note when the kit's rated airflow sits under the design figure. */
.cfm-kit__warn {
  margin: .1em 0 0;
  font-size: .78rem;
  line-height: 1.45;
  color: #FFD9A8;
}
.cfm-kit__warn a { color: #6BE08C; text-decoration: underline; }
.cfm-kit__body img,
.cfm-kit__img {
  width: 64px; height: 64px;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255,255,255,.92);
  padding: 5px;
  box-shadow: 0 6px 18px rgba(4,14,28,.4);
}
.cfm-kit__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: .95rem;
  line-height: 1.25;
  color: #fff;
}
.cfm-kit__price {
  display: block;
  margin-top: .18em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  color: #6BE08C;
  font-variant-numeric: tabular-nums;
}
.cfm-kit__meta {
  display: block;
  margin-top: .12em;
  font-size: .8rem;
  color: #C6D6EA;
}
.cfm-kit__cta {
  grid-column: 1 / -1;
  margin-top: .3em;
  justify-content: center;
  width: 100%;
  font-size: .9rem;
  padding-block: .7em;
}
.cfm-kit a:focus-visible,
.cfm-kit__cta:focus-visible {
  outline: 3px solid rgba(47,168,79,.55);
  outline-offset: 3px;
}

/* ---- 6f) Actions + status ---- */

.cfm-actions {
  display: grid;
  gap: .6rem;
  margin-top: 1.1rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(198,214,234,.18);
}
.cfm-actions .btn--navy {
  background: var(--paper);
  color: var(--navy);
  box-shadow: 0 8px 22px rgba(4,14,28,.35);
}
.cfm-actions .btn--navy:hover { box-shadow: 0 14px 30px rgba(4,14,28,.45); }
.cfm-actions .btn--ghost {
  color: #EAF1FB;
  border-color: rgba(198,214,234,.35);
}
.cfm-actions .btn--ghost:hover {
  color: #fff;
  border-color: #6BE08C;
  background: rgba(47,168,79,.14);
}
.cfm-actions__note {
  margin: .3em 0 0;
  font-size: .78rem;
  line-height: 1.45;
  color: #C6D6EA;
  opacity: .9;
}

.cfm-status {
  margin: .2em 0 0;
  display: flex;
  align-items: flex-start;
  gap: .5em;
  font-size: .84rem;
  line-height: 1.45;
  font-weight: 600;
  color: #C6D6EA;
}
.cfm-status::before {
  content: "";
  flex: 0 0 auto;
  width: 9px; height: 9px;
  margin-top: .42em;
  border-radius: 50%;
  background: currentColor;
  opacity: .85;
}
.cfm-status.is-ok  { color: #6BE08C; }
.cfm-status.is-err { color: var(--rose-soft); }
.cfm-status.is-busy { color: #C6D6EA; }
.cfm-status.is-busy::before {
  border-radius: 50%;
  background: none;
  border: 2px solid currentColor;
  border-top-color: transparent;
  width: 12px; height: 12px;
  margin-top: .3em;
  animation: cfm-spin .8s linear infinite;
}
@keyframes cfm-spin { to { transform: rotate(360deg); } }


/* ============================================================
   7) EXPLAINER GRID
   ============================================================ */

.cfm-explain {
  margin-top: clamp(34px, 5vw, 60px);
  padding-top: clamp(28px, 4vw, 44px);
  border-top: 1px solid var(--line);
}
.cfm-explain > h2 { margin-bottom: .8em; }

.cfm-explain__grid { grid-template-columns: repeat(3, 1fr); }

.cfm-explain__item {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15em 1.25em 1.25em;
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s ease;
}
.cfm-explain__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: rgba(47,168,79,.35);
}
.cfm-explain__item h3 {
  font-size: 1.02rem;
  margin-bottom: .35em;
}
.cfm-explain__item p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.cfm-explain__foot {
  margin: clamp(20px, 3vw, 30px) 0 0;
  font-size: .88rem;
  line-height: 1.6;
  max-width: 78ch;
}
.cfm-explain__foot a {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* ============================================================
   8) FOCUS — one visible convention, everywhere
   ============================================================ */

.cfm-page a:focus-visible,
.cfm-page button:focus-visible,
.cfm-page input:focus-visible,
.cfm-page [tabindex]:focus-visible {
  outline: 3px solid rgba(47,168,79,.55);
  outline-offset: 3px;
  border-radius: 8px;
}
.cfm-table input.cfm-in:focus-visible { outline-offset: 0; }


/* ============================================================
   9) RESPONSIVE — 1100 / 880 / 560 only
   ============================================================ */

@media (max-width: 1100px) {
  /* One column. The numbers rail jumps ABOVE the tool so a phone user
     sees the permit figures without scrolling past 19 rows. */
  .cfm-layout { grid-template-columns: minmax(0, 1fr); }
  .cfm-results {
    order: -1;
    position: static;
    top: auto;
  }
  .cfm-results__inner { padding: clamp(18px, 3vw, 26px); }
  .cfm-live {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
  }
  .cfm-verdict { grid-column: 1 / -1; }
  .cfm-actions {
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
  }
  .cfm-actions__note,
  .cfm-status { grid-column: 1 / -1; }
}

@media (max-width: 880px) {
  .cfm-card--assume { grid-template-columns: minmax(0, 1fr); }
  .cfm-assume__aside { align-self: stretch; }

  .cfm-explain__grid { grid-template-columns: repeat(2, 1fr); }

  .cfm-tablewrap { max-height: 65vh; }

  /* iOS zooms any focused input under 16px. dev-enhancements.css does this
     globally for other forms; the CFM inputs are named explicitly here. */
  .cfm-page .field input,
  .cfm-table input.cfm-in { font-size: 16px; }
  .cfm-table input.cfm-in { padding: .38em .45em; }

  .cfm-rooms__head { flex-direction: column; }
  .cfm-rooms__tools { width: 100%; }
  .cfm-rooms__tools .btn { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .cfm-fields { grid-template-columns: 1fr; }
  .cfm-explain__grid { grid-template-columns: 1fr; }

  .cfm-live { grid-template-columns: 1fr; }
  .cfm-actions { grid-template-columns: 1fr; }

  .cfm-card { padding: 18px 16px; }
  .cfm-card--rooms { padding-inline: 12px; }
  .cfm-rooms__foot { flex-direction: column; align-items: stretch; }
  .cfm-rooms__foot .btn { width: 100%; justify-content: center; }
  .cfm-rowcount { text-align: center; }
}


/* ============================================================
   10) REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  .cfm-howto,
  .cfm-kit,
  .cfm-explain__item,
  .cfm-load__fill,
  .cfm-table input.cfm-in,
  .cfm-page .field input,
  button.cfm-del,
  .cfm-balance-fix,
  .cfm-verdict {
    transition: none !important;
  }
  .cfm-howto:hover,
  .cfm-kit:hover,
  .cfm-kit:focus-within,
  .cfm-explain__item:hover,
  button.cfm-del:hover { transform: none; }
  .cfm-status.is-busy::before { animation: none; }
}


/* ============================================================
   11) PRINT — this IS the permit document
   Target: one US-Letter page, flat ink on white, real table rules.
   ============================================================ */

@media print {

  @page { size: letter; margin: 0.5in; }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 9.5pt;
    line-height: 1.32;
  }

  /* ---- Hide the web ---- */
  .site-header,
  .site-header__utility,
  .slogan-band,
  .site-footer,
  #lulu-assistant-root,
  .nav-toggle,
  .nav,
  .page-band,
  .cfm-band,
  .cfm-rooms__tools,
  .cfm-rooms__foot,
  .cfm-actions,
  .cfm-howto,
  .cfm-assume__aside,
  .cfm-explain,
  .cfm-empty,
  .cfm-rowact,
  .cfm-c-act,
  .cfm-balance-fix,
  .hp-field {
    display: none !important;
  }

  /* Blank rows collapse — JS marks them .is-blank. */
  tr.cfm-row.is-blank { display: none !important; }

  /* ---- Show the print furniture ---- */
  .cfm-printhead {
    display: flex !important;
    align-items: center;
    gap: 12pt;
    border-bottom: 2pt solid #000;
    padding-bottom: 6pt;
    margin-bottom: 10pt;
  }
  .cfm-printhead__banner {
    width: 92pt;
    height: auto;
    flex: 0 0 auto;
  }
  .cfm-printhead__title { display: block; }
  .cfm-printhead__title strong {
    display: block;
    font-family: var(--font-display);
    font-size: 15pt;
    line-height: 1.1;
    color: #000;
  }
  .cfm-printhead__title span {
    display: block;
    font-size: 8.5pt;
    color: #333;
    margin-top: 2pt;
  }

  .cfm-printfoot {
    display: block !important;
    margin-top: 8pt;
    padding-top: 5pt;
    border-top: 1pt solid #999;
    font-size: 7.4pt;
    line-height: 1.35;
    color: #222;
    break-inside: avoid;
  }
  .cfm-printfoot p { margin: 0 0 2pt; }
  .cfm-printfoot__brand { color: #555; font-style: italic; }

  /* ---- Flatten every gradient, shadow and glow ---- */
  .cfm-page,
  .cfm-card,
  .cfm-card--assume,
  .cfm-results__inner,
  .cfm-verdict,
  .cfm-erv,
  .cfm-kit,
  .cfm-tablewrap,
  .cfm-table,
  .cfm-table thead th,
  .cfm-table tfoot .cfm-totals td,
  .cfm-explain__item {
    background: #fff !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    color: #000 !important;
  }
  .cfm-card--assume::before,
  .cfm-results__inner::after { display: none !important; }

  /* ---- Page shell ---- */
  .cfm-page { padding: 0 !important; }
  .cfm-page .container { max-width: none; padding-inline: 0; }
  .cfm-layout { display: block !important; }
  .cfm-main { display: block !important; }
  .cfm-results {
    position: static !important;
    order: 0 !important;
    display: block !important;
    break-inside: avoid;
  }

  .cfm-card {
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 0 8pt !important;
    overflow: visible !important;
    break-inside: avoid;
  }
  .cfm-card__title {
    font-size: 10.5pt !important;
    margin: 0 0 3pt !important;
    color: #000 !important;
  }
  .cfm-card__sub { display: none !important; }

  /* ---- Assumptions: one compact line-up ---- */
  .cfm-card--assume {
    display: block !important;
    border: 1pt solid #999 !important;
    padding: 5pt 7pt !important;
    margin-bottom: 8pt !important;
  }
  .cfm-assume-list {
    display: block;
    font-size: 8pt;
  }
  .cfm-assume-list li {
    display: inline;
    padding-left: 0;
    font-size: 8pt;
  }
  .cfm-assume-list li::before { display: none; }
  .cfm-assume-list li + li::before {
    content: " · ";
    display: inline;
    position: static;
    width: auto; height: auto;
    background: none;
    box-shadow: none;
    color: #666;
  }
  .cfm-assume-list b { color: #000 !important; }
  .cfm-assume-note {
    display: block;
    margin-top: 3pt;
    padding: 0;
    border: none !important;
    border-left: 2pt solid #999 !important;
    border-radius: 0 !important;      /* else the lone left edge prints as "(" */
    padding-left: 5pt;
    background: none !important;
    font-size: 8pt;
    color: #222 !important;
  }
  .cfm-assume-note > span[aria-hidden] { display: none; }

  /* ---- Project fields: four across, values must read ---- */
  .cfm-fields {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 3pt 10pt;
    margin-bottom: 8pt;
  }
  .cfm-page .field label {
    font-size: 7pt !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #555 !important;
    margin-bottom: 0 !important;
  }
  .cfm-req { display: none; }
  .cfm-assume-note > span[aria-hidden] { display: none !important; }
  .cfm-load, .cfm-load__bar, .cfm-load__fill, .cfm-kit { display: none !important; }

  .cfm-page input,
  .cfm-table input.cfm-in {
    border: none !important;
    background: none !important;
    color: #000 !important;
    box-shadow: none !important;
    outline: none !important;
    /* NOT zero on the left: Chrome's input editor clips at the border box and
       shaves the first glyph's side bearing — "Sample" prints as "5ample". */
    padding: 0 0 0 1.5pt !important;
    margin: 0 !important;
    font-size: 9pt !important;
    line-height: 1.3 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible;
    text-overflow: clip;
    -webkit-appearance: none;
    appearance: none;
  }
  .cfm-page .field input { border-bottom: .5pt solid #BBB !important; }

  /* ---- The room schedule: real engineering rules ---- */
  .cfm-tablewrap {
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
    border-radius: 0 !important;
  }
  .cfm-table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse !important;
    font-size: 8.6pt !important;
    table-layout: fixed;
  }
  thead { display: table-header-group; }
  tfoot { display: table-footer-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }

  .cfm-table th,
  .cfm-table td {
    border: 1px solid #999 !important;
    padding: 2.2pt 3.5pt !important;
    vertical-align: middle !important;
  }
  .cfm-table thead th {
    position: static !important;
    top: auto !important;
    height: auto !important;
    /* The one tint worth the ink: it separates the header from 19 data rows. */
    background: #E6E6E6 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    color: #000 !important;
    font-size: 7.4pt !important;
    letter-spacing: .03em;
    white-space: normal;
  }
  .cfm-unit {
    color: #444 !important;
    font-size: 6.4pt !important;
    margin-top: 0;
  }
  .cfm-table tbody tr td,
  .cfm-table tbody tr:nth-child(even) td,
  .cfm-table tbody tr:hover td,
  .cfm-table td.cfm-calc,
  .cfm-table td.cfm-c-calc,
  .cfm-table td.cfm-c-supply,
  .cfm-table td.cfm-c-exhaust {
    background: transparent !important;
    color: #000 !important;
  }
  .cfm-table tfoot .cfm-totals td {
    position: static !important;
    border-top: 1.6pt solid #000 !important;
    font-size: 9pt !important;
    padding: 3pt 3.5pt !important;
  }
  .cfm-totals__label { color: #000 !important; font-size: 7.4pt !important; }

  /* ---- Results: white card, dark text, laid out wide ---- */
  .cfm-results__inner {
    border: 1pt solid #999 !important;
    border-radius: 0 !important;
    padding: 6pt 8pt !important;
    margin-top: 8pt;
  }
  .cfm-results__title {
    color: #000 !important;
    font-size: 9pt !important;
    letter-spacing: .08em;
    margin: 0 0 4pt !important;
  }
  .cfm-live {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6pt 12pt !important;
    align-items: start;
  }
  .cfm-live[hidden] { display: grid !important; }
  .cfm-verdict {
    grid-column: auto !important;
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
  }
  .cfm-verdict__label,
  .cfm-erv__label {
    color: #555 !important;
    font-size: 7pt !important;
  }
  .cfm-verdict__value {
    color: #000 !important;
    font-size: 20pt !important;
    text-shadow: none !important;
  }
  .cfm-verdict.is-error .cfm-verdict__value,
  .cfm-verdict.is-error .cfm-verdict__label,
  .cfm-verdict.is-error .cfm-verdict__msg { color: #000 !important; }
  .cfm-verdict__msg { color: #333 !important; font-size: 7.6pt !important; }

  .cfm-stats { grid-column: span 2; }
  .cfm-stat {
    padding: 1pt 0 !important;
    border-bottom: .5pt solid #CCC !important;
  }
  .cfm-stat:first-child { border-top: .5pt solid #CCC !important; }
  .cfm-stat dt { color: #333 !important; font-size: 8pt !important; }
  .cfm-stat dd { color: #000 !important; font-size: 8.6pt !important; }

  .cfm-erv {
    grid-column: 1 / -1;
    border: none !important;
    border-top: .5pt solid #CCC !important;
    border-radius: 0 !important;      /* same arc problem on the top edge */
    padding: 3pt 0 0 !important;
  }
  .cfm-erv__value { color: #000 !important; font-size: 10.5pt !important; }
  .cfm-load, .cfm-kit { display: none !important; }

  /* Nothing on the sheet should carry a focus ring. */
  .cfm-page *:focus,
  .cfm-page *:focus-visible { outline: none !important; }
}
