/* ==========================================================================
   ONE SPACING SCALE FOR THE WHOLE SITE — 09/25/2026, ROUND R364.

   ⛔ SCOTT ASKED FOR SPACING TO BE STANDARDIZED AND PICKED `1A 2A 3A 4A` from
   `claude/SPACING-AUDIT-2026-09-25.md`, with the same instruction the button
   and heading rounds got, VERBATIM: "i don't want to do one page at a time, i
   want all the pages done at the same time, it takes too long to do one page
   at a time."

   ⚠️ WHAT THE AUDIT MEASURED ON 67 PAGES AT 1440px, 09/25/2026:
     - the room inside a card ran 10px → 41px, in nine different values
     - the gap between two sections ran 0px → 66px, in a dozen values
     - the gap between two form rows ran 9px → 114px
     - six email pages were capped at 820px with 352px of empty screen beside
       them, while 61 other pages filled the window
     - text boxes were 32, 36, 40 or 48px tall depending on the page

   ✅ HIS FOUR PICKS, AND THEY ARE THE ONLY NUMBERS IN THIS FILE:
     1A  20px between sections, and between the page title and the first card
     2A  16px of room inside a card, and below a section's band
     3A  14px between form rows (a label to its own box stays 6px)
     4A  the email pages fill the window; the letter being written keeps a
         readable ~820px, and what it is about sits BESIDE it on a wide screen

   ⛔ THIS FILE IS SERVED LAST, AFTER `headings.css`, FOR THE SAME REASON THAT
   ONE IS SERVED AFTER `buttons.css`: the numbers it has to beat are spread
   across three older stylesheets at equal or lower weight, and source order is
   what settles a tie. ⛔ A SPACING NUMBER WRITTEN ANYWHERE ELSE IS A DEFECT,
   and `tests/spacing_standard_test.py` counts them.

   ⚠️ OUT OF SCOPE, BY SCOTT ON 09/25/2026: table row heights. The compact
   41–49px rows stay exactly as they are.
   ========================================================================== */

/* ==========================================================================
   1. THE PAGE FILLS THE WINDOW — 36px of gutter, and no cap.
   ⚠️ MEASURED: the Admin Manual stopped 122px from the right edge, the
   Meetings list 112px and the Staff Meeting Agenda 62px, each because the page
   had written its own width. Scott, 09/25/2026: "fill the screen".
   ========================================================================== */
main.container {
  /* ⛔ `!important` ON THE GUTTER ALONE. Scott, 09/25/2026: "fill the screen".
     MEASURED: the assessment set its own 14px at phone width and the Admin
     Manual, the Meetings list and the agenda each wrote their own width a
     different way. A page does not get to choose how far from the edge it
     starts. */
  max-width: none !important;
  padding-left: var(--page-gutter) !important;
  padding-right: var(--page-gutter) !important;
  margin-left: 0;
  margin-right: 0;
}
/* ⛔ THE THREE PAGES THAT WROTE THEIR OWN WIDTH. Each says it a different way
   -- a max-width, an auto margin, a wider padding -- so each is named. */
main[data-page="admin-manual"],
main[data-page="meetings"],
main[data-page="meeting"],
main[data-page="care-specifics"] {
  max-width: none;
  padding-left: var(--page-gutter);
  padding-right: var(--page-gutter);
}

/* ==========================================================================
   2. 1A — 20px BETWEEN SECTIONS.
   ⛔ THE GAP BELONGS TO THE CARD ABOVE IT, NEVER TO THE ONE BELOW. Writing it
   both ways is how the audit found 32px and 40px gaps that nobody had asked
   for: two rules each adding their own half.
   ⚠️ AND A PAGE WRAPS ITS SECTIONS IN A BARE DIV MORE OFTEN THAN IT DOES NOT
   (`<div id="family-contacts">`), so the second level is named too.
   ========================================================================== */
/* ⛔ EVERY TOP-LEVEL BLOCK, NOT A LIST OF THE ONES SOMEBODY REMEMBERED. The
   audit found 0px, 4px, 8px, 12px, 16px, 18px, 22px, 26px, 28px, 32px and 66px
   gaps, and most of them were between a card and something that is not a card
   -- a title, a toolbar, a paragraph, a bare wrapper a page happens to use.
   ⚠️ A NAMED LIST IS HOW THIS DRIFTS BACK: the next page that wraps its
   sections in a new class is not in it. */
/* ⛔ AND THE NUMBER IS `!important`, WHICH NOTHING ELSE IN THIS FILE IS.
   The gap between two sections is the decision itself, and MEASURED
   09/25/2026 it was being set by a dozen page rules that each out-weighed a
   plain one: `p.muted.small` beats `main.container > *` on specificity alone,
   so the Audit log kept 12.8px; `.pb-type-panel` kept the Playbook at 8px.
   ⚠️ Out-specifying them one at a time is how the next page gets missed --
   the same argument the heading round's straddle rests on. */
main.container > * {
  margin-top: 0 !important;
  margin-bottom: var(--section-gap) !important;
}
/* ...and a bare wrapper is not a section: its children are.
   ⛔ EXCEPT WHERE THE WRAPPER IS A ROW. ⚠️ SCOTT, 09/28/2026, of the Owner
   Dashboard: "last tile is bigger than the others". MEASURED: `.ds-tiles` is a
   `div` under `main.container`, so its four tiles were each given 20px of
   SECTION GAP underneath -- and the `:last-child` rule below then took that
   margin off the fourth one alone. The grid row is sized by the three tiles
   WITH a margin (88 + 20 = 108), and the fourth, having none, stretched to
   fill it. One tile 20px taller than its neighbours, from a rule about the
   space between sections.
   ⛔ A ROW OF TILES IS ONE BLOCK, NOT FOUR STACKED ONES. The same is true of
   any grid or flex row a page uses to lay things out side by side, which is
   why this is `display`-based and not a list of class names -- a list is how
   this drifts back the moment somebody adds another row. */
main.container > div:not(.ds-section):not(.panel):not(.card):not(.ds-card):not(.ds-tiles):not(.ds-toolbar):not(.todo-line):not(.action-grid):not(.ds-form-actions) > * {
  margin-top: 0 !important;
  margin-bottom: var(--section-gap) !important;
}
/* ⚠️ AND THE SAME FAULT, ON THE SAME DAY'S RULE, ON THE ADMINISTRATOR
   DASHBOARD. Scott, 09/29/2026: "Administrator dashboard has the fourth tile
   bigger than the others." MEASURED: `.action-grid` is a div of four cards
   under `main.container`; three carried the 20px section gap and the fourth,
   as `:last-child`, did not -- 93px beside 113px. */
/* ⚠️ AND AGAIN, 10/01/2026, Care Plans Due: "the icon next to no care plans due is not aligned with the
   wording". MEASURED: `.todo-line` is a flex row under `main.container`; its icon carried the 20px
   section gap and its words, as `:last-child`, did not -- the icon sat 11px high. */
/* ⚠️ AND 10/03/2026, the Incident Report review page: its actions row (Complete review, Save as
   draft, Delete) sits straight under `main.container`; the first two buttons carried the 20px
   section gap and Delete, as `:last-child`, did not -- it sat 10px lower than the other two. */
main.container > .todo-line > *,
main.container > .ds-tiles > *, main.container > .ds-toolbar > *, main.container > .action-grid > *,
main.container > .ds-form-actions > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}
/* ⛔ AND WHERE THE PAGE STACKS ITS SECTIONS WITH `gap` RATHER THAN MARGINS,
   THE GAP IS THE SAME NUMBER. MEASURED: the Residents page read 28px between
   its search box and the first house with BOTH margins at zero -- the number
   was the flex container's own `gap` and no margin rule could have touched
   it. */
main.container,
main.container > div:not(.ds-section):not(.panel):not(.card):not(.ds-card):not(.ds-form-actions) {
  row-gap: var(--section-gap);
}
/* ...and the last one owes the page nothing. */
main.container > :last-child,
main.container > div:not(.ds-section):not(.panel):not(.card):not(.ds-card):not(.ds-tiles):not(.ds-toolbar):not(.todo-line):not(.action-grid):not(.ds-form-actions) > :last-child {
  margin-bottom: 0 !important;
}
/* ⛔ AND A CARD'S OWN CHILDREN ARE NOT SECTIONS -- that is section 3 below,
   and without this exclusion the two rules fight over every paragraph. */

/* ==========================================================================
   3. 2A — 16px OF ROOM INSIDE A CARD.
   ⚠️ MEASURED: 41px on the SEO, Financials and RingCentral pages, 25px on the
   nine profile tabs, 39px on the Move-In and Move-Out tabs, 17px on the
   Playbook. All of it written page by page, none of it decided.
   ========================================================================== */
/* ⛔ THE ROOM IS THE CHILDREN'S MARGIN, NOT THE CARD'S PADDING, AND THAT IS
   NOT A STYLE CHOICE. MEASURED 09/25/2026: of the cards on this site, some pad
   themselves, some pad an inner wrapper, and some pad neither and let each
   child do it -- so a rule that pads the card doubled the room on a third of
   the pages and did nothing on another third. ⚠️ Asking every child for the
   same margin is the one form that lands identically on all three. */
main.container .ds-section,
main.container .panel,
main.container .card,
main.container .ds-card { padding: 0; }

/* ⛔ `!important`, AND THE BANDS, BODIES AND THE ONE SCROLLER ARE NAMED OUT OF
   IT RATHER THAN OVERRIDDEN AFTER. MEASURED on the Care Plan tab: the Quick
   Actions row and the allergy form sat at the card's edge while every pair
   beside them was 12px in, because `body.ds-c .profile-panel form.allergy-form
   { margin: 0 }` out-weighs any plain rule -- and
   `tests/profile_quick_actions_band_test.py` read it as two columns on one
   page. The room inside a card is decision 2A; a page does not get a vote. */
main.container .ds-section:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .panel:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .ds-card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body) {
  margin-left: var(--card-pad) !important;
  margin-right: var(--card-pad) !important;
}
/* ⛔ AND ONE MECHANISM INSIDE A CARD, NOT TWO. ⚠️ MEASURED on Call-Offs: the
   card stacks its content with `gap`, so a band that also carried 16px
   underneath put 28px between itself and the first row -- two rules each
   adding their own half, which is the same failure the section gap had.
   ✅ The gap goes to zero and every child carries its own 12px, so the space
   under anything is that thing's margin and nothing else. ⚠️ 12px, not 16: the
   room at the card's EDGE and the gap BETWEEN two things inside it are
   different numbers, and the audit's scale names both. */
main.container .ds-section,
main.container .panel,
main.container .card,
main.container .ds-card { row-gap: 0; }
main.container .ds-section:not(form) > * + *,
main.container .panel:not(form) > * + *,
main.container .card:not(form) > * + *,
main.container .ds-card:not(form) > * + * { margin-top: var(--inside-gap); }
/* ⚠️ AND THE PROFILE'S TAB HEADING GETS THAT GAP WHETHER OR NOT SOMETHING
   SITS BEFORE IT. Scott, 09/29/2026: "The word contacts on the resident
   profile contacts page is not the same distance from the top of the section
   as the word Profile is from the top of it's section ... everyone from
   contacts on is not correct." MEASURED: Profile and Care Plan read 13px
   because the lock button is the card's first child and the heading its
   second; the seven tabs with no lock button read 1px (Contacts 3px). */
main.container .panel > .tab-heading:first-child,
main.container .panel > .contacts-title-row:first-child { margin-top: var(--inside-gap); }
/* ⚠️ A CARD THAT IS ITSELF THE FORM IS GOVERNED BY THE FORM GAP, NOT THE
   INSIDE GAP. MEASURED on the residency contract, which is one
   `<form class="panel stack-form">`: its rows took the row gap AND the card's
   inside gap AND the label's own 6px, and read 32px where 6px was meant. */
main.container form.panel > * + *,
main.container form.card > * + * { margin-top: 0; }
/* ⛔ AND A CARD THAT IS THE FORM PADS ITSELF INSTEAD OF MARGINING ITS ITEMS.
   MEASURED on the residency contract at 390px: its boxes are grid items sized
   to the card's FULL width, so a 12px left margin pushed each of them 11px
   past the card's right edge -- `tests/field_standard_test.py` caught it.
   ⚠️ Padding the form is the same 16px of room and the items size to what is
   left, which a margin cannot do. */
main.container form.panel,
main.container form.card,
main.container form.ds-section {
  /* ⚠️ ALL FOUR SIDES. The first cut padded left and right only, and the
     residency contract's first group title sat on the card's top edge
     (MEASURED in the form-field round's own screenshot, 09/25/2026). */
  padding: var(--card-pad);
}
main.container form.panel > *,
main.container form.card > *,
main.container form.ds-section > * { margin-left: 0 !important; margin-right: 0 !important; max-width: 100% !important; }
/* ⛔ AND A TABLE THAT IS ASKED TO STEP IN MUST ALSO BE ASKED TO NARROW.
   MEASURED 09/25/2026: a `<table width:100%>` inset by the card room is 100%
   of the CARD, so it ran 11-15px past its own card's right edge on Repairs,
   the Playbook, Call-Offs, Staff accounts and the To-do list --
   `tests/field_standard_test.py` caught all five on a 390px screen. */
main.container .ds-section:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .panel:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
main.container .ds-card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body) { max-width: calc(100% - 2 * var(--card-pad)) !important; }
/* ⚠️ EXCEPT THE ONE THING THAT RUNS EDGE TO EDGE ON PURPOSE: the Weekly
   Report's sideways scroller. `#weeks > .wk-panel-scroll` zeroes its own
   margins with `!important` so a table wider than any screen can be dragged;
   capping its width put a 32px step back in front of it
   (`tests/weekly_report_table_test.py`). */
main.container .panel > .wk-panel-scroll { max-width: none; }
/* ⚠️ AND A TABLE INSIDE A CARD BODY STAYS INSIDE IT. MEASURED on the Owner
   Dashboard: the house table measured 1105px in a 1104px body -- one pixel of
   border rounding -- and `tests/dashboard_house_rows_test.py` reads that as a page
   that scrolls sideways. */
/* ⛔ A BODY THAT PADS ITSELF IS NOT ALSO MARGINED. `.ds-section-body` has
   always carried the room as padding, so the children's-margin rule above
   gave it 16px MORE -- 32px of room in a card that measured 16 at its edge,
   because the probe reads where the body starts, not where its table does.
   MEASURED on the Owner Dashboard: the house table lost 32px and its longest
   row then ran 1px past the body (`tests/dashboard_house_rows_test.py`). */
main.container .ds-section > .ds-section-body,
main.container .panel > .panel-body,
main.container .ds-card > .ds-card-body {
  margin-left: 0; margin-right: 0; max-width: none;
  padding: var(--inside-gap) var(--card-pad);
}
main.container .ds-section > table,
main.container .panel > table,
main.container .card > table,
main.container .ds-card > table { width: calc(100% - 2 * var(--card-pad)); }

/* ⛔ A BAND RUNS EDGE TO EDGE. That is decision 1A of the heading round of the
   same day, and insetting it here would undo it. ⚠️ The Level 2 pill is NOT in
   this list: it carries its own 14px inset from `headings.css`, said there
   with `!important` because where it sits is that round's decision. */
main.container .ds-section > .ds-section-head,
main.container .panel > .house-panel-header,
main.container .panel > .panel-header,
main.container .panel > h2:first-child,
main.container .kv-section-head.kv-band.ds-hband { margin-left: 0; margin-right: 0; }

/* ⛔ AND THE GAP UNDER A BAND IS ONE NUMBER, SAID IN ONE PLACE. MEASURED on
   Call-Offs: the band carried 12px of its own underneath and the row below it
   carried 16px, and the page read 28. ⚠️ AND FIXING IT ON THE CHILD IS HOW IT
   CAME BACK THE OTHER WAY -- the Playbook's bands then read 0, because there
   the gap had always been the band's. ✅ So the gap belongs to the BAND, which
   is the same rule the section gap follows: the space under a thing belongs to
   the thing above it. ⛔ ONLY UNDERNEATH -- the air ABOVE a band belongs to the
   page, and zeroing that stripped 16px off every band on Repairs &
   Maintenance, the exact thing Scott reported on 09/22/2026. */
/* ⛔ AND A BAND THAT IS ITS CARD'S FIRST CHILD SITS FLUSH WITH THE TOP.
   ⚠️ SCOTT, 09/28/2026, WITH TWO SCREENSHOTS OF REPAIRS & MAINTENANCE among a
   batch of "spacing is off in many of these". MEASURED that day, the top of the
   first band in a card, across the site:
       Owner Dashboard, Projections   0px
       Call-Offs, To-do               1px   (the card's own outline)
       Licenses                      14px
       Playbook                      15px
       Repairs & Maintenance         17px
   FIVE ANSWERS. The last three leave a white ledge above the band with the
   card's rounded corners showing through it, which reads as a mistake because
   it is one.
   ⚠️ AND THE MARGIN IS LEFT OVER FROM BEFORE THIS FILE EXISTED. headings.css
   records why it was added -- Scott, 09/22/2026: the bands were "pushed way to
   the top of the section with no white space above it". That white space is the
   gap BETWEEN sections, and since 09/25/2026 it is `--section-gap`, set here,
   20px, on every page. A second copy of it inside the card is the ledge.
   ✅ Decision 1A is the Owner Dashboard's band: it starts where its card
   starts. */
/* ⛔ AND FLUSH AT THE SIDES TOO, FOR THE SAME REASON. MEASURED the same day:
   the first band's left inset was 0px on the Owner Dashboard and Projections,
   1px on Call-Offs and the To-do page, and 16px on Repairs' house cards, the
   Playbook's type panels and Licenses -- so a band could start at the card's
   edge on one page and 16px inside it on the next. A band is the card's own
   top row; it starts where the card starts. */
main.container .panel > .kv-section-head.kv-band:first-child,
main.container .ds-section > .kv-section-head.kv-band:first-child,
main.container .panel > .house-panel-header:first-child,
main.container .panel > h2:first-child,
main.container .ds-section > .ds-section-head:first-child,
/* ⛔ AND A FOLD'S OWN BAND, WHICH IS ONE LEVEL DEEPER. A collapsible section is
   `<details><summary><band></summary>`, so the band's parent is the summary and
   none of the selectors above reach it.
   ⚠️ THIS IS SCOTT'S OUTSTANDING "COMPLETED HISTORY ALIGNMENT" FROM 09/25/2026,
   which an earlier round could not reproduce and asked him for a window size
   about. It is not a width at all: on Repairs & Maintenance six bands sat at
   0px above their cards and "Completed history" at 16px, so it alone stood a
   ledge lower than everything else on the page. */
main.container summary > .kv-section-head.kv-band:first-child {
  margin-top: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

main.container .ds-section > .ds-section-head,
main.container .panel > .house-panel-header,
main.container .panel > .panel-header,
main.container .panel > h2:first-child,
main.container .panel > .kv-section-head.kv-band.ds-hband { margin-bottom: var(--card-pad); }
/* ⛔ BUT A CLOSED FOLD HAS NOTHING UNDER ITS BAND, so that 16px is a white
   strip hanging off the bottom of the heading (MEASURED 10/03/2026 on the
   Weekly Report's "How to keep payroll costs low": a 52px band in a 68px
   card). Closed, the band IS the card -- the same answer Wage Reduction's own
   folds already had (headings.css, `details.wr-panel:not([open])`). */
main.container details.ds-section-fold:not([open]) > .ds-section-head { margin-bottom: 0; }
/* ⛔ AND CLOSED, THE BAND OWNS ALL FOUR CORNERS, AND NOTHING ELSE IS DRAWN.
   Scott, 10/03/2026, of Repairs & Maintenance's "Completed history": a white
   strip under the dark band when it is shut. The band's own bottom corners are
   square (it is the top row of an open card), so a closed fold relied on the
   card's clip to round them, and on the browser to hide the body; either one
   failing shows the white card under the band. Neither is left to chance. */
main.container details.ds-section-fold:not([open]) > .ds-section-head { border-radius: inherit; }
main.container details.ds-section-fold:not([open]) > .ds-section-body { display: none; }
main.container details.ds-section-fold:not([open]) { padding-bottom: 0; min-height: 0; }
main.container .ds-section > .ds-section-head + *,
main.container .panel > .house-panel-header + *,
main.container .panel > .panel-header + *,
main.container .panel > h2:first-child + *,
main.container .panel > .kv-section-head.kv-band.ds-hband + * { margin-top: 0; }

/* ⛔ AND THE ROOM ABOVE AND BELOW THE CARD'S CONTENT IS THE SAME 16px. */
main.container .ds-section > :last-child,
main.container .panel > :last-child,
main.container .card > :last-child,
main.container .ds-card > :last-child { margin-bottom: var(--card-pad); }

/* ==========================================================================
   4. 3A — 14px BETWEEN FORM ROWS, 6px FROM A LABEL TO ITS OWN BOX.
   ⚠️ MEASURED: 39px on Add a resident, Edit resident, Staff accounts and My
   profile; 54, 80 and 104px on the residency contract; 34px on the email
   pages; 46px on the Groceries upload.
   ========================================================================== */
/* ⛔ A ROW IS "THE LAST BOX TO THE NEXT LABEL", AND THAT IS THE 14px. The
   6px is the label to its OWN box. ⚠️ MEASURED: the site's forms do not wrap a
   row in anything -- `form.stack-form` is a grid of alternating labels and
   boxes -- so one `gap` would have to serve both distances and every form on
   the site read 6.4px in both places, which is why a label looked as attached
   to the box above it as to its own. ✅ The gap is the ROW gap; the label
   gives back the difference. */
main.container .ds-form,
main.container form.stack-form,
main.container .ds-form-grid,
main.container .wc-form { display: grid; row-gap: var(--form-gap); }
main.container .ds-form > label,
main.container form.stack-form > label,
main.container .ds-form-grid > label {
  /* ⚠️ AND THE TOP MARGIN GOES. MEASURED: the labels carried 8px of their own,
     which the row gap then added to -- 22px above a label and 6px below it,
     when the whole point of 3A is that a label belongs to the box UNDER it. */
  /* ⛔ `!important` for the same reason the row gap is the decision: MEASURED
     on the residency contract, whose labels set their own 6px bottom margin
     two classes deep and read 20px above every box. */
  margin-top: 0 !important;
  margin-bottom: calc(var(--tight-gap) - var(--form-gap)) !important;
}
main.container .ds-field { display: grid; row-gap: var(--tight-gap); }
main.container .ds-field > label,
main.container .ds-field > .ds-label { margin: 0; }
main.container .ds-form > .ds-field,
main.container .ds-form > .ds-row { margin: 0; }

/* ⛔ AND ON A SCREEN, SHORT FIELDS STAND TWO ACROSS.
   ⚠️ MEASURED 09/25/2026: Add a resident, Edit resident, Staff accounts and My
   profile were one column of nine boxes, each 820px wide for a first name --
   half a screen of white space beside them and a page you have to scroll.
   ⛔ AND IT IS `columns`, NOT A TWO-COLUMN GRID, FOR A REASON: these forms are
   a flat run of `<label>` then `<input>`, with nothing wrapping a row, so a
   grid puts a label BESIDE its own box. `break-after: avoid` on the label is
   what keeps the pair together, and the ratchet measures that every label is
   still directly above its own box. */
@media (min-width: 1025px) {
  main.container form.stack-form {
    display: block;
    columns: 2;
    column-gap: var(--section-gap);
    /* ⚠️ TWICE THE ONE-COLUMN WIDTH, NOT THE OLD CAP. These forms carried
       `max-width: 480px` for a single column; leaving it would have made two
       columns of 230px, which is narrower than a date box. */
    max-width: calc(2 * var(--form-col) + var(--section-gap));
    /* ⚠️ `auto`, NOT `100%`. A block already fills what is left after its own
       margins; `100%` is 100% of the CARD, so a form inside one overhung it by
       exactly the card room -- MEASURED at 15px on My profile. */
    width: auto;
  }
  main.container form.stack-form > label {
    display: block;
    break-after: avoid;
    margin-top: var(--form-gap) !important;
    margin-bottom: var(--tight-gap) !important;
  }
  main.container form.stack-form > :not(label) { break-before: avoid; }
  /* ⛔ A LONG BOX AND THE SAVE BUTTON SPAN BOTH COLUMNS. */
  /* ⛔ A LONG BOX AND THE SAVE BUTTON SPAN BOTH COLUMNS, AND THEY HAVE TO BE
     BLOCKS TO DO IT. MEASURED: `column-span: all` is ignored on an
     inline-level box, so the notes box and the Save button stayed in column
     two with the button sitting beside the box it belongs under. */
  main.container form.stack-form > textarea,
  main.container form.stack-form > label:has(+ textarea) {
    column-span: all; display: block; width: 100%; box-sizing: border-box;
  }
  main.container form.stack-form > button,
  main.container form.stack-form > .form-actions {
    column-span: all; display: block; width: fit-content;
    margin-top: var(--section-gap) !important;
  }
  main.container form.stack-form > label:first-child { margin-top: 0 !important; }
}

/* ==========================================================================
   4b. THE TWO PHONE-FIRST PAGES KEEP THEIR SHAPE AND TAKE THE SCALE.
   ⚠️ The incident report and the phone assessment do not render inside the
   site's shell at all -- they are `body > .ir-main`, one question per card,
   48px boxes, designed to be filled in one-handed. ⛔ That stays. What they
   give up is their own gap between cards, MEASURED at 26px against everybody
   else's 20.
   ========================================================================== */
.ir-main .ir-form > .ir-card,
.ir-main .ir-form > .ir-section-title,
.ir-main .ap-shell .ir-card {
  /* ⛔ `!important`: the cards set their own 26px top margin, which is the
     number this round exists to remove. */
  margin-top: 0 !important;
  margin-bottom: var(--section-gap) !important;
}
.ir-main .ir-form > :last-child { margin-bottom: 0; }

/* ⛔ 40px IS THE BOX HEIGHT THE RULEBOOK HAS SAID SINCE 09/18/2026, and half
   the site was still drawing 32px or 36px. ⚠️ THE PHONE FORMS KEEP 48px --
   the assessment and the incident report are filled in one-handed and that
   number was measured against a thumb, not against a desk. */
/* ⚠️ `input:not([type])` IS IN THIS LIST because the Weekly Report's and the
   Interviewees' row editors name no type, and an attribute selector cannot see
   a default -- the trap the button round hit with `<button>`. ⚠️ CORRECTED
   09/25/2026: the first cut of this file blamed that for the 32px boxes on the
   Contacts and Communications tabs. It was not that; those inputs say
   `type="text"` and were held at 32px by a `min-height` two classes deep,
   which is what the `!important` below is for. */
main.container input:not([type]),
main.container input[type="text"],
main.container input[type="email"],
main.container input[type="tel"],
main.container input[type="number"],
main.container input[type="date"],
main.container input[type="time"],
main.container input[type="password"],
main.container input[type="search"],
main.container input[type="url"],
main.container select {
  /* ⛔ `!important`, FOR THE SAME REASON THE SECTION GAP IS. MEASURED: the
     Contacts and Communications add-forms, Call-Offs and the email pages each
     set `min-height: 32px` two or three classes deep, which out-weighs any
     plain rule written here. The box height is not a page's to choose -- the
     rulebook has said 40px since 09/18/2026. */
  min-height: var(--field-h) !important;
  box-sizing: border-box;
}
main[data-page="assessment-phone"] input,
main[data-page="assessment-phone"] select,
main[data-page="incident"] input,
main[data-page="incident"] select,
.ir-main input,
.ir-main select { min-height: 48px !important; }
/* ⚠️ AND A CONTROL INSIDE A TABLE ROW IS NOT A FORM BOX. The little dropdown
   that edits a value in place lives in a 41-49px row, and Scott put row
   heights out of scope by name on 09/25/2026 -- forcing 40px into a 41px row
   would break the one thing he asked to leave alone. */
main.container table input,
main.container table select { min-height: 0 !important; }

/* ==========================================================================
   5. 4A — THE EMAIL PAGES FILL THE WINDOW, THE LETTER STAYS READABLE.
   ⚠️ MEASURED: all six sat in an 820px column with 352px of empty screen to
   the right of them. Scott picked A: the page fills the window, the letter
   being written keeps ~820px because a line of prose that long is where
   reading slows, and what the letter is ABOUT -- who it goes to, what is
   attached, the note -- moves beside it on a wide screen instead of below.
   ========================================================================== */
/* ⛔ THE PAGE FILLS THE WINDOW. The cap that held these six at 820px is
   `main`'s own `max-width`, removed in section 1. */
main.container .email-composer,
main.container .wc-page,
main.container .wc-form,
main.container .em-wrap { max-width: none; width: 100%; }

/* ⛔ AND ON A WIDE SCREEN, WHAT THE LETTER IS ABOUT SITS BESIDE IT.
   ⚠️ 1200px is where the two columns both work: the letter keeps its readable
   820px and the column beside it still has 280px, which is what "Who it goes
   to" needs before its names start wrapping one per line. Below that the page
   is one column, in the order it is written. */
/* ⛔ ONLY A FORM THAT HAS A LETTER. Scott, 10/05/2026: the rate change email's
   details page (no letter yet) put every field in the right-hand column with
   the left one empty -- "all the fields are to the right, this is not correct". */
@media (min-width: 1200px) {
  main.container .wc-form:has(> .wc-letter) {
    grid-template-columns: minmax(0, var(--letter-w)) minmax(280px, 1fr);
    column-gap: var(--section-gap);
    align-items: start;
  }
  main.container .wc-form:has(> .wc-letter) > * { grid-column: 2; }
  /* ⛔ THE LETTER IS COLUMN ONE AND IT RUNS THE WHOLE HEIGHT. `span 50` rather
     than `1 / -1`: on an implicit grid the last line is not known, and
     `-1` resolves to the letter's own row, which puts every other panel under
     it again. */
  main.container .wc-form > .wc-letter { grid-column: 1; grid-row: 1 / span 50; }
  main.container .wc-form > .wc-panel { max-width: none; }
}

/* ==========================================================================
   6. THE PHONE — one gutter, everything else unchanged.
   ⚠️ 16px, not 36: MEASURED on a 390px screen, 36px each side leaves 318px of
   content and the Pricing questions stop fitting on one line, which is a thing
   Scott asked for by name on 09/24/2026.
   ========================================================================== */
/* ⚠️ A TEXTAREA IS NOT A FIELD HEIGHT. Its height is how many lines it holds,
   and forcing 40px made an empty notes box on the Care Plan tab draw two lines
   where Scott asked for one (`tests/care_plan_phone_density_test.py`). */

@media (max-width: 760px) {
  :root { --page-gutter: 16px; }
  main.container { padding-left: var(--page-gutter); padding-right: var(--page-gutter); }
  /* ⚠️ AND THE ONE OTHER PHONE NUMBER, TESTED AND KEPT: 12px of card room, not
     16. MEASURED 09/25/2026 -- at 16px every band card's table ran 15px past
     its own card on five pages, and the Care Plan tab grew past the ceiling
     Scott asked for on 09/24/2026. */
  main.container .ds-section:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .panel:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .ds-card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body) {
    margin-left: var(--card-pad-phone) !important;
    margin-right: var(--card-pad-phone) !important;
  }
  main.container .ds-section:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .panel:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body),
  main.container .ds-card:not(form) > *:not(.kv-section-head):not(.ds-section-head):not(.house-panel-header):not(.panel-header):not(h2:first-child):not(.wk-panel-scroll):not(.ds-section-body):not(.panel-body):not(.ds-card-body) { max-width: calc(100% - 2 * var(--card-pad-phone)) !important; }
  main.container .panel > .wk-panel-scroll { max-width: none; }
  main.container .ds-section > .ds-section-body,
  main.container .panel > .panel-body,
  main.container .ds-card > .ds-card-body {
    margin-left: 0; margin-right: 0; padding: var(--inside-gap) var(--card-pad-phone);
  }
  /* ⚠️ 44px BOXES ON A PHONE, NOT 40. The phone pages already drew 44px so a
     thumb lands on them and the browser does not zoom; forcing 40 took that
     away (`tests/calloffs_page_test.py`). The ratchet accepts 40, 44 or
     48 on a phone and never less. */
  main.container input:not([type]),
  main.container input[type="text"],
  main.container input[type="email"],
  main.container input[type="tel"],
  main.container input[type="number"],
  main.container input[type="date"],
  main.container input[type="time"],
  main.container input[type="password"],
  main.container input[type="search"],
  main.container input[type="url"],
  main.container select { min-height: 44px !important; }
  main.container .ds-section > table,
  main.container .panel > table,
  main.container .card > table,
  main.container .ds-card > table { width: calc(100% - 2 * var(--card-pad-phone)); }
  main.container form.panel,
  main.container form.card,
  main.container form.ds-section {
    padding-left: var(--card-pad-phone);
    padding-right: var(--card-pad-phone);
  }
  main.container form.panel > *,
  main.container form.card > *,
  main.container form.ds-section > * { margin-left: 0 !important; margin-right: 0 !important; }
}

/* ====================================================================== */
/* ⛔ A BORDERED BOX KEEPS AIR BETWEEN ITS EDGE AND WHAT IT HOLDS.        */
/* ⚠️ SCOTT, 09/28/2026, of a batch of screenshots: "the box within a box */
/* is off within some of these, alignment, spacing between wording and    */
/* the internal box". The shapes below each draw a real border and pad    */
/* only their TOP, so their words and boxes ran straight into the edge --  */
/* eleven pages of it, found by `SP-PAD` in `tools/design_check.py`, which */
/* was written the same afternoon because every rule that existed asked    */
/* where a box STARTS and none asked how much air is inside it.           */
/* ✅ 16px is the same `--card-pad` every other card already uses; this is */
/* that number said for the shapes that were missed, not a new one.       */
/* ⛔ TOP AND BOTTOM ARE LEFT ALONE. Each of these shapes has had its      */
/* vertical rhythm set deliberately by an earlier round -- the Care Plan   */
/* twice -- and this is a fix for the SIDES.                              */
.wk-f-sec, .ap-row, .ec-block, .alink-editor, .wr-hero-split,
.cp-group[class*="cp-group-"], .gr-meta-row {
  padding-left: var(--card-pad, 16px);
  padding-right: var(--card-pad, 16px);
}
/* ⚠️ AND THE PLAYBOOK'S ADD FORM HAD 6px, WHICH IS NOT NONE BUT IS NOT THE
   STANDARD EITHER -- the one shape here that looked almost right, which is
   how it survived four rounds of this page being worked on. */
form.pb-add { padding-left: var(--card-pad, 16px); padding-right: var(--card-pad, 16px); }

/* ⛔ AND ON A PHONE IT IS THE PHONE NUMBER, like every other card on the site.
   ⚠️ MEASURED 09/28/2026: 16px on the Care Plan's groups at 390px pushed the tab
   24px past the ceiling `tests/care_plan_phone_density_test.py` holds -- the
   narrower text wraps onto more lines, and that suite exists because Scott asked
   three rounds running for this page to fit. 12px is the site's phone card pad
   and it keeps the air without the extra lines. */
@media (max-width: 760px) {
  .wk-f-sec, .ap-row, .ec-block, .alink-editor, .wr-hero-split,
  .cp-group[class*="cp-group-"], .gr-meta-row, form.pb-add {
    padding-left: var(--card-pad-phone, 12px);
    padding-right: var(--card-pad-phone, 12px);
  }
}
