/* Harkham admin console — layout that exists ONLY on this surface.
 *
 * ⚠️ EVERY TOKEN AND EVERY SHARED PRIMITIVE LIVES IN `/shared/tokens.css`, WHICH `index.html`
 * LOADS BEFORE THIS FILE. Until 4 September 2026 the first 146 lines of this file were a
 * byte-identical copy of the first 146 lines of `public/agent/app.css`, each carrying a comment
 * explaining that the copy was deliberate. They had already diverged — see that file's header for
 * what the divergence cost on this surface specifically (nineteen unstyled `<select>` elements, a
 * dead `.note.ok` class, no per-field refusal style, and no touch-target block on a console Randy
 * uses on a phone).
 *
 * ⚠️ DO NOT DECLARE A CUSTOM PROPERTY OR A HEX COLOUR IN THIS FILE. `src/sharedDesignTokens.test.ts`
 * fails on either, and nor may it re-declare a shared primitive. What belongs here is
 * composition with no counterpart in the agent portal: the money derivation table, the sign-in
 * trail's user-agent column, and this surface's own narrow-width rail treatment. The shell and
 * the rail themselves moved to the shared sheet on 4 September 2026 — see the note below.
 */

/* ⚠️ THE CONSOLE SHELL AND THE GROUPED SIDE RAIL NOW LIVE IN `/shared/tokens.css`, MOVED THERE
 * 4 September 2026 (Run F) WHEN THE AGENT PORTAL GAINED A RAIL OF ITS OWN. `.shell`, `.side`,
 * `.navgroup`, `.glabel`, `.navitem` and their states are one rule set for both surfaces —
 * see that file for the reasoning, which is carried over unchanged including this console's own
 * "why a sidebar and not more tabs" argument and the measured min-width finding.
 *
 * What stays in THIS file is what is genuinely this surface's own: the narrow-width treatment
 * below (the console scrolls its rail sideways; the portal hides it and uses a bottom bar) and the
 * console's wider content column.
 */

/* Money: the derivation table. Monospaced figures in a right-hand column so the digits line up
 * and a reader can add them down the page. .sum is the rule-off-and-total row. */
.calc{width:100%;border-collapse:collapse;font-size:var(--t-body);max-width:480px}
.calc td{padding:var(--s1) 0;border:0}
.calc td.n{text-align:right;font-variant-numeric:tabular-nums;
  font-family:var(--font-mono);white-space:nowrap;padding-left:var(--s6)}
.calc tr.sum td{border-top:1px solid var(--line2);padding-top:var(--s2);font-weight:650;color:var(--ink)}
.calc tr.sum td.n{font-size:var(--t-h2)}
.calc td.op{color:var(--ink3);width:1%;white-space:nowrap;padding-right:var(--s2)}

/* The sign-in trail's user-agent column. A column width is the only thing that lets `.trunc` do its
 * job -- an ellipsis needs a boundary to be an ellipsis of. Without it one 120-character agent
 * string set the column width and every other column was squeezed around it. */
/* ~~.agentcell{max-width:220px}~~ OPS-136 step 12 (LA1-45): the agent string is shown in full now, so the
 * column has a floor rather than a ceiling, and the trail's cells break only at a space or a <wbr>
 * (an underscore, an "@", a dot) — never inside a word. The JSON detail may still break anywhere. */
.authtrail-table td:not(.nowrap):not(.n){overflow-wrap:normal}
.authtrail-table td.agentcell{min-width:16em}
.authtrail-table td.detailcell{overflow-wrap:anywhere}

/* ================================================================================================
   🔴 `.side.compact` — ELEVEN SECTIONS IN THE SPACE EIGHT USED TO TAKE. OPS-62 phase 2.
   ================================================================================================

   Randy, 16 September 2026, with the approved tree: *"Accordion default stays EXPANDED. Every
   top-level category visible without scrolling."* Those two together are an arithmetic problem, and
   the reorganisation makes it harder rather than easier: it goes from 8 sections to 11 and from 29
   items to 28-plus-a-foot, so at the metrics the shared sheet sets, the rail gets TALLER.

   ⚠️ A MODIFIER CLASS RATHER THAN AN EDIT TO THE SHARED RULES, AND THAT IS THE WHOLE REASON THIS
   BLOCK IS HERE INSTEAD OF IN `/shared/tokens.css`. `.navgroup`, `.glabel` and `.navitem` are one
   rule set for BOTH surfaces (that file's own header). The agent portal's rail has four sections
   and does not have this problem; tightening the shared rules to solve the console's would take
   20px of breathing room out of a rail that never needed it. `<nav class="side compact">` says
   which surface is asking.

   ⚠️ NOTHING HERE TOUCHES A COLOUR, A FONT SIZE OR A TOUCH TARGET. Only the space BETWEEN things:
   the group gap, the label's padding under itself, and the item's vertical padding. An item is
   still 28px tall at 12px of hit area plus its line box, which clears the 24px AA target for a
   pointer; the phone treatment below is untouched and still uses the full-size rule.
   ================================================================================================ */
/* ================================================================================================
   🔴 AND THE RAIL SCROLLS ITSELF, WHICH IS THE DEFECT THIS PHASE ACTUALLY FOUND.
   ================================================================================================

   MEASURED, not argued — `npm run inventory:console`, private context, 1440x900, nothing clicked:
   the rail's content is **1176px** in a **900px** viewport and `scrolls` was **false**, with the
   last item **304px below the fold**. Randy's own finding from OPS-61, in his words: *"does not
   scroll is the dangerous answer."*

   ⚠️ WHY "DOES NOT SCROLL" MEANT "CANNOT BE REACHED" HERE, WHICH IS NOT OBVIOUS. `.side` is
   `position: sticky; top: 0` with `min-height: calc(100vh - 52px)`. Nothing clipped it — it was
   simply 1176px tall — so the instinct is that the PAGE scroll reveals the rest. It does not: a
   sticky element pinned at `top: 0` starts pinned and stays pinned, so scrolling the page moves the
   content column and leaves the rail exactly where it is. The bottom 276px were off-screen at every
   scroll position. "Audit" and "My profile" were, at 1440x900, unreachable.

   ⚠️ THIS DOES NOT MEET *"every top-level category visible without scrolling"* AND IS NOT PRETENDING
   TO. It makes every category REACHABLE, which is strictly better than four of them being
   unreachable, and the shortfall is reported rather than absorbed: at these metrics 29 items and 11
   labels need ~1176px and the viewport offers ~848px. Closing that gap needs FEWER THINGS or
   COLLAPSED GROUPS, and both are the owner's call — `docs/90` §6 proposed the second and he has
   said expanded. See this run's report.

   ✅ SUPERSEDED 16 September 2026 (OPS-63 phase C) — THE OWNER HAS TAKEN BOTH OF THE TWO OPTIONS
   THIS PARAGRAPH NAMED, AND THE PARAGRAPH IS KEPT BECAUSE IT IS THE MEASUREMENT THAT FORCED THEM.
   *"1176px against 848px does not fit. 'Accept the scroll' was the right emergency fix and is the
   wrong end state."* So: **FEWER THINGS** — the four NOT BUILT items are gone from the rail
   (~112px, phase C.3) — and **COLLAPSED GROUPS** — docs/90 §6's own answer, now the default on a
   device that has never expressed a preference (phase C.1). The paragraph's own sentence *"he has
   said expanded"* was true on 15 September and is false now.

   U0001F534 AND THE COLLAPSE IS NOT SHIPPED ALONE, WHICH IS THE HALF WORTH REMEMBERING. Randy made
   all three of C.2 conditional on each other: the current screen's group opens by itself, the last
   state is remembered, and a FILTER BOX exists — *"without (c) an operator who does not know where
   a thing lives must open groups and hunt, which is worse than scrolling because it is invisible."*
   Collapsing without the filter trades a visible cost for an invisible one.
   ================================================================================================ */
.side.compact{padding:var(--s3) 0 var(--s4);max-height:calc(100vh - 52px);overflow-y:auto;overscroll-behavior:contain}
/* 20px of gap x 11 groups was 220px of the rail spent on nothing. The uppercase eyebrow and the
 * chevron already separate one section from the next -- the gap was doing a second job that the
 * label was already doing, which is affordable at eight sections and is not at eleven. */
.side.compact .navgroup{margin-bottom:var(--s3)}
.side.compact .glabel{padding-bottom:var(--s1)}
.side.compact .navitem{padding-top:var(--s1);padding-bottom:var(--s1)}
/* THE FOOT. Below every section, ruled off, and outside the accordion entirely -- it is the
 * operator's own account rather than a console area. The rule is what says "this is not one more
 * section"; without it "My profile" reads as an twelfth group that has lost its label. */
.navfoot{margin-top:var(--s4);padding-top:var(--s3);border-top:1px solid var(--line)}

/* ================================================================================================
   THE RAIL FILTER — OPS-63 phase C.2(c).
   ================================================================================================
   Aligned to `.glabel`'s own left padding (`--s5`) so the box sits on the same vertical line as
   every section name it filters, rather than floating in its own margin.

   ⚠️ `--navy` ON `--navy` IS DELIBERATE AND IS WHY THE BORDER IS `--line2` RATHER THAN `--line`.
   The rail's ground is already the INSET colour, so an inset-coloured field has no fill contrast
   against it at all — the border is the only thing that says "this is a control you may type in",
   and `--line` (L* 25.8, the default hairline) is not enough to carry that on its own. */
.navfilterwrap{padding:0 var(--s5) var(--s3)}
.navfilter{width:100%;padding:var(--s2);border-radius:var(--r-sm);border:1px solid var(--line2);
  background:var(--navy);color:var(--ink);font-size:var(--t-body);line-height:1.3}
.navfilter::placeholder{color:var(--ink3)}
.navfilter:focus-visible{outline:2px solid var(--cy);outline-offset:1px;border-color:var(--cy2)}
/* Empty until the filter is used, so it costs nothing in the resting state — the whole point of
   this phase is a rail that FITS, and a permanent count line would spend rail height saying "29". */
.navfiltercount{font-size:var(--t-micro);color:var(--ink3);padding-top:var(--s1);min-height:0}
/* A group whose label still shows but whose every item was filtered out. Dimmed rather than hidden:
   hiding the label would make the rail's shape change as you type, and a section that vanishes and
   returns is harder to read than one that greys. */
.navgroup.nomatch > button.glabel{color:var(--ink3);opacity:.45}

/* ================================================================================================
   `.micro` — A SECOND LINE INSIDE A DENSE TABLE CELL. OPS-63 phase B.4.
   ================================================================================================
   The voyage schedule puts three facts in one capacity cell: the sold/held/allotted triple, what is
   LEFT, and what the deck is made of. The second and third are subordinate to the first and must
   read that way, or the cell becomes three equal numbers and the row stops being scannable.

   ⚠️ IT IS NOT `uppercase`/`letter-spacing`, WHICH IS WHAT EVERY OTHER `--t-micro` RULE IN THE
   SHARED SHEET DOES. Those are LABELS — column headers, stat captions, pills. This carries VALUES
   ("87.6 m left", "3× SEDAN 16.5m"), and tracked uppercase makes a number harder to read, not
   easier. `tabular-nums` for the same reason the `.n` column alignment exists.

   ⚠️ DECLARED HERE BECAUSE IT WAS EMITTED FIRST AND STYLED SECOND, WHICH IS THE ORDER THAT GOES
   WRONG. `src/stateClassesAreStyled.test.ts` exists because `class="warn"` shipped with no rule
   matching it: the markup was correct, every assertion passed, and the browser rendered it as
   ordinary body text. That test guards `warn`/`bad`/`ok` only — it would not have caught this one,
   which is the argument for writing the rule in the same commit as the class rather than trusting a
   guard whose list this name is not on. */
.micro{font-size:var(--t-micro);line-height:1.35;font-variant-numeric:tabular-nums;font-weight:400}

/* ⚠️ THE BREAKPOINT IS 768px ON BOTH SURFACES, 4 September 2026. It was 900 here and 620 in the
 * portal and 760 in the shared grid rules -- three numbers for one idea, so a layout could be in
 * its narrow mode and its wide mode at the same time depending on which rule you read. */
@media(max-width:767px){
  /* The foot joins the horizontal strip as one more item rather than keeping a top rule that would
   * draw a line down the middle of a row. */
  .navfoot{margin-top:0;padding-top:0;border-top:0;display:flex;align-items:center;flex:0 0 auto}
  /* The narrow strip scrolls SIDEWAYS and is as tall as one row, so a vertical scroller here would
   * be a second scroll axis on an element that needs none — and `max-height` against `100vh` on a
   * phone is the viewport-unit trap (the browser chrome makes `100vh` taller than what is visible). */
  .side.compact{padding:var(--s2) 0;max-height:none;overflow-y:visible}
  /* 🔴 L3-62: THE MENU FILTER KEEPS A WIDTH THAT SAYS WHAT IT IS. As the first item of this sideways strip it was
   * shrunk to its own padding (58 px at 390), an empty box with its placeholder clipped away, so nobody could tell
   * the one control that finds "Refunds" among forty destinations was there. */
  .navfilterwrap{flex:0 0 12rem;padding:0 var(--s3);align-self:center}
  .side.compact .navgroup{margin-bottom:0}
  .side.compact .navitem{padding-top:var(--s2);padding-bottom:var(--s2)}
  .shell{grid-template-columns:minmax(0,1fr)}
  .side{position:static;min-height:0;border-bottom:1px solid var(--line);
    display:flex;gap:0;overflow-x:auto;padding:var(--s2) 0}
  .navgroup{margin:0;display:flex;align-items:center;flex:0 0 auto;
    border-right:1px solid var(--line);padding-right:var(--s1);margin-right:var(--s1)}
  .glabel{padding:0 var(--s2) 0 var(--s3);white-space:nowrap}
  .navitem{width:auto;white-space:nowrap;border-left:0;border-bottom:2px solid transparent;
    padding:var(--s2) var(--s3);align-items:center}
  .navitem.on{border-left:0;border-bottom-color:var(--cy);background:var(--accent-wash)}
  /* 🔴 NO ACCORDION IN THE NARROW STRIP, AND THIS IS A DECISION RATHER THAN AN OMISSION — OPS-53
   * phase E. Above 768px the rail is a vertical column of eight stacked sections, which is what an
   * accordion is for. Below it, `.side` is a single horizontally scrolling ROW and each group is a
   * flex item inside it, so "collapsing a section" would hide items sideways behind a label that
   * is itself already scrolled past — it would remove destinations and save no vertical space at
   * all, because there is none being spent. So the panels are forced visible and the switch is
   * inert: every item stays reachable at 390px exactly as it is today.
   *
   * ⚠️ `display:contents` RATHER THAN `display:flex`, so the wrapper this commit introduced does
   * not become a second flex box inside the strip and lay its items out in a box of their own. The
   * items go on participating in `.navgroup`'s row as though the wrapper were not there, which is
   * precisely what "keeping every position exactly as it is today" requires.
   *
   * ⚠️ AND `[hidden]` IS `!important` IN THE SHARED SHEET, so this must be too — otherwise an
   * operator who collapses a section on a laptop and then opens the console on a phone finds a
   * group's items missing with nothing to press. */
  .navitems{display:contents!important}
  button.glabel{pointer-events:none;padding:0 var(--s2) 0 var(--s3)}
  .gchev{display:none}

  /* ════════════════════════════════════════════════════════════════════════════════════════════
     🔴 THE CONSOLE IS A PHONE SURFACE, AND ITS TOP BAR WAS THE ONLY REASON ALL 26 SCREENS
     OVERFLOWED. OPS-73 phase B. `docs/26` rows 1403 and 1421.
     ════════════════════════════════════════════════════════════════════════════════════════════
     Randy Harkham, 17 September 2026: *"i think it needs to be phone accessible as well, sometimes
     work is required on the go and not at a laptop."* So the 390px gate is CORRECT here, and 26 of
     26 was a real defect rather than a gate pointed at the wrong surface.

     🔒 IT IS ONE DEFECT, NOT TWENTY-SIX, AND THAT WAS MEASURED RATHER THAN HOPED FOR
     (`scripts/overflowProbe.ts`). On every one of the 26 screens the document was **+306px** and
     the element whose right edge sat at exactly 696px was `#btn-logout` — which lives in the top
     bar, which is ONE block of markup shared by all of them. Not a table, not the card decorator,
     not the rail: the rail is `overflow-x: auto` and scrolls correctly, and its items sitting at
     +4,325px are contained, not pushing. The first version of the probe ranked those rail items
     above the real fault and buried it; a diagnostic that promotes a working control over the
     actual defect is worse than none, because it is convincing.

     ── THE MECHANISM, IN MEASURED NUMBERS AT 390px ───────────────────────────────────────────
     `.topbar` itself is 390px and correctly constrained. `.brandrow` takes 197px — HALF the
     viewport — because the shared sheet gives it `flex: 0 0 auto` ("the brand does not shrink").
     That leaves the account row 149px. Its own `.who` had already collapsed to **0px**, doing
     exactly what it was built to do. What overflows is everything after it, because
     `.topbar .btn, .topbar .pill { flex: 0 0 auto }` in the shared sheet makes all four rigid:
     `SUPERADMIN` 95 + `Switch on a capability` 162 + `My profile` 89 + `Sign out` 77, plus gaps
     = 471px of unshrinkable content in a 149px box, with no `overflow` on it to clip them.

     ⚠️ THAT RIGIDITY IS NOT A BUG AND IS NOT BEING REMOVED. The shared sheet's own comment records
     why it exists: without it a squeezed button wraps its LABEL, and the console's header went
     142px → 181px while the portal's went 162px → 91px. "A control in a header is one line or it
     is not in the header." The rule is right; what was missing is anywhere for the overflow to go.

     ── FOUR RULES, IN ORDER OF HOW MUCH THEY TAKE AWAY, WHICH IS NONE ────────────────────────
     Every one of these is inside this file and inside this breakpoint, so the agent portal and
     every width at or above 768px are untouched — re-measured at 1440 afterwards, not assumed. */

  /* 1 · THE DUPLICATE GOES. `My profile` is in the top bar (index.html:210) AND in the rail
     (index.html:681), and below this breakpoint the rail is a horizontal strip carrying all 25
     destinations. So hiding it here removes nothing a person can reach — it removes a second copy
     of a button that is two centimetres away. 89px + a 12px gap back, for nothing. */
  .topbar > .row .btn[data-area="profile"]{display:none}

  /* 2 · THE READOUT GIVES WAY BEFORE ANY CONTROL DOES. `#topbar-role` is a pill saying which role
     you hold; it is read, never pressed, and it was holding 95px — a quarter of the viewport — of a
     149px budget, against three buttons.
     ⚠️ HIDDEN, AND THE FIRST VERSION OF THIS RULE SHRANK IT INSTEAD — measured, that produced a
     **16px** pill, which is one letter and an ellipsis. "SUPERAD…" was the argument for shrinking;
     "S…" is the argument against it. A readout too small to read is worse than an absent one,
     because it still costs the space.
     🔒 AND IT REMOVES NOTHING UNREACHABLE, WHICH WAS CHECKED RATHER THAN ASSUMED: the profile
     screen renders `Role(s)` in full (`#profile-roles`, index.html:2253), and below this breakpoint
     that screen is one tap away in the rail strip. Same fact, same console, one press.

     ⚠️ `.who` GOES WITH IT, AS ONE DECISION WITH ONE REASON, AND IT IS THE MEASUREMENT THAT DECIDED
     IT. `#topbar-who` was rendering at **0px** — the shared sheet's ellipsis had already collapsed
     it to nothing under the squeeze — while still costing a 12px flex gap to display an empty box.
     With the pill gone and `.who` kept, `Sign out`'s right edge measured 398px: 8px of a button
     clipped behind a swipe, to preserve a name nobody could read. So: **below this breakpoint the
     console's header states the app, the capability control and sign out; who you are and what you
     hold live on the profile screen**, which renders the display name in an editable field
     (`#profile-name`) beside the role. One sentence, two rules, and everything fits with room. */
  #topbar-role, .topbar .who{display:none}

  /* 3 · AND SO DOES THE BRAND — WHICH FINALLY MAKES AN ELLIPSIS THAT WAS ALWAYS THERE FIRE.
     The shared sheet carries `.topbar .brandname { text-overflow: ellipsis }` AND
     `.topbar .brandrow { flex: 0 0 auto }`. The second makes the first inert: an item that never
     shrinks never truncates. That sheet's own comment documents this exact trap twice over, for
     `.who` and for `.side` — this is the third instance, in the block that fixed the other two.
     ⚠️ NOT `display: none` ON THE NAME. The mark alone would identify the app, and hiding the name
     would also take it out of the accessibility tree. Shrinking keeps every word present and lets
     the browser decide how much of it fits.

     🔴 AND THE SHRINK FACTOR IS 200, NOT 1, WHICH LOOKS LIKE A MAGIC NUMBER AND IS A PRIORITY.
     Flex has no "shrink this one first" — it divides the squeeze in proportion to basis × factor.
     With both at 1 the brand and the account row shared it, and MEASURED, that put the brand at
     152px showing `HARKHAM TRA…` while `Sign out` sat 57px off the right edge behind a swipe. Worse
     still, rule 4's `overflow-x` makes the row's automatic minimum size ZERO, so the row gave way
     freely and the brand — the one thing on this bar nobody presses — won the fight. A large factor
     states the order plainly: the brand absorbs essentially all of the squeeze, down to its own
     mark, before a control gives up a pixel. It is a ratio, not a width, so no measurement here
     goes stale when a label changes. */
  .topbar .brandrow{flex:0 200 auto}

  /* 4 · AND THE ROW CAN NEVER PUSH THE DOCUMENT AGAIN, WHATEVER A LABEL SAYS. Rules 1–3 make it
     fit today, with room. They would not survive a longer capability label — and that label is
     SERVER-DRIVEN (`Switch on a capability` today, a group's own name once one is active), so a
     fix that only fits today's strings is a fix with an expiry date nobody will notice passing.
     `overflow-x: auto` is the console's own established phone idiom — it is exactly what `.side`
     does fifteen lines above — and it makes the worst case a short sideways swipe instead of a
     page that scrolls sideways on every screen.
     ⚠️ THE 2px OF PADDING AND ITS MATCHING NEGATIVE MARGIN ARE FOR THE FOCUS RING, NOT FOR LOOKS.
     `overflow` clips descendants, and `:focus-visible` on these buttons draws OUTSIDE their box —
     so without this the keyboard focus ring on `Sign out` would be sliced off at the top and
     bottom. The negative margin returns the 2px, so nothing moves. */
  .topbar > .row:last-child{overflow-x:auto;overflow-y:hidden;scrollbar-width:none;padding:2px 0;margin:-2px 0}
  .topbar > .row:last-child::-webkit-scrollbar{display:none}
}

/* ⚠️ .main's own `margin:0 auto` must be neutralised inside the shell. An auto margin on a grid
 * item disables the default stretch, so the content column sized itself to its content and
 * floated in the middle of the column instead of filling it -- caught by measuring the rendered
 * page (666px inside a 1189px column), not by reading the stylesheet. Left-aligned deliberately:
 * in a console with a fixed left rail, content that drifts toward the centre of a wide screen
 * moves away from the navigation the operator is reading it against. */
/* ==============================================================================================
   🔴 THE CONTENT COLUMN TAKES THE WIDTH IT IS GIVEN; A CARD TAKES THE WIDTH ITS CONTENT NEEDS.
   OPS-94 part 2a. `docs/88` C1 paired with S4.
   ==============================================================================================

   MEASURED, NOT ASSERTED. At 1920 the console left **624–648 px — a third of the monitor —
   unused**, while `voyages` hid **548 px** of its schedule behind `overflow-x: auto`. The space
   that screen needed was the space sitting empty beside it. Both numbers come from
   `npm run measure:console`; the probe now computes the first one itself rather than leaving it
   to be read off a screenshot by hand.

   🔒 THE RULE, AND IT IS A RULE RATHER THAN A FIX FOR `voyages`:

       A TABLE IS NOT PROSE. Prose and forms have a comfortable width and stop there. A table
       has as many columns as the data has, and every pixel it is denied is a column a person
       has to scroll to find.

   So the COLUMN fills the window, and each CARD keeps the comfortable width UNLESS it holds a
   table, in which case it takes what the column gives it. Twenty-nine screens are not tuned; one
   selector asks each card what it contains.

   ⚠️ WHY `:has(table)` AND NOT A CLASS ON THE CARDS THAT NEED IT. A class is a decision taken
   once, per card, by whoever wrote that card — so the thirtieth screen is wide only if somebody
   remembers, and the failure is invisible (a screen that scrolls sideways looks like a screen).
   `:has()` asks the DOM the question every time it renders. Same argument as
   `src/silentGrantAndConfigRemoval.test.ts` deriving its table list from `pg_trigger` rather than
   from a list anybody typed: a typed list does not drift, it is simply incomplete.

   ⚠️ WHAT THIS DELIBERATELY DOES NOT CHANGE. `.inp` is `width: 100%`, so an uncapped card would
   make a single-column form field seventeen hundred pixels wide — which is why the cap is moved
   onto the CARD and kept, rather than removed from the column and forgotten. A form card renders
   at exactly the width it did before this change, at every viewport. Below 1120 px of available
   column nothing moves at all, so 390 and 1280 are untouched by construction.

   ⚠️ AND IT STAYS IN THIS FILE, NOT IN `tokens.css`. The agent portal's column is deliberately
   narrower (prose-heavy against this one's table-heavy) — that asymmetry is recorded at
   `tokens.css`'s own `.shell > .main` rule, and widening the portal is not something OPS-94 was
   asked to do. Only the token is shared.

   🔴 AND `:has(table)` ALONE WAS WRONG, WHICH THE PHOTOGRAPH FOUND AND THE MEASUREMENT DID NOT.
   The first version was `.card:has(table){max-width:none}` — every table card took the whole
   window. `tokens.css` sets `table{width:100%}`, so a FOUR-column table stretched to 1700 px and
   `kyc` rendered its Confirm / Reject / Documents buttons roughly **600 px from the row they act
   on**, across dead space. That is worse than the 1120 px it replaced.

   ⚠️ AND THE INSTRUMENT REPORTED IT AS A SUCCESS. `unusedWidthPx` measures ink to the right of the
   furthest-right element; the buttons were pinned to the right edge, so it read ~0 px unused and
   called the screen full. **The space had not gone away — it had moved into the middle of the
   card, where nothing was looking.** Exactly what OPS-94 2e exists for.

   🔒 SO THE RULE IS "AS WIDE AS ITS CONTENT NEEDS", NOT "AS WIDE AS THE WINDOW":

     · `width: fit-content` — the card sizes to its table's own natural width.
     · `min-width: min(100%, --col-comfortable)` — and never below what it was before, so a card
       with a narrow table renders at exactly the width it always did. This is the clause that
       makes the change invisible everywhere it should be invisible.
     · `max-width: 100%` — capped at the column, so nothing can push the page sideways. */
.shell > .main{max-width:none}
.shell > .main .card{max-width:var(--col-comfortable)}
.shell > .main .card:has(table){
  width:fit-content;
  min-width:min(100%,var(--col-comfortable));
  max-width:100%;
}
/* 🔴 AND THE READING MEASURE, WHICH THE RULE ABOVE CLAIMED AND DID NOT IMPLEMENT — also found by
 * looking at a screenshot rather than at a number. With the column uncapped, a `.note` and the page
 * rule under the `h1` stretched to the full 1724 px while every card beside them stayed at 1120:
 * a wide header zone over a narrow body, and one banner sentence running the width of a monitor.
 *
 * A note is prose. It gets the comfortable width wherever it sits, INCLUDING inside a wide table
 * card — a paragraph does not become easier to read because the table under it is 1684 px.
 *
 * ⚠️ NOT `.shell > .main > *`, WHICH IS THE OBVIOUS FORM AND IS WRONG HERE: each screen is a
 * `#ledger-tab-*` div that IS a direct child, so capping direct children would cap the whole screen
 * and take the table card's width straight back. The cap belongs on the prose, not on the box that
 * happens to contain it. */
.shell > .main .note,
.shell > .main .emptystate,
.shell > .main > hr{max-width:var(--col-comfortable)}
/* 🔴 AND THE MULTI-COLUMN FORM LAYOUTS ARE HELD AT THE OLD WIDTH, BECAUSE THE CLAIM ABOVE THAT
 * "a form card renders at exactly the width it did before" WAS FALSE FOR THEM AND THE MEASUREMENT
 * SAID SO. `profile` and `recovery` put two form cards in a `.grid2`; each was 532 px inside a
 * 1120 px column and became **834 px** inside a 1724 px one, because the grid scaled with its
 * container and the 1120 px card cap never bound a card that was already half that.
 *
 * `.inp` is `width: 100%`, so that is a PASSWORD FIELD roughly 790 px wide — seen on the
 * screenshot, not in a number: nothing was clipped, nothing was starved and no figure moved. A
 * twelve-character secret in a field three quarters of a metre wide is not better than one in a
 * field half that.
 *
 * ⚠️ THE CAP IS ON THE GRID, NOT ON `.inp`. Capping the input would be a change to the shared
 * design system, on both surfaces, to fix a consequence of a console-only layout decision — and
 * OPS-94 says do not redesign. Capping the grid restores exactly the previous rendering for the
 * screens that regressed and touches nothing else. */
.shell > .main .grid2,
.shell > .main .grid3,
.shell > .main .grid4{max-width:var(--col-comfortable)}


/* ==============================================================================================
   THE OPERATING CALENDAR (migration 220). A month you click.
   ============================================================================================== */

/* ⚠️ THE LOCATION PICKER IS A ROW OF BUTTONS AND NOT A `<select>`, AND THAT IS THE ONE DESIGN
 * DECISION ON THIS SCREEN THAT IS ABOUT SAFETY RATHER THAN TASTE. Two of the three calendars
 * belong to OTHER ORGANISATIONS — Sankofa and CBP — and closing a day on the wrong one moves real
 * cutoffs for a reason nobody can later trace. A collapsed select shows the current value in the
 * same 14px as everything else; three buttons with the chosen one filled cannot be misread at a
 * glance, which is the glance this screen gets. */
.locpicker{display:flex;gap:var(--s3);flex-wrap:wrap;margin-bottom:var(--gap-block)}
.locpicker .loc{flex:1 1 220px;text-align:left;padding:var(--s3) var(--s4);border-radius:var(--r-sm);
  background:transparent;box-shadow:inset 0 0 0 1px var(--line2);color:var(--ink);cursor:pointer;
  border:0;font:inherit;display:block}
.locpicker .loc:hover{background:var(--navy2)}
.locpicker .loc.on{background:var(--cyd);box-shadow:inset 0 0 0 2px var(--cy)}
.locpicker .loc .locname{display:block;font-weight:650;font-size:var(--t-body)}
.locpicker .loc .locby{display:block;color:var(--ink3);font-size:var(--t-micro);margin-top:2px}

.calhd{display:flex;align-items:center;justify-content:space-between;gap:var(--s3);
  margin-bottom:var(--s3);flex-wrap:wrap}
.calgrid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:var(--s1)}
.calgrid .dow{font-size:var(--t-micro);letter-spacing:.08em;text-transform:uppercase;
  color:var(--ink3);text-align:center;padding-bottom:var(--s1)}
/* A day is a button because it does something. `aspect-ratio` rather than a fixed height so the
 * grid stays square as the column narrows instead of the cells going letterbox on a laptop. */
.calgrid .day{aspect-ratio:1/1;display:flex;flex-direction:column;align-items:flex-start;
  justify-content:flex-start;gap:2px;padding:var(--s2);border:0;border-radius:var(--r-sm);
  font:inherit;cursor:pointer;text-align:left;background:var(--grnd);color:var(--ink);
  box-shadow:inset 0 0 0 1px transparent}
.calgrid .day:hover{box-shadow:inset 0 0 0 2px var(--cy)}
.calgrid .day.closed{background:var(--navy3);color:var(--ink3)}
/* 🔴 A THIRD FILL FOR THE THIRD STATE, AND IT IS NOT A SIXTH HUE. `--goldd`/`--gold` is the
 * palette's existing "provisional, override, needs attention" pair, which is exactly what an
 * overtime day is: available, and only because somebody pays for it. The rule above says a sixth
 * colour means the thing needs its own word — this one HAS its own word, printed in the cell
 * ("Overtime") and in the legend, so the fill is reinforcement rather than the only carrier.
 *
 * ⚠️ AND IT MUST NOT BE DRAWN AS ORDINARY OPEN. An overtime day counts as open for every cutoff,
 * which is what makes painting it the same green the dangerous kind of correct: a month of
 * holidays the terminal works at several hundred dollars an hour would look like an ordinary
 * month. The gold OUTLINE (`.override`) still reads on top of this fill — `--gold` on `--goldd`,
 * the palette's own light-on-dark pair — so "worked at overtime" and "somebody typed this by hand"
 * stay two separate facts.
 *
 * ⚠️ THE TOKEN NAMES, NOT THEIR VALUES, AND THE FIRST DRAFT OF THIS COMMENT GOT IT WRONG. It cited
 * the two hex codes to justify the contrast, and `src/sharedDesignTokens.test.ts` went red on a
 * stylesheet that consumes only tokens — correctly: a hex in a COMMENT is a second copy of a value
 * that lives in `tokens.css`, and the day the palette moves it becomes a confident, wrong
 * explanation. The scan does not exempt comments and should not. */
.calgrid .day.overtime{background:var(--goldd);color:var(--gold)}
/* ⚠️ AN OVERRIDE IS MARKED BY AN EDGE, NEVER BY A SIXTH COLOUR (docs/60 §4: a sixth hue means the
 * thing needs its own word). Open-vs-closed is the fill; "somebody typed this by hand" is the
 * outline, so the two facts are readable at once instead of competing for the same channel. */
.calgrid .day.override{box-shadow:inset 0 0 0 2px var(--gold)}
.calgrid .day.blank{background:transparent;cursor:default;box-shadow:none}
.calgrid .day .dnum{font-weight:650;font-variant-numeric:tabular-nums}
.calgrid .day .dwhy{font-size:var(--t-micro);line-height:1.2;overflow:hidden}
.callegend{display:flex;gap:var(--s4);flex-wrap:wrap;margin-top:var(--s3);
  font-size:var(--t-micro);color:var(--ink3)}
.callegend span{display:inline-flex;align-items:center;gap:var(--s1)}
.callegend i{width:12px;height:12px;border-radius:3px;display:inline-block}

@media(max-width:767px){
  /* A square cell at a seventh of 375px is 45px and holds nothing. The reason text goes; the
   * number and the colour stay, which is what the month view is actually for on a phone. */
  .calgrid .day{aspect-ratio:auto;min-height:44px;padding:var(--s1)}
  .calgrid .day .dwhy{display:none}
}

/* ================================================================================================
   `.blpreview` — a name shown as the DOCUMENT will set it. OPS-39 phase 5(i).
   ================================================================================================
   🔴 THE ONE PLACE IN THIS CONSOLE THAT DELIBERATELY DOES NOT WEAR THE CONSOLE'S PALETTE, AND THE
   EXCEPTION IS THE WHOLE POINT. `vessel_master.full_name` is printed on a bill of lading
   (DECISIONS.md PART M ⑧), and the operator is being asked to review a string as it will appear on
   that document. Rendering it in dark-panel type and colour would show them something other than
   the thing they are approving.

   The `--bl-*` tokens are the bill of lading's own values, and they live in
   public/shared/tokens.css with the argument for why they exist at all — including that they are a
   COPY of the renderer's `STYLES` that nothing keeps in step. No hex appears here, because
   src/sharedDesignTokens.test.ts forbids one in an app stylesheet outright and has no exception
   mechanism, which is correct.

   ⚠️ `white-space: pre-wrap` IS LOAD-BEARING, NOT TIDINESS. A trailing space or a double space
   inside a name is invisible in a `window.prompt`, invisible in an ordinary HTML render — and it
   prints. Showing what the field actually holds is the entire reason this preview exists. */
.blpreview {
  background: var(--bl-paper);
  color: var(--bl-ink);
  border: 1px solid var(--bl-rule);
  border-radius: 2px;
  padding: var(--s3) var(--s4);
  font: 13px/1.45 "Helvetica Neue", Helvetica, Arial, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 46px;
}

/* The caption above the value, exactly as the document sets its own field labels (`.lbl` in the
   renderer): 9.5px, .1em tracking. */
.blpreview .bllbl {
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bl-label);
  margin-bottom: 3px;
}

/* Nothing typed, or only whitespace typed. Said in words rather than left blank: an empty white box
   reads as "this is fine", and an empty master name on a bill of lading is not. */
.blpreview .blempty {
  color: var(--bl-missing);
  font-style: italic;
}

/* Said in words because `pre-wrap` cannot show a space that has no glyph — see
   renderMasterNamePreview() in app.js for why this is a notice and not a silent trim. Inside the
   preview panel, so it wears the document's own label colour rather than the console's. */
.blpreview .blnote {
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--bl-missing);
}

/* ── PUBLISHED, AND NOT YET VISIBLE ─────────────────────────────────────────────────────────────
   Sits UNDER the visibility pill in the voyage row, because it qualifies that pill: "Public" is
   true and incomplete, and the two belong together rather than in separate columns. Gold rather
   than red — nothing is wrong, and a red note here would send an operator looking for a fault. */
.hznote {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--gold);
  white-space: normal;
  max-width: 260px;
}


/* ── TABS WITHIN A RECORD — OPS-61 phase 3.2 ────────────────────────────────────────────────────
   Randy Harkham, 15 September 2026, and the distinction is the whole reason this component exists
   rather than another rail entry: "SUB-MENUS IN THE RAIL for navigating between SUBJECTS. TABS
   WITHIN A RECORD for one subject with several FACES — an agency's Details, Agreement, KYC, Access
   history are tabs, not menu entries." Principle 3: section -> tab -> selected thing. Level three
   was flattened onto level two, so an agency detail was ONE card holding a name, four h3s and
   several unheaded panels, measured at 1,728px.

   Deliberately plain: a row of buttons with an underline on the selected one. No pill, no card, no
   second border. The tab strip sits INSIDE the record's card, under the record's own heading, so
   the visual hierarchy says what the structure says — you are inside one agency, looking at one of
   its faces. */
.tabs {
  display: flex;
  gap: var(--s1);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin: var(--s4) 0 var(--s3);
}

/* A tab is a button, so it is focusable and operable from the keyboard for free. The transparent
   bottom border is there at rest so that selecting one does not move the text by 2px. */
.tabs .tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ink2);
  font: inherit;
  font-size: 13px;
  letter-spacing: .01em;
  padding: var(--s2) var(--s2);
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}

.tabs .tab:hover { color: var(--ink); }

/* ⚠️ KEYED ON aria-selected, NOT ON A SEPARATE `.on` CLASS. Two sources of truth for "which tab is
   open" is two things that can disagree, and the one screen readers use would be the one nobody
   was maintaining. This way the accessible state IS the visual state, structurally. */
.tabs .tab[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--cy);
}

.tabs .tab:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* The count beside a tab's name — how many rows are behind it. Muted, because it qualifies the
   label rather than competing with it, and present even when zero: "Agreement history 0" tells an
   operator something that an absent badge does not. */
.tabs .tab .tabn {
  color: var(--ink3);
  margin-left: 6px;
  font-variant-numeric: tabular-nums;
}

.tabs .tab[aria-selected="true"] .tabn { color: var(--ink2); }

/* ⚠️ `hidden` IS NOT ENOUGH ON ITS OWN AND THIS REPOSITORY ALREADY KNOWS IT — see
   src/hiddenAttributeWorks.test.ts. Any `display` declaration on a selector that also matches a
   hidden element beats the user-agent's `[hidden] { display: none }`, so the attribute silently
   stops hiding. This rule restates it at higher specificity for panels specifically, so a panel
   cannot be revealed by some later layout rule nobody connected to it. */
.tabpanel[hidden] { display: none; }

/* ================================================================================================
   RECOVERY CODES — OPS-115 part 1a. The one list in this console whose contents a person is
   expected to copy onto paper by hand, so it is set in the monospace face at a size a phone
   camera and a tired eye can both read, with generous tracking: a recovery code is 26 characters
   from an alphabet that deliberately excludes 0, 1 and 8, and the failure mode of getting one
   wrong is silent (rule 42's own lesson about a hand-transcribed URI).

   Two columns on a wide modal, one on a narrow one — ten items in a single column pushes the
   footer button below the fold on a laptop, and a person who cannot see "I have saved them"
   reaches for the scrim instead.
   ================================================================================================ */
.codelist {
  margin: var(--s4) 0;
  padding-left: var(--s5);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s2) var(--s4);
}

.codelist li {
  font-family: var(--font-mono);
  font-size: var(--t-body);
  letter-spacing: .08em;
  color: var(--ink);
  padding: var(--s1) 0;
}

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

/* 🔴 A TEST RECORD, GREYED — OPS-122 part 2, the architect’s decision of 29 September 2026.

   ⚠️ IT IS A COLOUR AND A RULE, NEVER AN `opacity`. `public/shared/tokens.css` carries the
   measurement that settles this: `--ink3`'s previous value FAILED AA at 4.31:1 and was changed for
   it — and an `opacity` on a row would undo that correction everywhere it was applied,
   silently, for exactly the rows an operator most needs to read accurately before pressing
   `Open`. `--ink2` on the row body keeps the contrast the token file already proved.

   🔒 THE NAME KEEPS ITS OWN COLOUR, DELIBERATELY. The name is what the operator matches against
   what they were told to look for; greying the identifier is how somebody opens the wrong
   record. What is greyed is everything that makes the row look like BUSINESS — the agreement,
   the jurisdiction, the booking count. */
tr.testrow > td { color: var(--ink2); background: var(--navy3) }
tr.testrow > td > b { color: var(--ink) }
