/* Hetu component contracts. Every rule is anchored with :not(#_) (id-level specificity) so it wins over the page stylesheets it standardises; :not(#__) adds a second level where a page rule carries an id.
   Loaded last on every page (website, auth, legal, product). 11 October.
   One spec per role; the older class names are aliased here rather than renamed in markup.
   Buttons: primary, secondary, quiet, danger. Sizes 40 (default) and 32 (compact, .is-compact or inside a toolbar).
   Inputs: 40px, line border, 4px corners, accent border and tint ring on focus.
   Dialogs: paper, 8px corners, 28px padding, display-face title, actions right-aligned with a 12px gap.
   Empty states: centred, display-face title, one line of help, one action.
   States: hover, active, focus-visible and disabled on every control; motion off under reduced motion. */

/* ---------- long words (25 Nov, X-03) ----------
   A long unbroken run (a URL, a citation, a name typed without spaces) wraps at the edge of its box instead of running off
   the card or the screen. break-word, not anywhere: it only breaks a word that would otherwise overflow, so it never changes
   how wide a table column is sized. A control's own label is left as it was: a word in a narrow button ("Memorandum" in the
   phone's mode cards) is never split in two; the page sizes its buttons for their words. */
body{overflow-wrap:break-word}
:where(button,[role=button],[role=tab],summary,select,label){overflow-wrap:normal}

/* ---------- focus: one ring everywhere ---------- */
body :is(a,button,input,select,textarea,summary,[tabindex]):not(#_):focus-visible{outline:2px solid var(--accent);outline-offset:2px}
/* Root cause of the stray frame round a menu's or panel's first row (12 Nov): a panel, menu or dialog that opens by a click moves
   focus to its first control by script, and Safari (and Chrome after a script focus) then matches :focus-visible, so the ring
   drew round a row nobody had tabbed to. app-shell.js records the last real input on <html data-input>; after a pointer press a
   script-focused control shows no ring. The keyboard always does, and so does any field the pointer did not just press. */
html[data-input=pointer] body :is(a,button,summary,[role^=menuitem],[role=switch],[role=radio],[role=option],[tabindex]):not(#_):not(#__):focus-visible{outline:none}
/* a page or heading focused by script after navigation is a reading position, not a control: no ring */
body :is(main,h1,h2)[tabindex="-1"]:not(#_):focus-visible{outline:none}
body :is(.lp a,.lp button):not(#_):focus-visible{outline-color:var(--accent)}
body :is(.au-tabs a,.au-link,.au-back,.lg-back,.au-note a,.au-fine a):not(#_):focus-visible{outline:2px solid var(--accent);outline-offset:2px;border-radius:2px}
body :is(.account-panel .hn-opt,.dc-link,.dc-menu button):not(#_):focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
body :is(#reader-main .reader-follow-box textarea,#follow-form textarea):not(#_):focus-visible{outline:none}
body :is(#follow-form.follow-sheet,.reader-follow-box):not(#_):focus-within{border-color:var(--accent);box-shadow:var(--ring)}

/* ---------- buttons ---------- */
body :is(.lp-button,.primary,.secondary,.submit,.send,.st-btn-deep,.mw-submit,.collection-primary,.small-primary,.ac-choice button,.hn-banner-action,.dialog-actions button,.dialog-footer button,.range-submit,.mk-btn):not(#_){
  display:inline-flex;align-items:center;justify-content:center;gap:8px;box-sizing:border-box;height:40px;min-height:40px;padding:0 16px;border:1px solid transparent;border-radius:var(--r-control);
  font:500 14px/20px var(--sans);letter-spacing:0;text-decoration:none;white-space:nowrap;cursor:pointer;
  transition:background-color var(--dur-2) var(--ease),border-color var(--dur-2) var(--ease),color var(--dur-2) var(--ease),transform var(--dur-1) var(--ease)}
/* primary: the scheme's button colour */
body :is(.lp-button-primary,.primary,.submit,.send,.st-btn.st-btn-deep,.mw-submit,.small-primary,.ac-card .primary,.dialog-footer .send):not(#_):not(#__):not(:disabled):not(.is-disabled){background:var(--btn);border-color:var(--btn);color:var(--btn-text)}
body :is(.lp-button-primary,.primary,.submit,.send,.st-btn.st-btn-deep,.mw-submit,.small-primary,.dialog-footer .send):not(#_):not(#__):hover:not(:disabled){background:var(--btn-hover);border-color:var(--btn-hover);color:var(--btn-text)}
/* secondary: a line */
body :is(.lp-button-outline,.secondary,.ac-choice button,.range-submit,.mk-btn):not(#_){background:var(--paper);border-color:var(--line-strong);color:var(--ink)}
body :is(.lp-button-outline,.secondary,.ac-choice button,.range-submit,.mk-btn):not(#_):hover:not(:disabled){background:var(--accent-tint);border-color:var(--accent);color:var(--ink)}
/* soft: the list pages' create action (New matter, New topic, New research) */
body :is(.collection-primary,.dg-tools .secondary,.wc-tools .secondary,.hn-banner-action,.is-soft):not(#_):not(:where(.wc-add,.wc-confirm,.dc-menu-new,.mp-create,.collection-create,.year-fields) *){height:36px;min-height:36px}
body :is(.collection-primary,.dg-tools .secondary,.wc-tools .secondary,.hn-banner-action,.is-soft):not(#_){padding:0 12px;background:var(--accent-tint);border-color:color-mix(in srgb,var(--accent) 28%,transparent);color:var(--memo-deep)}
body :is(.collection-primary,.dg-tools .secondary,.wc-tools .secondary,.hn-banner-action,.is-soft):not(#_):hover:not(:disabled){background:color-mix(in srgb,var(--accent-tint) 60%,var(--accent-soft));border-color:color-mix(in srgb,var(--accent) 45%,transparent)}
/* quiet: text only */
body :is(.lp-button-quiet,.text-button,.text-link,.quiet-action,.collection-quiet):not(#_){height:auto;min-height:32px;padding:0 4px;background:none;border-color:transparent;color:var(--muted)}
body :is(.lp-button-quiet,.text-button,.text-link,.quiet-action,.collection-quiet):not(#_):hover:not(:disabled){color:var(--ink)}
/* danger: the one style of a button that deletes, removes or cancels for good (a client, matter, subject, topic,
   translation, the account, a connected app). :not(:disabled):not(.is-disabled) gives it the primary rule's weight, which it
   follows, so it is red, not the primary colour. */
body :is(.primary.is-danger):not(#_):not(#__):not(:disabled):not(.is-disabled){background:var(--danger);border-color:var(--danger);color:var(--paper)}
body :is(.primary.is-danger):not(#_):not(#__):hover:not(:disabled){background:color-mix(in srgb,var(--danger) 85%,var(--ink));border-color:transparent}
/* compact size: toolbars and rows. A dialog's own buttons are the full 40px (25 Nov, AC-05): Cancel and Delete are the
   same height in every dialog. The button rule above weighs (1,1,2), because of its ".ac-choice button" and
   ".dialog-actions button" items; :not(.x-none) matches every element and lifts these two rules to (1,2,1), one class
   above it, so a compact button is 32 tall with 12px sides. Both branches had that weight from a two-class item in the
   list (.follow-composer .send, .ac-row .secondary) until the join removed both items (26 Nov). */
body :is(.is-compact,.mk-btn):not(#_):not(.x-none){padding:0 12px;font-size:14px}
body :is(.is-compact,.mk-btn):not(#_):not(.x-none):not(:where(.wc-add,.wc-confirm,.dc-menu-new,.mp-create,.collection-create,.year-fields) *){height:32px;min-height:32px}
/* an inline form (New client, New subject, New topic, New matter, Rename in place, the New row of a pick menu, a years row,
   and the Delete question that opens in the same place): every button is the field's height. Fill, border and padding stay
   the button's own. The soft and compact heights above leave these forms out (:not(:where(...) *) adds no weight), so this
   rule only has to follow the button rule it ties with. */
body :is(.wc-add,.wc-confirm,.dc-menu-new,.mp-create,.collection-create,.year-fields) button:not(#_){height:var(--field-h);min-height:var(--field-h)}
body :is(.au .lp-button):not(#_){width:100%;height:44px;min-height:44px}
/* composer toolbars (25 Nov, D-B). The New research box is the reference. Every control in a composer's toolbar (the
   mode or approach trigger, Courts, Years, Attach, Enhance, Send) is one height, --composer-h (tokens.css), in the research box, the
   follow-up box under a memo or Find, a matter's research box and the Law Lookup and Case search query bars. A touch
   screen draws the same 40 as a mouse: a finger's 44 is the invisible tap area touch.js adds ("tap areas" below). Attach
   and Enhance are squares of that size. The files of each box set no height of their own, and the button family's 40px
   (buttons, above) does not reach in: min-height:0 here leaves --composer-h the only height. A phone builds its own
   toolbar (phone.css: pills 32, the Send circle 36, one centre line). */
body :is(#research-form .sheet-tools,#follow-form .sheet-tools,#mw-research-form .mw-composer-tools,#lk-form .lk-tools,#cs-form .lk-tools) :is(.tool,.approach-trigger,.mw-approach-trigger,.mw-tool,.lk-tool,.lk-mode,.rb-attach,.enhance,.lk-enhance,.submit,.send,.mw-submit,.lk-go){height:var(--composer-h);min-height:0}
body :is(#research-form .sheet-tools,#follow-form .sheet-tools,#mw-research-form .mw-composer-tools,#lk-form .lk-tools) :is(.rb-attach,.enhance,.lk-enhance){width:var(--composer-h)}
/* pressed and disabled */
body :is(.lp-button,.primary,.secondary,.submit,.send,.st-btn-deep,.mw-submit,.collection-primary,.small-primary,.ac-choice button,.hn-banner-action,.range-submit):not(#_):active:not(:disabled){transform:translateY(1px)}
body :is(.lp-button,.primary,.secondary,.submit,.send,.st-btn-deep,.mw-submit,.collection-primary,.small-primary,.ac-choice button,.hn-banner-action,.range-submit):not(#_):disabled,:where(.lp-button,.primary,.secondary).is-disabled{background:var(--fill);border-color:var(--fill);color:var(--muted);cursor:default;transform:none;opacity:1}
/* busy: a button that is waiting on the server */
body :is(.is-busy):not(#_){position:relative;color:transparent!important;pointer-events:none}
body :is(.is-busy):not(#_):after{content:'';position:absolute;inset:0;margin:auto;width:16px;height:16px;border:2px solid color-mix(in srgb,var(--btn-text) 35%,transparent);border-top-color:var(--btn-text);border-radius:50%;animation:hetu-spin .8s linear infinite}
body :is(.secondary.is-busy,.lp-button-outline.is-busy):not(#_):after{border-color:color-mix(in srgb,var(--ink) 25%,transparent);border-top-color:var(--ink)}
@keyframes hetu-spin{to{transform:rotate(360deg)}}

/* ---------- inputs ---------- */
/* One field height (25 Nov, D-C): --field-h is 40 (tokens.css) and 44 on a phone (phone.css). A button in the same row as a field
   is the field's height (docs/PHONE_DESIGN.md), so a field and its buttons are drawn from the one value. */
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input,.collection-create input):not(#_){box-sizing:border-box;width:100%;height:var(--field-h);min-height:var(--field-h);padding:0 12px;border:1px solid var(--line);border-radius:var(--r-control);background:var(--paper);color:var(--ink);font:400 14px/20px var(--sans);transition:border-color var(--dur-2) var(--ease),box-shadow var(--dur-2) var(--ease)}
body :is(textarea.field-input):not(#_){height:auto;min-height:120px;padding:8px 12px;line-height:1.5}
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input):not(#_)::placeholder{color:var(--subtle);opacity:1}
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input):not(#_):focus{outline:none;border-color:var(--accent);box-shadow:var(--ring)}
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input):not(#_)[aria-invalid=true]{border-color:var(--danger)}
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input):not(#_)[aria-invalid=true]:focus{box-shadow:0 0 0 3px color-mix(in srgb,var(--danger) 14%,transparent)}
body :is(.field-input,.au-field input,.ac-field input):not(#_):disabled{background:var(--surface);color:var(--muted)}
/* labels and hints: one eyebrow style */
body :is(.au-field label,.ac-field label,.field-label,.lp-plan-name,.ac-plan-kicker,.vs-kicker,.inv-grid small,.inv-table th,.ghost-eyebrow,.vis-ask-head):not(#_){font:500 12px/16px var(--sans);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
body :is(.au-error,.ac-field small.is-error,.form-error):not(#_){display:block;margin-top:4px;font:400 12px/16px var(--sans);color:var(--danger)}
/* forms.js (25 Nov): the one-line error under a box keeps its line even when empty, so showing an error moves nothing */
body .form-error:not(#_){min-height:16px;overflow-wrap:break-word}
body :is(.ac-field small,.au-hint):not(#_){font:400 12px/16px var(--sans);color:var(--muted)}

/* ---------- dialogs ---------- */
body :is(dialog:not(.workspace-panel):not(.hn-skip)):not(#_):not(#__){box-sizing:border-box;width:min(520px,calc(100vw - 32px));max-height:88vh;padding:24px;border:1px solid var(--line);border-radius:var(--r-menu);background:var(--paper);color:var(--ink);box-shadow:var(--shadow-dialog)}
body :is(dialog):not(#_)::backdrop{background:color-mix(in srgb,var(--ink) 18%,transparent)}
body :is(dialog):not(#_) :is(#dialog-title,.dialog-top h2,h2:first-child){margin:0 32px 8px 0;font:400 22px/1.25 var(--display);letter-spacing:-.02em;color:var(--ink)}
body :is(dialog):not(#_) :is(.dialog-description,p:not(.au-error)){margin:0 0 16px;font:400 14px/22px var(--sans);color:var(--muted)}
body :is(dialog):not(#_) :is(.dialog-actions,.dialog-footer){display:flex;justify-content:flex-end;align-items:center;gap:12px;margin-top:24px}
body :is(dialog):not(#_) :is(.close,.dialog-close){position:absolute;top:16px;right:16px;display:grid;place-items:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--r-control);background:none;font-size:20px;line-height:1;color:var(--muted);cursor:pointer}
body :is(dialog):not(#_) :is(.close,.dialog-close):hover{background:var(--accent-tint);color:var(--ink)}
body :is(dialog):not(#_) .dialog-top{display:block;margin:0}

/* ---------- empty states ---------- */
body :is(.empty-state,.history-empty,.no-matches,.hn-empty-state):not(#_){display:flex;flex-direction:column;align-items:center;gap:0;padding:64px 24px 72px;text-align:center}
body :is(.empty-state,.history-empty,.no-matches):not(#_) h2{margin:0;font:400 24px/1.2 var(--display);letter-spacing:-.02em;color:var(--ink)}
body :is(.empty-state,.history-empty,.no-matches):not(#_) p{max-width:420px;margin:8px 0 0;font:400 14px/22px var(--sans);color:var(--muted);}
body :is(.empty-state,.history-empty,.no-matches):not(#_) :is(.primary,.secondary,.collection-primary){margin-top:24px}
body :is(.wc-none,.hn-empty):not(#_){padding:24px 0;font:400 14px/22px var(--sans);color:var(--muted)}

/* ---------- notices: loading, error, undo ---------- */
.hetu-notice{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px;align-items:center;box-sizing:border-box;width:fit-content;max-width:min(100%,520px);min-height:48px;margin:0 0 16px;padding:8px 12px;border:1px solid var(--line);border-radius:var(--r-menu);background:var(--paper);font:400 14px/20px var(--sans);color:var(--ink)}
.hetu-notice>b,.hetu-notice>span:not(.hetu-notice-actions){grid-column:1;text-wrap:balance}
.hetu-notice.is-error{border-color:color-mix(in srgb,var(--danger) 40%,transparent);background:color-mix(in srgb,var(--danger) 6%,var(--paper))}
.hetu-notice.is-error b{color:var(--danger)}
.hetu-notice .hetu-notice-actions{display:flex;grid-column:2;grid-row:1/span 2;gap:8px;margin-right:-4px}
body .hetu-notice .hetu-notice-actions button:not(#_):not(#__){height:32px;min-height:32px;padding:0 8px;border:0;border-radius:4px;background:none;box-shadow:none;color:var(--accent);font:500 14px/20px var(--sans);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 35%,transparent);text-underline-offset:3px}
body .hetu-notice .hetu-notice-actions button:hover:not(#_):not(#__){background:var(--accent-tint);color:var(--accent);text-decoration-color:currentColor}
.hetu-skeleton{display:block;height:14px;border-radius:4px;background:linear-gradient(90deg,var(--fill),var(--surface),var(--fill));background-size:200% 100%;animation:hetu-shimmer 1.4s linear infinite}
.hetu-skeleton + .hetu-skeleton{margin-top:8px}
@keyframes hetu-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}
/* the fallback toast: aligned to the same slot and shape as notify.css */
.hetu-toast{position:fixed;right:16px;top:var(--notice-top,16px);z-index:240;display:flex;align-items:center;gap:10px;box-sizing:border-box;width:fit-content;min-height:40px;max-width:min(440px,calc(100vw - 32px));padding:8px 14px;border:1px solid var(--line);border-radius:10px;background:var(--paper);box-shadow:var(--hn-shadow,var(--shadow-pop));font:500 14px/20px var(--sans);color:var(--ink);text-wrap:pretty;animation:hetu-toast-in var(--dur-2,.2s) var(--ease,cubic-bezier(.22,.61,.36,1))}
.hetu-toast:not(:has(button,a)){padding-right:14px}
.hetu-toast button:not(#_):not(#__){height:28px;min-height:28px;padding:0 8px;border:0;border-radius:6px;background:none;box-shadow:none;font:500 14px/20px var(--sans);color:var(--accent);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 35%,transparent);text-underline-offset:3px;cursor:pointer}
.hetu-toast button:hover:not(#_):not(#__){background:var(--accent-tint);text-decoration-color:currentColor}
.hetu-toast .hetu-toast-x{padding:0 4px;color:var(--muted);text-decoration:none}
@keyframes hetu-toast-in{from{opacity:0;transform:translateY(8px)}}
@keyframes hetu-toast-top{from{opacity:0;transform:translateY(-6px)}}
@media(min-width:761px){.hetu-toast{top:auto;left:var(--app-sidebar-width,0px);right:0;bottom:24px;margin-inline:auto;translate:none;max-width:min(440px,calc(100% - var(--app-sidebar-width,0px) - 32px))}}
@media(max-width:760px){.hetu-toast{left:12px;right:12px;top:var(--notice-top,12px);margin-inline:auto;animation-name:hetu-toast-top}}

/* ---------- skip link, on every page ---------- */
.hetu-skip{position:absolute;left:16px;top:-48px;z-index:300;height:40px;padding:0 12px;border-radius:var(--r-control);background:var(--ink);color:var(--paper);font:500 14px/40px var(--sans);text-decoration:none;transition:top var(--dur-1) var(--ease)}
.hetu-skip:focus{top:12px;outline:2px solid var(--accent);outline-offset:2px}

/* ---------- reduced motion ---------- */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}
  .hetu-skeleton{animation:none;background:var(--fill)}
}

/* ---------- utilities shared by every page ---------- */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
body .skip:not(#_){position:fixed;left:16px;top:-80px;z-index:300;height:40px;padding:0 12px;border-radius:var(--r-control);background:var(--ink);color:var(--paper);font:500 14px/40px var(--sans);text-decoration:none}
body .skip:not(#_):focus{top:12px}
.hetu-notice.is-offline{position:fixed;left:var(--app-sidebar-width,0px);right:0;bottom:24px;top:auto;z-index:250;margin:0 auto;max-width:min(440px,calc(100% - var(--app-sidebar-width,0px) - 32px));padding:10px 14px;border-radius:10px;border-color:color-mix(in srgb,var(--danger) 28%,var(--line));box-shadow:var(--hn-shadow,var(--shadow-pop))}
@media(max-width:760px){.hetu-notice.is-offline{top:var(--notice-top,12px);bottom:auto;left:12px;right:12px;max-width:none}}
.hetu-loading{display:flex;flex-direction:column;gap:8px;padding:8px 0}
.hetu-notice b{font-weight:500}
.hetu-notice>span:not(.hetu-notice-actions){color:var(--muted)}
@media print{#dots-canvas,.hetu-skip,.skip,.hetu-toast,.hetu-notice,.lp-nav,.lp-footer,.app-sidebar,.app-mobile-head,.hn-panel,.hn-banners,dialog{display:none!important}body{background:#fff}}

/* ---------- page frames: one width per family, one gutter, one sidebar source ---------- */
body :is(.history-page,#collection-view,.collection-overview):not(#_){max-width:var(--page-list)}
body :is(.ac-page):not(#_){max-width:var(--page-form)}
body :is(.dg-page,.mw-home,.mw-collection):not(#_){max-width:var(--page-list)}
body.has-app-shell:not(.is-reading):not(.is-working) main:not(#_){padding-left:var(--page-gutter);padding-right:var(--page-gutter)}
body.has-app-shell:not(.is-reading):not(.is-desk) main:not(#_){padding-top:48px}
@media(max-width:760px){body.has-app-shell:not(.is-reading):not(.is-working) main:not(#_){padding-left:16px;padding-right:16px;padding-top:24px}}
/* page titles: one size and measure; each page keeps its own face */
body #desk-heading:not(#_){font-size:var(--fs-display);line-height:var(--lh-display);letter-spacing:-.03em}
body :is(.page-head h1,.ac-page h1,.wc-head h1,.dg-head h1,.collection-header h1,.history-page h1):not(#_){font-size:var(--fs-title);line-height:var(--lh-title);letter-spacing:-.03em}
@media(max-width:760px){body :is(.page-head h1,.ac-page h1,.wc-head h1,.dg-head h1,.collection-header h1,.history-page h1,#desk-heading):not(#_){font-size:28px}}

/* ---------- accessibility (27 Oct, WCAG 2.2 AA) ---------- */
/* a field or a secondary button is known by its border: 3:1 against white and the page, in every scheme
   (hairlines between rows keep the soft --line) */
:root{--line-control:color-mix(in srgb,var(--muted) 62%,var(--paper))}
body :is(.field-input,.au-field input,.ac-field input,.wc-add input,.dc-menu-new input,.mp-name-input,.year-fields input,.au-phone,.au-code input,#clarify-answer):not(#_):not(#__){border-color:var(--line-control)}
body :is(.lp-button-outline,.secondary,.ac-choice button,.range-submit):not(#_):not(#__){border-color:var(--line-control)}
/* the search boxes over a list: clean focus without colored underline */
body :is(.wc-page .wc-tools .search-field,.dg-tools .dg-search,.history-page .history-search):focus-within:not(#_){box-shadow:none!important}
/* the two question boxes: a focus that can be seen */
body :is(.question-sheet,.lk-sheet,.follow-sheet):focus-within:not(#_):not(#__){border-color:color-mix(in srgb,var(--accent) 70%,var(--paper));box-shadow:0 0 0 3px var(--accent-tint)}
/* phones: nothing scrolls sideways */
body.has-approach-menu #desk-view .recent-row:not(#_){min-width:0;max-width:100%}
body.has-approach-menu #desk-view .recent-row>*:not(#_){min-width:0}

@media (max-width:640px){body.has-approach-menu #desk-view .recent-row>div:not(#_){flex-direction:column;align-items:flex-start;gap:2px}body.has-approach-menu #desk-view .recent-row p:not(#_){white-space:normal}}
@media (max-width:480px){body #desk-heading:not(#_){white-space:normal;}}
@media (max-width:400px){body .jv-stick:not(#_){margin-left:0;margin-right:0;padding-left:0;padding-right:0}}

/* ---------- motion (27 Oct) ---------- */
/* paused research: nothing goes on moving as if Hetu were still working */
body :is(.st-layout[data-phase="stopped"],.f-layout[data-phase="stopped"]) :is(.st-log-verb,.f-summary-live)::after{animation:none!important;content:''!important}
body :is(.st-status[data-state="paused"],.st-status[data-state="held"]) .st-hmark *{animation:none!important}

/* ---------- type: the last off-scale styles folded onto the 12 roles (27 Oct) ----------
   Kept on purpose: list letters and numerals sized to the line beside them (.st-letter, .m-letter, .m-roman,
   .m-index-num), the long memorandum title (28/36), the memorandum's section heading, the plan price, the landing
   page's marketing sizes, and text hidden for screen readers. */
/* Control 14/20 (DESIGN.md 6 Nov: no 13px text) */
body :is(.st-progress-line,.au-note,.wc-counts,.cs6-note):not(#_):not(#__){font-size:14px;line-height:20px}
/* Meta 12/18 */
body :is(#recent-heading,#recent .recent-row p,.lk-held,.lk-kind-w,.wc-filed-matter,.hn-banner-body,.dc-filed-court,.st-frame-status,.st-countdown,.m-label,.m-schedule-division,.m-desk-label,.m-appeal,.cs5-years,.ac-tag,.mw-research-row,.wc-filed-kind,.hn-row time,.app-avatar):not(#_):not(#__){font-size:12px;line-height:18px}
/* Label 11/16 600 caps */
body .lk-kind-k:not(#_):not(#__){font-size:12px;line-height:16px;font-weight:600;letter-spacing:.08em}
body :is(.au-field label,.ac-field>label,.lg-invoice th,.lg-invoice small):not(#_):not(#__){font-size:12px;line-height:16px;font-weight:600;letter-spacing:.08em}
/* Interface 14/20 and card prose 14/22 */
body :is(.ac-lede,.f-transcript p,.lg-invoice td,#inv-desc,#inv-amt,#inv-gst,.tr-ph,.tr-browse,.m-prov-role,.m-statute-act):not(#_):not(#__){font-size:14px;line-height:22px}
body :is(.f-transcript summary,.hn-banner h3,.lg-invoice b,#inv-date):not(#_):not(#__){font-size:14px;line-height:20px}
/* the narrator's line keeps its voice size, on a whole-pixel line */
body .st-line:not(#_):not(#__){line-height:22px}
/* Name compact 15/22 */
body .wc-filed-text:not(#_):not(#__){font-size:16px;line-height:22px}
/* invoice: Chapter for its title, Heading for its total */
body .lg-invoice h1:not(#_):not(#__){font-size:24px;line-height:30px}
body :is(#inv-total,.lg-invoice .inv-total td):not(#_):not(#__){font-size:18px;line-height:26px}
/* landing: the 13.5 and 15.5 asides onto 14 and 15 */
body .lp :is(.vis-quote-source,.vis-quote-locator,.vis-inspect):not(#_){font-size:14px}
body .lp .vis-inline-source:not(#_){font-size:15px}
/* the second pass, on the exact elements */
body :is(.hn-banner h3 time,.approach-option-time,.approach-option-body,.au-or,.lk-section-top>span,.cs5-years button,.m-schedule-head span,.mw-home .mw-library .mw-library-identity small):not(#_):not(#__):not(#___){font-size:12px;line-height:18px}
body .hn-banner .hn-text:not(#_):not(#__):not(#___){font-size:14px;line-height:20px}
body :is(.au-link,.ac-row small):not(#_):not(#__):not(#___){font-size:13px;line-height:20px}
body :is(.ac-section>p,.tr-table td,.tr-table th):not(#_):not(#__):not(#___){font-size:14px;line-height:22px}
body :is(.ac-plan .ac-plan-kicker,.ac-summary .ac-plan-kicker):not(#_):not(#__):not(#___){font-size:11px;line-height:16px;font-weight:600;letter-spacing:.08em}
body .mw-home .mw-library .mw-library-identity strong:not(#_):not(#__){font-size:16px;line-height:22px}
/* the legal pages read as the memorandum does: Body 16/28 */
body .lg-doc p:not(#_):not(#__){font-size:16px;line-height:28px}
body :is(.ac-field small:not(.au-error),.cs5-opt small,.cs5-opt em,.cs5-pend,#lk-kinds-h~*,.lk-section-top span):not(#_):not(#__):not(#___){line-height:18px}
body :is(.ac-foot,#inv-no):not(#_):not(#__):not(#___){font-size:13px;line-height:20px}

/* ---------- typing boxes on touch screens (24 Nov 2026) ----------
   iPhone and iPad Safari zoom the whole page when you tap a typing box whose text is under 16px. So on any screen with
   touch, every typing box is at least 16px, whatever page or rule sized it. any-pointer, not pointer and not width: an
   iPad with a trackpad still has a touch screen, and a narrow laptop window has none, so a mouse keeps the 14px look.
   A box meant to be larger than 16px on touch sets --field-font-size; this rule keeps the larger of the two. */
@media (any-pointer:coarse){
 :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=button],[type=submit],[type=reset],[type=image],[type=hidden]),textarea,select){font-size:max(16px,var(--field-font-size,0px))!important}
}

/* ---------- tap areas and touch (25 Nov 2026): one method, decided by the kind of pointer, never by the width ----------
   It replaces the 27 Oct (pointer:coarse) block and the 13 Nov phone-width tap areas of the notice and toast buttons.
   house.css keeps its 13 Nov phone-width block: it draws the 44px buttons and fields of the phone look.
   1. Tap areas. A control keeps the size it is drawn at; what grows is an invisible area that answers the finger. touch.js
      measures every control smaller than var(--hit) (tokens.css: 44px on any touch screen, 24px with a mouse only) and the
      room round it, and sets data-tap-area (the pseudo-element the page leaves free) and --hit-t/-r/-b/-l (how far the area
      reaches on each side). The area grows into empty space and plain text and stops where the next control's area
      starts, so two controls never take each other's press. The owner's iPad held sideways (1366 wide, the laptop layout)
      gets 44, the same as a phone. Nothing here is visible. :where() keeps it at no weight: a page that positions its
      control (a dialog's X) keeps its own position. Opt a control out with data-tap-area="off".
   2. A press shows (touch only): no grey flash, a light shade of the control's own text colour while the finger is down,
      and no wait for a double tap. touch.js listens for touchstart so iOS paints :active at all.
   3. Rows in pop-up menus and lists are var(--row-touch) tall on touch (40px), and every row of the left navigation rail
      (Back, the open/close control, the pages) var(--hit), 44px (app-shell.css --rail-row): the owner allows rows to grow;
      buttons never do. A full-width row of a plain stack (the desk's three modes: 36 high, a hairline between) keeps its
      laptop height: its area cannot grow into the rows beside it, so touch.js counts its whole pitch as enough (stackPitch).
   4. Links inside running text keep a 24px box on touch: 44px would cover the lines above and below. */
:where([data-tap-area=after],[data-tap-area=before]){position:relative}
:where([data-tap-area=after])::after,:where([data-tap-area=before])::before{content:"";position:absolute;inset:calc(-1 * var(--hit-t,0px)) calc(-1 * var(--hit-r,0px)) calc(-1 * var(--hit-b,0px)) calc(-1 * var(--hit-l,0px))}
@media (any-pointer:coarse){
 /* the only drawn growth: the attached-file chip's X is drawn 22px, too small for a finger to see where to press; on touch
    it is drawn 28px, the most the 30px chip holds, and its tap area reaches outside the chip like any control's */
 body .rb-chip-x{width:28px;height:28px}
 /* the list pages' search box (a label round its icon and box) answers a finger over 44: above and below it reaches half
    of what its height lacks, and a quarter more, which a half-pixel layout would otherwise lose (36px tall: 5px each side;
    44 or taller, as on the phone: nothing, so the chips under it keep their room). It sits behind the box itself (isolation
    keeps z-index:-1 inside the label), so a press on its words still places the caret; touch.js keeps neighbours' areas
    out of it. Law Lookup's regulator search box, a Digest topic's and the desk's Matters search box are drawn the same way
    (LL-03, DG-11, CM-11) */
 body :is(.search-field,.lb-find,.dg-search,.collection-search){position:relative;isolation:isolate}
 body :is(.search-field,.lb-find,.dg-search,.collection-search)::after{content:"";position:absolute;inset:min(0px,calc((50% - var(--hit) / 2) * 1.25)) 0;z-index:-1}
 /* 2. press */
 :where(a[href],button,summary,select,label,input,textarea,[role=button],[role=tab],[role=option],[role^=menuitem],[role=switch],[data-touch-row]){-webkit-tap-highlight-color:transparent;touch-action:manipulation}
 :where(a[href],button,summary,[role=button],[role=tab],[role=option],[role^=menuitem],[role=switch]):not(:disabled,[aria-disabled=true]):active{background-image:linear-gradient(color-mix(in srgb,currentColor 12%,transparent),color-mix(in srgb,currentColor 12%,transparent))}
 /* 3. rows */
 body :is([role=menu] :is([role=menuitem],[role=menuitemradio],[role=menuitemcheckbox]),[role=listbox] [role=option],.mw-pop .scope-option,.mw-pop .court-option):not(#_){min-height:var(--row-touch)}
 /* 4. links in running text: 24px */
 body :is(.m-chip,.m-cite,a.f-page,.au-note a,.au-link,.dc-subject,.lk-fn,.jv-n,.hn-text):not(#_):not(#__):not(#___){display:inline-block;padding:4px 4px;margin:-4px -4px;min-height:24px;min-width:24px;box-sizing:border-box}
}

/* ---------- rows Counsel creates: long press and swipe to delete (touch.js, 25 Nov 2026) ----------
   touch.js marks each opted-in row data-touch-row (and data-touch-del when it can be deleted). On a touch screen the row's
   text cannot be selected and iOS shows no link preview on it, so a long press can open the row's own menu; a deletable
   row leaves sideways moves to the page (pan-y) so a swipe left can show its Delete button. With a mouse nothing changes. */
@media (any-pointer:coarse){
 [data-touch-row]{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
 [data-touch-row] :is(a,img){-webkit-user-drag:none}
 [data-touch-row][data-touch-del]{touch-action:pan-y}
}
/* held: a light shade over the row, whatever its own background (an inset shadow sits above it) */
[data-touch-row].is-touch-held{box-shadow:inset 0 0 0 100vmax color-mix(in srgb,var(--ink) 7%,transparent)}
[data-touch-row].is-touch-sliding{transition:none}
:is([data-touch-row],.hetu-swipe-del).is-touch-settling{transition:translate var(--dur-2) var(--ease),left var(--dur-2) var(--ease),width var(--dur-2) var(--ease)}
/* the Delete button in the space a swiped row leaves: the danger colour, the house type, no corners of its own */
.hetu-swipe-del{position:fixed;z-index:60;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:0;margin:0;padding:0;overflow:hidden;border:0;border-radius:0;background:var(--danger);color:var(--paper);font:500 14px/20px var(--sans);white-space:nowrap;cursor:pointer;-webkit-tap-highlight-color:transparent}
.hetu-swipe-del:focus-visible{outline:2px solid var(--accent);outline-offset:-4px}
.hetu-swipe-del:active{background:color-mix(in srgb,var(--danger) 85%,var(--ink))}
@media (prefers-reduced-motion:reduce){:is([data-touch-row],.hetu-swipe-del).is-touch-settling{transition:none}}
