/* Subset copies of the URW base-35 faces that ship with Ghostscript, so the
   look doesn't depend on what happens to be installed on the device or the
   phone rendering it. Subset to Latin-1 plus the marks the templates draw,
   and converted to woff2: 320 KB of OTF became 61 KB, which matters over a
   intersection from a phone. scripts/subset-fonts.py regenerates them and holds the
   character list; widen that when a template starts drawing a new mark.

   A mark left out of the subset doesn't fail visibly -- it quietly comes
   from whatever the phone has installed, at a different weight and sitting
   at a different height in its box, which is a difference we can neither see
   from here nor correct for. The chevron was in exactly that state until
   U+203A went into the subset.

   The `?v=2` is hand-written because CSS can't call deps.static(). These
   files are vendored and immutable, so that's fine -- but it does mean
   *replacing* a font file requires bumping the number here, or browsers
   will keep the old one forever (the /static mount marks anything carrying
   a version as immutable; see web/app.py::VersionedStaticFiles). */
@font-face {
  font-family: "URW Gothic";
  src: url("fonts/gothic-book.woff2?v=2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "URW Gothic";
  src: url("fonts/gothic-demi.woff2?v=2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nimbus Sans Narrow";
  src: url("fonts/narrow-bold.woff2?v=2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Nimbus Mono PS";
  src: url("fonts/mono-regular.woff2?v=2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

/* ---- Design tokens -------------------------------------------------------

   The "panel" direction: solid painted surfaces, no hairline outlines, and
   one accent colour that means exactly one thing on any given screen.
   Restrained variant -- colour identifies *activity*, never which app you
   happen to be in. Replaces the previous fixed white-on-black scheme.

   Still deliberately not adapting to OS light/dark: this is a device
   console, and it should look the same on every phone that opens it. */
:root {
  /* Surfaces, darkest first. Warm-biased neutrals -- a slight green-yellow
     tilt rather than pure grey -- so they read as painted metal instead of
     the default near-black every dark dashboard ships with. */
  --ground: #14130f;
  --ground-2: #1d1c17;
  --surface: #2a2924;
  --surface-2: #35342e;

  /* Plain white, not the warm bone this started as. The warmth stays in
     the surfaces, where it reads as painted metal; on text it just looked
     slightly dirty against them. The two muted steps go neutral with it --
     a warm grey under white text reads as a rendering fault rather than a
     hierarchy. */
  --bone: #ffffff;
  --bone-dim: #b4b4b4;
  /* #8c, not the #7a this landed on first: --bone-faint is the field
     placeholder colour, and placeholders sit on --surface-2, where #7a
     measured 2.91:1 -- under WCAG's 3:1 floor for any legible text. This
     clears it on every surface the token is actually used against. */
  --bone-faint: #8c8c8c;

  /* Semantic, and deliberately not drawn from --accent: a warning is not an
     "active" thing and the two must never be confusable at a glance. */
  --ok: #8fa84b;
  --warn: #d19a1e;
  --bad: #a93a24;
  /* The same red at ink weight. --bad is a *fill*: it is sized to carry
     white text on top of it (6.3:1), which is why it is this dark. Used as
     text on our own dark surfaces it lands at 2.3-2.7:1 -- below the 4.5:1
     body-text threshold, and in practice the destructive item in a tile
     menu was close to unreadable. That is what this token is for; it
     clears 4.5:1 on --ground, --ground-2, --surface and --surface-2.

     The rule: --bad paints something, --bad-ink writes on something. A red
     that does both does neither well. */
  --bad-ink: #e08872;

  /* The one hot colour, and it is now genuinely per-device -- each machine
     in the set gets its own, so you can tell which one you're about to
     reboot, which is what this comment promised from the start.

     --device-hue is set on the root element by base.html (derived from the
     device id, or the accent its owner picked, applied by topbar.js). The
     fallback of 20 is the original orange's hue, so anything rendered
     without a device -- the intersection console, an error page -- looks exactly
     as it always did.

     OKLCH so one lightness holds across the whole wheel: --on-accent is a
     near-black laid on top of this, and in HSL the same numbers would be a
     pale yellow at one hue and a dark blue at another, passing contrast for
     some devices and failing for others.

     L is 0.70 because of the *second* job this colour has. As a fill under
     --on-accent it had room to spare at 0.62; but --accent is also drawn as
     text (`.row-sub--live` and friends) on --surface, and there 0.62
     measured 3.52:1 -- under the 4.5:1 small text needs. 0.70 clears both
     at every hue with the tighter of the two at 4.86:1. Found by the test
     that walks all 360, not by looking at it. */
  --accent: oklch(0.70 0.14 var(--device-hue, 20));
  --on-accent: #14130f;
  /* The *deep* accent: the one surface family this app paints in the device
     colour and writes on in white. --accent above is far too light for that
     -- it exists to carry --on-accent, which is nearly black.
     Two surfaces use this now (the topbar and the home panel's handle), so
     it is a token rather than a number written twice: the lightness is not a
     taste, it is the value at which white clears 4.5:1 at every one of the
     360 hues a device may be, and a second copy of it would be a second
     thing to re-derive. The fallback for engines that cannot parse oklch
     is the @supports block after this rule. */
  --accent-deep: oklch(0.52 0.12 var(--device-hue, 20));

  --radius: 6px;

  /* Three type roles, strictly: display for names and titles, label for
     every status/number/caption, mono for literal machine output *only*
     (terminal contents, log tails) -- never as a generic "technical" font,
     which is how mono ends up everywhere. */
  --font-display: "URW Gothic", "Century Gothic", system-ui, sans-serif;
  --font-label: "Nimbus Sans Narrow", "Liberation Sans Narrow", system-ui, sans-serif;
  --font-mono: "Nimbus Mono PS", ui-monospace, Menlo, monospace;

  /* How far a lone glyph has to drop to sit optically centred in its square.
     One value per face, because it is the face's own descender depth that
     causes the problem -- see "Why every icon square drops its glyph" above
     .btn for where these two numbers come from. `em` in a custom property is
     resolved against whichever element reads it, not against :root, so these
     scale with each control's own font-size. */
  --glyph-drop: 0.06em; /* URW Gothic, ascender 0.739 / descender 0.261 */
  --glyph-drop-mono: 0.15em; /* Nimbus Mono PS, 0.603 / 0.397 -- much deeper */

  /* Legacy aliases. The ~1,500 lines of component CSS below still reference
     these names, so pointing them at the new palette re-skins the entire app
     in one move -- which is what lets templates migrate to the component kit
     (bottom of this file) one screen at a time instead of in a single
     unreviewable commit. Delete each alias as its last consumer goes. */
  --bg: var(--ground);
  --fg: var(--bone);
  --muted: var(--bone-dim);
  --border: var(--surface);
  --card-bg: var(--ground-2);
  --bubble-me: var(--accent);
  --bubble-me-fg: var(--on-accent);
  --bubble-them: var(--surface);
  --bubble-them-fg: var(--bone);
  --topbar-h: 3.4rem;
  --player-h: 4rem;
}
/* The fallback for engines without oklch() (Safari before 15.4). It has to
   be a separate @supports block: writing an hsl() line above the oklch()
   one, the usual trick, does nothing for a custom property -- its value is
   not checked until it is used, so the second line always wins and an old
   engine is left holding a colour it cannot read, and every var(--accent)
   under it is dropped. The same goes for any declaration containing var().
   The deep accent is deliberately darker than it needs to be -- a fallback
   should be safe at every hue rather than pretty at most. */
@supports not (color: oklch(0 0 0)) {
  :root {
    --accent: hsl(var(--device-hue, 20) 70% 60%);
    --accent-deep: hsl(var(--device-hue, 20) 45% 24%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  line-height: 1.45;
}

/* Base link color -- without this, any <a> not already covered by a more
   specific rule (.tile, .badge, .back-link, ...) falls back to the
   browser's default blue, which is nearly unreadable against black and
   was never part of this app's palette to begin with. No blanket a:hover
   rule here on purpose: components with their own hover treatment
   (.tile:hover, .badge:hover, ...) set background/color but not always
   text-decoration/opacity, and a bare `a:hover` would still win on
   whichever property those don't explicitly re-set (same specificity
   category, but with an extra element-selector point) -- narrower,
   per-context hover rules are safer than one global one here. */
a { color: var(--fg); }

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Uppercase with a little tracking is what makes URW Gothic read as
   equipment labelling rather than as a generic geometric sans -- it's a
   1970s Avant Garde clone and it wants to be set that way. Applied to
   headings only; body copy stays sentence case. */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
h1 { font-size: 1.4rem; margin-bottom: 0.75rem; }
/* Pairs an <h1> with a settings cog (a plain .badge link, see below) on
   pages whose old inline "Advanced" section moved to /system/settings/*. */
.page-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
/* Two controls at the end of a title row, kept together. The form around a
   POST-only action would otherwise be a third flex item and space itself out
   between them. */
.page-title-actions { display: flex; align-items: center; gap: 0.5rem; }
.page-title-actions form { margin: 0; display: flex; }
.page-title-row h1 { margin-bottom: 0; }
h2 { font-size: 1.1rem; margin-top: 2rem; }
h3 { font-size: 0.98rem; margin-top: 1.25rem; }

/* Explicit height (not padding-driven auto height) so --topbar-h is exact,
   not guessed -- .chat-screen relies on it to fill the rest of the
   viewport precisely. */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}
/* ---- installed (Home Screen / standalone) --------------------------------
   Set by static/display-mode.js; see that file for why an attribute and
   not `@media (display-mode: standalone)` alone.

   Only reachable with viewport-fit=cover in the viewport meta, which is
   what makes env(safe-area-inset-*) return anything but zero -- and
   viewport-fit=cover is also what lets the page paint *under* the status
   bar in the first place. The two go together: without this padding the
   brand and the account control sit beneath the clock and the battery.

   The env() fallback is 0px, so every browser that has never heard of safe
   areas renders exactly what it does now. Preview it anywhere with
   ?standalone -- no install required, which is the point. */
html[data-display-mode="standalone"] .topbar {
  height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(1rem, env(safe-area-inset-left, 0px));
  padding-right: max(1rem, env(safe-area-inset-right, 0px));
}
.topbar-left { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 0.9rem; flex-shrink: 0; }
.topbar .brand { color: var(--fg); font-weight: 600; text-decoration: none; letter-spacing: 0.02em; }

/* Lives at the top of #page-content now, not the topbar (see base.html) --
   a bordered, badge-like button rather than a small muted inline text link,
   specifically so it reads as an obvious, tappable control instead of
   something easy to miss next to the brand logo. */
.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1.2rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
}
/* The pointer guard, and the policy behind it, stated once for the whole
   file: every :hover rule in this stylesheet sits inside
   `@media (hover: hover) and (pointer: fine)`. No exceptions, including the
   rules whose only job is to cancel another hover.

   Why, in full, is above `button:hover` and again in POINTER AND
   WIDE-VIEWPORT BEHAVIOUR near the bottom; the short version is that a
   phone has no way to unhover, so a tapped control keeps its hover paint
   until something else is tapped -- and this app's hover paint is a
   one-step surface lift, which is very close to what "selected" looks like.

   The policy is written as an all-or-nothing rule because the four hovers
   this file did *not* guard were each individually defensible when they
   were written, and four defensible exceptions are how a rule stops being
   one. An opt-out (`.tile.tile-static:hover`, `.tile-menu-item[disabled]:hover`)
   is genuinely harmless outside the guard -- restating a resting value on a
   device that was never going to leave it costs nothing -- but it is also
   the shape someone copies when adding the next real hover, so it comes
   inside too. A media query does not change specificity, so an opt-out
   still beats the rule it cancels from inside a block of its own.

   The blocks below don't repeat any of this. A bare `:hover` in this file
   is a bug, not a decision. */
@media (hover: hover) and (pointer: fine) {
  .page-back-link:hover { background: var(--surface-3); }
}

/* Text badges, not icons -- emoji render as full-color glyphs on every
   platform and clash with the rest of this app's monochrome outline/text
   language (buttons, tiles, dots), so status/label widgets are small
   bordered text instead, matching .filter-tab. Originally topbar-only,
   now reused anywhere a compact label fits (e.g. a model name in chat). */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--bone);
  text-decoration: none;
  line-height: 1.5;
  white-space: nowrap;
}
/* A badge that leads with a drawn icon. These SVGs carry no width/height of
   their own -- every other icon site in this file sizes them explicitly, and
   without a rule here the browser falls back to the SVG default box, which
   is vastly larger than the 0.68rem text beside it. The gap is what keeps
   the glyph from touching the label; .badge is a centred flex row already,
   so nothing else is needed. */
.badge svg { width: 0.95rem; height: 0.95rem; flex: none; }
.badge:has(svg) { gap: 0.35rem; }
.badge.dummy { opacity: 0.4; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  a.badge:hover, button.badge:hover { background: var(--surface-3); }
}
button.badge { background: none; font: inherit; cursor: pointer; }
#topbar-connectivity.dot { width: 0.65rem; height: 0.65rem; margin-right: 0; }

/* Scaffold only (fleet-foundation-plan.md section I) -- deliberately no
   `display` rule on #session-switcher/.session-switcher-menu themselves:
   topbar.js toggles their `hidden` attribute, and this app already hit the
   bug where an author `display` rule on the same selector silently
   overrides the UA's [hidden]{display:none} regardless of specificity (see
   the terminal fullscreen toolbar fix). */
.session-switcher { position: relative; }
.session-switcher-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.4rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  min-width: 10rem;
  z-index: 10;
}
.session-switcher-item { display: block; padding: 0.3rem 0.5rem; font-size: 0.85rem; text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .session-switcher-item:hover { background: var(--surface-2); }
}
/* Separated from the device list above it: going to the console is a
   different kind of action from jumping to a device. */
.session-switcher-console { border-top: 1px solid var(--muted); margin-top: 0.2rem; padding-top: 0.4rem; }
/* Log out sits below #session-switcher-items (device list + Manage devices,
   see base.html) -- same separator treatment as .session-switcher-console
   above it, since this is a third, even more distinct kind of action again.
   A real button (not a .session-switcher-item link) styled with .danger --
   red border/text, full-invert-to-red on hover -- rather than the plain
   list-item look, so ending your session doesn't read as just another menu
   row next to a device jump. */
.session-switcher-logout-form { border-top: 1px solid var(--muted); margin-top: 0.2rem; padding-top: 0.4rem; }
.session-switcher-logout { display: block; width: 100%; text-align: center; }

.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--bad-ink); font-weight: 600; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* The "stay signed in for" choices on the console's Security page. A row of
   radios that wraps, rather than a <select>: five fixed options is few
   enough to show all of them, and a menu you have to open hides the fact
   that there is a choice at all. */
.session-length { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.75rem 0; }
/* Same dress as .stacked-form's select, but this form is a row rather than a
   stack -- one picker and its Save button sit side by side, which keeps the
   control to a single line on a phone. */
.session-length select {
  min-height: 46px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: inherit;
}

.banner {
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.banner.error { border-color: var(--bad); color: var(--bad-ink); }

/* /intersection/console/vm/progress -- a deliberately plain loading screen (no
   per-step detail, no raw provisioning log) shown while a cloud VM session
   starts or saves. .vm-progress-filler is an intentionally empty slot below
   the status line, reserved so a future "something to do while you wait"
   feature has an obvious place to go without a redesign. */
.vm-progress { text-align: center; padding: 3rem 1rem; }
/* The same spinner at row scale, for the update page's "working" state. The
   mark is shared deliberately -- see .vm-progress-spinner below and
   ui-design-notes.md's "do not add a second spinner" -- and only its size and
   its box change here. `hidden` needs the explicit rule for the reason
   .home-drawer[hidden] records: the author `display` below would otherwise
   beat the UA's. */
.update-working { display: flex; align-items: center; flex: none; }
.update-working[hidden] { display: none; }
.update-working .vm-progress-spinner { width: 1.1rem; height: 1.1rem; border-width: 2px; margin: 0; }
.vm-progress-spinner {
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto 1.2rem;
  border: 3px solid var(--border);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: vm-progress-spin 0.9s linear infinite;
}
@keyframes vm-progress-spin { to { transform: rotate(360deg); } }
.vm-progress-label { font-size: 1.05rem; }
.vm-progress-filler { margin-top: 2rem; }
/* The waiting pages' glyph row: the notify bell, and "check again" once a
   page has stopped. Both hide themselves when they have nothing to offer. */
.wait-actions { display: flex; justify-content: center; gap: 0.75rem; margin-top: 1rem; }
/* .icon-btn's own display would otherwise beat the UA's [hidden]. */
.wait-actions .icon-btn[hidden] { display: none; }

table.status-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1.25rem;
}
table.status-table th, table.status-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.inline-form { display: inline; }

.inline-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }

/* Restyled in place rather than replaced with .btn everywhere: these three
   selectors cover every control in ~20 not-yet-migrated templates plus the
   intersection console, so pointing them at the new language unifies the whole app
   without twenty risky markup rewrites. Same tactic as the legacy colour
   aliases in :root. A page still gets migrated to .btn/.row properly when
   its *structure* needs to change, not merely its paint. */
button, .filter-tab, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  /* See the block above .btn -- and note that a left-aligned control built
     on <button> has to zero this back out. */
  text-indent: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}
/* (hover: hover) scopes this to devices with a real hover-capable pointer
   (mouse/trackpad) -- touch devices have no way to "unhover", so without
   this a tapped button's :hover state visually sticks until something else
   is tapped, using the exact same invert as an actually-selected/locked
   state (see .mod-key.locked etc.) and making the two indistinguishable. */
@media (hover: hover) and (pointer: fine) {
  /* :not([disabled]) so a dimmed control doesn't still light up under the
     pointer -- CSS :hover matches a disabled <button> perfectly happily,
     and the invert is this app's "you can press this" signal. Written here
     rather than as a later `button[disabled]:hover { background: ... }`
     override on purpose: that rule would out-specify `.btn--primary` and
     repaint a disabled primary button surface-grey on hover. */
  button:not([disabled]):hover, .filter-tab:hover { background: var(--surface-3); }
}
.filter-tab.active { background: var(--accent); color: var(--on-accent); }

/* The bare element's disabled state. .btn, .tile-menu-item and .hs-row-del
   each grew one of these; the ~65 buttons in this app that carry no class
   at all never did, and fell through to the UA's own disabled grey --
   which, as the comment on .tile-menu-item[disabled] already says, is
   picked for a white page and disappears on ours. Every mechanism below
   disables a button, so without this a busy control on a not-yet-migrated
   page is one that has visibly stopped working rather than one that is
   working. Same 0.45 as .btn[disabled], so a dimmed control looks the same
   wherever it appears. */
button[disabled], input[type="submit"][disabled] {
  opacity: 0.45;
  cursor: default;
}

/* ---- The busy state ------------------------------------------------------

   Roughly 45 POST forms, and until this existed exactly two of them said
   anything at all when you pressed the button. Everything else -- Wi-Fi
   Connect, Sunshine start/stop, reboot, Stripe checkout -- looked precisely
   like a tap that missed until the answer arrived, which on a phone talking
   to the intersection (and then to DigitalOcean, or Stripe) is long enough
   to press it again. See static/form-busy.js for the same argument at
   length.

   ONE busy state, marked from two directions, because no single mechanism
   reaches every form here:

   1. `htmx-request`, free, for every boosted form. htmx puts that class on
      **the form, not the button** -- verified in the vendored source, not
      assumed: addRequestIndicatorClasses is handed the element that issued
      the request (for a boosted <form>, the form itself) and only looks
      elsewhere if hx-indicator names something. So the selector has to
      reach down from the form to the button.
   2. `.is-busy`, put on the button by form-busy.js, for the forms htmx
      never sees: the hx-boost="false" ones (reboot, sleep, shutdown, sign
      in -- the slowest and most consequential actions in the app) and the
      whole intersection console, which loads no htmx at all.

   `button:not([type="button"]):not([type="reset"])` rather than
   `button[type="submit"]`: submit is the *default* type and most of this
   app's buttons don't spell it out, so matching on it would miss them.
   What must be excluded is the other kind -- a modal's Close and Cancel
   sit inside the same <form> as its submit button (dashboard, files,
   profile, updates all do this) and must stay lit while it's in flight. */
form.htmx-request button:not([type="button"]):not([type="reset"]),
button.is-busy {
  opacity: 0.45;
  cursor: default;
  /* Not decoration: on a console page there is no htmx to disable the
     control outright, and this is what stops the second tap. */
  pointer-events: none;
}

/* The motion cue. Same ring, same keyframes as .vm-progress-spinner above
   -- deliberately not a second spinner vocabulary -- shrunk to sit beside a
   label and drawn in currentColor so it inverts along with the button it is
   attached to, exactly as an _icons.html glyph does.

   Icon-only controls are excluded: .icon-btn-solid is a fixed 44px square
   and .icon-btn barely more, so there is no room beside the glyph for this
   to appear in without either overflowing or squeezing the glyph. Those
   keep the dimming above, which on a control that small is the whole of the
   available signal anyway. */
form.htmx-request button:not([type="button"]):not([type="reset"]):not(.icon-btn):not(.icon-btn-solid)::after,
button.is-busy:not(.icon-btn):not(.icon-btn-solid)::after {
  content: "";
  flex: none;
  display: inline-block;
  vertical-align: -0.1em;
  width: 0.85em;
  height: 0.85em;
  /* A margin rather than the parent's `gap`, because these buttons are not
     all flex containers (.tile-menu-item is display: block). On a .btn,
     which has its own 0.5rem gap, the two add up and the ring sits a little
     further out -- the only place this shows, and it costs nothing. */
  margin-left: 0.5rem;
  border: 2px solid var(--border);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: vm-progress-spin 0.9s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  /* Still a ring with one bright arc, just not turning: the dimming and the
     mark itself carry the state, and only the rotation was the problem.
     Written without the exclusions above because it doesn't need them -- a
     pseudo-element with no `content` generates no box, so this reaches
     exactly the rings the rule above drew and nothing else. */
  form.htmx-request button::after, button.is-busy::after { animation: none; }
}

/* Generic icon-only control -- fixed, square-ish sizing so a row/overlay of
   these reads as uniform controls regardless of which glyph each one
   carries, unlike text labels of different lengths sitting side by side
   (see ui-design-notes.md). Border/background/hover-invert already come
   from the plain `button` rule above; this only fixes the shape. Always
   pair with a `title` attribute -- an icon button carries no visible label
   of its own. Not the same rule as .term-fs-toolbar button.icon-btn, which
   only affects that one toolbar and predates this general-purpose version.*/
.icon-btn {
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.3rem;
  /* Optically centred, not box-centred -- see "Why every icon square drops
     its glyph" above .btn. */
  padding-top: calc(0.3rem + 2 * var(--glyph-drop));
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Both of these because an .icon-btn is sometimes an <a> and sometimes a
     <button>, and the two arrive with different defaults. The button rule
     above hands a <button> `text-decoration: none`; an anchor gets the
     UA's underline instead, under a cog or an arrow, which is how the
     Settings and Fullscreen controls ended up underlined. See
     .icon-btn-solid, which had the same split. */
  text-decoration: none;
  /* A single glyph has nothing to track *between*, and the trailing
     letter-space is what pushes it off centre -- see the block above .btn. */
  letter-spacing: 0;
  text-indent: 0;
}
/* An .icon-btn's glyph is a Unicode character by default (sized via its own
   font-size), but a few (trackpad's Keyboard) use inline SVG instead -- see
   trackpad.html's own comment on why that one specifically couldn't use a
   Unicode glyph without risking emoji rendering. `em` sizing
   scales the SVG along with whichever font-size context it's in (this
   generic 1rem, or .trackpad-toolbar button.icon-btn's 1.2rem override)
   instead of the SVG's own intrinsic pixel dimensions from its viewBox. */
.icon-btn svg {
  width: 1.1em;
  height: 1.1em;
  display: block;
  flex-shrink: 0;
}
/* An SVG is centred on its own viewBox already -- it has no baseline and no
   descender to compensate for, so the optical drop above would just push it
   a pixel low. */
.icon-btn:has(svg) { padding-top: 0.3rem; }

/* Two classes with no rule anywhere until now. system_settings_trackpad.html
   has used .setting-toggle / .setting-toggle-label since it was written, so
   its Natural scrolling and Tap to click switches have been rendering as raw
   browser-default checkboxes -- visibly not this app. Found while adding the
   chat settings page, which needs the same shape: a checkbox that submits
   with the rest of a form rather than on its own.

   Not the switch() macro (_switch.html), deliberately. That is a form per
   toggle that posts the moment you press it, which is right for a radio or a
   service but wrong for one field among ten behind a single Save. */
.setting-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 46px;
  padding: 0 0.9rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}
.setting-toggle input:is([type="checkbox"], [type="radio"]) {
  /* The one place a native control is kept: it is already a checkbox, the
     accent is the device's own, and re-drawing it would be a third toggle
     shape in an app that already has .switch and a plain button. */
  accent-color: var(--accent);
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  flex: none;
  margin: 0;
}
.setting-toggle-label { font-size: 0.9rem; }
/* A one-of-several choice inside a settings form (the trackpad's drag or
   touch): the same rows as .setting-toggle, grouped under a plain heading
   instead of the browser's etched fieldset box. */
.setting-choice { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.setting-choice legend { padding: 0; margin-bottom: 0.4rem; font-weight: 600; }
/* The toolbar switch's own mark beside each choice, so the setting and the
   control on the Desktop view are recognisably the same thing. */
.setting-toggle-icon { display: flex; flex: none; color: var(--bone-dim); }
.setting-toggle-icon svg { display: block; width: 1.25rem; height: 1.25rem; }

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 420px;
}
.stacked-form input, .stacked-form textarea, .stacked-form select {
  min-height: 46px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: inherit;
}
.stacked-form textarea { padding: 0.7rem 0.9rem; }
.stacked-form button { align-self: flex-start; }

/* Settings pages are a stack of independent little forms, and each of them
   is now a 44px control -- so two in a row sat flush against each other and
   read as one oddly-split widget. They were fine when controls were short
   outlined chips; the kit's minimum tap target is what exposed it. The gap
   goes between sibling forms rather than inside .stacked-form, which
   already spaces its own children. */
.stacked-form { margin-bottom: 1.25rem; }
form + form,
form + .button-row,
.button-row + form { margin-top: 0.75rem; }
/* ...but only where the forms are in ordinary document flow. A container
   that lays its own children out with `gap` already owns the spacing between
   them, and the rule above then adds 0.75rem to every form *except the
   first* -- which does not read as "the rest are low", it reads as the first
   button or tile sitting higher than its neighbours. That is what put Start
   above Stop/Restart/Enable on the Sunshine page and lifted the first tile
   of the Applications grid above the second.
   .tile-menu-form below already zeroes this out in its own rule; these are
   the rest of the gap-based layouts that hold sibling forms. A new one
   needs adding here. */
.button-row > form,
.tile-grid > form,
.inline-actions > form,
.row-stack > form { margin-top: 0; }
/* The toggle sits inside the input itself (not beside it) -- an absolutely
   positioned icon button over the input's own right padding, rather than a
   separate flex sibling. Deliberately NOT `display: flex` on
   `.password-field` with `flex: 1` on the input (an earlier version of
   this did that): a flex item's `flex-basis` wins over its own `width`
   whenever basis isn't `auto`, which would have silently overridden
   system_wifi.html's fixed-width password field. `top: 50%` +
   `translateY(-50%)` centers on the wrapper's actual midpoint instead,
   independent of both the input's width and any line-box height slack a
   plain block wrapper has around an inline-block input. */
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 2.25rem; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: var(--radius);
  background: none;
  padding: 0;
  color: var(--muted);
}
/* Firefox gives buttons their own internal focus padding that isn't
   removed by `padding: 0` alone -- same reset already used for
   .tile-button elsewhere in this file. */
.password-toggle::-moz-focus-inner { border: 0; padding: 0; }
@media (hover: hover) and (pointer: fine) {
  .password-toggle:hover { background: none; color: var(--fg); }
}
.stacked-form label { margin-bottom: -0.25rem; }

/* The way out of a page whose real business is the form above it -- sign
   out on the two-factor challenge, and anything else that ends up in the
   same shape. It is not one of the page's actions and must not sit in the
   same rhythm as them: a 44px button immediately under another 44px button
   reads as a second submit, which is exactly how it read on the challenge
   page for as long as that page has existed. */
.form-escape { margin-top: 2.25rem; }
.form-escape-note { margin-top: 2.25rem; margin-bottom: 0.4rem; }
.form-escape-note + .form-escape { margin-top: 0; }

/* The device PIN field. This used to be a `type="text"` masked only by
   `-webkit-text-security: disc`, deliberately, to keep a browser from
   offering to save it and muddling it with the Supabase account password.
   Two things were wrong with that. Firefox implemented no such property, so
   the PIN was simply on screen in plain digits for anyone using it; and
   password-toggle.js only ever wraps input[type="password"], so the one
   field in the app you might most want to check before submitting was the
   one with no way to reveal it.

   It is a real password input now (local_login.html explains that trade),
   and **the masking declaration is gone**. It was kept once as "a harmless
   no-op on a field the browser is already masking". It was not: the reveal
   works by swapping the input's `type` to `text`, and a CSS property does
   not care what type the element is. Both PIN prompts in the app wear this
   class -- the unlock page and the sealed channel's dialog -- so on every
   Chromium and WebKit browser (and, since 135, Firefox too) the eye
   redrew itself, announced "Hide password", and left six dots on screen.
   The field was the only one in the app where the control was inert, and
   it is the field where an invisible stray character costs someone their
   evening.

   What is load-bearing now is the input's own autocomplete="off" -- that,
   not any of this, is what keeps the PIN out of the password manager. */
.pin-input {
  letter-spacing: 0.35em;
  /* The worst case in the app: at 0.35em the digits sat visibly left of
     centre in the field. See the block above .btn. */
  text-indent: 0.35em;
  text-align: center;
}

/* Sign in, create account, password reset, local unlock and the device-PIN
   instructions page all share this centered card -- the one family of pages
   in the app that isn't left-aligned inside <main> like everything else,
   because a standalone auth screen reads as more standard centered than
   sharing every other page's top-left, list-like layout.

   It used to be .hero-card's language: `1px solid var(--fg)` on the page's
   own ground. That is the outlined vocabulary the kit moved away from -- a
   full-bone rule is the heaviest line the palette has, and it drew a box
   round the quietest screen in the app. A raised surface says the same thing
   (this is a thing, and it is not the page) without shouting it, and matches
   every other grouped surface the kit draws. */
.auth-shell { display: flex; justify-content: center; padding-top: 1.5rem; }
.auth-card {
  width: 100%;
  max-width: 380px;
  border: 0;
  border-radius: var(--radius);
  background: var(--ground-2);
  padding: 1.75rem 1.5rem 1.5rem;
}
.auth-card h1 { text-align: center; }
.auth-card .hint { text-align: center; margin-bottom: 1.25rem; }
/* The form itself. Not .stacked-form: that rule dresses bare inputs, and
   these are kit .field controls, which it would override on specificity
   whichever order the two rules ended up in. The layout is all this needs.

   The gap is the label-to-field gap; each label pulls its own bottom margin
   in so a label sits with the field it names rather than floating midway
   between two. */
.auth-form { display: flex; flex-direction: column; gap: 0.5rem; }
/* Without this the line above wins and the form never goes away.
   `display: flex` is an author rule, and an author `display` beats the UA's
   `[hidden] { display: none }` at any specificity -- the trap
   .home-drawer[hidden], .battery-plug[hidden] and .music-player-bar all
   already record.
   Two flows set `form.hidden = true` and both were silently doing nothing:
   the password reset, which has claimed since it was written that "the form
   goes away rather than inviting a second send", and signup, where the
   account already exists by the time the check-your-email notice appears --
   reported as "it just says check email to confirm account but I can click
   it again". */
.auth-form[hidden] { display: none; }
.auth-form .kit-section-label { margin-bottom: -0.2rem; }
.auth-form .kit-section-label:not(:first-child) { margin-top: 0.6rem; }
/* The card's submit stands off from the fields it follows -- it is the
   action, not the last of them. Width comes from .btn--block in the kit. */
.auth-form .btn--block { margin-top: 1.1rem; }
.auth-card .notice { margin-top: 1rem; }
/* Both ways off this card -- the other auth page, and the way to reset a
   password. Deliberately not buttons: see .form-escape above for the same
   decision and the same reason, a 44px control immediately under another
   44px control reads as a second submit. */
/* The gap between an auth card's form and a switch that follows it -- the
   Local network access control under the device PIN. .switch-form draws its
   own rule underneath itself but nothing above, and without this the switch
   sits in the same rhythm as the paragraph before it, reading as part of
   the sentence about the PIN rather than as a separate thing to set. */
.auth-card .switch-form { margin-top: 1.75rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; }
.auth-switch + .auth-switch { margin-top: 0.5rem; }

.pair-columns {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0 1.5rem;
}
.pair-column { flex: 1; min-width: 240px; }
.pair-column h2 { margin-top: 0; }

/* Home page tiles + the Agents/Chat picker share this look. Fixed 2-column
   grid rather than auto-fit -- deliberately blocky/simple rather than
   reflowing to however many columns happen to fit a given width. */
.tile-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr -- a grid item's implicit min-width is
     "auto" (its content's own min-content size) unless the track itself
     caps it. Plain 1fr only splits the *remaining* space after that
     minimum is honored, so a tile with wide content (the terminal session
     tiles' rename input + Open/Fullscreen/Close badge row, especially with
     a long session title) grows its column -- and the whole grid, and the
     page -- past the viewport on a narrow phone instead of wrapping. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 1rem;
}
/* One device per row, on the console's device lists.

   Two columns is right for the home screen, where a tile is an icon and a
   short word and the grid is something to scan. It is wrong for a list of
   machines: a device name is not a label chosen to fit, it is whatever the
   owner called the thing, and in half a phone's width most of them did not
   fit. Three of four names on a real console were ellipsed -- the one fact
   the list exists to tell you, cut off. */
.tile-grid--rows { grid-template-columns: minmax(0, 1fr); }
.tile {
  display: block;
  padding: 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--bone);
  text-decoration: none;
}
/* Guarded for the reason spelled out above button:hover -- and it matters
   more here than anywhere: this console is driven mostly from a phone, a
   tile is the biggest thing on the page, and one lifted to --surface-2
   with no way to unhover it is indistinguishable from a tile that's
   somehow selected. The same guard is already on .mosaic .tile:hover in
   the component kit at the bottom of this file; this is the legacy .tile
   catching up with it, not a second policy. */
@media (hover: hover) and (pointer: fine) {
  .tile:hover { background: var(--surface-2); }
}

/* Unreachable/never-finished-enrolling device tiles on the intersection console --
   dimmed rather than hidden, since a device still existing (just not
   reachable right now) is useful to know. Deliberately just the tile
   itself, not .tile-wrap -- the overlaid Remove icon stays full-strength
   even here, since a dead device is exactly what you'd reach for it on
   (see the thinkpad's TPM2 credential incident). */
.tile-offline { opacity: 0.55; }

/* Wraps a device tile (an <a> when online and there's nothing else to do
   with it, a plain div otherwise) plus its overlaid "more actions" menu.
   The menu is a sibling of the tile, not nested inside its <a> -- browsers
   don't handle a real interactive control nested inside a link reliably,
   and it would fight the link for the click. Being later in paint order
   over a `position: relative` ancestor, it's already on top and clickable
   on its own with no z-index needed; set one anyway for clarity. See
   ui-design-notes.md's "whole tile is the link" section -- this is the
   general shape for "one primary action, one small secondary one" that
   doesn't demote the primary action to a smaller button.

   A cloud session's tile is the case this had to be got right for, and it
   took three tries. Save & Stop was a sibling below the tile (a slab
   attached to it rather than one of its controls), then an action row
   inside the tile's body -- which cost the tile its link, since a <button>
   cannot live in an <a>, and demoted Open to a small button. It is now in
   the .tile-menu overlay below, which is what this whole shape exists for,
   and a running session's tile is a plain link like every other device's.

   Grid rows stretch their items to equal height by default, but a plain
   .tile is only display:block, sized to its own content -- so two tiles in
   the same row with different amounts of text ended up different heights,
   with borders that didn't line up. .tile-wrap itself is the column flex
   box (not just its .tile child): .tile gets flex: 1 so it grows to fill
   whatever height the row actually is. Scoped to .tile-wrap (intersection
   console only) rather than the base .tile class, which other pages rely on
   sizing to its own content.

   It also carries the .tile-button--stacked case: a stopped cloud session
   is a <form class="tile"> whose button fills it, and the button needs the
   same column layout its link-tile neighbours get from the rule below. */
.tile-wrap { position: relative; height: 100%; display: flex; flex-direction: column; }
.tile-wrap > .tile { flex: 1 1 auto; display: flex; flex-direction: column; }
/* A device's own name sits in the same top-right corner as the menu toggle
   below -- without reserving room for it, a long display_name ran straight
   under the overlaid button instead of stopping short of it. min-width: 0
   is what lets a flex child actually shrink and ellipsize instead of
   overflowing its row (the flex default is "auto", i.e. never smaller than
   its own content). Long names additionally drop a size, same idea as
   apps.html's own name-long/name-xlong tiers for its app tiles -- reusing
   the app-wide 1.1rem title size unconditionally left long names either
   truncating so early they were unreadable, or (worse) not actually
   shrinking to fit at all. */
.tile-wrap .tile-title { padding-right: 1.8rem; }
.tile-wrap .tile-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* The .name-long / .name-xlong tiers are gone with the two-column grid that
   needed them. They shrank a name to 0.92rem past fourteen characters and
   0.8rem past twenty-two, which was the best available answer while a tile
   was half a phone wide. Across a full row those lengths fit at full size,
   and shrinking them would now be a device whose name is printed smaller
   than its neighbour's for no reason the owner can see. The ellipsis above
   stays for the genuinely absurd case. */

/* The kind of machine, on the title line. Sized in em so it tracks the
   title rather than being pinned to a pixel size the type can outgrow, and
   --bone-dim so it reads as an annotation to the name rather than as a
   second thing competing with it. */
.tile-type { display: inline-flex; flex: none; margin-right: 0.45rem; color: var(--bone-dim); }
.tile-type svg { width: 1.05em; height: 1.05em; display: block; }

/* Every device tile's overlaid "more actions" control -- a sibling of the
   tile, not nested inside its <a>, same reasoning as the old Remove-icon
   version this replaces (see ui-design-notes.md's "whole tile is the link"
   section): browsers don't handle a real interactive control nested inside
   a link reliably, and it would fight the link for the click. */
.tile-menu {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 1;
}
/* Every .tile-menu is its own stacking context at z-index 1, so a panel's
   z-index only counts inside it -- and the next row's menu, later in the
   page at the same level, painted its toggle on top of the open panel
   dropping over it. The open one is lifted out of that tie. */
.tile-menu.is-open { z-index: 20; }
.tile-menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.3rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  min-width: 9rem;
  z-index: 10;
}
.tile-menu-form { margin: 0; }
.tile-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  text-indent: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  background: none;
  border: none;
  color: var(--fg);
  /* Every one of these was a <button> until Files put a Download link in a
     menu, and an <a> arrives with the UA's underline -- the same <a>-vs-
     <button> split that had the Settings cogs underlined. */
  text-decoration: none;
}
/* "Wake already requested" is the only disabled item here so far. Without
   this it fell to the UA's own disabled grey, which is picked for a white
   page and disappears on ours -- the same class of bug as the danger red
   below. Matches .btn[disabled]'s opacity so a dimmed control looks the
   same wherever it appears. */
.tile-menu-item[disabled] { opacity: 0.45; cursor: default; }
.tile-menu-item.danger { color: var(--bad-ink); }
/* All three menu hovers together rather than each beside the rule it
   modifies, so the guard is written once for the component. Relative order
   is unchanged and doesn't matter anyway: each of these out-specifies the
   one above it. */
@media (hover: hover) and (pointer: fine) {
  .tile-menu-item:hover { background: var(--surface-2); }
  .tile-menu-item[disabled]:hover { background: none; }
  .tile-menu-item.danger:hover { background: var(--bad); color: var(--bone); }
}

/* The intersection console's "connect another device" tile -- deliberately the
   inverse of every other tile's resting state (a filled light block among
   dark ones) so it reads as the one obviously-different, always-inviting
   action in the grid, not just another device. Centered like
   .tile-button's "+ New session" tile (terminal.html) -- a tile that's one
   deliberate action reads as a call-to-action, not a content card, so it
   shouldn't be left-aligned like one.

   White at rest, --accent only on hover, and that split is the whole point:
   this tile lives on the *intersection* console, where no device is in
   scope, so --device-hue falls back to 20 and --accent resolves to the
   original orange. A saturated orange block was the only colour on the
   page, sitting the same distance round the wheel as --warn and --bad --
   an invitation to add a device was reading as a destructive action. White
   is the same "filled, unlike its neighbours" idea with no hue to
   misread, and the accent still shows up, as the response to the pointer
   rather than as the resting paint.

   Text follows the fill it sits on: --ground on white (18.6:1, and the
   same pairing .topbar-cluster .badge already uses on its white patch),
   --on-accent on the accent, which is the job that token exists for and
   which the 360-hue test holds at >=4.86:1 everywhere on the wheel. */
.tile.tile-add {
  background: var(--bone);
  color: var(--ground);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  gap: 0.4em;
}
/* The plus leads the label at the label's own size -- it was a typed "+". */
.tile.tile-add svg { width: 1.1em; height: 1.1em; flex: none; }
/* Guarded, like every other hover in this file (see the comment above
   button:hover): a phone can't unhover, and an accent fill that stuck
   after a tap is exactly what a *selected* tile looks like -- on a tile
   whose whole job is "tap me to add a device", the stuck state would be
   claiming the device was already added. */
@media (hover: hover) and (pointer: fine) {
  .tile.tile-add:hover { background: var(--accent); color: var(--on-accent); }
}

/* Device tiles carry a status dot inline with the name; .dot's own margin
   already spaces it, so nothing extra is needed here. */
/* A flex row: a status dot, a mark for the kind of machine, and the name.
   Both marks carry their own right margin, so there is no gap here to keep
   in step with them. */
.tile-title {
  display: flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
/* min-width: 0 because this is a flex container (device tiles put a status
   dot inline with the text): without it the text item keeps its
   min-content width and pushes the status past the tile's edge instead of
   wrapping inside it. overflow-wrap catches the remaining case -- a single
   token longer than the column, like an unbroken hostname -- which would
   otherwise still overflow rather than break.
   flex-wrap so a dot + long status moves the text to its own line rather
   than crushing it into whatever is left beside the dot. */
.tile-status {
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  overflow-wrap: anywhere;
}
.tile-status + .tile-status { margin-top: 0.2rem; }

/* A running session's time left and size (session_line in
   intersection_devices.html). A short filled bar, no track outline, in the
   accent: the same "time left" shape as the bar in the machine's own
   session dialog, at tile scale. */
.tile-session { gap: 0; }
.tile-timer {
  flex: none; width: 3.2rem; height: 6px; margin-right: 0.5rem;
  border-radius: 3px; background: var(--surface-2); overflow: hidden;
}
.tile-timer i { display: block; height: 100%; background: var(--accent); }
.session-left { font-variant-numeric: tabular-nums; }

/* A slot whose last start failed. --bad-ink, not --bad: this writes rather
   than paints (see the token comment above), and it sits next to a dot-bad
   that does the painting. */
.tile-status-bad { color: var(--bad-ink); font-weight: 600; }

/* The first-session PIN, inside a tile. Stacked rather than inline: a tile is
   the narrowest thing on the page and a field beside a button wraps into two
   half-width controls on a phone, which reads as a broken layout rather than
   a compact one. */
.vm-start-form { display: flex; flex-direction: column; gap: 0.5rem; }
.vm-start-form .field { min-height: 44px; width: 100%; }
.tile-hint { margin-top: 0.35rem; color: var(--muted); font-size: 0.75rem; line-height: 1.3; }

/* The PIN step-up dialog (static/pin-modal.js, markup in base.html).

   Its <form> is a .modal-body now, and that is the whole of this rule's
   history: this file used to give .pin-modal-form its own flex column and
   its own gap, which was a second copy of .modal-body's -- and when
   `dialog.modal` took `padding: 0` (so .modal-body could own the padding
   instead), the copy that never got it left this dialog with none at all.
   Title, hint, field and buttons all sat flush against the dialog's edges,
   on the one prompt in the app that appears on top of whatever you were
   doing. The session dialog below hit the same thing and was patched with
   a padding of its own; this one is fixed by joining the class that
   already has one.

   What stays here is only what is genuinely this dialog's: a floor on the
   width, so the PIN box does not collapse to the width of two buttons.

   Deliberately above the touch-zoom floor further down: a `.field` rule
   declared after it wins on specificity and takes the 16px minimum with it,
   which is zoom-on-focus back on every phone. */
.pin-modal-form { min-width: min(20rem, 80vw); }
.pin-modal-form .field { min-height: 46px; }

/* The cloud-session warning (static/session-clock.js, markup in base.html).
   Dressed as .modal already, like the PIN dialog above; these lay out its
   contents and nothing else.

   Padded here rather than inheriting, because unlike .pin-modal-form this
   dialog holds no <form> wrapping everything -- there is no answer to give,
   only one action to take -- so its children are direct children of the
   dialog, and dialog.modal deliberately sets padding: 0.

   `dialog.modal.session-modal`, not `.session-modal`, and that spelling is
   the whole of a bug this shipped with. A bare class loses to `dialog.modal`
   (element plus class) on specificity, and loses again on order, that rule
   being 3800 lines further down. So the padding was declared, commented, and
   never once applied: the dialog's contents sat flush against its edges on
   every side. Two classes and the element, so neither can undo it.

   Why override narrowly instead of relaxing `dialog.modal`: modal.js reads a
   backdrop click as `ev.target === dialog`, which is also what a click on
   the dialog's own padding area reports as. Every other modal pads
   `.modal-body` instead, so its edge never becomes a dismiss zone -- that is
   what the zero is for, not tidiness. This dialog is not wired by modal.js
   at all (base.html loads session-clock.js and never modal.js), which is the
   only reason padding is safe on it. */
dialog.modal.session-modal { padding: 1rem; }
/* The title shares a row with the dismiss, so the step below it belongs to
   the row rather than to the heading inside it -- and a bottom margin on the
   h2 would pull the title half a step off centre against the 44px square. */
.session-modal .modal-head { margin-bottom: 0.5rem; }
.session-modal h2 { margin: 0; }
/* Two buttons: add an hour, and save and stop. The third -- the way out that
   does neither -- is now the dismiss in the head row, where a corner X is
   looked for anyway, and moving it buys back the width that used to make
   these two wrap at 420px. Still right-aligned for the same reason Confirm
   is in the PIN dialog -- the action is where the eye already is on the way
   out -- and still wrapping, because 420px is a cap and narrower phones
   exist. */
.session-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
/* The sentence about how many extensions are left. Set apart from the
   paragraph above it, which is about the deadline rather than about what can
   be done to it. */
.session-modal-extensions { margin-top: 0.6rem; }
/* The hours strip: the first hour and each extension it can grow by, the
   granted ones carrying a bar of the time left along their foot. Filled
   shapes, no outlines, like every other control here; an hour not yet added
   is the plain surface with its "+1" in faint ink. The bar rather than a
   full-height fill so the label always sits on a surface it is legible on,
   and the device's accent because it is the "this machine" colour the rest
   of the page already wears. */
.session-hours { display: flex; gap: 4px; margin-top: 0.8rem; }
.session-hours[hidden] { display: none; }
.session-hour {
  position: relative; flex-basis: 0; height: 44px; overflow: hidden;
  display: flex; align-items: flex-start; padding: 0.45rem 0.5rem;
  border-radius: var(--radius); background: var(--surface-2);
}
.session-hour i { position: absolute; left: 0; bottom: 0; height: 6px; background: var(--accent); }
.session-hour b {
  position: relative; font-family: var(--font-label); font-weight: 700; font-size: 0.62rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--bone);
}
.session-hour--later { background: var(--surface); }
.session-hour--later b { color: var(--bone-faint); }
.session-modal-extensions[hidden] { display: none; }
/* .btn sets a display, and an author display beats the UA's
   [hidden] { display: none } at any specificity -- the trap .home-drawer,
   .battery-plug and .auth-form all already record. Without this the "Add an
   hour" button stays on screen after the extensions run out, which is the
   one state it must not be offered in. Caught by the invariant in
   tests/test_devset_web.py rather than by anybody looking. */
.session-modal-extend[hidden] { display: none; }

/* The badge is a button now, so it arrives carrying the UA's button styling
   -- a border, a grey fill and a font that is not this page's. .badge draws
   it; this only has to stop the browser from drawing it first. Cursor and
   focus are kept: it is a real control and should look and behave like one.
*/
button.session-clock {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

/* The install one-liner and its Copy button (intersection_connect_result.html).
   The line is long and carries a token, so it scrolls in its own box rather
   than wrapping into something that cannot be read or double-clicked
   cleanly -- and the button sits outside that scroll, or it would scroll
   away from the thing it copies. */
.install-line { display: flex; align-items: flex-start; gap: 0.5rem; }
.install-line pre {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  margin: 0;
}
.install-line .btn { flex: none; }
/* The long way round, folded away. Open it and it reads as the page it used
   to be. */
.install-manual { margin-top: 1.5rem; }
.install-manual summary { cursor: pointer; color: var(--bone-dim); font-size: 0.9rem; }
.install-manual pre { overflow-x: auto; }

/* The remaining-time badge, in the slot the battery occupies on a Pi.
   Tabular figures for the same reason .battery-badge uses them, and more
   sharply: this one changes every second, and a proportional colon would
   make the whole strip twitch once a second for an hour. */
.session-clock { font-variant-numeric: tabular-nums; }
/* Two minutes out: weight only, no colour. There is no --warn-ink, and
   --warn is a fill by this palette's own rule ("--bad paints something,
   --bad-ink writes on something") -- amber as text on the light cluster
   ground fails contrast exactly as a mid red does, which is what
   .battery-badge--low exists to document. Weight is enough here regardless,
   because the modal is already interrupting at this point; red is held back
   for the last minute so that it still means something when it arrives. */
.session-clock--warn { font-weight: 600; }
/* The last minute. Same treatment .battery-badge--low gets, and chosen for
   the same reason: on the light cluster ground a mid red fails contrast, so
   this is the legible warning ink rather than merely red. */
.session-clock--urgent { color: var(--bad-ink); font-weight: 600; }
.session-clock[hidden] { display: none; }

/* The row's own error_message, verbatim. Upstream wording, which means it
   can be long and can carry a URL -- so it breaks anywhere rather than
   forcing the tile wide, and is clamped to three lines so one unlucky
   message cannot push the Try again button off a phone screen. The full
   text stays in the title attribute and in error_events. */
.tile-error {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Phone width is where a tile is narrowest and its status most likely to
   wrap, so that is where the title needs a little more room under it --
   otherwise a two-line status reads as one four-line block with the title
   buried in it rather than as a heading and its state. */
@media (max-width: 700px) {
  .tile-title { margin-bottom: 0.5rem; }
}

/* Home screen only: square icon tiles, 4 across, layered on top of the
   plain .tile/.tile-grid rules above (same border/hover-invert language)
   rather than replacing them -- these rules just override the parts that
   make a .tile a left-aligned title+status rectangle. aspect-ratio, not a
   fixed height, so a tile stays square at any column width the 4-up grid
   produces instead of needing a breakpoint-specific number. */
.icon-tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.7rem; }
.icon-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  text-align: center;
}
.icon-tile-glyph { display: inline-block; width: 1.9rem; height: 1.9rem; }
.icon-tile-glyph svg { width: 100%; height: 100%; }
.icon-tile-label { font-size: 0.72rem; font-weight: 600; line-height: 1.2; }

/* Eyebrow-style label ahead of the System Apps row: uppercase and muted
   rather than a full <h2> -- it's marking a tile category, not starting a
   new section of content the way "Power" or "Pair a Moonlight client" do
   elsewhere. (It used to cite .meter-label for that treatment; that class
   went with the hero card it belonged to.) */
.tile-divider { border: none; border-top: 1px solid var(--border); margin: 1.6rem 0 1.1rem; }
/* .tile-section-label lived here and is gone: it was the older of two
   eyebrow labels doing the same job, and the console's device list was its
   last user. .kit-section-label is the one the panel's six kit pages use,
   so the console now uses it too -- one label treatment, not two that
   differ in font, size, tracking and colour for no reason anyone could
   state. Part of the migration ui-todo.md item 11 describes.

   The margins it carried could not move onto .kit-section-label itself: the
   panel uses that class fifteen-odd times, mostly as an inline <span>
   labelling a meter or a card (the Status page's Storage/Memory/Battery,
   base.html's drawer headings), and a block margin would push all of them
   around. It is layout-free on purpose. So the spacing is a second class,
   applied only where the label is heading a grid. */
.tile-grid-label { margin-top: 1.5rem; margin-bottom: 0.7rem; }

/* Apps screen. (It had a tab bar holding one tab, this device's name --
   a switcher with nothing to switch to; gone until there is.) Each app tile is a <form>
   (launching an app is a POST, not a navigation) carrying .tile directly,
   so it's a completely normal grid item sized like any other .tile -- a
   <button> can't reliably be promoted to a grid item via display:contents
   on its parent <form> (inconsistent across browsers, confirmed live: tile
   sizes came out content-dependent instead of uniform), so the form itself
   must be the grid item, with a fully-reset <button> filling it. */
/* The status line lifts with the tile it's in: the hovered tile goes to
   --surface-2, and --bone-dim on that lighter surface is a step flatter
   than it is at rest, so the second line goes full --bone to keep the
   hovered tile reading as the brightest thing on the grid. This used to be
   a hardcoded dark grey -- correct back when a hovered tile inverted to
   white, and effectively invisible since the tile started merely lifting
   one step instead: near-black ink on --surface-2 is barely a contrast at
   all. Same guard as .tile:hover itself, or a phone would strand the
   lift. */
@media (hover: hover) and (pointer: fine) {
  .tile:hover .tile-status { color: var(--bone); }
}

/* Terminal's session-list tiles hold several independent actions (Open,
   Fullscreen, Close) instead of being one big link -- .tile:hover's lift
   would otherwise pull the tile's ground up under the still
   explicitly-colored children nested inside, so tile-static opts out of
   it. The intersection console's cloud session tiles are the same shape
   and opt out for the same reason.

   var(--surface)/var(--bone), i.e. exactly .tile's resting state: "opt out
   of the hover change" is what this means, and it has to say so literally
   because CSS has no way to cancel a declaration -- the only way to not be
   hovered is to restate the resting values. Still needed now that
   .tile:hover sits inside a (hover: hover) block: a media query doesn't
   change specificity, so this rule (three classes) still beats .tile:hover
   (two) exactly as before.
   It used to say var(--bg)/var(--fg), which was that same resting state
   back when the app was light-themed -- under the current palette --bg is
   --ground, two steps *darker* than a tile, so hovering a static tile sank
   it into the page instead of leaving it alone.

   Guarded like everything else (see the policy above .page-back-link:hover)
   even though an opt-out outside the guard would be harmless: on a touch
   device it only restates values nothing was going to change. It matches
   the guard on the rule it cancels so the pair can only ever be read
   together -- an opt-out that outlives its rule is the kind of leftover
   this file has already grown twice. */
@media (hover: hover) and (pointer: fine) {
  .tile.tile-static:hover { background: var(--surface); color: var(--bone); }
  .tile.tile-static:hover .tile-status { color: var(--muted); }
}

/* .tile-actions lived here and is gone (2026-08-27).

   It was a tile's own action row, inside its body -- the console's cloud
   session tiles putting Open beside Save & Stop while running, and Start
   while stopped. That shape is the thing ui-design-notes.md warns about by
   name: an action row inside a tile costs the tile its link, because a
   <button> cannot be nested in an <a>, so Open had to be demoted to a small
   button to make room. Those actions are now in .tile-menu, which is the
   overlay the notes prescribe for exactly this, and every console tile is a
   link again. Nothing in the app renders a .tile-actions any more.

   Its neighbours survive it and are not leftovers: .tile-wrap is still the
   column flex box that gives tiles in one grid row equal height, and
   .tile-cta-form below still spaces the one remaining in-tile action. */

/* intersection_connect.html's upsell tile's own Subscribe action, and now
   the only in-tile action left in the app. A separate name from the row
   that used to sit above this one, because it sits inside a tile-static
   card following a .tile-status line -- a subscribe CTA on a tile that is
   an advertisement rather than a device, which is why it is not subject to
   the whole-tile-is-the-action rule the device grid follows. */
.tile-cta-form { margin-top: 0.7rem; }

.session-rename-form { display: flex; align-items: center; gap: 0.4rem; }
.session-title-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  background: transparent;
  color: inherit;
  border: none;
  border-bottom: 1px dashed var(--border);
  padding: 0 0 0.2rem;
}
.session-title-input:focus { outline: none; border-bottom-color: var(--fg); }
/* The session screen's heading, as the rename field. Same face as an h1,
   on a tint so it reads as something to type into. */
.session-rename-form--page { margin-bottom: 0.75rem; }
.session-title-input--page {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  min-height: 44px;
}
.session-title-input--page:focus { outline: 2px solid var(--fg); outline-offset: -2px; }
.session-rename-form--page .icon-btn-solid { flex: none; }

/* A tile that's a <form> whose whole area is the click target -- same
   reasoning as .app-tile-button below (a <button> can't be reliably
   promoted to a grid item via display:contents on its parent <form>), but
   usable anywhere, not just the Apps panel. */
.tile-button {
  all: unset;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  color: inherit;
}
.tile-button::-moz-focus-inner { border: 0; padding: 0; }
/* .tile-button centers its label, which is right for a tile whose whole
   content *is* one word (Apps) and wrong for one that has to line up beside
   tiles carrying a title and a status line under it.

   That is the console's device grid: a stopped cloud session is a form
   (starting is a POST) sitting in a row of tiles that are links, and the
   one thing it must not do is look like a different component -- the whole
   point of that grid is that a cloud session and a Pi are the same tile.
   So this makes the button lay its children out exactly as .tile-wrap > .tile
   does for the link tiles beside it. */
.tile-button--stacked {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  font-weight: inherit;
}

/* Every app tile is the same fixed box regardless of name length -- long
   names step down through these font sizes (chosen by name length in
   apps.html) rather than overflowing or growing the tile. */
.apps-panel .app-tile {
  height: 4.5rem;
  padding: 0;
  overflow: hidden;
}
.app-tile-button {
  all: unset;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0.6rem 0.9rem;
  border: none;
  background: none;
  cursor: pointer;
  text-align: center;
}
/* Firefox keeps an inner dotted focus box with its own border/padding on
   buttons that "all: unset" alone doesn't reach -- without this it reads
   as a second, smaller box nested inside the tile. */
.app-tile-button::-moz-focus-inner {
  border: 0;
  padding: 0;
}
.apps-panel .tile-title {
  margin-bottom: 0;
  font-size: 1rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.apps-panel .tile-title.name-long { font-size: 0.85rem; }
.apps-panel .tile-title.name-xlong { font-size: 0.72rem; }

.apps-settings-list { columns: 2; column-gap: 1.5rem; max-width: 640px; margin: 0.75rem 0 1rem; }
.apps-settings-list .setting-toggle { break-inside: avoid; }

.dot {
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.stat-grid {
  display: grid;
  /* minmax(0, 1fr), not plain 1fr -- the same trap .tile-grid documents at
     length. A grid item's implicit min-width is its content's min-content
     size unless the track caps it, and plain 1fr only splits what is left
     after that minimum is honoured. A long thermal-zone name in .stat-label
     ("Temp - rp1_adc-thermal-zone") is exactly such a minimum, so the column
     grew, and the grid and the page with it, straight past the right edge of
     a phone screen. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1rem 0 1.5rem;
}
/* A filled surface, not an outline. `1px solid var(--fg)` was the language
   of the hero card this app used to open on -- the outlined vocabulary the
   kit moved away from, and the heaviest line the palette has. .auth-card's
   own note records the same change for the same reason; these six tiles
   were most of what was left of it, six hard white rectangles on a page
   where everything else is a soft fill.

   --surface, so a stat tile and a .row are the same object at different
   sizes rather than two ideas about what a card is. */
.stat-tile {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1rem 1.1rem;
}
/* A placeholder now reads as an empty outline rather than a faded fill:
   `border-style: dashed` said nothing once the border went, and half-opacity
   on a filled tile reads as a tile that is loading rather than one that is
   not real. --surface-2 because --border *is* --surface, which is now the
   colour of the tiles beside it. */
.stat-tile.dummy { opacity: 0.5; background: none; border: 1px dashed var(--surface-2); }
.stat-tile:not(.dummy) { cursor: pointer; }
/* Fired by system-stats.js on tap and on its 10s auto-refresh -- a light
   color-mix pulse against --bg rather than a full var(--fg)/var(--bg)
   invert (like .tile:hover elsewhere): full inversion firing on its own
   every 10s read as too jarring for something the user didn't just do. */
/* Rebased on --surface with the tiles: animating back to --bg would have
   settled every tile onto the page ground, so the pulse ended by erasing
   the card it was drawing attention to. */
@keyframes stat-flash {
  0% { background: var(--surface); }
  25% { background: color-mix(in srgb, var(--fg) 22%, var(--surface)); }
  100% { background: var(--surface); }
}
.stat-tile.stat-flash { animation: stat-flash 0.5s ease-out; }
.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
  /* Capping the track above only helps if the content will actually wrap
     inside it. Zone names arrive from sysfs and are one unbroken token as
     often as not, which would otherwise just overflow the tile it was
     nicely fitted into. */
  overflow-wrap: anywhere;
}
.stat-value { overflow-wrap: anywhere; }
.stat-value { font-size: 1.7rem; font-weight: 700; }
.stat-detail { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.dot-ok { background: var(--ok); }
.dot-bad { background: var(--bad); }
.dot-neutral { background: var(--muted); }

/* Fills the viewport below the topbar so the chat feels like an actual
   chat screen (input pinned at the bottom) rather than a form with a log
   above it -- especially noticeable on a brand-new/empty conversation,
   which otherwise just showed a couple of lines up top and a lot of dead
   space below. No position:fixed anywhere here on purpose: nested flex +
   overflow reflows naturally when the mobile keyboard resizes the visual
   viewport, avoiding the class of bug the terminal's fullscreen mode hit. */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
  /* main's own padding, canceled out so the chat screen truly fills its space */
  margin: -1.5rem -1rem -3rem;
  padding: 1rem;
}
.chat-header { flex-shrink: 0; }
.chat-header h1 { margin-bottom: 0.25rem; }
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* Short/empty transcripts sit at the bottom, right above the input, like
     a real chat -- not floating near the top with empty space below. Once
     content overflows, this also starts the view scrolled to the latest
     message with no JS needed. */
  justify-content: flex-end;
}
.chat-screen .chat-form { flex-shrink: 0; margin-top: 0.75rem; }
.chat-empty { text-align: center; margin: auto 0 0.5rem; }

.transcript {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
  min-height: 2rem;
}
.bubble-row { display: flex; }
.bubble-row.me { justify-content: flex-end; }
.bubble-row.them { justify-content: flex-start; }
/* A message is a column now -- reasoning above, bubble, time below -- where it
   used to be a single bubble. The row stays the thing that pushes it to one
   side; the stack is the thing those three parts share an edge with, so a
   timestamp lines up with the bubble above it rather than with the screen.
   max-width moves here for the same reason: 75% of the row once, rather than
   75% of 75% for anything nested. */
.bubble-stack { display: flex; flex-direction: column; max-width: 75%; min-width: 0; }
.bubble-stack .bubble { max-width: 100%; }
.bubble-row.me .bubble-stack { align-items: flex-end; }
.bubble-row.them .bubble-stack { align-items: flex-start; }
/* Quiet on purpose. A time is for the one reading a transcript back, not for
   the one having the conversation, so it should be findable and never in the
   way. */
/* One line, ellipsised. Truncated here rather than server-side so the full
   text stays in the DOM -- a wide screen shows more of it and the title
   attribute carries the rest. */
.chat-title {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Copy is a glyph, not a word. This shipped as an uppercase text pill under
   every reply -- a control louder than the message it belonged to, and the
   one thing the house rule about glyphs exists to prevent. The mark already
   existed in _icons.html and was not used.
   
   Quiet until wanted: dimmed at rest, full strength on hover or focus, and
   always legible where there is no hover. */
.chat-copy {
  margin-top: 0.1rem;
  padding: 0.15rem;
  border: 0;
  background: none;
  color: var(--bone-faint);
  line-height: 0;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.12s ease;
}
.chat-copy svg { width: 0.85rem; height: 0.85rem; }
.bubble-stack:hover .chat-copy,
.chat-copy:focus-visible { opacity: 1; }
@media (hover: none) {
  .chat-copy { opacity: 0.75; }
}
/* What the model is doing right now, above the bubble it is about to fill.
   Removed when the turn settles -- it describes work in progress, and the
   sources line under the reply is what records what was actually used. */
.chat-activity {
  align-self: flex-start;
  margin-bottom: 0.25rem;
  font-family: var(--font-label);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
/* A question raised mid-turn, above the bubble waiting on the answer. Says
   what it is and what it costs in words -- never a sum somebody has to do
   while they are trying to ask a question. */
.chat-approval {
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.8rem;
  color: var(--bone);
}
.chat-approval span { flex: 1 1 12rem; }
/* Sized by element rather than by the button class, which reads identically
   and collides with the centred-label test: that test finds a rule by
   searching for the selector text followed by a brace, so any rule -- or
   comment -- repeating it shadows the real one. */
.chat-approval button { padding: 0.25rem 0.7rem; font-size: 0.75rem; }
.chat-time { margin-top: 0.15rem; font-size: 0.68rem; color: var(--bone-faint); }
/* Where an answer came from. Quiet, wrapping, and above the time -- it belongs
   to the reply rather than to the clock. A long URL must wrap rather than push
   the bubble wide, which on a phone is the whole difference. */
/* What a message carried. Same chip vocabulary as the sources below it --
   they are both "this message touched something" -- but above the text, in the
   order a message is assembled. */
.chat-attachments { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.3rem; }
.chat-attachment {
  max-width: 100%;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.68rem;
  color: var(--bone-dim);
  overflow-wrap: anywhere;
  text-decoration: none;
}
/* An image attachment is the image. Bounded so a tall photo cannot push the
   composer off a phone screen, and object-fit so a wide one is cropped rather
   than letterboxed into a grey slab. */
.chat-attachment--image { padding: 0; overflow: hidden; line-height: 0; }
.chat-attachment--image img {
  display: block;
  max-width: 12rem;
  max-height: 9rem;
  object-fit: cover;
}
/* Attached once, not there now -- the file was deleted or renamed in the
   Files app. Named rather than hidden: the transcript is a record of what was
   sent, and quietly dropping it would rewrite that. */
.chat-attachment--gone { opacity: 0.55; text-decoration: line-through; }
/* The attach control is .icon-btn -- the app's existing square glyph button,
   with its optical centring -- plus the height the composer row wants. A
   label rather than a button because the file input it wraps is hidden, which
   is the only way to style a file control. */
/* The composer's glyphs are larger than .icon-btn's 1.1em default, which is
   sized for a dense toolbar. These are two of the three things on the row and
   they sit alone in a 46px square; at toolbar size they read as specks. */
.chat-attach-btn {
  min-height: 46px;
  min-width: 46px;
  flex: 0 0 auto;
  /* .icon-btn nudges its content down by twice --glyph-drop, which is right
     for a *font* glyph -- those sit high in their em box. An SVG does not, and
     a flex-centred box has already centred it, so the nudge only pushed the
     paperclip off centre and left it differently padded from the send button
     beside it. Both are square, both are padding-free, both centre their own
     mark. */
  padding: 0;
}
.chat-attach-btn svg { width: 1.4rem; height: 1.4rem; }
/* The one action, square so it sits as a pair with the paperclip across the
   textarea rather than as a wide slab on one end. */
.chat-send {
  min-height: 46px;
  min-width: 46px;
  padding: 0;
  flex: 0 0 auto;
}
.chat-send svg { width: 1.35rem; height: 1.35rem; }
/* Which mark shows is the button's state, so there is one source of truth for
   it -- the same attribute a screen reader's label is set from. */
.chat-send-mark { display: none; line-height: 0; }
.chat-send[data-state="send"] .chat-send-mark--send,
.chat-send[data-state="stop"] .chat-send-mark--stop,
.chat-send[data-state="stopping"] .chat-send-mark--stop { display: inline-flex; }
/* Acknowledged the instant it is pressed. The socket takes as long as it
   takes; the press must not. */
.chat-send[data-state="stopping"] { opacity: 0.55; }
/* The composer's own chips, which are the same component in a different
   place: below the transcript, above the box, so they are visible while you
   type about them. Empty most of the time, so no margin until it has one. */
.chat-attachments--composing:empty { display: none; }
.chat-attachments--composing { margin: 0 0 0.4rem; }
/* Still uploading, or refused. Pending is dim rather than animated -- an
   upload off a phone is over before a spinner would finish one turn. */
.chat-attachment--pending { opacity: 0.55; }
.chat-attachment--bad { background: var(--bad); color: var(--bone); }
.chat-attachment-drop {
  margin-left: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}
.chat-sources { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.chat-source {
  max-width: 100%;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.68rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  text-decoration: none;
}
/* A source that goes somewhere says so on hover, and is a link colour at
   rest -- the difference between a citation and a label. */
a.chat-source { color: var(--bone-dim); }
a.chat-source:hover { color: var(--bone); text-decoration: underline; }
/* A day boundary, centred across the transcript rather than attached to a
   message, because it belongs to the gap and not to either side of it. */
.chat-day {
  align-self: center;
  margin: 0.9rem 0 0.1rem;
  font-family: var(--font-label);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
/* The stored trace's disclosure. Closed by default -- see _bubbles.html. */
.chat-thinking-note { align-self: stretch; }
.chat-thinking-note > summary {
  cursor: pointer;
  font-family: var(--font-label);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.bubble {
  max-width: 75%;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.94rem;
  /* No outline. Both kinds of bubble already carry a fill -- --bubble-me is
     the accent, --bubble-them a surface -- so the border was a full-bone
     rule drawn around something that was never in doubt. It was the last
     of that outlined vocabulary anywhere in the app, and the loudest
     instance of it: not one card on one page, but a hard white edge on
     every message in every conversation. */
}
.bubble-row.me .bubble { background: var(--bubble-me); color: var(--bubble-me-fg); }
.bubble-row.them .bubble { background: var(--bubble-them); color: var(--bubble-them-fg); }

/* ---- markdown inside a bubble -------------------------------------------

   An assistant bubble holds rendered markdown now (static/chat.js), so it
   contains real block elements where it used to contain one text node. Two
   consequences, both handled here.

   First, `white-space: pre-wrap` has to go for those bubbles: it was what made
   plain text readable, and with real <p>s inside it doubles every blank line
   the parser has already turned into a paragraph break. It stays on the user's
   own bubbles, which are still exactly what was typed.

   Second, nothing in this stylesheet had ever styled a <pre>, <code>, <ul> or
   <table>, because until now nothing rendered any -- so they would arrive with
   UA defaults, at UA font sizes, inside a 75%-width bubble on a phone. */
.bubble[data-md] { white-space: normal; }

/* First and last child margins collapse out, or every bubble grows padding it
   did not ask for. */
.bubble[data-md] > :first-child { margin-top: 0; }
.bubble[data-md] > :last-child { margin-bottom: 0; }
.bubble[data-md] p { margin: 0 0 0.6em; }
.bubble[data-md] ul, .bubble[data-md] ol { margin: 0 0 0.6em; padding-left: 1.2em; }
.bubble[data-md] li { margin: 0.15em 0; }
.bubble[data-md] h1, .bubble[data-md] h2, .bubble[data-md] h3,
.bubble[data-md] h4, .bubble[data-md] h5, .bubble[data-md] h6 {
  /* Deliberately not the display face. A model writes "## Steps" as
     structure, not as a page title, and setting it in URW Gothic uppercase
     the way h1 is elsewhere would make a heading inside a reply louder than
     the heading of the page it sits on. */
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1em;
  font-weight: 700;
  margin: 0.8em 0 0.4em;
}
.bubble[data-md] blockquote {
  margin: 0 0 0.6em;
  padding-left: 0.7em;
  border-left: 2px solid var(--border);
  color: var(--muted);
}
.bubble[data-md] a { text-decoration: underline; }
.bubble[data-md] hr { border: 0; border-top: 1px solid var(--border); margin: 0.8em 0; }

/* Inline code. Borrows .code-line's font stack but none of its box: this is a
   few characters mid-sentence, not a command to be selected whole, so it gets
   no `user-select: all`. */
.bubble[data-md] code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  background: rgb(0 0 0 / 0.28);
}
/* A fenced block. The decisions are .log-tail's -- monospace, pre-wrap rather
   than a horizontal scrollbar, a capped height with its own scroller -- but
   not its `background: #08090c` literal, which is a page-level ground. Inside
   a bubble the surface has to come from the bubble, so this is a wash over
   whatever colour it is sitting on and works on both sides of the transcript. */
.bubble[data-md] pre {
  margin: 0 0 0.6em;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.28);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow-y: auto;
}
.bubble[data-md] pre code { padding: 0; background: none; font-size: inherit; }

/* A table is the one thing that cannot wrap. Give it its own scroller rather
   than letting it push the bubble past the width of a phone. */
.bubble[data-md] table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 0.85em; }
.bubble[data-md] th, .bubble[data-md] td { border: 1px solid var(--border); padding: 0.25em 0.5em; text-align: left; }

/* ---- a turn in progress ---- */

/* A caret while the model is still writing, so a reply that takes forty
   seconds to start does not look like a page that has died. */
.bubble.pending::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 0.1em;
  vertical-align: text-bottom;
  background: currentColor;
  opacity: 0.7;
}
@media (prefers-reduced-motion: no-preference) {
  .bubble.pending::after { animation: chat-caret 1s steps(2, start) infinite; }
}
@keyframes chat-caret { 50% { opacity: 0; } }

/* A turn that did not finish. --warn rather than --bad: the reply that did
   arrive is kept and is still worth reading, so this is a caveat, not a
   failure. */
.bubble.interrupted { border-color: var(--warn); }
.chat-note { margin-top: 0.5em; font-size: 0.75rem; color: var(--muted); }

/* The reasoning trace, when a thinking model is asked for one. Sits outside
   the answer bubble because it is not part of the answer.
   
   It *is* stored now, behind a disclosure -- which is a change from when this
   comment said the opposite. What has not changed is that it is never replayed
   to the model: modules/history.py keeps the display and replay queries apart
   so that feeding a model its own scratch work is not one typo away. */
.chat-thinking {
  align-self: flex-start;
  max-width: 75%;
  margin-bottom: 0.2rem;
  padding: 0.4rem 0.6rem;
  border-left: 2px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--bone-faint);
  white-space: pre-wrap;
  max-height: 10rem;
  overflow-y: auto;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}
/* The composer's field, drawn exactly as every other text field in this app is
   -- borderless, on --surface-2, 46px tall, the shared radius. It used to have
   a 1px border on --card-bg at a height of its own, which is what made the
   most-looked-at control on the screen the one that matched nothing else.
   .stacked-form's rule above is the house style; this follows it rather than
   restating it differently.

   46px against the buttons' 44 is deliberate and is theirs: a field and a
   button beside it are the same optical height because the button's border
   adds the difference. */
.chat-form input[type="text"],
.chat-form textarea {
  flex: 1;
  min-width: 10rem;
  min-height: 46px;
  padding: 0.7rem 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: inherit;
  font-size: 0.94rem;
}
/* Grown by chat.js as you type, capped here rather than there so the ceiling
   is a layout decision and not a magic number in a script. 40vh leaves the
   transcript readable on a phone even with a long draft in the box. */
.chat-form textarea {
  max-height: 40vh;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
}
/* The row the composer sits on: align to the bottom, so a growing textarea
   pushes upward and the send button stays beside its last line rather than
   floating at the middle of a tall box. */
.chat-form { align-items: flex-end; }
/* The step-up PIN, revealed by chat.js only for the elevated scopes. No
   `display` here on purpose: an author display rule beats the UA's
   [hidden]{display:none} at any specificity, which is the trap
   .home-drawer[hidden] and .battery-plug[hidden] are both commented for. It
   sizes itself instead, so hiding stays the UA's job. */
.chat-form input[type="password"] {
  width: 7rem;
  flex: 0 0 auto;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
}
.chat-form select {
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
}

/* ---- Terminal ---- */

/* The update console (templates/updates_console.html). Three stacked
   things -- a verdict, a screen, one control -- and none of the page
   components involved carries a margin of its own, so the spacing is
   stated here rather than inherited from a layout that does not exist.

   Shorter than .term-container's 65vh: this pane is not the page, it is
   the evidence under the answer, and on a phone the verdict line and the
   Stop button both have to be on screen with it. */
.update-console-status { margin-bottom: 0.9rem; }
.update-console-term { height: 45vh; min-height: 220px; margin-bottom: 0.9rem; }
#update-console-stop[hidden],
#update-console-done[hidden] { display: none; }

/* The password bar (static/terminal.js). Above the terminal, not over it:
   focusing it raises the on-screen keyboard, which covers the bottom of the
   screen -- the same reason the fullscreen toolbar is pinned to the top.

   It only exists while the pty is actually reading a secret, so it is
   allowed to be the loudest thing on the page while it is there. */
.term-secret {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.term-secret[hidden] { display: none; }
.term-secret-label {
  flex: none;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
/* The field takes the room, the button takes what it needs. `min-width: 0`
   because a flex item's default min-width is its content, which on a narrow
   phone pushes Send off the edge rather than letting the field shrink.

   Its own class rather than a descendant selector ending in the button
   class, and that is not a style preference. tests/test_web.py finds a rule
   by searching for the selector followed by an opening brace, so any
   compound selector *ending* in a shared class, sitting earlier in this
   file, becomes the rule every assertion about that class then reads. It
   did, here. The same trap caught .auth-form once -- see .btn--block, which
   is how that one was fixed: a modifier, not a descendant.

   (The first version of this note sprang it a second time by quoting the
   pattern verbatim. The helper strips comments only after it has sliced,
   so the comment was the match. Hence the prose.) */
.term-secret .password-field { flex: 1; min-width: 0; }
.term-secret-send { flex: none; }

.term-container {
  height: 65vh;
  min-height: 320px;
  background: #000000;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  overflow: hidden;
}

/* The terminal's text, selectable by the browser itself.

   xterm.css turns `user-select` off on .xterm and implements its own
   selection instead: drawn on a layer, driven by mouse events, and disabled
   outright the moment the running program turns mouse tracking on
   (SelectionService.disable). That model is unreachable from a phone -- the
   library binds no touch selection anywhere in the bundle, only viewport
   scrolling -- so terminal output simply could not be selected on a
   touchscreen, and `user-select: none` also meant the OS long-press "Select
   text" bubble never appeared to say so.

   Under the default renderer the rows are real DOM, so putting `user-select`
   back is the whole of what the phone's own selection needs: handles, the
   drag, the OS copy bubble, all of it, none of it ours. It costs the desktop
   nothing, because xterm preventDefaults mousedown over the terminal and a
   native drag never starts there anyway.

   Scoped to the rows rather than .xterm so the hidden helper textarea and the
   selection layer stay out of it. The id is load-bearing: base.html loads
   xterm.css *after* this file, so an equal-specificity rule would lose on
   order. */
#term .xterm .xterm-rows,
#term .xterm .xterm-rows * {
  user-select: text;
  -webkit-user-select: text;
}
/* And a selection that can be seen on a black ground. There is no other
   ::selection rule in this file -- everywhere else the UA's own colour sits
   on the app's light surfaces perfectly well. Here it lands on #000 among
   sixteen ANSI colours, so it is spelled out in the app's own pair rather
   than left to whatever the browser picks. Both halves are needed: the
   descendant form catches the spans a row is built from, the element form
   the row itself. */
#term .xterm .xterm-rows::selection,
#term .xterm .xterm-rows *::selection {
  background: var(--accent);
  color: var(--on-accent);
}

/* Every terminal page is 50000px wide until this rule.

   xterm measures character width with a div it appends to <body> itself:
   `position: absolute; top: -50000px; width: 50000px`, carrying no class or
   id to select it by. The negative `top` keeps it off the top of the page,
   but with no `left` it starts at body's content edge and runs 50000px to
   the *right*, and nothing was containing it. It is a sibling of #term-wrap
   rather than a descendant, so .term-container's `overflow: hidden` never
   had a chance at it -- and clipping it from above does not work either:
   its containing block is the initial containing block, so `overflow` on
   <html> or <body> leaves it alone (both were tried and measured; the page
   stayed 49000px scrollable under each).

   What that does is subtle enough to have survived two passes at it. The
   page looks completely normal, because the div is empty and off-screen.
   But the document is fifty thousand pixels wide, so it scrolls sideways
   into blank darkness -- and every `position: fixed` overlay (dialogs, both
   sheets, the player bar) is laid out against that, so opening one puts it
   somewhere out in the blankness to go hunting for.

   It reads as a fullscreen bug because fullscreen is the only thing that
   ever hid it: body.term-fs-lock below is `position: fixed; overflow:
   hidden`, which makes <body> the containing block and clips the div for
   exactly as long as fullscreen lasts. Entering looked like it fixed the
   page and minimising looked like it broke it; the page was wrong the whole
   time, and on every terminal visit that never went fullscreen at all.

   So the element itself is what gets moved. Its width is untouched -- the
   measurement needs the room, and cols/rows/char-width come out identical
   with and without this (verified: cols=96 rows=16 both ways). Only `left`
   changes, putting the box between -50000 and 0 instead of 0 and 50000:
   overflow to the left of the origin is not scrollable, so the document
   stops growing and nothing about what xterm measures changes.

   Matched on the inline style because there is nothing else to match on.
   test_xterm_measure_element_is_still_the_shape_this_rule_targets pins the
   constant against the vendored copy, so re-vendoring a build that changed
   it fails a test instead of quietly restoring the bug. */
div[style*="top: -50000px"] { left: -50000px !important; }

/* Set by terminal.js while fullscreen is active -- see the comment in
   setFullscreen() for why this is needed (mobile keyboard focus-scroll). */
body.term-fs-lock {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

#term-wrap.fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* Last, so it wins wherever visual-viewport.js has published it, and is
     simply absent everywhere else -- the 100dvh above stays the answer on
     Android, where the layout viewport already shrinks for the keyboard.
     This is the iOS case: there the keyboard overlays instead of resizing,
     dvh tracks the URL bar rather than the keyboard, and without this the
     terminal keeps its full height with its bottom rows underneath the
     keyboard.

     `top` for the other half of the same problem: iOS scrolls the page
     under the keyboard, and a position:fixed box is laid out against the
     *layout* viewport, so it drifts off the top of what can be seen. Both
     declarations are inert until the variables exist. */
  height: var(--visual-viewport-height, 100dvh);
  top: var(--visual-viewport-top, 0px);
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  max-height: var(--visual-viewport-height, 100dvh);
  overflow: hidden;
  box-sizing: border-box;
  z-index: 1000;
  background: #000;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
}
#term-wrap.fullscreen .term-container {
  flex: 1;
  width: 100%;
  height: auto;
  /* Flex items default to min-width/min-height: auto, which lets a child's
     intrinsic content size (xterm's canvas) refuse to shrink and push this
     box past the viewport -- explicit 0 is what actually lets it clamp to
     the space flex allocates it. */
  min-width: 0;
  min-height: 0;
  border: none;
  overflow: hidden;
}
/* Belt-and-suspenders alongside the body.term-fs-lock scroll lock above:
   pins the toolbar to the top of whatever scrolls, if anything ever does. */
#term-wrap.fullscreen .term-fs-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #000;
}

/* Always visible now, fullscreen or not, wide screen or narrow -- Close
   session and the modifier/arrow keys are just as useful outside
   fullscreen (a desktop user still wants Ctrl-C without reaching for a
   physical key, and Close session shouldn't require entering fullscreen
   first to reach it). Used to be hidden on wide screens until the
   "Fullscreen" button revealed it (.visible class, set by JS); the
   fullscreen-only bits (#btn-exit-fullscreen) still gate themselves
   separately below. */
.term-fs-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.2rem 0.2rem 0.6rem;
}
@media (max-width: 700px) {
  .term-container { height: 50vh; }
}


/* Always-visible row: the handle that toggles the Ctrl/Alt/Shift/Tab/Esc/
   arrow group below (reclaiming vertical space -- particularly useful with
   the keyboard up, where every row of chrome competes with the terminal
   itself for the little room left; collapsed state is remembered in
   localStorage, see terminal.js) plus the Exit fullscreen/Reconnect/Close
   session actions, which aren't modifier keys and so stay visible
   regardless of collapsed state even though they live in this same row. */
.term-fs-toolbar-handle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.term-fs-toolbar-handle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  background: none;
  border: none;
  color: var(--muted);
}
.term-fs-toolbar-toggle-glyph { display: inline-block; width: 1em; }
.term-fs-toolbar-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.term-fs-toolbar.collapsed .term-fs-toolbar-content { display: none; }

.term-fs-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.term-fs-toolbar button {
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  min-width: 2.6rem;
  text-align: center;
}
/* Exit fullscreen / Reconnect / Close session: icon-only now instead of
   text labels, specifically to keep this row narrow -- every row of
   toolbar chrome eats into space the terminal itself could use, especially
   with the keyboard up. */
.term-fs-toolbar button.icon-btn {
  padding: 0.5rem 0.6rem;
  /* The shorthand above just wiped .icon-btn's optical drop -- put it back
     on this rule's own padding. See the block above .btn. */
  padding-top: calc(0.5rem + 2 * var(--glyph-drop));
  min-width: 2.2rem;
  font-size: 1.2rem;
}
/* The handle row carries the collapse handle and the action icons, and the
   Copy button made it a four-icon group. Left to itself it had two ways to
   deal with that and picked whichever the width allowed: wrap the group onto
   its own line (where `space-between` with one item puts it hard left), or
   wrap *inside* the group into two short rows. Either way the controls moved
   under you as the keyboard opened and closed.

   So it is spelled out instead. One line, never wrapped; the handle keeps the
   left and gives up width first; the icons keep the right and stay in one
   row. The buttons lose a little padding rather than the row losing its
   shape -- they are still well over the 44px touch target, which is what the
   width was ever for. */
@media (max-width: 700px) {
  .term-fs-toolbar-handle-row { flex-wrap: nowrap; }
  .term-fs-toolbar-handle { min-width: 0; flex-shrink: 1; overflow: hidden; white-space: nowrap; }
  .term-fs-toolbar-actions { flex-wrap: nowrap; flex-shrink: 0; margin-left: auto; }
  /* Left/right only: the `padding` shorthand here would wipe .icon-btn's
     glyph-drop correction, which is the trap the rule above already
     documents. */
  .term-fs-toolbar button.icon-btn { min-width: 2rem; padding-left: 0.4rem; padding-right: 0.4rem; }
}
/* Matches .trackpad-modifier-btn's armed/locked treatment exactly (see
   below) -- same off -> armed -> locked model, so the two
   remote-keyboard-style modifier UIs in this app read as one system.

   Both states are an accent fill rather than the old full invert: on a
   touchscreen there is no hover for an inverted button to be distinguished
   from, so "latched" has to be carried by colour, not by contrast.

   armed and locked are no longer identical. They used to be, with a small
   green dot as the sole difference -- which is a lot of weight for one dot
   to carry when the difference is "this fires once" versus "this stays on
   until you tap it again". Locked additionally gets a solid bar along its
   bottom edge: same latch language as .row-sub--live, readable at arm's
   length, and it survives the dot being missed entirely. The dot is kept
   as well; the two reinforce rather than compete. */
.term-fs-toolbar .mod-key.armed,
.term-fs-toolbar .mod-key.locked {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.term-fs-toolbar .mod-key.locked,
.trackpad-modifier-btn.locked {
  box-shadow: inset 0 -4px 0 var(--on-accent);
}

/* Locked-state indicator added by modifier-keys.js (shared by both the
   terminal's Ctrl/Alt/Shift and the trackpad's remote keyboard modifiers)
   -- reuses the platform's existing green "ok" status-dot (.dot/.dot-ok)
   rather than a new indicator, per that convention. Element+class selector
   deliberately used (not just .mod-key-lock-dot) so this default-hidden
   rule reliably beats .dot's own `display: inline-block` regardless of
   stylesheet order, since both are otherwise equal specificity. */
span.mod-key-lock-dot { display: none; margin: 0 0 0 0.35rem; vertical-align: middle; }
button.locked > span.mod-key-lock-dot { display: inline-block; }
/* The dot only ever appears on a locked key, which is now accent-filled --
   so it has to be repainted in the on-accent ink. Its inherited .dot-ok
   green sat on orange, which is both illegible and the one colour pairing
   this palette is meant to make impossible. */
button.locked > span.mod-key-lock-dot.dot-ok { background: var(--on-accent); }

/* Unlike the modifier/arrow-key group (always useful on a phone, fullscreen
   or not -- see the comment above), Enter/Exit fullscreen are each only
   meaningful in one of the two states; the mobile media query above forces
   the whole toolbar visible regardless of that state, so these need their
   own narrower guard rather than inheriting the toolbar's visibility.
   Exact mirror images of each other so exactly one of the two ever shows. */
#btn-exit-fullscreen { display: none; }
#term-wrap.fullscreen #btn-exit-fullscreen { display: inline-block; }
#term-wrap.fullscreen #btn-fullscreen { display: none; }

.danger { background: var(--bad); color: var(--bone); border-color: var(--bad); }
@media (hover: hover) and (pointer: fine) {
  .danger:hover { background: var(--bad); color: var(--bone); filter: brightness(1.12); }
}

/* Persistent music player bar (see base.html) -- lives outside #page-content
   so it survives boosted navigation. Hidden until player.js has something
   to play (toggled via the .visible class, deliberately not the `hidden`
   attribute -- see base.html's comment on why). body.has-player adds
   bottom padding so the fixed bar never covers page content underneath it. */
.music-player-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--player-h);
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.music-player-bar.visible { display: flex; }
body.has-player main { padding-bottom: calc(var(--player-h) + 1.5rem); }
/* Art + titles are one big tap target that opens the sheet, so it has to
   shed every default a <button> arrives with and behave like the row it
   replaced. */
.music-player-open {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  letter-spacing: 0;
  text-indent: 0;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .music-player-open:hover .music-player-title { color: var(--accent); }
}
.music-player-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.music-player-title { font-weight: 600; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-player-subtitle { color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-player-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
/* Glyph-only, so it stops tracking rather than compensating -- and drops
   the indent it would otherwise inherit from the button rule. */
.music-transport-btn { padding: 0.4rem 0.5rem; font-size: 0.85rem; line-height: 1; border: none; background: none; letter-spacing: 0; text-indent: 0; }
/* The border-radius belongs to the hover fill and only ever showed with it,
   so it moves inside the guard with the background rather than being left
   behind on a control that has no fill to round. */
@media (hover: hover) and (pointer: fine) {
  .music-transport-btn:hover { background: rgba(255, 255, 255, 0.1); border-radius: var(--radius); }
}
.music-transport-btn--lg { font-size: 1.15rem; padding: 0.5rem 0.6rem; }
/* The transport marks are SVG (see _icons.html's "play"), so they size off
   the box rather than off a font-size, and never inherit a fallback face. */
.music-transport-btn { display: inline-flex; align-items: center; justify-content: center; }
.music-transport-btn svg { width: 1.05rem; height: 1.05rem; display: block; }
.music-transport-btn--lg svg { width: 1.4rem; height: 1.4rem; }
.music-playpause .mark-play,
.music-playpause .mark-pause { display: inline-flex; }
/* Idle shows play; player.js adds .is-playing. Defaulting to play in the
   markup means the control is right before any script has run. */
.music-playpause .mark-pause { display: none; }
.music-playpause.is-playing .mark-play { display: none; }
.music-playpause.is-playing .mark-pause { display: inline-flex; }
.music-sheet-playpause svg { width: 1.3rem; height: 1.3rem; }
/* Never shown -- just a playback engine for streaming mode, driven by
   player.js's own custom transport below (#music-playpause-btn/#music-seek),
   not the browser's native <audio controls> UI. */
#music-audio { display: none; }
.music-seek {
  width: 90px;
  accent-color: var(--accent);
}
.music-seek--wide { width: 100%; }
.music-local-indicator {
  display: none;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.music-local-indicator.visible { display: inline; }
.music-output-select {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.82rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
}
@media (max-width: 700px) {
  .music-player-bar { gap: 0.5rem; padding: 0 0.6rem; }
  .music-player-subtitle { display: none; }
  /* The bar keeps the three transport controls and drops the scrub, which
     is unusable at this width anyway -- the sheet is one tap away and has
     a full-width one with numbers on it. */
  .music-seek { display: none; }
  .music-seek--wide { display: block; }
}

/* ---- now-playing sheet ----
   A full-height panel over the app, not a modal box: on a phone this is the
   player, and the queue it carries needs the room. Slides up from the bar it
   was opened from. Class-driven visibility for the same reason as the bar
   (see base.html). */
.music-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  padding: 1rem 1rem 2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex-direction: column;
  gap: 0.9rem;
}
.music-sheet.visible { display: flex; }
@media (prefers-reduced-motion: no-preference) {
  .music-sheet.visible { animation: music-sheet-in 160ms ease-out; }
}
@keyframes music-sheet-in {
  from { transform: translateY(2rem); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.music-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.music-sheet-eyebrow {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.music-sheet-art {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.music-sheet-meta { text-align: center; min-width: 0; }
.music-sheet-title { font-weight: 600; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-sheet-subtitle { color: var(--muted); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-sheet-seek { display: flex; flex-direction: column; gap: 0.25rem; }
.music-sheet-times { display: flex; justify-content: space-between; }
/* Tabular so the elapsed side doesn't jitter the total side as digits change. */
.music-time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.music-sheet-transport { display: flex; align-items: center; justify-content: center; gap: 0.6rem; }
.music-sheet-playpause { min-width: 3.2rem; min-height: 3.2rem; font-size: 1.2rem; border-radius: 50%; }
/* Shuffle and repeat are toggles, and a toggle has to look different when it
   is on -- .icon-btn is otherwise identical in both states. */
.icon-btn--on { color: var(--accent); }
.music-sheet-row { display: flex; align-items: center; gap: 0.6rem; }
.music-volume-row { display: none; }
.music-volume-row.visible { display: flex; }
.music-volume-mark { display: inline-flex; width: 1.15rem; height: 1.15rem; color: var(--muted); flex-shrink: 0; }
.music-volume-mark svg { width: 100%; height: 100%; }

/* ---- the queue ---- */
.music-queue-section {
  display: none;
  font-family: var(--font-label);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.5rem 0 0.2rem;
}
.music-queue-section.visible { display: block; }

/* One toast for the whole app. Sits above the player bar rather than over
   it -- the bar is a control, and covering it to report that a control
   worked is self-defeating. --player-h is a constant, so this clears the bar
   whether or not it is currently shown; a few spare rem above nothing is
   cheaper than measuring. */
.app-toast {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--player-h) + 0.9rem);
  z-index: 300;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.85rem;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}
.app-toast.visible { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .app-toast.visible { animation: app-toast-in 140ms ease-out; }
}
@keyframes app-toast-in {
  from { transform: translate(-50%, 0.5rem); opacity: 0; }
  to { transform: translateX(-50%); opacity: 1; }
}
.music-queue { display: flex; flex-direction: column; gap: 0.4rem; }
.music-queue-head { display: flex; align-items: center; justify-content: space-between; }
.music-queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.music-queue-empty { display: none; }
.music-queue-empty.visible { display: block; }
.music-queue-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.music-queue-item:last-child { border-bottom: none; }
/* The row jumps to that track; the trailing X removes it without playing it.
   Two intents, so two targets -- tapping a queue entry to delete it is the
   classic way to lose your place. */
.music-queue-jump {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  letter-spacing: 0;
  text-indent: 0;
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) {
  .music-queue-jump:hover .music-queue-title { color: var(--accent); }
}
.music-queue-title { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-queue-sub { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- album track rows ---- */
/* The whole row is the target, not just the title text: a track name is a
   small thing to hit on a phone, and every player of this shape plays from
   anywhere on the row. */
.music-track-row { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  .music-track-row:hover { background: var(--card-bg); }
}
.music-track-row.is-current { color: var(--accent); }
/* A drawn mark, not a CSS content escape for U+25B6 -- the vendored faces
   have no such glyph and cannot be subsetted to gain one, so that rule was
   rendering the now-playing indicator in a stranger's font.

   Written without the escape sequence itself on purpose: the subset test
   scans `content:` values, and a comment that quotes one reads to it as a
   use. Naming the codepoint says the same thing to a person. */
.music-track-mark { display: none; width: 0.8rem; height: 0.8rem; }
.music-track-mark svg { width: 100%; height: 100%; display: block; }
.music-track-row.is-current .music-track-mark { display: inline-flex; }
.music-track-row.is-current .music-track-num { display: none; }
.music-track-no { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.music-track-row.is-current .music-track-no { color: var(--accent); }
.music-track-actions { display: flex; gap: 0.15rem; justify-content: flex-end; white-space: nowrap; }

/* ---- account panel: expandable devices, and this device's power ---- */
/* The sign-out button is `position: sticky` so it is always reachable, which
   means content scrolls *underneath* it. That was harmless while the panel
   was short enough not to scroll, and stopped being harmless when the power
   box landed directly above it: a red LOG OUT pinned over a red SHUT DOWN,
   both half-readable, is a mis-tap waiting to happen.
   
   So it gets an opaque ground and reads as a pinned footer rather than a
   floating overlay. The colour cannot be hardcoded -- this panel renders
   both as a page (on --bg) and swapped into the account drawer (on
   --ground-2), and profile.html is explicit that nothing in it may depend on
   which. So the *panel* declares its ground and the button takes it, which
   keeps the knowledge where the difference actually is. */
#profile-panel { --panel-ground: var(--bg); padding-bottom: 0.75rem; }
.side-drawer-panel #profile-panel { --panel-ground: var(--ground-2); }
/* Indented so an expanded list reads as belonging to the row above it
   rather than as more siblings. */
/* The same 4px .row-list puts between rows. Without it the devices inside
   this list sat flush against each other while every row around them was
   spaced -- and because .row is a rounded rectangle on a filled ground,
   flush meant the three of them merged into one shape with only the outer
   corners rounded. It did not read as three devices; it read as one card
   with sections, in a list whose whole job is to say how many machines you
   have. */
.row-sublist { display: flex; flex-direction: column; gap: 4px; padding-left: 0.9rem; }
.row-sublist[hidden] { display: none; }
.row-chevron--toggle { transition: transform 120ms ease-out; }
[aria-expanded="true"] .row-chevron--toggle { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) {
  .row-chevron--toggle { transition: none; }
}
/* A border and a warm tint, because this is the one group on an
   account-wide panel that acts on a single machine. Everything above it
   spans every device you own; these three do not, and the box is what says
   so before the label is read. */
.profile-power {
  border: 1px solid var(--bad);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem 0.2rem;
}
.profile-power .kit-section-label { color: var(--bad-ink); }

/* ---- notifications ---- */
/* The whole of the notifications badge now -- the bell it used to sit
   beside is gone, so the margin that separated them went with it. */
.badge-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
/* Two columns: everything the alert says on the left, its dismiss control
   alone on the right, pinned to the first row rather than flowing after the
   action button. That placement is the point, not the alignment: this sheet
   is read on a phone, and a 44px X sitting directly beside (or under) a
   full-width primary action is a mis-tap that throws the alert away instead
   of acting on it. Up beside the title, the two targets are a row apart.

   `align-items: start` so a title that wraps to three lines keeps the
   control at the top corner where it was; centring it against the text
   would have it drift down the taller the alert gets. */
.notify-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  column-gap: 0.6rem;
  align-items: start;
  padding: 0.9rem 0;
}
/* Separators go *between* items, never under one. This was a border-bottom
   on every item plus `.notify-item:last-of-type { border-bottom: none }` to
   take the last one off again, and that second rule never matched anything:
   :last-of-type counts <div> siblings, and the last <div> in
   .side-drawer-body was .notify-permission, not an item. So the final alert
   kept its hairline directly above the permission block's own border-top --
   two lines, 1px apart, which is the doubled edge this drawer drew for as
   long as the two lived together.
   The adjacent-sibling form cannot get that wrong: n items draw n-1 lines
   whatever follows them, and it holds whether the permission block sits
   under the list, moves elsewhere, or is absent. Deliberately not
   `:last-child` of the body either -- that would be correct today and wrong
   again the moment anything is appended after the loop. A separator rule
   that has to know what comes after the list is one that breaks the next
   time the markup around it changes, which is what happened here. */
.notify-item + .notify-item { border-top: 1px solid var(--border); }
/* Title, detail and action stack in the text column; only the dismiss form
   crosses into the second one. Stated rather than left to auto-placement --
   auto-placement would put whichever element came second into the empty
   cell beside the title. */
.notify-item > * { grid-column: 1; }
.notify-item > .notify-dismiss { grid-column: 2; grid-row: 1; }
/* A block form around an inline-flex button gets a line box, and a line box
   reserves descender depth the button never fills -- a couple of stray
   pixels under a control whose whole job is to line up with the title. */
.notify-dismiss { display: flex; }
.notify-item-title { font-weight: 600; margin-bottom: 0.6rem; }

/* The title's own bottom margin is spacing for the action button below it.
   With a description in between, that gap lands in the wrong place and the
   two lines drift apart, so the title gives it up when one is present. */
.notify-item-title:has(+ .notify-item-detail) { margin-bottom: 0; }

/* A captured prompt's own description, and the only thing that ever renders
   here -- nothing the panel writes itself goes under a notification title.
   Wraps rather than truncating: these are one or two sentences from a dialog
   and the second half is usually the part that says what to do. */
.notify-item-detail {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}
/* Hidden by default *and* by [hidden], because .notify-permission sets
   display and an author display rule beats the UA's [hidden] at any
   specificity -- the trap base.html's player-bar comment documents and the
   home drawer hit for real. */
.notify-permission {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.notify-permission[hidden] { display: none; }

/* ---- library browser: Songs / Artists / Albums ---- */
.music-tabs { margin-bottom: 0.6rem; }
.music-list { display: flex; flex-direction: column; }
/* Rows are <a> on the library and <button> in the queue view -- same shape
   either way, so both have to shed their own defaults. */
.music-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.2rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  letter-spacing: 0;
  text-indent: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.music-row:last-child { border-bottom: none; }
@media (hover: hover) and (pointer: fine) {
  .music-row:hover { background: var(--card-bg); }
  .music-row:hover .music-row-title { color: var(--accent); }
}
.music-row-art { width: 2.4rem; height: 2.4rem; }
/* min-width: 0 so a long title ellipsizes instead of widening the row past
   the viewport -- the same flex-item minimum .tile-grid documents. */
.music-row-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.music-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row-sub { font-size: 0.78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-row-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.music-queue-actions { display: flex; align-items: center; gap: 0.2rem; }

/* Every row in these lists is a wrapper holding the tappable row and its
   actions menu side by side -- see the comment at the top of
   _music_browse.html for why the menu cannot live inside the row. The
   separator moves out here with it: the row is no longer the last child of
   the list, so :last-child on .music-row would stop matching and the final
   row would keep a rule under it with nothing below. */
.music-row-wrap {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  border-bottom: 1px solid var(--border);
}
.music-row-wrap:last-child { border-bottom: none; }
/* min-width: 0 so the row can shrink below its title's width and ellipsize,
   rather than pushing the menu off the side of the phone. */
.music-row-wrap .music-row { flex: 1; min-width: 0; border-bottom: 0; }

/* The music lists' three-dot toggle.

   It was .icon-btn-solid: a 44x44 solid square, which is the right shape for
   a standalone control and the wrong one for something that appears on every
   line of a list. Forty of them down the side of a song list is a column of
   filled blocks with the music as an afterthought, and the owner's word for
   it was "ugly, oversized".

   So the *painted* box shrinks and goes borderless, and the *tappable* box
   does not: this is a phone, and a 30px target is a miss waiting to happen.
   The ::before is the whole trick -- a transparent 44x44 overlay centred on
   the mark, hit-testable like any other element, so the finger gets the
   Apple/Android minimum while the eye gets a mark that stays out of the way
   until it is wanted. Padding would have worked too, but padding also pushes
   the row's own height around, and these rows are already 44px tall. */
.music-menu-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  /* The generic `button` rule hands every button a fill and 1.1rem of side
     padding; both have to go, or "quiet" is neither. */
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  letter-spacing: 0;
  text-indent: 0;
  cursor: pointer;
}
.music-menu-toggle svg { display: block; width: 1.05rem; height: 1.05rem; }
.music-menu-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
}
/* Open is the one state that has to be loud: with the panel showing, this is
   the control the panel belongs to, and on touch there is no hover to say so. */
.music-menu-toggle[aria-expanded="true"] { background: var(--surface-2); color: var(--bone); }
@media (hover: hover) and (pointer: fine) {
  .music-menu-toggle:hover { background: var(--surface-2); color: var(--bone); }
}
/* .row-menu's 16rem is sized for the terminal's rename field; four short
   text items need nothing like it, and at 16rem the panel hangs past the
   left edge of a narrow phone. Same fix .files-row already makes. */
.music-menu .tile-menu-panel { min-width: 11rem; }

/* The Add-to-playlist picker's destination list (_music_menu.html). Capped
   and scrollable rather than growing the dialog: a long playlist collection
   would otherwise push the "new playlist" field off the bottom of the
   screen, which is the one control the owner is guaranteed to need on the
   first run, when there is nothing in this list at all. */
.music-playlist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 40vh;
  overflow-y: auto;
}
.music-playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  min-height: 44px;
  padding: 0 0.7rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font: inherit;
  letter-spacing: 0;
  text-indent: 0;
  text-align: left;
  cursor: pointer;
}
.music-playlist-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-playlist-count { flex-shrink: 0; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.music-playlist-new { display: flex; gap: 0.5rem; margin: 0; }
.music-playlist-new .field { flex: 1; min-width: 0; }

/* ---- library-root picker (/music/browse) ---- */
.picker-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
  /* A deep path is long and arrives from the filesystem, so it has to be
     able to break anywhere rather than push the page sideways. */
  overflow-wrap: anywhere;
}
.picker-crumb { color: var(--muted); text-decoration: none; }
.picker-crumb:last-of-type { color: var(--fg); }
@media (hover: hover) and (pointer: fine) {
  .picker-crumb:hover { color: var(--accent); }
}
.picker-crumb-sep { color: var(--border); }
.picker-commit { margin-bottom: 1.1rem; }
.picker-list { display: flex; flex-direction: column; }
.picker-row {
  display: flex;
  align-items: center;
  /* 44px, same floor as .btn -- these are the whole point of the page and
     get tapped on a phone. */
  min-height: 44px;
  padding: 0.5rem 0.2rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
}
.picker-row:last-child { border-bottom: none; }
@media (hover: hover) and (pointer: fine) {
  .picker-row:hover { color: var(--accent); }
}
.picker-row--up { color: var(--muted); }
.picker-row-name { overflow-wrap: anywhere; }

.music-art {
  display: block;
  object-fit: cover;
  border-radius: 3px;
  background: var(--card-bg);
  flex-shrink: 0;
}
.music-art-sm { width: 2.6rem; height: 2.6rem; }
.music-art-lg { width: 100%; max-width: 220px; aspect-ratio: 1; margin-bottom: 1rem; }
/* No art cached/found -- a plain dashed box (same convention as
   .stat-tile.dummy), not an icon or placeholder image: this app has a
   standing rule against pictographic icons anywhere in its UI. */
.music-art-placeholder {
  border: 1px dashed var(--border);
  background: none;
}

.music-album-header { display: flex; align-items: flex-start; gap: 1.2rem; margin-bottom: 1rem; }
.music-album-header h1 { margin-bottom: 0.2rem; }
.music-album-header .music-art-lg { margin-bottom: 0; width: 140px; }
.track-play-btn {
  background: none;
  border: none;
  color: var(--fg);
  font: inherit;
  text-align: left;
  /* `font: inherit` does not carry text-indent, so the button rule's is
     still in force here. */
  text-indent: 0;
  cursor: pointer;
  padding: 0;
}
@media (hover: hover) and (pointer: fine) {
  .track-play-btn:hover { text-decoration: underline; }
}

.settings-list { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1rem; }

/* ---- setting switch rows (_switch.html) --------------------------------
   The row around the existing .switch control -- label left, switch right --
   not a second switch. The first version of this drew its own pill with its
   own .switch class, which collided with the real one below (line ~2800)
   and lost: the button came out 52x30 with a --surface-2 fill and the label
   wrapped inside it, which reads exactly like a checkbox sitting on top of
   the text. Two faults in one: a name collision, and a pill in a language
   whose switch is documented as "square-ish, not a pill".

   The whole row is the button, so the target is the width of the screen
   rather than a 52px sliver -- which matters on the phone this is driven
   from. The .switch inside is a decorative span; the row carries the state. */
.switch-form { border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  /* Vertical only: the row already sits in the page's gutter, and side
     padding would pull the switch in from the edge the rest of the page
     aligns to. */
  padding: 0.15rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.switch-row::-moz-focus-inner { border: 0; padding: 0; }
.switch-row-label { font-weight: 600; }
/* State lives on the row (role="switch" + aria-checked) and is mapped onto
   the control here, so the attribute the eye reads and the one a screen
   reader announces are the same attribute and cannot drift apart. The
   control's own [aria-pressed] rules stay untouched for its other uses. */
.switch-row[aria-checked="true"] .switch { background: var(--accent); }
.switch-row[aria-checked="true"] .switch::after { left: 26px; background: var(--on-accent); }
/* Aligned to the label rather than indented past a control that no longer
   sits to its left -- the old 1.7rem indent was clearing a checkbox. */
.switch-hint { margin: 0.35rem 0 0; }

/* Same input treatment as .stacked-form (border/background/radius) --
   this one field was still bare browser-default styling, narrowed but
   otherwise unstyled, the only such gap outside intersection_connect.html's
   already-fixed add-device form. Stays inline-in-the-row rather than
   promoted to its own page: unlike adding a device (a multi-step
   provisioning flow), connecting to one already-scanned network is a
   single self-contained action scoped to that row. */
.wifi-connect-form input[type="password"] {
  width: 130px;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-family: inherit;
}

/* Remote trackpad (see templates/trackpad.html, static/trackpad.js). Mobile
   browsers flash their own default tap-highlight overlay on every tap
   regardless of our state classes, which made armed/locked visually
   indistinguishable from a plain tap -- turned off everywhere in here so
   the classes below are the only thing that visibly changes. */
.trackpad-toolbar { -webkit-tap-highlight-color: transparent; }
.trackpad-toolbar button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

/* Structural clone of .term-fs-toolbar and its handle-row/content-row split
   (style.css's own terminal section, above) -- same collapse-to-reclaim-
   space reasoning applies here (the trackpad surface competes with this
   toolbar for the same screen the on-screen keyboard is also fighting for),
   so this deliberately isn't a fresh design, it's that one's rules with
   "term-fs" swapped for "trackpad". Kept as its own parallel class family
   rather than sharing the literal .term-fs-toolbar selectors, matching how
   .mod-key/.trackpad-modifier-btn already coexist as separate-but-identical
   families instead of one shared class. */
.trackpad-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.2rem 0.2rem 0.6rem;
  margin-bottom: 0.6rem;
}
.trackpad-toolbar-handle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
/* Groups the grip/Modifiers-handle/connection-status together as one flex
   item, so .trackpad-toolbar-handle-row's space-between still just splits
   two things apart (this group vs. the action-icon group) rather than
   fighting over how to lay out three-plus. */
.trackpad-toolbar-handle-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.trackpad-toolbar-handle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.82rem;
  background: none;
  border: none;
  color: var(--muted);
}
.trackpad-toolbar-toggle-glyph { display: inline-block; width: 1em; }
/* Fullscreen-only drag handle (see trackpad.js's drag-to-a-screen-edge
   section) -- hidden the rest of the time, same pattern as the Hide-toolbar
   button below, since dragging only makes sense once the toolbar is a
   floating overlay. touch-action: none so a touch-drag on the grip doesn't
   also trigger the browser's own scroll/pan gesture underneath it. */
.trackpad-toolbar-grip { display: none; cursor: grab; touch-action: none; }
#trackpad-page.is-fullscreen .trackpad-toolbar-grip { display: inline-flex; }
.trackpad-toolbar-grip:active { cursor: grabbing; }
/* Small connection-status readout for the /trackpad/ws socket (see
   trackpad.js's connect()/forceReconnect()) -- reuses the existing
   .dot/.dot-ok/.dot-bad/.dot-neutral status-dot convention rather than a
   new indicator style, per ui-design-notes.md. Hidden while connected,
   same "nothing to say" idiom as #stream-status.hidden below. */
.conn-status {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}
.conn-status.hidden { display: none; }
/* Two visually separated clusters instead of one undifferentiated row of
   icons -- Fullscreen/Exit-fullscreen/Reconnect/End session (state of
   *this* view) on one side, Keyboard/Hide toolbar (chrome visibility) on
   the other. A thin hairline divider, not a gap alone, since a gap by
   itself read as arbitrary rather than a deliberate grouping. */
.trackpad-toolbar-actions-secondary {
  border-left: 1px solid var(--border);
  padding-left: 0.5rem;
  margin-left: 0.1rem;
}
.trackpad-toolbar-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.trackpad-toolbar.collapsed .trackpad-toolbar-content { display: none; }
.trackpad-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* Same sizing as .term-fs-toolbar button -- border/background/hover-invert
   already come from the plain `button` rule. */
.trackpad-toolbar button {
  padding: 0.6rem 0.8rem;
  font-size: 1rem;
  min-width: 2.6rem;
  text-align: center;
}
.trackpad-toolbar button.icon-btn {
  padding: 0.5rem 0.6rem;
  /* Same shorthand-wipes-the-drop problem as .term-fs-toolbar above. The
     Keyboard button in this toolbar is the SVG one, and :has(svg) puts it
     back to a plain 0.5rem. */
  padding-top: calc(0.5rem + 2 * var(--glyph-drop));
  min-width: 2.2rem;
  font-size: 1.2rem;
}
.trackpad-toolbar button.icon-btn:has(svg) { padding-top: 0.5rem; }

/* The spacebar is wide, and that is the whole of how it is recognised -- on a
   real keyboard it carries no legend at all. Here it carries a small drawn
   mark as well, because a blank button in a toolbar has no keyboard around
   it to give it that context. The width is what does the identifying; the
   mark only has to confirm it. */
#trackpad-space-btn { min-width: 6rem; }

/* Pointer lock, shown only on the Desktop view, and there only where a real
   cursor exists to lock. Two conditions, for two separate reasons.

   `.stream-play` is the Desktop view's own wrapper (see stream_play.html).
   That page is the one with a second cursor on screen -- the remote
   desktop draws its own inside the video -- and the one where a glide
   stalling at the window edge costs you the far side of a full desktop.
   /trackpad shares this toolbar verbatim but has no video, nothing drawing
   a cursor, and nothing to look at while you move it.

   `pointer: fine` because a lock is meaningless without a pointer. Hidden
   by default and revealed by the query, rather than the reverse: `pointer:
   none` (headless, a TV remote, a browser reporting nothing useful) should
   get the phone's answer, not the desktop's, and only `fine` is a positive
   statement that a cursor exists.

   trackpad.js puts an inline `display: none` on top of both on browsers
   with no Pointer Lock API, which wins over either.

   The button stays in the markup everywhere rather than being rendered
   conditionally -- see _trackpad_toolbar.html for why. */
/* Next screen: the Desktop view only. /trackpad includes the same toolbar
   but is not looking at a screen, so "show me the next one" has nothing to
   mean there. Hidden rather than rendered conditionally, so the two pages
   go on sharing one component -- same arrangement as the lock button just
   below, whose own comment explains the choice. */
#trackpad-screen-btn { display: none; }
.stream-play #trackpad-screen-btn { display: inline-flex; }

#trackpad-lock-btn { display: none; }
/* any-pointer, not pointer: a phone or tablet with a Bluetooth mouse still
   reports its touchscreen as the primary pointer (`pointer: coarse`), and
   that is exactly the setup where the mouse needs locking. */
@media (any-pointer: fine) {
  .stream-play #trackpad-lock-btn { display: inline-flex; }
}

/* Drag or touch: the Desktop view only, like the screen button above --
   /trackpad has no picture to tap on. It is the Files page's .view-switch;
   these rules only fit it to the toolbar, whose generic `button` rule would
   otherwise hand each half 0.8rem of side padding and push the icons off
   the thumb. */
#trackpad-sound-btn { display: none; }
.stream-play #trackpad-sound-btn { display: inline-flex; }
/* By id, like the buttons above: as a class rule this tied with .view-switch's
   own display: grid, which comes later in this file and so won, showing the
   switch on /trackpad too. */
#trackpad-input-switch { display: none; }
.stream-play #trackpad-input-switch { display: grid; align-self: center; }
.trackpad-input-switch[data-view="touch"] .view-switch-thumb { transform: translateX(44px); }
.trackpad-toolbar .view-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 2.2rem;
  padding: 0;
  border: 0;
}
/* Exact mirror of #btn-exit-fullscreen/#btn-fullscreen below -- exactly one
   of the two ever shows. Keyed off .is-fullscreen, the class trackpad.js
   toggles, for the reason the .is-fullscreen block further down explains:
   the native pseudo-class means "the Fullscreen API worked", which on
   iPadOS is never. This now says "the page is in its fullscreen mode",
   which is a thing this app decides and can therefore rely on. */
#trackpad-exit-fullscreen-btn { display: none; }
#trackpad-page.is-fullscreen #trackpad-exit-fullscreen-btn { display: inline-block; }
#trackpad-page.is-fullscreen #trackpad-fullscreen-btn { display: none; }
/* No resting-state rule of its own (border/background/color all come from
   the plain `button` rule) -- same as the terminal's .mod-key, which is
   likewise undecorated until armed/locked. Used only as a JS/CSS hook
   (querySelectorAll, touch-action above, the armed/locked rule below). */
/* Armed fires once with the next key, then clears. Locked stays held until
   tapped again. Both are an accent fill; locked additionally carries the
   inset bottom bar -- see the terminal's .mod-key rule for why the two
   stopped looking identical, and note the bar rule up there covers this
   selector too so the two keyboards can't drift apart. */
.trackpad-modifier-btn.armed,
.trackpad-modifier-btn.locked {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
#trackpad-surface {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  height: 55vh;
  min-height: 280px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
}
#trackpad-surface.trackpad-dragging { border-color: var(--fg); border-style: solid; }
/* Fullscreen container/toolbar/surface rules used to live here, scoped to
   plain /trackpad only, separately from stream_play.html's own (better)
   floating-toolbar-over-edge-to-edge-content treatment below -- consolidated
   into one generalized #trackpad-page.is-fullscreen block (see the section
   after .stream-play-video-wrap) so both pages get identical fullscreen
   chrome instead of two different layouts. */
/* Invisible, but deliberately *inside* the viewport rather than parked at
   left: -9999px, which is the usual way to write this and is wrong on a
   phone: focusing an input outside the viewport makes the browser scroll it
   into view, and since this one is summoned by .focus() the moment you tap
   the keyboard button, that dragged the whole layout ~9999px sideways and
   left every fixed overlay somewhere you couldn't see.

   1px at the top-left corner with opacity 0 is unnoticeable and needs no
   scrolling to reach. pointer-events: none so the corner stays tappable by
   whatever is actually drawn there -- nothing ever needs to hit this
   directly, trackpad.js focuses it in code.

   font-size: 16px for the same reason as .field below. */
/* Two fields nobody sees, hidden the same way for the same two reasons.
   .trackpad-keyboard-input is focused to summon the on-screen keyboard;
   .term-copy-holder holds the text for execCommand("copy") on a plain-HTTP
   address, where navigator.clipboard does not exist (see terminal.js).

   Both are focused by script, and `left: -9999px` -- the usual way to hide a
   field -- makes that focus scroll the element into view, dragging the layout
   viewport sideways by the full 9999px and taking every fixed overlay with
   it. So they stay inside the viewport and go invisible instead. 16px because
   WebKit zooms the page in on a focused field smaller than that and does not
   reliably zoom back out.

   One rule rather than two: the hiding is the shared judgement, and a second
   copy of it would be the one that quietly stops matching. */
.term-copy-holder,
.trackpad-keyboard-input {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
  font-size: 16px;
}

/* stream_play.html: same #trackpad-page/#trackpad-toolbar/#trackpad-surface
   structure as /trackpad (see templates/stream_play.html's own comment for
   why -- it lets trackpad.js run completely unmodified), but always
   full-video rather than only in fullscreen, so this uses the .stream-play
   class to override just the pieces that differ instead of touching
   /trackpad's own rules above. Layout itself mirrors #term-wrap.fullscreen's
   already-proven flex-column split (toolbar at its natural height, content
   area filling the rest) rather than fixed-position/z-index layering. */
#trackpad-page.stream-play {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}
.stream-play #trackpad-toolbar { flex: none; }
.stream-play-video-wrap {
  position: relative;
  flex: 1;
  min-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
}
#stream-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.stream-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  pointer-events: none;
}
.stream-status.hidden { display: none; }
/* Pre-connect resolution picker -- last in stream_play.html's DOM order
   (see that template's own comment) so it sits above #trackpad-surface and
   actually receives taps while shown; stream_connect.js hides it on
   submit. Own background (not transparent, unlike the surface) since
   there's no video underneath yet at this point. */
.stream-setup {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: var(--bg);
}
.stream-setup.hidden { display: none; }
.stream-setup select {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 1rem;
}
/* Transparent and borderless here (unlike /trackpad's own bordered,
   card-background surface) so the video underneath shows through --
   otherwise identical touch/gesture behavior, driven by the same
   trackpad.js. */
.stream-play #trackpad-surface {
  position: absolute;
  inset: 0;
  height: auto;
  min-height: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.stream-play #trackpad-surface.trackpad-dragging { border: 2px solid var(--fg); }

/* Fullscreen: true edge-to-edge content (video on the Desktop view, the
   gesture surface alone on plain /trackpad), not a toolbar-as-a-permanent-
   row layout (that's what read as letterboxed on the Desktop view -- the
   toolbar's own height, plus its expanded modifier/arrow row, permanently
   shrank the video area). The toolbar floats over the content instead,
   reusing its existing collapse-to-a-thin-handle mechanic (trackpad.js's
   own toolbarHandle click handler, unmodified) rather than inventing a new
   gesture -- tap the handle to reveal modifiers/Esc/Tab/Enter/arrows, tap
   again to get them out of the way; Android's own back gesture still exits
   fullscreen same as always.

   Generalized from an earlier .stream-play-only version so plain /trackpad
   gets identical fullscreen chrome to the Desktop view, instead of the
   simpler static-row layout it used to have. */
/* The class, not :fullscreen, is what makes this page fullscreen.
   
   It used to be the pseudo-class, which meant the whole layout depended on
   the Fullscreen API having worked. On iPadOS it has not: WebKit ships the
   prefixed API only, so `document.fullscreenEnabled` is falsy there, the
   buttons hid themselves, and the only fullscreen left was WebKit's native
   <video> player -- which owns the touch surface, draws its own media
   controls, and renders in a layer where this toolbar and the gesture
   surface do not exist at all. Dragging scrubbed the video.
   
   So this positions itself, exactly as #term-wrap.fullscreen has always
   done (terminal.js says outright that it does this "not the fullscreen
   API"). The native API is still requested on top -- it is what removes
   the browser's own chrome -- but nothing here depends on it any more.
   Grouping `.is-fullscreen, :fullscreen` in one selector list would have
   been the obvious shortcut and is a trap: a selector list containing a
   pseudo-class the engine does not know is dropped whole, which is exactly
   the engine this needs to work on. */
#trackpad-page.is-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  /* dvh second so it wins where supported: the toolbar is pinned to the
     bottom edge and 100vh on mobile is the *largest* viewport, which puts
     that edge under the browser's own chrome. */
  height: 100dvh;
  z-index: 1000;
  display: block;
  background: var(--bg);
  padding: 0;
  min-height: 0;
  overflow: hidden;
}
/* Plain /trackpad has no video-wrap element (that's stream_play.html
   only) -- the gesture surface itself goes edge-to-edge here instead,
   losing its bordered/dashed look while fullscreen (nothing else to
   visually separate it from). Scoped off .stream-play so it doesn't
   fight that page's own always-on transparent/absolute #trackpad-surface
   rule above, which already handles Desktop's fullscreen sizing via its
   video-wrap parent. */
#trackpad-page.is-fullscreen:not(.stream-play) #trackpad-surface {
  position: fixed;
  inset: 0;
  height: auto;
  min-height: 0;
  border: none;
  border-radius: 0;
}
/* width/height in lvw/lvh (the viewport size *without* dynamic browser UI
   like the on-screen keyboard subtracted), not inset:0 -- inset:0 sizes to
   the current (shrinking) viewport, same as base.html's own
   interactive-widget=resizes-content meta tag, so opening the keyboard
   was resizing this box, which changed the video's fitted size against
   object-fit:contain and reintroduced letterboxing. Fixed at the
   keyboard-closed size instead, so the keyboard now simply overlays the
   bottom of the video (like it would over any other app) rather than
   triggering a reflow. */
#trackpad-page.stream-play.is-fullscreen .stream-play-video-wrap {
  position: fixed;
  top: 0;
  left: 0;
  width: 100lvw;
  height: 100lvh;
  border-radius: 0;
}
#trackpad-page.is-fullscreen #trackpad-toolbar {
  position: fixed;
  z-index: 5;
  margin: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  transition: transform 0.15s ease;
}
/* Dragging is driven by trackpad.js setting an inline `transform:
   translate(...)` on every pointermove -- the transition above (meant for
   the hide/reveal snap) would otherwise animate-lag every single frame of
   the drag itself. */
#trackpad-page.is-fullscreen #trackpad-toolbar.dragging { transition: none; }
/* Which screen edge the toolbar is pinned to -- trackpad.js's drag-to-edge
   feature (persisted server-side, see routes/trackpad.py's
   trackpad_toolbar_edge) toggles this attribute on both #trackpad-toolbar
   and #trackpad-page. Defaults to "top" via the template's own rendered
   attribute (not a CSS fallback), so first paint already matches whatever
   was last saved with no snap-into-place flash. */
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="top"] {
  top: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.5rem 0.5rem;
}
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="bottom"] {
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.5rem 0.4rem;
}
/* Installed, the page owns the whole screen including the strip behind the
   status bar and the home indicator -- so the one piece of chrome that
   must stay reachable moves out from under them. Nothing else in
   fullscreen needs this: the video is meant to run edge to edge and under
   both, which is exactly what viewport-fit=cover is for. */
html[data-display-mode="standalone"] #trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="top"] {
  padding-top: calc(0.4rem + env(safe-area-inset-top, 0px));
}
html[data-display-mode="standalone"] #trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="bottom"] {
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
}
/* Left/right: a genuine single-file vertical bar, every button stacked one
   below the next and stretched to the bar's own width -- not a wide column
   that a horizontal row of buttons just wraps inside of (that was the
   original version of this rule, and it was wrong: only the top-level
   handle-row got flex-direction:column, so every *nested* row -- the
   action-icon groups, the modifier/arrow content rows -- was still a
   horizontal flex row underneath it, so those kept trying to lay out
   side-by-side and overflowing past the strip's own width instead of
   aligning to it). `.trackpad-group` alone covers
   .trackpad-toolbar-actions/-primary/-secondary and both
   #trackpad-toolbar-content rows, since all of them carry that class --
   one rule turns the whole tree vertical, not just its first level. Narrow
   now on purpose (was a wide 15rem column before, sized for a horizontal
   layout that no longer exists) -- 6.5rem is enough for the widest text
   label ("Super") without wrapping, once every button stretches to fill it
   rather than sizing to its own min-width. */
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) {
  top: 0;
  bottom: 0;
  width: min(55vw, 6.5rem);
  padding: 0.5rem 0.4rem;
  overflow-y: auto;
}
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="left"] { left: 0; }
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="right"] { right: 0; }
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) .trackpad-toolbar-handle-row,
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) .trackpad-toolbar-handle-group,
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) .trackpad-toolbar-content,
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) .trackpad-group {
  flex-direction: column;
  /* Overrides .trackpad-toolbar-handle-row's own wrap (needed elsewhere so
     it doesn't overflow at narrow widths, see that rule's own comment) --
     here the toolbar itself already scrolls vertically (overflow-y: auto
     above) when its stacked content is taller than the screen, so allowing
     wrap too would instead start a second side-by-side column once the
     strip's fixed height fills up, silently blowing the "thin bar" width
     back out to two button-widths. One column, however tall, not two. */
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.35rem;
}
/* The divider between Fullscreen/Exit/Reconnect/End-session and
   Keyboard/Hide-toolbar reads as a vertical rule between two side-by-side
   groups at top/bottom (see .trackpad-toolbar-actions-secondary above) --
   stacked vertically here instead, so it becomes a horizontal rule between
   the two blocks rather than a vertical stripe down a column. */
#trackpad-page.is-fullscreen #trackpad-toolbar:is([data-toolbar-edge="left"], [data-toolbar-edge="right"]) .trackpad-toolbar-actions-secondary {
  border-left: none;
  border-top: 1px solid var(--border);
  padding-left: 0;
  padding-top: 0.5rem;
  margin-left: 0;
  margin-top: 0.15rem;
}
/* Full collapse -- in addition to (not instead of) the toolbar's own
   Modifiers handle, which only hides the Ctrl/Alt/Shift/Esc/Tab/Enter/
   arrows row while still leaving the handle row itself (with
   Fullscreen/Keyboard) permanently on screen. This hides that whole row
   too, leaving only the small reveal tab below -- added/toggled by
   trackpad.js, fullscreen-only, since #trackpad-toolbar isn't an overlay
   at all outside fullscreen (see the non-fullscreen rules above). Slides
   off in whichever direction matches its own snapped edge. */
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="top"].toolbar-hidden { transform: translateY(-100%); }
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="bottom"].toolbar-hidden { transform: translateY(100%); }
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="left"].toolbar-hidden { transform: translateX(-100%); }
#trackpad-page.is-fullscreen #trackpad-toolbar[data-toolbar-edge="right"].toolbar-hidden { transform: translateX(100%); }
.toolbar-reveal-handle {
  position: fixed;
  z-index: 6;
  padding: 0;
  line-height: 1;
  font-size: 0.7rem;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.55);
  color: var(--muted);
  display: none;
}
/* The tab stays small so it doesn't sit on the picture, but the finger
   needs the app's usual 44px: an invisible margin around it takes the tap.
   Most of it hangs off the screen edge; what is left inside is ~44px deep. */
.toolbar-reveal-handle::after {
  content: "";
  position: absolute;
  inset: -1.5rem;
}
/* Sized here, not left to the browser: an unsized inline <svg> is 100% of
   the box in one engine and 300x150 in another, which is how this came out
   differently on Safari. */
.toolbar-reveal-handle svg { display: block; width: 0.95rem; height: 0.95rem; }
/* The overflow mark is drawn vertical (⋮). On a top or bottom tab it lies
   along the tab instead, so the dots run the same way as the bar they
   bring back. */
#trackpad-page:is([data-toolbar-edge="top"], [data-toolbar-edge="bottom"]) .toolbar-reveal-handle svg {
  transform: rotate(90deg);
}
/* Deliberately not scoped under #trackpad-page.is-fullscreen -- the handle
   is appended as a child of #trackpad-page itself (see trackpad.js's own
   comment) specifically so it renders inside the browser's native
   fullscreen "top layer" (content outside the fullscreened element is
   invisible/unreachable during :fullscreen no matter what z-index says,
   confirmed live building this originally -- an earlier version appended
   it to <body> instead and it never showed). Given that, none of these
   four rules need their own :fullscreen gate: the JS already only ever
   adds .visible while actually in fullscreen (setToolbarHidden() is only
   reachable from the fullscreen-only Hide button, and fullscreenchange
   clears it on exit) -- positioned per #trackpad-page's own
   data-toolbar-edge, same attribute the toolbar itself keys off. */
#trackpad-page[data-toolbar-edge="top"] .toolbar-reveal-handle {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3rem;
  height: 1.15rem;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
}
#trackpad-page[data-toolbar-edge="bottom"] .toolbar-reveal-handle {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3rem;
  height: 1.15rem;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}
#trackpad-page[data-toolbar-edge="left"] .toolbar-reveal-handle {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.15rem;
  height: 3rem;
  border-left: none;
  border-radius: 0 var(--radius) var(--radius) 0;
}
#trackpad-page[data-toolbar-edge="right"] .toolbar-reveal-handle {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1.15rem;
  height: 3rem;
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
}
.toolbar-reveal-handle.visible {
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Installed, the page runs under the status bar and the home indicator,
   and both are the system's touch zones: a tap there goes to the iPad
   first, which is why the tab only answered some of the time. The toolbar
   already steps clear of them (above); the tab that brings it back has to
   as well. */
html[data-display-mode="standalone"] #trackpad-page[data-toolbar-edge="top"] .toolbar-reveal-handle { top: env(safe-area-inset-top, 0px); }
html[data-display-mode="standalone"] #trackpad-page[data-toolbar-edge="bottom"] .toolbar-reveal-handle { bottom: env(safe-area-inset-bottom, 0px); }
html[data-display-mode="standalone"] #trackpad-page[data-toolbar-edge="left"] .toolbar-reveal-handle { left: env(safe-area-inset-left, 0px); }
html[data-display-mode="standalone"] #trackpad-page[data-toolbar-edge="right"] .toolbar-reveal-handle { right: env(safe-area-inset-right, 0px); }
/* The button that triggers the collapse (added into the toolbar's own
   secondary action-icon group) -- fullscreen-only same as
   #trackpad-fullscreen-btn/#trackpad-exit-fullscreen-btn, since toggling it
   outside fullscreen would do nothing (the .toolbar-hidden rule itself is
   fullscreen-scoped) and a dead button is worse than no button. */
.toolbar-hide-btn { display: none; }
#trackpad-page.is-fullscreen .toolbar-hide-btn { display: inline-block; }

/* ==========================================================================
   COMPONENT KIT
   ==========================================================================

   The shared vocabulary every app page is assembled from. Everything above
   this line is the older per-page CSS it replaces; as a template migrates to
   these classes, its bespoke rules above should go with it.

   Five rules hold the whole thing together:

     1. The ground is the divider. No hairline borders anywhere. A list
        separates by putting each row on its own surface with a gap between
        them, so the background showing through *is* the rule. This is the
        single biggest change from the old look and the one that stops it
        reading like a generic dark dashboard.
     2. Controls are filled, never outlined. An outlined button is the same
        hairline problem wearing a hat.
     3. --accent means one thing per screen. On Terminal it marks the
        attached session; in Music it's the transport; in Settings it's
        what's on. Two unrelated orange things on one screen means one of
        them is wrong.
     4. 44px minimum on anything tappable. Solved once here so no individual
        screen has to remember it.
     5. Type roles come from the tokens, not from taste. See :root.

   Note on hover: these components deliberately have no hover-invert, unlike
   the older tiles/badges above. This app is used from a phone, where hover
   does not exist -- state is carried by fill (accent = active/latched) and
   feedback by a 1px press displacement. Focus rings are kept for keyboards.
   ========================================================================== */

/* ---- Buttons ------------------------------------------------------------ */

/* ---- Why every centred label carries a text-indent ----------------------

   letter-spacing adds its space *after* every character, including the last
   one. So a tracked label's box is one letter-space wider than its visible
   ink, and centring the box leaves the ink sitting half a letter-space left
   of centre. Small -- 0.04em on a button -- but it is on every button, every
   badge, every glyph in the app at once, which is exactly what "everything
   is very slightly off centre" looks like. The wider the tracking the worse
   it gets: the PIN field tracks at 0.35em and is off by nearly a fifth of a
   character.

   The fix is a text-indent equal to the element's own letter-spacing.
   Indenting widens the box by the same amount it shifts the ink, so
   re-centring the wider box lands the ink dead centre -- indent I on a box
   of width W puts the ink centre at C + I/2 - (letter-space)/2, which is C
   exactly when I is the letter-spacing.

   Two consequences worth knowing before adding anything here:

   - text-indent inherits, and the generic `button` rule below sets it. Any
     button-shaped control whose label is *left*-aligned has to zero it back
     out (.tile-menu-item, .track-play-btn, button.row), or its first line
     sits 0.06em right of everything stacked above it. `font: inherit` does
     not do this for you -- text-indent isn't part of the font shorthand.
   - A control carrying one glyph gets `letter-spacing: 0; text-indent: 0`
     instead. There is nothing to track between, so the honest fix is to
     stop tracking rather than to compensate for it. */

/* ---- Why every icon square drops its glyph ------------------------------

   The same problem again, turned ninety degrees. A line box is as tall as
   the font's ascender plus its descender, and centring that box in a 44px
   square centres a slot with descender depth reserved at the bottom -- but
   an icon glyph never uses it. Nothing hangs below the baseline in a cog, a
   chevron or a cross, so the ink ends up sitting above the middle of the
   square by however much descender space is going spare. "Slightly high, in
   every icon square at once" is what that looks like.

   The numbers, measured off the actual outlines in the vendored faces
   (scripts/subset-fonts.py has the sources; the drop is ink centre minus box
   centre, and box centre is (ascender - descender) / 2):

     URW Gothic     box centre 0.239em   > 0.060  ↗ 0.065  x 0.061  ⚙ 0.062
     Nimbus Mono PS box centre 0.103em   > 0.106  ↗ 0.144  x 0.179

   Mono is the outlier because it reserves 0.397em of descender against a
   0.559em cap -- which is why .icon-btn-solid gets its own, larger number
   instead of sharing one global fudge.

   The mechanism is padding, and it works out the same whether the control
   has a fixed height or not: content sits (padding-top - padding-bottom) / 2
   below the box centre either way. So the drop is applied as a padding-top
   of twice --glyph-drop, on top of whatever padding the control already
   had. Two things follow from that:

   - Any later rule that re-sets `padding` with the shorthand wipes this out
     and has to re-add it (.term-fs-toolbar and .trackpad-toolbar both do).
   - It moves *whatever is inside*, including an SVG -- and an SVG is drawn
     on its own viewBox, already centred, so it must not be nudged. Hence the
     :has(svg) reset on .icon-btn.

   Glyphs the vendored faces don't have (⚙ ▶ ◀ ↻ ✎ ⋮ ⛶ ⤢) come from whatever
   the phone has installed, and their ink sits wherever that font puts it.
   The measured spread across a real fallback is about 0.06em either side of
   these numbers, so one value per face is as close as this can get without
   knowing what font a given phone actually used. Widening the subset is the
   real fix, one glyph at a time, when the original has the character. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 1.25rem;
  /* Reserved, not zeroed. This was `border: 0` -- there only to drop the
     UA's own button border, which a transparent one does just as well --
     and reserving the pixel is what lets .btn--ghost draw an edge without
     coming out 2px wider than the filled button beside it in a modal
     footer. Every variant is the same size whether it paints its border or
     not. */
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-indent: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
/* Full width, for a button that is the only action in its container and has
   nothing to sit beside -- the auth cards' single submit. A modifier rather
   than a `.auth-form .btn` rule, and not only for tidiness: any descendant
   selector ending in `.btn ` collides with the plain `.btn {` that several
   tests here look up by substring, and would silently hand them these two
   declarations instead of the button's own. */
.btn--block { width: 100%; }
.btn--danger { background: var(--bad); color: var(--bone); }
/* The way in: sign in, create an account, set a password, change the PIN.
   Deliberately off the hue wheel altogether rather than pinned to a hue of
   its own, which is what this was and why it did not work.

   Every accent in the app is `oklch(0.70 0.14 H)` -- lightness and chroma
   fixed, only hue moving -- and an owner picks H from twelve swatches thirty
   degrees apart, or lets it be derived from the device id, which can produce
   any of the 360. So there is no hue a control can take that some device
   cannot also take: the previous attempt picked 150 and that is swatch six.
   Distinguishing by hue cannot work. Distinguishing by *lightness* always
   can, because that is the axis the accent never moves on.

   So: bone, the brightest fill the palette has, near-black on it. It cannot
   collide by construction rather than by luck, and the rule it encodes --
   the way in is the brightest thing on the card -- stays true whatever
   colour the machine underneath it happens to be. */
.btn--action { background: var(--bone); color: var(--ground); }
/* The quiet variant, and the one that had to stop reading as broken. It was
   `background: none` over --bone-dim and nothing else, which is what
   .btn[disabled] three rules below amounts to at 0.45 opacity, and the two
   were not tellable apart: both a label with no surface under it, dimmer
   than the text around it. So a ghost button standing on its own read as
   the greyed-out remnant of a control that had just disappeared --
   updates.html hit this for real with "Check now" on an up-to-date device,
   and worked around it there by promoting the button to --primary when it
   is the only one on the page. That workaround is now a hierarchy decision
   (the sole action on a page should be the filled one) rather than a rescue
   from this.

   The edge is the fix. currentColor rather than --border, which is
   --surface: 1.5:1 against --ground, a hairline nobody would see. Matching
   the label means the outline is exactly as legible as the word inside it,
   and it also means the variant's hover has one declaration to write --
   see .btn--ghost:hover, which sets `color` and gets the border with it.

   This does not contradict the token block's "no hairline outlines" -- that
   is about surfaces, where a card is painted rather than drawn. A ghost is
   the one control in the kit with no surface to paint, so an edge is the
   only thing left that can say "this is a control" at rest.

   Fixed here rather than by making .btn[disabled] something other than
   dimming: 0.45 is the disabled signal in .btn, in the bare `button` rule,
   in .tile-menu-item and in the busy state, each citing the others, so
   re-picking it is a change to the one signal in here that is already
   consistent. And the failure to avoid is two states that both read as
   pressable. A disabled ghost is this outline at 0.45 -- still the
   obviously dead one, because the edge fades with it.

   The busy state gets the same benefit for free: `form.htmx-request button`
   dims to that same 0.45, which on a ghost used to leave a barely-there
   label and the spinner ring alone to say anything was happening. A dimmed
   outline still holds the control's shape while it works. */
.btn--ghost { background: none; color: var(--bone-dim); border-color: currentColor; }
.btn--block { width: 100%; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: default; }

/* Compact actions attached to a row or toolbar: a fixed square, so a row
   with one action and a row with three read as the same component. Always
   pair with title="..." -- these carry no visible label, exactly as
   ui-design-notes.md already requires of icon-only controls. */
.icon-btn-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  /* Mono's descender is deep enough that this is the most visible instance
     of it in the app -- see "Why every icon square drops its glyph" above. */
  padding-top: calc(2 * var(--glyph-drop-mono));
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  /* An <a class="icon-btn-solid"> -- the Settings cog on System, Terminal
     and Trackpad, and Terminal's Fullscreen -- was getting the UA's
     underline. The generic `button` rule turns it off, but only for actual
     buttons, and these are links. */
  text-decoration: none;
  /* One glyph, so no tracking, and no inherited indent from the button
     rule -- see the block above .btn. */
  letter-spacing: 0;
  text-indent: 0;
}
/* The same pair .icon-btn already carries, and for the same two reasons --
   added when the settings gear, fullscreen, exit-fullscreen and reconnect
   marks stopped being Unicode characters (2026-08-27). All four were
   glyphs no vendored face carries, so they came from whatever the phone had
   installed; they are drawn in _icons.html now.

   The padding-top above is an optical drop for a Unicode glyph's descender.
   An SVG is centred on its own viewBox and has neither, so on an SVG that
   drop is not a correction -- it is the whole misalignment, pushing the mark
   below centre in a 44px square. Reset rather than lowered, exactly as
   .icon-btn does it.

   em sizing, not the viewBox's pixels, so the mark scales with whatever
   font-size context the control is in. */
.icon-btn-solid:has(svg) { padding-top: 0; }
.icon-btn-solid svg {
  width: 1.15em;
  height: 1.15em;
  display: block;
  flex-shrink: 0;
}
.icon-btn-solid--on { background: var(--accent); color: var(--on-accent); }
.icon-btn-solid--danger { background: var(--bad); color: var(--bone); }
.icon-btn-solid:active { transform: translateY(1px); }

.btn:focus-visible,
.icon-btn-solid:focus-visible,
.key-btn:focus-visible,
.view-switch-btn:focus-visible,
.switch:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Rows --------------------------------------------------------------- */

/* Replaces both the bordered .tile and the divider-separated list. The gap
   is the separator; see rule 1 above. */
.row-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 56px;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--bone);
  text-decoration: none;
}
.row--icon { grid-template-columns: 30px minmax(0, 1fr) auto; }
.row-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
/* A row is sometimes a <button> and sometimes an <a>, and it must not look
   different for it. The generic button rule uppercases, so "Password" --
   the one row on the account panel that opens a dialog rather than
   navigating -- rendered as PASSWORD next to sentence-case neighbours.
   Reset on .row rather than .row-title so the whole row is immune, not just
   the line that happened to show it. .row-sub sets its own uppercase and is
   unaffected: it targets the element directly and beats inheritance. */
.row { text-transform: none; }
.row-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}
.row-sub {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bone-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The only accent permitted inside a row -- it marks the one that's live. */
.row-sub--live { color: var(--accent); }

/* A row that is a *sentence* rather than a status.
 *
 * .row-sub is built for one short uppercase word sitting under a title --
 * nowrap, hidden overflow, an ellipsis, 0.11em of letter-spacing. Correct
 * for "ONLINE". Wrong for "This device can't reach the intersection right
 * now", which is the empty/error message the Devices list and the account
 * panel both render into a .row-sub with no title above it: the sentence
 * ran off the end of the row and the ellipsis ate the half that said what
 * was actually wrong. A diagnostic you cannot read is not a diagnostic.
 *
 * So: wrap, and drop the label treatment that only ever made sense on a
 * single word. Slightly larger and with normal case for the same reason --
 * uppercase at 0.11em tracking is a poster, not prose. */
.row-sub--note {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.74rem;
  line-height: 1.4;
}
.row-actions { display: flex; gap: 5px; }

/* ---- Fields ------------------------------------------------------------- */

.field {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}
.field::placeholder { color: var(--bone-faint); }
/* No focus ring on top of the caret: a text cursor already says "focused",
   and doubling it just makes the field look alarmed. */
.field:focus { outline: none; background: var(--surface); }

/* ---- The console's own colour ------------------------------------------- */

/* --device-hue exists to tell machines apart, and base.html sets it on
   <html> from the device you are looking at. The console is not a machine,
   has no such colour, and its shell has no <html> element of its own to
   carry one -- so --accent fell through to the `, 20` default in :root.
   Hue 20 is where --bad lives, which made every primary control on the
   console the same red as "Remove device", starting with Sign in.

   Both colours are restated here, not just the hue, and that distinction is
   the whole of why the first attempt at this did nothing. A custom property
   is resolved where it is *declared*: --accent is declared on :root, so its
   var(--device-hue, 20) is answered by whatever :root can see, and a
   --device-hue set further down the tree arrives far too late. Descendants
   inherit the already-resolved colour. So the colour itself has to be
   redeclared at the point the hue changes -- which is exactly what
   .hue-dot does for the device colour picker, one rule per swatch.

   265 rather than any pleasant blue: it is off the twelve-step grid the
   picker offers (0 to 330 by 30), so the console cannot come out wearing
   the colour of one of the machines it manages. The @supports block after
   them is the fallback for engines that cannot parse oklch, matching :root. */
.console-shell {
  --device-hue: 265;
  --accent: oklch(0.70 0.14 265);
  --accent-deep: oklch(0.52 0.12 265);
}
/* The console's bar sits outside .console-shell (it is a sibling of <main>),
   so it restates the same colour for the wordmark's line. */
.console-topbar {
  --device-hue: 265;
  --accent: oklch(0.70 0.14 265);
}
@supports not (color: oklch(0 0 0)) {
  .console-shell { --accent: hsl(265 70% 60%); --accent-deep: hsl(265 45% 24%); }
  .console-topbar { --accent: hsl(265 70% 60%); }
}

/* ---- Checkboxes --------------------------------------------------------- */

/* A checkbox and its label as one tap target. The only one in the app, and
   deliberately not the switch() macro next door: that is a submit button,
   because a setting saves the moment you touch it. This is not a setting --
   it modifies the action the button beneath it is about to take -- so it has
   to be a real control that submits with its form. */
.check-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  font-size: 0.9rem;
  color: var(--bone);
}
.check-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

/* ---- Switches ----------------------------------------------------------- */

/* Square-ish, not a pill -- pills belong to the rounded language this
   direction moved away from. */
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--bone-faint);
  transition: left 160ms ease, background 160ms ease;
}
/* Both attributes, because .switch is worn by two shapes of control. As a
   decorative span inside .switch-row the state lives on the row (handled
   above). As a control in its own right -- the per-network auto-join
   switches on the Wi-Fi page, which sit in a .row-actions column where a
   full-width .switch-row will not fit -- the state lives on the element,
   and `role="switch"` + `aria-checked` is what _switch.html argues a
   two-state control must announce. [aria-pressed] is kept alongside it for
   a plain toggle button that is not a switch. */
.switch[aria-pressed="true"],
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-pressed="true"]::after,
.switch[aria-checked="true"]::after { left: 26px; background: var(--on-accent); }
@media (prefers-reduced-motion: reduce) {
  .switch::after { transition: none; }
}

/* ---- Keys --------------------------------------------------------------- */

/* Terminal's modifier keys. "Held" is an accent fill rather than an
   inversion, because a sticky modifier has to look *latched* -- and a
   hover-invert never could on a touchscreen, where there's no hover to
   distinguish it from an ordinary button. */
.key-btn {
  min-height: 40px;
  padding: 0 0.85rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.key-btn--held { background: var(--accent); color: var(--on-accent); }

/* ---- Banners ------------------------------------------------------------ */

/* Solid fills, severity by colour, no icon and no left rail. --warn and
   --bad exist for this and for nothing else. */
.notice {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--bone);
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.notice--warn { background: var(--warn); color: var(--on-accent); }
.notice--bad { background: var(--bad); color: var(--bone); }

/* ---- Section labels ----------------------------------------------------- */

.kit-section-label {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--bone-faint);
}

/* ---- Kit adjuncts ------------------------------------------------------- */

/* The row's main area is itself the link (whole-row target), so it has to
   shed the default anchor styling the base `a` rule gives it. */
a.row-main { color: inherit; text-decoration: none; }

/* .tile-menu is positioned absolutely to overlay a tile; inside a row it
   sits in the actions column as an ordinary flow element instead. Keeps the
   .tile-menu class so tile-menu.js still finds it.

   Note what this rule does *not* do: it moves the menu into the flow and
   stops there, so the toggle keeps whatever it was given -- and every user
   of this class had reached for .icon-btn-solid, a 44x44 filled square built
   to be a standalone control. Inside a row that square is the heaviest thing
   on the line, and the music lists (where every row has one) read as a
   column of buttons with some text beside them. .music-menu-toggle in the
   music section above is the quiet in-row treatment, and it is scoped to
   music rather than applied here for one specific reason: the terminal's row
   puts a real .icon-btn-solid (Fullscreen) immediately next to its menu
   toggle, so making every .row-menu toggle ghost would leave that row with
   two controls of the same size in two different weights. Files and the
   trackpad's help panel would take the same treatment happily and should
   probably get it -- but that is their branch's call, not this one's. */
.row-menu { position: relative; top: auto; right: auto; }
.row-menu .tile-menu-panel {
  min-width: 16rem;
  padding: 0.5rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.row-menu .session-rename-form { gap: 0.4rem; margin-bottom: 0.4rem; }
/* The name sat on the panel's own surface-2, so nothing said it could be
   typed into. The ground under it marks it as a field. */
.row-menu .session-rename-form .field { min-height: 40px; background: var(--ground); border-bottom: 0; }
.row-menu .session-rename-form .icon-btn-solid { width: 40px; height: 40px; min-height: 40px; flex: none; }

/* ---- Files -------------------------------------------------------------

   The list was a three-column <table> whose last cell held Download, Open
   via Moonlight, Rename and Delete as four full-size buttons -- about 440px
   of controls before the filename column had had any, so the table was wider
   than any phone and the whole page scrolled sideways. It is .row-list now,
   with everything except "open it" behind the overflow menu.

   Grid is the same rows re-laid-out, not a second rendering of the
   directory: static/files-view.js flips data-view on the container and the
   rules below do the rest, so switching costs nothing and there is only one
   piece of markup to keep correct. */

/* A deep path is one long unbroken run of links and pushes the page sideways
   on its own, quite separately from the list under it. */
.files-crumbs { overflow-wrap: anywhere; }

.files-toolbar { display: flex; justify-content: flex-end; margin: 0.5rem 0 1rem; }

/* The layout switch. One control with two positions rather than two buttons,
   because the two layouts are a single either/or -- a pair of buttons says
   "here are two things you could press", a slider says "it is set to this
   one". Same track/thumb/slide shape as .switch above, which is the on-off
   variant of the same idea.

   Both marks come from _icons.html, not from Unicode: the vendored faces
   carry no list or grid character, so a text glyph would be drawn by
   whatever the phone has installed -- the same reasoning behind the
   trackpad's hand-drawn Keyboard icon. */
.view-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 44px);
  padding: 3px;
  border-radius: var(--radius);
  background: var(--surface);
}
.view-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 44px;
  height: calc(100% - 6px);
  border-radius: 4px;
  background: var(--surface-3);
  transition: transform 0.18s ease;
}
.view-switch[data-view="grid"] .view-switch-thumb { transform: translateX(44px); }
.view-switch-btn {
  /* Over the thumb, and see-through so it shows -- the generic button rule
     hands every <button> a filled background and 1.1rem of side padding. */
  position: relative;
  z-index: 1;
  padding: 0;
  background: none;
  color: var(--bone-dim);
  text-indent: 0;
}
.view-switch-btn[aria-pressed="true"] { color: var(--bone); }
/* Drawn on a 24 viewBox like the rest of the set; sized in rem so it doesn't
   inherit the button rule's 0.8rem type scale. */
.view-switch-btn svg { display: block; width: 1.15rem; height: 1.15rem; }
@media (hover: hover) and (pointer: fine) {
  /* Would otherwise paint a fill straight over the thumb. */
  .view-switch-btn:hover { background: none; color: var(--bone); }
}
@media (prefers-reduced-motion: reduce) {
  .view-switch-thumb { transition: none; }
}

/* A filename has no spaces to break at, so it ellipses rather than widening
   its column. .row-main's min-width: 0 is what actually lets the 1fr track
   shrink below the name's own width -- without it the grid track floors at
   min-content and the row grows instead. */
.files-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.files-list[data-view="grid"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.files-list[data-view="grid"] .row {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  min-height: 88px;
  /* Room for the corner menu, so a long name never runs under it. */
  padding-right: 2.9rem;
}
/* Out of the actions column and into the corner, which is where .tile-wrap
   already puts this control on the intersection console. */
.files-list[data-view="grid"] .row-actions { position: absolute; top: 4px; right: 4px; }
/* Names wrap here rather than ellipsing: a tile is several lines tall, and a
   grid is for seeing more of the name, not less. Three lines, because a
   fourth would set the height of every tile in the row. */
.files-list[data-view="grid"] .files-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  white-space: normal;
  overflow-wrap: anywhere;
}
/* .row-menu's 16rem is sized for the terminal's rename field. Four plain
   items need far less, and the panel hangs from the tile's right edge -- at
   16rem it would reach past the left edge of the page on a narrow phone,
   which is the bug this whole section exists to fix. */
.files-row .tile-menu-panel { min-width: 11rem; }
.files-list[data-view="grid"] .tile-menu-panel { min-width: 8rem; max-width: 10.5rem; }

/* This page's one primary action, kept under the thumb while the list
   above it scrolls.

   ONE. The name says it and it is a hard limit, because sticky boxes do not
   stack: give two of these the same `bottom` and both pin to the same edge,
   so on a screen shorter than the content they sit on top of each other.
   That has now happened twice -- profile.html's sign-out ("it floated over
   whatever you had scrolled to, detached from anything around it") and the
   update page, which had three of them and superimposed all three on a
   phone. Both pages dropped it rather than fought it: .row-stack is already
   a column with a gap, which is what a group of buttons wants. Reach for
   this only when there is exactly one action and a long scroll above it --
   terminal.html is the remaining honest user. */
.page-primary-action {
  position: sticky;
  bottom: 1rem;
  /* Over the rows it floats above. Without a z-index of its own, each
     row's 3-dot menu (a .tile-menu, z-index 1) painted through it as the
     list scrolled underneath. An open menu (.is-open, 20) still covers it. */
  z-index: 5;
  margin: 1rem 0 0;
}

/* Tap-to-open reference panel (trackpad gestures). Not a `title` tooltip:
   this page is used from a phone, where there is no hover to trigger one. */
.page-title-row .tile-menu { margin-left: auto; }
.help-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 0.9rem;
  margin: 0;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}
.help-list dt { color: var(--accent); white-space: nowrap; }
.help-list dd { margin: 0; color: var(--bone); }

/* ==========================================================================
   HOME SCREEN
   ==========================================================================
   Six tiles, a hard ceiling, and a pull-up sheet for everything else. See
   routes/dashboard.py for why six, and why two of the tiles are bare
   geometry rather than cards. */

.home-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
}
.home-id-mark {
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--accent);
}
.home-device {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
}
.home-vitals {
  margin-left: auto;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

/* Four columns is the unit grid; tiles claim spans of it. Fixed row height
   rather than aspect-ratio so a "bar" tile is genuinely half-height and the
   whole six-tile set lands above the fold on a phone. */
.mosaic {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 66px;
  gap: 11px;
}

.tile--wide { grid-column: span 4; grid-row: span 2; }
.tile--square { grid-column: span 2; grid-row: span 2; }

/* Overrides the older .tile above (bordered, hover-inverting, used by the
   tile grids elsewhere). Home tiles are filled surfaces with no outline --
   see the COMPONENT KIT block's rule 1. */
.mosaic .tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 0.7rem 0.75rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--bone);
  text-decoration: none;
  overflow: hidden;
}
.mosaic .tile:active { transform: translateY(1px); }

/* The glyph owns all the space above the caption and sits in the middle of
   it, rather than being pinned to the top-left corner by `margin-bottom:
   auto`. At 1.5rem in a corner it read as a marginal note on the tile; at
   this size, centred, it is the thing you actually aim at, which is what a
   tile on a phone home screen is for. The caption stays left-aligned on the
   bottom edge -- it is a label for the tile, not part of the mark. */
.tile-glyph {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bone-dim);
  line-height: 0;
}
.tile-glyph svg { width: 2.4rem; height: 2.4rem; }

.tile-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tile-status {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.66rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bone-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live = a solid bar along the bottom edge, not a border tint. It survives
   on any fill, reads at arm's length, and doesn't reintroduce the outline
   the whole direction is built on not having. */
.tile--live::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: var(--accent);
}
.tile--live .tile-status { color: var(--bone); }

/* ---- Shape tiles -------------------------------------------------------
   The shape replaces the card: no fill, no padding, the ground shows
   through. They read as objects *because* their neighbours are solid --
   a screen of nothing but floating geometry would collapse into noise,
   which is why only two of the six are like this. */

.mosaic .tile--shape {
  background: none;
  padding: 0;
  gap: 6px;
  justify-content: stretch;
}
.mosaic .tile--shape:active { transform: none; }

/* The transport tile's button is dragged, not just tapped -- horizontally to
   scrub, vertically for volume (home.js). Without this the browser claims a
   vertical drag as a page scroll before the first pointermove ever arrives,
   so the volume half of the gesture cannot exist. Scoped to the button
   rather than the tile, so the rest of the tile still scrolls the home
   screen normally. */
.js-transport { touch-action: none; }

/* Same reason as the transport: the tile is dragged sideways, and without
   this the browser can claim the drag as a scroll first. */
[data-tile="system"][data-readings] { touch-action: pan-y; }

/* With a mouse, Safari treats a press-and-move on a link or image as a
   native drag-and-drop: it lifts a shrunken ghost of the tile, which reads
   as the screen minimizing, and cancels the gesture home.js is running.
   Touch never starts one, so this only ever showed on a computer. home.js
   also cancels dragstart for the browsers that ignore this property. */
.js-transport,
.js-transport *,
[data-tile="system"][data-readings],
[data-tile="system"][data-readings] * { -webkit-user-drag: none; }

.shape-hit {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.shape-hit:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.shape-cap {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  color: inherit;
  text-decoration: none;
}
.shape-cap:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.shape-cap-a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.shape-cap-b {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--bone-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Play/pause morph. Two halves, four points each, so clip-path can
   interpolate between them -- a triangle's left half is a trapezoid and its
   right half is a wedge, and both become rectangles for pause. */
.pp {
  display: flex;
  aspect-ratio: 1;
  height: 100%;
  max-width: 100%;
}
.pp i {
  display: block;
  width: 50%;
  height: 100%;
  background: var(--accent);
  transition: clip-path 420ms cubic-bezier(0.65, 0, 0.35, 1);
}
.pp-l { clip-path: polygon(8% 2%, 74% 2%, 74% 98%, 8% 98%); }
.pp-r { clip-path: polygon(26% 2%, 92% 2%, 92% 98%, 26% 98%); }
.is-play .pp-l { clip-path: polygon(0% 0%, 100% 25%, 100% 75%, 0% 100%); }
.is-play .pp-r { clip-path: polygon(0% 25%, 100% 50%, 100% 50%, 0% 75%); }
@media (prefers-reduced-motion: reduce) {
  .pp i { transition: none; }
}

/* Disk ring. conic-gradient for the sweep, a punched-out centre for the
   hole -- no SVG and no library for what is one gradient and a circle.

   The swept arc is --accent, not a neutral: this is the device's own hue
   (see --device-hue), so the tile that reports on the machine is drawn in
   the colour that identifies it, and the same ring on the System page
   agrees with the tile you opened it from. It sits next to the Music
   tile's transport, which is also accent -- deliberately, since the two
   shape tiles are a matched pair; the "one accent per screen" rule in the
   kit header is about two *unrelated* accents, not about a pair that reads
   as one class of object. */
.ring {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  height: 100%;
  border-radius: 50%;
  /* --surface-2 for the unspent part, not --surface. Every card a ring sits
     in is --surface now -- the home screen's .tile already was -- so the
     track was the same colour as the tile behind it and the ring read as a
     floating arc with no dial under it. One step up the ramp is the whole
     fix. */
  background: conic-gradient(var(--accent) 0 var(--ring-pct), var(--surface-2) var(--ring-pct) 100%);
}
.ring[hidden] { display: none; }
.ring--warn { background: conic-gradient(var(--warn) 0 var(--ring-pct), var(--surface) var(--ring-pct) 100%); }

/* The ring sweeps a fraction. Uptime is not one -- there is no whole for it
   to be a part of -- so on that reading there is no ring at all: the value
   stands on its own in the space the gauge would have used.

   This used to draw the full track at 0.55 opacity, which was the wrong
   answer to the right question. A dimmed, completely unswept ring is not
   read as "this number isn't a fraction"; it is read as a gauge sitting at
   zero -- which is the exact impression a flat reading exists to avoid, and
   a faded one at that, so uptime looked like a reading that had failed.
   Drawing nothing cannot be misread.

   Doubled class, and .ring--warn above is the reason to bother: these
   modifiers only beat .ring's own background by sitting after it, and this
   one lived a hundred lines *earlier* in the file for a while, where
   `background: none` was silently overridden by the base rule and the ring
   kept drawing. Specificity survives somebody moving a block; source order
   does not.

   The box keeps its size (aspect-ratio and height are untouched), so the
   tile does not resize as you swipe between readings -- only what is inside
   it changes. */
.ring.ring--flat { background: none; }
.ring.ring--flat::after { display: none; }
/* Free of the punched-out centre, so it can use the whole circle rather
   than the 62% hole every other reading has to fit inside. */
.ring.ring--flat .ring-value { font-size: 1.6rem; }
.ring::after {
  content: "";
  position: absolute;
  width: 62%;
  height: 62%;
  border-radius: 50%;
  background: var(--ground);
}
.ring-value {
  position: relative;
  z-index: 1;
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.9rem;
}

/* ---- Chevrons -----------------------------------------------------------

   One mark, four directions: the same &rsaquo; the rows have always used
   for "there is more this way", rotated. Sheets open and close with it, so
   opening and closing are visibly the same idea pointed two ways, rather
   than a chevron in one place and an x in the other.

   It replaces two 52x5px rounded bars (the grip and the sheet's "grab"
   decoration). Both read as drag handles and neither ever had a drag
   behind it -- one of them was even taken for the close control and
   reported as "no way to close it". A chevron promises a tap, which is all
   either of these has ever done. */
.chev {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--bone-faint);
  /* One mark, inside a <button> -- so neither the tracking nor the indent
     that rule hands down applies here. See the block above .btn. */
  letter-spacing: 0;
  text-indent: 0;
  /* The drop goes on the mark itself rather than on .chev-btn, because
     .chev--up/--down rotate about this box's own centre: get the ink centred
     in here and every rotation of it stays centred, in both axes. Put it on
     the button instead and the up-chevron's correction would come out
     sideways. */
  padding-top: calc(2 * var(--glyph-drop));
}
.chev--up { transform: rotate(-90deg); }
.chev--down { transform: rotate(90deg); }

/* The 44px minimum touch target the rest of the kit uses -- the glyph
   itself is nowhere near it. */
.chev-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* ---- Row groups ---------------------------------------------------------

   A label and the list under it are one thing; two groups are two things,
   and the spacing has to say which is which. Without this the gap above a
   section label was the same as the gap between its own rows, so a screen
   of settings read as one undifferentiated column with words dropped into
   it at random. Tight inside a group, wide between groups -- the same
   rhythm every settings screen on a phone uses. */
.row-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.row-stack {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

/* More air on a phone, not less.

   The usual instinct on a narrow screen is to tighten, and it is wrong for
   this component. A row list on a desktop is read; on a phone it is aimed
   at, and 4px between two 56px targets is a miss waiting to happen. The
   grouping has to work harder too: there is no width left to separate
   things side by side, so vertical space is the only thing left to say
   "these belong together and those do not".

   All three levels move together, and the ratios between them are the
   point rather than the absolute numbers -- inside a list < label to its
   list < group to group. Bumping only one of them would flatten the very
   hierarchy the spacing exists to draw.
   700px is this stylesheet's existing breakpoint; see the blocks above. */
@media (max-width: 700px) {
  .row-list { gap: 8px; }
  .row-group { gap: 0.8rem; }
  .row-stack { gap: 2rem; }
  /* The row itself, so the text is not flush against the edge of a target
     that is now visibly its own object rather than one band in a stripe. */
  .row { padding: 0.85rem 0.95rem; }
}

/* ---- Pull-up sheet ------------------------------------------------------ */

.home-grip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  margin-top: 1.4rem;
  padding: 0.6rem 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.home-grip-label {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
  color: var(--bone-faint);
}

.home-drawer {
  position: fixed;
  inset: 0;
  /* Above the music player bar (z-index: 100), which is fixed to the same
     bottom edge this sheet slides up from -- at 40 it floated on top of
     the sheet, undimmed by the scrim, while the sheet's own rows scrolled
     underneath it. */
  z-index: 110;
  background: rgba(10, 9, 7, 0.6);
  display: flex;
  align-items: flex-end;
}
/* Required, not defensive. An author `display` rule beats the UA's
   `[hidden] { display: none }` regardless of specificity, so the rule above
   makes a `hidden` drawer render anyway -- fullscreen, over the whole home
   screen, with its own close control scrolled out of reach. base.html
   documents this exact trap from the last time it bit this app (the music
   player bar); it now has a test as well. Any new component that both sets
   `display` and toggles `hidden` needs this line too. */
.home-drawer[hidden] { display: none; }
.home-drawer-panel {
  width: 100%;
  /* Deliberately short of full height: the scrim above it is one of the
     ways out, and a panel that reaches the top leaves nothing to tap.
     dvh, not vh: on a phone browser vh is the *largest* viewport (address
     bar retracted), so a 78vh sheet is taller than 78% of what you can
     actually see while the bar is showing. */
  max-height: 78dvh;
  overflow-y: auto;
  padding: 0 1rem 1.5rem;
  border-radius: 16px 16px 0 0;
  background: var(--ground-2);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

/* ---- Side drawer (the account sheet) ------------------------------------

   The topbar's profile control opens this rather than navigating: an
   account panel is a detour from whatever you were doing, and taking the
   whole screen for it meant coming back was a separate decision. The
   content is /profile itself, fetched and swapped in (see base.html and
   static/profile-drawer.js) -- the page still exists and still renders on
   its own, so there is one template rather than a page and a panel that
   drift apart.

   Off the right edge because that is the corner its control lives in. */
.side-drawer {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(10, 9, 7, 0.6);
  display: flex;
  justify-content: flex-end;
}
/* Same trap as .home-drawer[hidden] above, for the same reason. */
.side-drawer[hidden] { display: none; }
.side-drawer-panel {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  /* 88vw rather than 100vw at the narrow end: a strip of scrim left
     showing is what says this is a layer over the page and not a
     navigation, and it is the easiest thing on the screen to tap to
     dismiss. */
  width: min(360px, 88vw);
  height: 100dvh;
  overflow-y: auto;
  padding: 0 1rem 1.25rem;
  background: var(--ground-2);
}

/* Sticky, on both sheets, and this is the orientation fix: a phone held
   sideways gives a sheet about 300px of height, most of which is taken by
   the rows themselves. A head that scrolls away takes the way out with it
   -- and the scrim is no help there, since in landscape a full-width sheet
   leaves almost none of it showing. Pinned, the chevron is on screen at
   every height. The negative margins let its background reach the panel's
   edges so rows pass underneath it rather than beside it. */
.home-drawer-head,
.side-drawer-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 -1rem;
  padding: 0.2rem 1rem;
  background: var(--ground-2);
}
body.drawer-open { overflow: hidden; }

.row-glyph { display: flex; align-items: center; justify-content: center; color: var(--bone-dim); line-height: 0; }
.row-glyph svg { width: 1.15rem; height: 1.15rem; }
.row-chevron { color: var(--bone-faint); }
/* Leaves this app. Three rows on the account panel hand off to the intersection
   console, and each one used to say so in its own subtitle -- "Manage at
   the console", three times in a column of five rows, which is noise
   pretending to be information. The mark carries it instead, and the
   anchor's aria-label says it in words for anyone who can't see the mark.
   Slightly smaller than the chevron it replaces: an arrow at the same size
   reads as heavier. */
.row-chevron--out { font-size: 0.85em; }

/* ==========================================================================
   POINTER AND WIDE-VIEWPORT BEHAVIOUR
   ==========================================================================

   The kit above was written phone-first and briefly went too far: it dropped
   hover entirely, on the reasoning that the device is driven from a phone.
   That's true and it isn't the whole truth -- this same panel is opened from
   a real browser, where a control with no hover response reads as inert.

   So hover comes back, but as *feedback* rather than as the state carrier it
   used to be. State is still fill (accent = live, latched, on); hover is a
   one-step lift of the surface underneath the cursor and nothing more. The
   old hover-invert stays gone: inverting a filled control on hover makes it
   look selected, which now means something specific.

   Guarded on `hover: hover` AND `pointer: fine` together -- a touchscreen
   that reports hover capability (some Android browsers, and anything with a
   stylus) would otherwise get sticky hover states that survive the tap. */
@media (hover: hover) and (pointer: fine) {
  /* Scoped off the variants rather than left generic, and this was a real
     bug rather than tidying: `.btn:hover` and `.btn--primary:hover` are
     both (0,2,0), but they never contested anything -- the first sets
     `background`, the second only `filter`. So the generic rule took the
     background uncontested, and it also out-specifies the resting
     `.btn--primary` (0,1,0) that the accent comes from. Every primary and
     danger button in the app dropped its fill for --surface-3 under a real
     pointer, and the brightness() then dutifully brightened the grey.

     Excluded here rather than re-declared inside each variant's own hover
     rule, because the defect is the generic rule claiming a property it has
     no business setting on a control that already carries a fill. Fixing it
     variant-side would cover the two that exist and leave the next one to
     rediscover this. `:not()` takes its argument's specificity, so the
     selector is (0,5,0) -- but it no longer overlaps the variants at all,
     which is the point. */
  .btn:not(.btn--primary):not(.btn--danger):not(.btn--ghost):not(.btn--action):hover {
    background: var(--surface-3, #3f3e37);
  }
  .btn--primary:hover,
  .btn--danger:hover { filter: brightness(1.12); }
  /* Down, not up: the fill is already white, so the direction every other
     variant brightens in is the one direction this one cannot move. Excluded
     from the generic rule above as well -- that is the trap the note above
     it says the next variant would rediscover, and this is the next
     variant. */
  .btn--action:hover { filter: brightness(0.92); }
  /* Colour only: the border is currentColor, so one declaration brightens
     the label and the edge together. The background is restated so the
     variant still describes its whole hover state on its own, the way
     .tile.tile-static:hover does. */
  .btn--ghost:hover { color: var(--bone); background: none; }

  /* The same defect one component down, and still latent: nothing renders
     .icon-btn-solid--on or --danger yet, so this fills the trap in rather
     than repairs a visible break. Both are (0,1,0) fills that the generic
     hover would have taken the moment either got used. */
  .icon-btn-solid:not(.icon-btn-solid--on):not(.icon-btn-solid--danger):hover {
    background: var(--surface-3, #3f3e37);
  }
  .icon-btn-solid--on:hover,
  .icon-btn-solid--danger:hover { filter: brightness(1.12); }

  .row:hover { background: var(--surface-2); }
  .mosaic .tile:hover { background: var(--surface-2); }
  /* Shape tiles have no fill to lift, so the shape itself responds. */
  .mosaic .tile--shape:hover .pp i { filter: brightness(1.15); }
  .mosaic .tile--shape:hover .ring { filter: brightness(1.15); }

  .key-btn:hover { background: var(--surface-3, #3f3e37); }
  .key-btn--held:hover { filter: brightness(1.12); }

  .home-grip:hover .chev,
  .chev-btn:hover .chev { color: var(--bone-dim); }
  .home-grip:hover .home-grip-label { color: var(--bone-dim); }
}

/* One step above --surface-2, for hover only. Declared here rather than up
   with the palette because nothing else needs it. */
:root { --surface-3: #3f3e37; }

/* ---- Wide viewports -----------------------------------------------------

   The phone layout is the constraint that shaped the design, so it stays
   the default and the browser gets a scaled version of the same thing --
   not a different layout. Tiles grow rather than multiply: a seven-tile
   home screen on a desktop would break the ceiling that makes the whole
   design work. */
@media (min-width: 680px) {
  .mosaic {
    grid-auto-rows: 96px;
    gap: 14px;
  }
  .home-device { font-size: 1.6rem; }
  .tile-glyph svg { width: 3.1rem; height: 3.1rem; }
  .tile-name { font-size: 0.95rem; }
  .tile-status { font-size: 0.72rem; }

  /* A bottom sheet is a phone idiom. On a browser the same content reads
     better as a centred dialog -- same markup, same behaviour, same close
     control, just not glued to the bottom edge of a 1440px window. */
  .home-drawer { align-items: center; justify-content: center; padding: 2rem; }
  .home-drawer-panel {
    max-width: 620px;
    max-height: 76dvh;
    border-radius: var(--radius);
  }

  .row { min-height: 60px; }
}

/* ---- Short viewports (a phone held sideways) ----------------------------

   The block above keys on width, and a phone in landscape is *wider* than
   680px -- so it was handed the centred-dialog treatment: 2rem of padding
   top and bottom plus a 76dvh cap, on a window about 340px tall. What was
   left was a sheet barely taller than its own header.

   Height is the constraint in this orientation, not width, so this query
   asks about height and puts the sheet back on the bottom edge with nearly
   all of the screen. It comes after the width query deliberately: same
   specificity, later wins, and both match at once on exactly the device
   this is for. The sticky heads above are the other half of the fix. */
@media (max-height: 520px) {
  .home-drawer { align-items: flex-end; justify-content: stretch; padding: 0; }
  .home-drawer-panel {
    max-width: none;
    max-height: 94dvh;
    border-radius: 16px 16px 0 0;
  }
  /* Wider, because a landscape window has the room and a 360px column of
     rows next to 700px of scrim looks like a mistake. */
  .side-drawer-panel { width: min(440px, 80vw); }
}

/* ---- Modals ------------------------------------------------------------
   Native <dialog>, so focus trapping, focus restore, Escape and page
   inertness come from the browser rather than from this app. See
   static/modal.js. */

dialog.modal {
  width: min(420px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--ground-2);
  color: var(--bone);
}
dialog.modal::backdrop { background: rgba(10, 9, 7, 0.62); }

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.9rem 1rem 1.1rem;
  margin: 0;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
/* A dialog's title, in the type the rows use -- not .kit-section-label,
   which is what it was.

   That class is 0.62rem, uppercase, with 0.2em of tracking, and it exists
   to label a *group of rows* from outside it. Borrowed as a dialog title it
   shouted "CHANGE PASSWORD" over a form whose every other word (the
   placeholders, the row you opened it from) is sentence case. Uppercase in
   this kit means "label or control" -- section labels and .btn both -- and
   a title is neither. Same size and family as .row-title so the dialog
   reads as a continuation of the row that opened it. */
.modal-title {
  /* Zeroed because this is now worn by an <h2> as well as a <span>: the PIN
     dialog's title is a real heading (its id is the dialog's
     aria-labelledby), and a bare h2 arrives carrying `margin-top: 2rem`
     from the top of this file plus the UA's own bottom margin. In a flex
     column with its own gap that is spacing twice, one of which nobody
     asked for. */
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  color: var(--bone);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
/* Explanatory text in a dialog, as opposed to .modal-error's refusal.
   `pre-line` because the pin-mismatch message sets two fingerprints on their
   own lines to be compared -- and two 71-character strings reflowed into a
   paragraph are exactly the comparison people perform badly. */
.modal-note {
  margin: 0;
  color: var(--bone-dim);
  font-size: 0.85rem;
  line-height: 1.45;
  white-space: pre-line;
}
.modal-note:empty { display: none; }
/* A file input can't be restyled into .field's shape, so it keeps the fill
   and gets breathing room instead of fighting the browser's own widget. */
.field--file {
  padding: 0.7rem 0.9rem;
  height: auto;
  min-height: 46px;
  font-size: 0.8rem;
}

.page-title-actions { display: flex; gap: 0.4rem; }

/* ---- System page: donut cards ------------------------------------------ */

/* .ring is sized by its parent on the home screen (it fills a tile). Here
   it sits beside text in a card, so it needs a size of its own. */
.ring--fixed { height: 84px; flex: none; }

.donut-card { display: flex; align-items: center; }
.donut-top { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.donut-legend .stat-detail { white-space: normal; }
/* The battery card is the only donut that also carries a sparkline, so it
   stacks -- ring and legend in a row on top, the line spanning the full
   width beneath. .donut-card is a row by default, which would otherwise sit
   the line beside the ring in the space the legend needs. */
#battery-tile { flex-direction: column; align-items: stretch; justify-content: center; }

/* Stack the ring and its legend on a phone.

   Side by side, the ring keeps its fixed 84px and the legend gets whatever
   is left of the tile -- which in a two-column grid on a 390px screen is
   about 36px. That is not a narrow column, it is one word per line:

       25.21
       GB
       used
       /
       30.16
       GB
       total

   set in a 36px strip 130px tall beside an 84px ring. The tile was sized
   for two columns of content and only ever had room for one.

   Stacking gives the legend the tile's full width, which is enough for the
   whole reading in two lines. Centred rather than left-aligned because the
   ring above it is centred and a left-aligned caption under a centred mark
   reads as a mistake.

   Keyed on the viewport rather than the tile: the grid is a fixed two
   columns at every width, so viewport width and tile width are the same
   question here, and 700px is the breakpoint the rest of this file already
   uses. A container query would say it more directly, but nothing else in
   this file uses one and this does not need to be the first. */
@media (max-width: 700px) {
  .donut-top {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  .donut-legend {
    align-items: center;
    text-align: center;
  }
}

/* ---- Home: horizontal pages -------------------------------------------- */

/* Stays put while the page scrolls under it. Which page you are on is the
   one piece of state on this screen that stops being obvious the moment it
   leaves the viewport -- and the tabs are also the only way back, so
   scrolling down a long Devices list used to mean scrolling all the way up
   again to get anywhere.

   The bleed is the same trick .home-pages uses below: negative margin out to
   the page gutter, matching padding back in, so the strip's own background
   covers the full width and content passes *behind* it rather than beside
   it. Without that you get tiles sliding through a 1rem gap on each side.

   z-index above the tiles (a .tile-menu panel is 10) and well below the
   drawer (110) and the player bar (100), both of which are meant to cover
   this. Nothing sits above it to offset against: the topbar scrolls away
   with the page, so top: 0 is the viewport edge by the time this lands. */
.home-tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 1.1rem;
  margin: 0 -1rem 0.9rem;
  padding: 0.55rem 1rem 0;
  background: var(--bg);
}
/* The underline tab: the home screen's Home/Devices and the editor's
   Apps/Live. Was the same sixteen lines written twice. */
.home-tab, .hs-tab {
  min-height: 0;
  padding: 0 0 6px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--bone-dim);
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.home-tab.is-on, .hs-tab.is-on { color: var(--bone); border-bottom-color: var(--accent); }

/* The track scrolls; the pages snap. No JS owns the gesture -- see home.js.
   Negative margin + matching padding lets a page's content sit flush with
   the page gutter while the scroll track itself runs edge to edge, so a
   swipe that starts at the screen edge still catches. */
.home-pages {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin: 0 -1rem;
  padding: 0 1rem;
  /* Must match the padding above. `scroll-snap-align: start` aligns a page
     to the *snapport*, which is the scrollport inset by scroll-padding --
     and scroll-padding defaults to 0, not to the element's own padding. So
     the resting position at scrollLeft 0 (content sitting after 1rem of
     padding) and the snapped position (page edge flush with the scrollport)
     disagreed by exactly that 1rem: the first page rendered misaligned and
     then jumped into place the first time it snapped. */
  scroll-padding-inline: 1rem;
  gap: 2rem;
  overscroll-behavior-x: contain;
}
.home-pages::-webkit-scrollbar { display: none; }

.home-page {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.device-row { align-items: center; }
.device-mark {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 2px;
  /* The owner's chosen accent, or a hue derived from the device id when
     they haven't picked one -- home.js decides which and sets --dev-hue.
     OKLCH, like the topbar: hue numbers are not portable between colour
     spaces, so a hue read as HSL here and as OKLCH there would put the same
     device in two different colours. Exactly --accent's recipe, not the
     bar's: a mark in the device list *is* that device's accent, and this one
     carries no text, so it takes the lighter of the two and pops against a
     dark row. */
  background: oklch(0.70 0.14 var(--dev-hue, 20));
}
@supports not (color: oklch(0 0 0)) {
  .device-mark { background: hsl(var(--dev-hue, 20) 70% 60%); }
}
/* An offline device keeps its identity in the list but not its colour:
   colour here reads as "live", and every row wearing it made a set with
   one machine up look like a set that was entirely up. */
.device-row--offline .device-mark { background: var(--bone-faint); }

/* ---- Device colour picker ----------------------------------------------- */

.hue-picker {
  display: grid;
  /* Wraps rather than scrolls: thirteen swatches at a comfortable tap size
     is two rows on a phone and one on a desktop, and a horizontally
     scrolling strip inside a modal fights the modal's own scroll. */
  grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
  gap: 6px;
}

.hue-swatch { display: block; cursor: pointer; }
/* The radio is the control and stays focusable; the dot is what you see.
   Not display:none, which would take it out of the tab order and leave the
   grid keyboard-unreachable. */
.hue-swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hue-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 44px: the same minimum tap target the rest of the kit uses. A colour
     swatch is one of the easiest controls to make too small. */
  min-height: 44px;
  border-radius: var(--radius);
  /* Exactly the topbar's own recipe, not an approximation of it: this
     swatch is a preview, and a preview that isn't the thing is a lie. The
     twelve hues are also evenly spaced in OKLCH, so they look evenly spaced
     -- in HSL the same twelve numbers bunch up in the greens. */
  background: oklch(0.52 0.12 var(--swatch-hue, 0));
  /* Transparent rather than absent, so selecting one doesn't change the
     swatch's size and shift every other swatch in the grid. */
  border: 2px solid transparent;
  color: var(--bone);
  font-size: 0.8rem;
}
@supports not (color: oklch(0 0 0)) {
  .hue-dot { background: hsl(var(--swatch-hue, 0) 45% 24%); }
}

.hue-swatch--auto .hue-dot { background: var(--surface-2); color: var(--bone-dim); }

/* Selection is a ring in the page's own foreground colour, not a tick or a
   tint: it has to be legible on top of twelve different hues, and only a
   neutral does that everywhere on the wheel. */
.hue-swatch input:checked + .hue-dot { border-color: var(--bone); }
.hue-swatch input:focus-visible + .hue-dot { outline: 2px solid var(--bone); outline-offset: 2px; }

.modal-error { color: var(--accent); margin: 0; }
.modal-error[hidden] { display: none; }

/* A command meant to be read and retyped. `overflow-wrap: anywhere` rather
   than a horizontal scroller: these are absolute paths into a venv, they do
   not fit a phone's width, and a line the reader has to drag sideways to
   finish reading is worse than one that wraps. `user-select: all` makes one
   tap select the whole command instead of a word of it. */
.code-line {
  display: block;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Sparklines on /system. Sized by the tile, drawn by system-stats.js. */
.spark { display: block; width: 100%; height: 24px; margin-top: 0.3rem; }
/* Both of these need an attribute selector to beat the `display` above.
   `hidden` is a UA rule of the lowest possible weight, so any author
   `display` silently defeats it -- the same trap base.html documents for the
   drawer, and the reason the system tile's ring did not disappear when it
   was told to. */
.spark[hidden] { display: none; }
/* The system tile's other mark: a number over a line, for a reading that is
   a value over time. Stands in for the ring, so it occupies the same centred
   slot -- and carries its own number, because .ring-value is inside the ring
   and goes when the ring does. */
.tile-line { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; width: 100%; }
.tile-line[hidden] { display: none; }
.tile-line-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
/* Taller than the 24px strip under a stat tile: there the line is a
   footnote to a number, here it is half of what the tile is showing. */
.tile-spark { max-width: 8rem; height: 2.5rem; margin-top: 0; }

/* ---- Developer mode: journal tail --------------------------------------- */

.log-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
/* Links acting as filter tabs, like Music's Songs/Artists/Albums buttons. */
.log-tabs .filter-tab { text-decoration: none; }
.log-tail {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  background: #08090c;
  color: var(--bone-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.7;
  /* pre-wrap, not the default pre: journal lines are long, and a horizontal
     scrollbar inside a page that must never scroll sideways is a trap. */
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 22rem;
  overflow-y: auto;
}

/* ---- Device identity in the topbar -------------------------------------
   The bar is tinted with this device's own hue (see deps.current_device_hue)
   so "which machine is this?" is answered before you read anything.

   Filled with the hue at full strength, in **OKLCH rather than HSL**, and
   that swap is what makes the fill possible at all. HSL's lightness is not
   perceptual: `hsl(H 65% 52%)` is a pale yellow and a dark blue at the same
   stated lightness, so white text on it passes contrast at some hues and
   fails at others -- which is why this bar used to be a dark tint with the
   real colour banished to a 3px edge. OKLCH's L *is* perceptual, so one
   lightness holds across the whole wheel: white on oklch(0.52 0.12 H)
   measures 4.96:1 at its worst hue and 5.89:1 at its best. There is a test
   that walks all 360 of them.

   The fallback for anything that can't parse oklch() lives with
   --accent-deep's, in the @supports block after :root. */
.topbar {
  background: var(--accent-deep);
  /* The colour is the whole bar now, so it no longer needs an edge to carry
     it. A shadow, not a border: it separates the bar from the page without
     drawing a line in some third colour that has to work against every
     hue. */
  border-bottom: 0;
  box-shadow: 0 1px 6px rgb(0 0 0 / 0.45);
}
.topbar .brand { color: #fff; }
/* The wordmark (base.html). A fixed width rather than auto, so the flex row
   can never squeeze it and clip the last t. Its line sits on the device
   colour, where --accent would vanish into its own hue, so here it lifts to
   a paler tint of that hue; the filled dot stays white and still reads. */
.topbar .brand { display: inline-flex; flex: none; --wm-bar: oklch(0.80 0.11 var(--device-hue, 20)); }
@supports not (color: oklch(0 0 0)) {
  .topbar .brand { --wm-bar: hsl(var(--device-hue, 20) 60% 75%); }
}
.topbar .brand .wm { display: block; height: 1.75rem; width: calc(1.75rem * 747 / 233); overflow: visible; }


/* Notifications, battery and profile: one rectangle, three separate clicks.
   The seams are what make that legible -- an unbroken lit strip reads as a
   single control, and these three do unrelated things.

   A rectangle at the normal --radius, not the 999px pill this started as.
   The pill was the actual complaint: rounded that hard and floating on a
   coloured bar, it read as a white blob belonging to some other app. Same
   colour, square corners, visible seams, and it reads as chrome that
   belongs to this one.

   Light ground with dark glyphs. The alternative -- veiling the bar with
   translucent white and keeping white text -- is the one thing that cannot
   work here: it lifts the ground under 11px uppercase to about 3:1, under
   the 4.5:1 it needs. Near-opaque light with --ground on top measures about
   16:1 at every hue, because neither end of it is derived from the hue. */
.topbar-cluster {
  gap: 0;
  border-radius: var(--radius);
  background: rgb(255 255 255 / 0.9);
  /* So the segments' square corners are clipped by the group's rounded
     ones, instead of poking out of them. */
  overflow: hidden;
}
.topbar-cluster .badge {
  border-radius: 0;
  background: none;
  color: var(--ground);
  min-height: 30px;
}
/* The seams. On the divider side only, so the group has no outer border of
   its own -- an outline around the whole thing plus the fill would be two
   statements of the same edge. */
.topbar-cluster > * + * { border-left: 1px solid rgb(0 0 0 / 0.18); }
/* Dimmed, but not to the 0.4 the rest of the app uses for .dummy: on this
   light ground that faded to near-invisible. */
.topbar-cluster .badge.dummy { opacity: 0.5; }
/* The battery reading. Not a .dummy any more -- it reads a real gauge -- so
   it sits at full strength like any other live value in the strip. */
/* Low, and on its own power. Deliberately not applied while charging: a
   battery at 8% on mains is recovering, and a red badge says the opposite.
   Kept legible rather than merely red -- this is the light cluster ground,
   where a mid red on white is the one combination that fails contrast. */
.battery-badge--low { color: var(--bad-ink); font-weight: 600; }
/* A row -- the mark then the reading, in that order -- inheriting .badge's
   own direction. The badge still must not change width when the charger
   goes in (it sits in a fixed-width strip of controls); that is handled by
   reserving the mark's slot rather than by stacking, see
   .battery-plug[hidden] below. */
.battery-badge {
  gap: 0.35em;
  /* The percentage is a number that changes under itself; tabular figures
     stop the badge and its seam twitching sideways as it ticks. */
  font-variant-numeric: tabular-nums;
}
.battery-plug {
  display: inline-flex;
  /* Fixed to the badge's own type size rather than a fraction of the cluster,
     so the mark holds its proportions if the topbar type ever changes. */
  width: 0.95em;
  height: 0.95em;
  /* Not the low colour: the plug is why a low battery is recovering, so it
     should not be painted in the warning that no longer applies. */
  opacity: 0.75;
}
.battery-plug svg { width: 100%; height: 100%; }
/* Two jobs in one declaration, and the unusual half is deliberate.

   It has to be here at all for the same reason .home-drawer[hidden] does:
   `display: inline-flex` above is an author rule and beats the UA's
   `[hidden] { display: none }` at any specificity, so without this the plug
   renders on a battery that isn't charging -- the one state it exists to
   distinguish, showing in both.

   `visibility`, not `display: none`, because the slot has to stay occupied.
   The badge sits in a fixed-width strip beside the notifications count and
   the profile control, and a mark that only takes up space while charging
   would widen the badge and shunt both of them sideways every time the
   charger goes in or out -- on a 30s poll, without anyone touching it. This
   keeps the mark left of the reading (which is where it reads best) and the
   strip as still as it was when the mark was stacked underneath. */
.battery-plug[hidden] { visibility: hidden; }
@media (hover: hover) and (pointer: fine) {
  .topbar-cluster a.badge:hover, .topbar-cluster button.badge:hover {
    background: rgb(0 0 0 / 0.08);
  }
}

/* The profile control. A glyph rather than the coloured chip this was: that
   chip existed to carry the device's colour when the bar behind it was a
   dark tint, and against a bar that *is* that colour it was invisible by
   construction -- see base.html.

   The glyph is a vertical ellipsis, the overflow-menu mark every phone OS
   uses. It was a single filled circle for one build, which is the mark for
   an *indicator* (unread, recording, live) -- so it sat in a row with two
   status badges looking like a third one, and nothing about it said it
   could be tapped. Set larger than the badges beside it because the three
   dots are drawn small inside their own em box. */
.topbar-btn {
  width: 32px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  text-decoration: none;
  /* Kept for any text that lands in here: .badge tracks at 0.1em, which put
     a single mark a twentieth of a character left of centre in a 32px
     square. See the block above .btn. */
  letter-spacing: 0;
  text-indent: 0;
}
/* The dots are an SVG now, not U+22EE. As a character they came from
   whatever font the phone had -- the codepoint is not in the vendored
   subset -- so they sat wherever *that* font's metrics put them in the box,
   which no --glyph-drop tuned for URW Gothic could correct. A drawing has
   no baseline and no descender, so .badge's own align/justify centring is
   the whole answer and it holds on every device. */
.topbar-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* The console's bar (intersection_base.html): white, not a hue. It is no
   machine, so it wears no machine's colour -- and white is the one ground no
   device can come out as. Everything on it inverts to match: dark wordmark
   with the console's own accent for its line, and a grey well for the
   cluster, since the white patch the device bars use would vanish here. */
.topbar.console-topbar { background: #fff; }
/* Black and white, no device colour: the console belongs to no one device.
   The line is a shaded white -- a step down from the bar it sits on, so it
   still shows -- and the black dot reads on it. */
.console-topbar .brand { color: var(--ground); --wm-bar: #bdbcb6; }
.console-topbar .topbar-cluster { background: rgb(0 0 0 / 0.07); }
/* Sign out is a POST, so it is a form; the form must not be the box the
   cluster's seams are drawn between. */
.topbar-form { display: flex; margin: 0; }


/* A <button> that has to look and sit exactly like the <a> rows beside it --
   the profile page's Password row opens a dialog rather than navigating, and
   a row that behaves differently must not *look* different. The UA gives a
   button a border, a centred label and its own font; a row is a left-aligned
   grid in the page's own type. */
button.row {
  width: 100%;
  border: 0;
  font: inherit;
  text-align: left;
  /* Without this the Password row's title sits 0.06em right of every
     anchor row stacked above it -- inherited from the button rule, and not
     reset by `font: inherit`. */
  text-indent: 0;
  cursor: pointer;
}


/* ==========================================================================
   HOME PANEL
   ==========================================================================
   This device's own home screen, docked at phone width on the right of a
   desktop window and staying there while the window is used for something
   else. The toggle is in the topbar cluster; static/home-panel.js is the
   window half, static/home-panel-embed.js the frame half, and
   templates/embed_base.html the shell the frame loads.

   It holds an <iframe>, and every reason is a rule in this very file:
   .home-drawer below is `position: fixed; inset: 0`, .side-drawer likewise,
   dialog.modal is centred by the browser in its own top layer, and
   @media (min-width: 680px) hands a wide window the *desktop* mosaic. All
   four resolve against the top-level viewport, so inside a 390px <div> the
   pull-up sheet would black out the whole desktop and the grid would come out
   at 96px rows. A frame is its own viewport. Every one of those is then
   correct inside the panel with nothing changed and no second copy of
   anything -- which is also why the panel costs this file one new section
   rather than a parallel set of panel-scoped variants. */

:root {
  /* Zero, and defined out here rather than only inside the media query
     below, so it resolves everywhere -- most importantly *inside the panel*,
     which is served this same stylesheet. A custom property is per-document,
     so the frame reads 0px and every offset further down is inert in there
     without a single guard or a second rule. */
  --home-panel-w: 0px;
  /* Whether there is room to dock one at all. Read by home-panel.js through
     getComputedStyle rather than restated over there as a matchMedia(),
     because the breakpoint needs exactly one owner: two copies would
     disagree the first time either is tuned, and the symptom is a button
     that toggles a panel with no width. */
  --home-panel-room: 0;
}

/* 390px, and it is derived rather than chosen. It has to sit below *both* of
   this stylesheet's width breakpoints so the frame gets the phone home
   screen -- 66px mosaic rows, the pull-up sheet, the layout this whole design
   was drawn against -- which is the entire point of the exercise; it is also
   the logical width of the phones it was drawn on. And it sets the threshold
   below: <main> is capped at 860px and 700px is this file's own "this is a
   phone now" line, so 700 + 390 is the window width under which docking would
   cost the main window more than the panel is worth. */
.home-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--home-panel-w);
  /* The ladder, extended: tile menu 10 -> home tabs 20 -> HOME PANEL 90 ->
     player bar 100 -> drawers 110 -> music sheet 200 -> toast 300 ->
     fullscreen 1000. Below everything rather than above, because the
     overlays that would otherwise cover it are moved *beside* it instead
     (see the offsets below) -- so nothing has to win a fight -- and the ones
     that are deliberately not moved are meant to cover it. */
  z-index: 90;
  background: var(--bg);
  /* A seam, not a drop shadow. This app draws a separation as a one-step
     surface change -- see .topbar's border-bottom and .music-player-bar's
     border-top -- and the only box-shadows in this file belong to things
     that genuinely float above the page. A docked column does not float; it
     is a second edge of the window. */
  border-left: 1px solid var(--border);
  /* Centres the frame when it is shorter than the dock. */
  align-items: center;
  justify-content: center;
}
/* Required, not defensive: an author `display` rule beats the UA's
   `[hidden] { display: none }` at any specificity, which is the trap
   .home-drawer[hidden] and .music-player-bar already record. Nothing toggles
   `hidden` on this today -- the state is an attribute on <html> -- and that
   is exactly why the line is here, so the next person to reach for `hidden`
   does not find it silently doing nothing. */
.home-panel[hidden] { display: none; }

.home-panel iframe {
  width: 100%;
  /* A phone, not a strip. 844px is the logical height that goes with the
     390px above, and the default four-row grid comes to about 820 of it --
     .mosaic 605, plus the head, the tabs, the grip and <main>'s own padding
     -- so an owner who has not rearranged anything sees the whole screen,
     grip included, without scrolling. Eight rows (home_layout.MAX_ROWS)
     scrolls, which is what a real phone does with a full home screen.

     min(), because a fixed 844 on a laptop would be worse than useless: it
     would leave dead space above and below *and* scroll internally at the
     same time. Below about 880px of window the panel simply fills the
     height instead. */
  height: min(844px, 100%);
  border: 0;
  display: block;
}

/* Only drawn when the frame failed to report in -- an expired session or an
   offline device, both of which are answered by the intersection rather than
   by this device and so arrive carrying its own `frame-ancestors 'none'`.
   The browser refuses those silently, so without this the panel is a blank
   rectangle. See static/home-panel.js. */
.home-panel-stalled { display: none; padding: 1.25rem; text-align: center; }
.home-panel--stalled .home-panel-stalled { display: block; }
.home-panel--stalled iframe { display: none; }

/* The dock itself. On <body>, which moves the topbar and <main> together in
   one declaration, because .topbar is in normal flow with an explicit height
   (see it above) rather than fixed. Nothing is ever hidden behind the panel;
   the page is narrower instead, which is the difference between a dock and
   an overlay.

   No transition. Animating this reflows the entire page on every frame, on a
   device where that is not free -- and the panel is not a thing that slides
   in, it is a thing that is there or is not. */
body { padding-right: var(--home-panel-w); }

/* The overlays that have to coexist with the dock, moved beside it. Each is
   `position: fixed`, so none of them sees <body>'s padding.

   Inside the panel these same rules resolve --home-panel-w to the 0px at the
   top of this section and are inert, which is why they need no guard. */
.music-player-bar,
.music-sheet,
.side-drawer,
.home-drawer { right: var(--home-panel-w); }
/* The toast is centred rather than edge-anchored, so it takes a shifted
   centre instead of an offset -- it has to read as centred over the content
   it is reporting on, not over the window. Note the panel *borrows* this
   toast (see home-panel-embed.js), so something raised in there surfaces
   here, which is right: it is reporting on what the whole browser just did. */
.app-toast { left: calc(50% - var(--home-panel-w) / 2); }

/* Deliberately NOT offset, and this is a decision rather than an oversight:
   #term-wrap.fullscreen, body.term-fs-lock, #trackpad-page.is-fullscreen and
   dialog.modal. Fullscreen is an explicit "this takes the window" request and
   covering the panel is the correct reading of it -- an offset fullscreen is
   not full. A native <dialog> is exclusive by definition, and its ::backdrop
   cannot be inset without looking like a mistake. The panel is untouched
   underneath and is still there when either one closes. A test pins this. */

/* The handle. It sits on the window's right edge, and it rides the dock:
   `right: var(--home-panel-w)` puts it against the screen edge when the
   panel is closed and against the panel's own edge when it is open, with no
   second rule and nothing to keep in sync. That is also what makes it read
   as attached to the panel rather than as a floating button -- it is the
   edge of the thing it opens.

   Painted in the deep accent with a white mark, which is this app's one
   white-on-colour treatment (see --accent-deep). Everything else here that
   carries the device colour is either a thin indicator or takes --on-accent,
   which is nearly black; a handle wants to be found without being read, so
   it takes the topbar's surface instead.

   Not an .icon-btn: those are compact controls that sit *in* a row or a
   toolbar and borrow its ground. This is chrome attached to the viewport,
   and it is the only control in the app whose whole job is to be visible
   from the corner of your eye. */
.home-panel-handle {
  position: fixed;
  right: var(--home-panel-w);
  /* Just under the topbar. env() is what makes the same expression right in
     both chromes: it resolves to 0px in a browser, and to the notch inset in
     the installed app -- which is exactly what the topbar's own height does
     (see html[data-display-mode="standalone"] .topbar), so the handle tracks
     the bar rather than guessing at it.

     The bar itself scrolls away, being in normal flow, and this does not --
     that is the point. It is chrome for a panel that outlives the page. */
  top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 0.75rem);
  /* Above the panel (90) so it is never covered by the edge it sits on, and
     below the player bar (100) and every modal layer -- a handle is not
     something to reach past a dialog for. */
  z-index: 95;
  /* Shown at every width, unlike the panel itself. Below the breakpoint
     there is nowhere to dock a column and the handle is then exactly what it
     says in the markup: a link to the home screen. That was the decision
     when this was a topbar control and it survives the move -- hiding it
     here would silently drop the phone behaviour rather than simplify it. */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 3.9rem;
  /* Rounded on the outer corners only when closed: the bar reads as a tab
     growing out of the screen edge rather than a free-floating pill. When
     the panel is open it is between two surfaces, so it rounds on both. */
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--accent-deep);
  color: #fff;
  text-decoration: none;
  box-shadow: -1px 0 6px rgb(0 0 0 / 0.35);
}
html[data-home-panel="on"] .home-panel-handle {
  border-radius: var(--radius);
  box-shadow: 0 0 6px rgb(0 0 0 / 0.35);
}
/* The mark, and the only thing it has to say is which way the panel is about
   to move. Closed, it points left: pull this out. Open, it points right:
   push it back. Same chevron the drawers use, so the app has one arrow. */
.home-panel-handle .chev {
  color: #fff;
  font-size: 1.25rem;
  transform: rotate(180deg);
}
html[data-home-panel="on"] .home-panel-handle .chev { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .home-panel-handle:hover { filter: brightness(1.15); }
}

/* Not on the home screen itself, where the panel would be offering the page
   you are already looking at.

   Driven by a marker base.html renders *inside* #page-content (see
   #is-home-screen there), not by a condition on the handle: a boosted
   navigation swaps only that element's innerHTML, so a server-side guard on
   the handle -- which lives outside it -- would be correct on first load and
   stale after every navigation. :has() re-runs on every swap on its own, and
   leaves the handle a stable element with its listener intact.

   Only while it is closed, though -- see the rule under this one. */
body:has(#is-home-screen) .home-panel-handle { display: none; }

/* ...but an *open* panel keeps its handle here, because that is a different
   control. Hidden above, it was offering to open a panel showing the page
   you are already on; here it is the way to shut one, and the only visible
   one -- otherwise closing it on this screen requires knowing that `p` is
   bound, and a thing you can see should never need a keystroke to undo.
   The mark points the right way on its own: open means it points back at the
   panel.

   Inside the media query, and that is the load-bearing part rather than
   tidiness. data-home-panel is remembered per browser, so it can perfectly
   well read "on" at a width with nowhere to dock a panel -- the panel itself
   is hidden by the same query. Outside it, this rule would put a close
   handle on a phone for something that is not on screen.

   It wins over the rule above on specificity, not on order: the attribute
   selector is the difference. */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  html[data-home-panel="on"] body:has(#is-home-screen) .home-panel-handle {
    display: flex;
  }
}

/* The one condition. Width for the room, and the pointer test because a
   tablet reports plenty of width and has nowhere to put a second screen --
   the same capability query every hover rule in this file sits behind. */
@media (min-width: 1100px) and (hover: hover) and (pointer: fine) {
  :root { --home-panel-room: 1; }
  html[data-home-panel="on"] { --home-panel-w: 390px; }
  html[data-home-panel="on"] .home-panel { display: flex; }
}


/* ==========================================================================
   HOME SCREEN ORGANISER  (/home-screen)
   ==========================================================================
   The grid editor is a small, honest picture of the grid it edits: rows in
   order, cells at their real proportions, one tap to change what is in one.
   It is deliberately not a preview of the *tiles* -- no live rings, no
   status lines -- because what is being decided here is arrangement, and a
   cell showing "42% disk" invites reading the number instead of the layout.

   See modules/home_layout.py for why the model is rows at all. */

.hs-device { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.6rem; }
.hs-error { color: var(--bad-ink); }

.hs-rows { display: flex; flex-direction: column; gap: 0.9rem; margin: 0.9rem 0 1rem; }

.hs-row { display: flex; flex-direction: column; gap: 0.4rem; }
.hs-row-bar { display: flex; align-items: center; gap: 0.6rem; }
.hs-row-n {
  font-family: var(--font-label);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  color: var(--bone-faint);
  min-width: 1.2rem;
}
/* Pushes Remove to the far edge, away from the shape switch -- the two do
   very different amounts of damage and should not sit as a pair. */
.hs-row-del { margin-left: auto; }
.hs-row-del[disabled] { opacity: 0.35; cursor: default; }

/* Two equal columns or one across, matching what the row will actually be.
   The real grid's cells are square-ish; these are shorter, because eight
   rows of true-height tiles would not fit on the screen you are arranging
   them for -- the proportion that matters here is one cell versus two. */
.hs-row-cells { display: grid; gap: 11px; }
.hs-row[data-shape="square"] .hs-row-cells { grid-template-columns: 1fr 1fr; }
.hs-row[data-shape="rect"] .hs-row-cells { grid-template-columns: 1fr; }

.hs-cell {
  min-height: 62px;
  padding: 0.6rem 0.7rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--bone);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
/* A dashed outline rather than a filled card: an empty cell is holding
   space on purpose, and it has to read as "nothing here yet" rather than as
   a tile whose name failed to load. */
.hs-cell--empty {
  background: none;
  border: 1px dashed var(--border);
  color: var(--bone-faint);
}
/* The live pair marked by the accent rather than a word -- they are the same
   app name as their card counterpart, and the only difference worth showing
   in a cell this size is that this one is the moving kind. */
.hs-cell--live { color: var(--accent); }

.hs-actions { display: flex; gap: 0.6rem; }

/* The picker's two tabs. Same treatment as the home screen's own Home/Devices
   tabs, so a tab strip reads the same way in both places. */
.hs-tabs { display: flex; gap: 1.1rem; margin-bottom: 0.2rem; }
.hs-pane[hidden] { display: none; }

/* The row-shape switch reuses .view-switch, whose thumb only knows about the
   Files toolbar's own two values. This is the same mechanic with this
   screen's vocabulary. */
.view-switch[data-view="rect"] .view-switch-thumb { transform: translateX(44px); }

/* An empty cell on the home screen itself draws nothing at all -- unlike the
   organiser's dashed placeholder, which is a control. It still occupies its
   grid space, which is the whole reason it is rendered: without it every
   tile after it slides up a row and the arrangement stops being the one that
   was configured. */
.mosaic .tile--empty {
  background: none;
  pointer-events: none;
}

/* ==========================================================================
   TOUCH TEXT-FIELD FLOOR
   ==========================================================================
   Last in the file on purpose, and this position is load-bearing. Every
   selector below is a single class or element, so anything later in the
   sheet setting a smaller font-size on the same field would win on source
   order alone -- .field--file already did, which is how this got written
   here rather than next to .field.

   16px is not a design choice, it is a hard floor. WebKit zooms the whole
   page in when a focused text field is smaller than that, and it does not
   reliably zoom back out when the field is blurred, so tapping any field in
   this app left it at a scale it never returned from. That is what makes
   the frame feel unstable afterwards rather than at the time: `position:
   fixed` is anchored to the *layout* viewport, so on a zoomed page both
   sheets, the player bar and the dialogs are laid out against a rectangle
   that no longer matches what is on screen -- they come up cropped, or off
   to one side, or apparently not at all.

   Scoped to coarse pointers, so the desktop keeps the smaller type this was
   drawn with. On a phone 16px is the platform norm anyway, and it is the
   letter-spacing rather than the size that carries the look here.

   Deliberately *not* fixed by putting `maximum-scale=1, user-scalable=no`
   on the viewport meta, which is the other well-known answer to this and is
   the wrong one: it stops the page auto-zooming by taking pinch-zoom away
   from everybody, including whoever needed it. */
@media (pointer: coarse) {
  .field,
  .field--file,
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  textarea,
  select {
    font-size: 16px;
  }
}

/* ---- playlists (/music/playlists) --------------------------------------
   Appended as one block rather than filed next to the .music-row rules
   above so this whole feature is one contiguous, revertable hunk. Only new
   selectors: the playlist pages otherwise dress themselves entirely in
   .music-list / .music-row / .btn / .icon-btn-solid, which already have the
   right shape. */

/* The mark on a playlist row in the index. Sized here because .music-row
   has never had an icon slot -- library rows carry album art (.music-row-art)
   or nothing at all. Same 1.15rem as .row-glyph, so a playlist row and an
   account row read as the same weight of mark. */
.music-row-glyph { display: flex; align-items: center; justify-content: center; color: var(--muted); line-height: 0; flex: none; width: 1.6rem; }
.music-row-glyph svg { width: 1.15rem; height: 1.15rem; }

.playlist-actions .btn svg { width: 1.05rem; height: 1.05rem; }

/* Three controls on a phone-width row, so they are narrower than the 44px
   .icon-btn-solid square -- but only narrower. The height stays 44px,
   because that is the dimension a thumb misses in, and these sit in a list
   where the row above and below are both live targets. */
/* The first row's "up" and the last row's "down". Left in the DOM and
   disabled rather than omitted: dropping them would shift the remaining
   controls sideways on exactly two rows, so the buttons on a list would
   never line up in a column. */
/* One drawn chevron serves both directions -- _icons.html has no "up", and
   rotating the down one is honest here in a way a Unicode arrow would not
   be (the vendored faces don't carry those, see the glyph-drop notes above). */
/* ---- Music search ------------------------------------------------------

   The library's search field (music.html), the same field repeated on the
   results page, and the headings that separate songs from albums from
   artists there (music_search.html). */

.music-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* The field takes the row and the button takes what it needs: on a phone
   this is most of the screen width, and the query is the part worth seeing
   in full. min-width: 0 because a flex item's automatic minimum size is its
   content, which stops an input from ever shrinking below its `size`
   attribute's width and pushes the button off the edge on a narrow screen. */
/* 44px tall, not .field's 46, so the field's edges meet the search
   square's -- the same 44px as Playlists and Settings above it. */
.music-search-input { flex: 1; min-width: 0; min-height: 44px; height: 44px; }

/* Clip WebKit's own search decorations. The field already sits in .field's
   shape, and the UA's inset magnifier/cancel widgets land on top of it in a
   second, unrelated style -- two magnifying glasses, one of them ours. The
   keyboard's own clear affordance is unaffected; this is only the painted
   in-field controls. */
.music-search-input::-webkit-search-decoration,
.music-search-input::-webkit-search-results-button { -webkit-appearance: none; }

/* Visually hidden, still read aloud and still the input's label -- the
   glyph beside the field says "search" to everyone who can see it, and
   nothing at all to anyone who can't. Not `display: none` or
   `visibility: hidden`, either of which would take it out of the
   accessibility tree too, which is the whole point of keeping it. */
.music-search-label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Tighter than a bare h2's 2rem, which was drawn for a page of prose
   sections. These label three adjacent lists on one results page, and at
   2rem the gap reads as "the page ended" rather than "next category". */
.music-search-heading { margin-top: 1.25rem; margin-bottom: 0.35rem; }

/* Bulk transfer progress (Phase 4.6).
 *
 * Inside the upload modal, appended by transfer.js once a file is big
 * enough to take the object-store path. Two halves to the bar because the
 * person is waiting through two different things -- encrypting here, then
 * the device pulling it down -- and a bar that sat still for the first half
 * and then raced would read as a stall followed by a lie. */
.transfer-progress { display: grid; gap: 0.4rem; margin-top: 0.75rem; }
.transfer-progress-label { color: var(--bone-dim); font-size: 0.9rem; }
.transfer-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.transfer-bar-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  /* Eased because progress arrives in poll-sized jumps, not smoothly, and
     an unanimated bar makes a working transfer look like a stuttering one. */
  transition: width 220ms ease-out;
}

/* A failure the person needs to read, in the one place they are looking.
   .hint is muted by definition; this is the exception that is not.
   --bad-ink, not --bad: this writes rather than paints. */
.hint--error { color: var(--bad-ink); }

/* "Copied", said by a glyph-only Copy button (copy-button.js): a small
   bubble above the button, since the button has no label to swap. */
.copy-btn { position: relative; }
.copy-btn[data-said]::after {
  content: attr(data-said);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--ground);
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
}

/* Glyphs that lead a label inside a text button ("+ New session", Shuffle)
   sit at the label's size, on its centre line. */
.btn > svg { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.15em; }
/* The fullscreen toolbars' collapse toggles and the "leaves this panel" row
   end: drawings now, at the size the typed characters had. */
.term-fs-toolbar-toggle-glyph svg, .trackpad-toolbar-toggle-glyph svg { width: 1em; height: 1em; display: block; }
.row-chevron--out svg { width: 1.1em; height: 1.1em; display: block; }


/* ==========================================================================
   Welcome tour (static/tour.js)

   Two shapes. On the home screen, a card that walks between the parts of
   the page with a cut-out lighting up the part it is talking about. On every
   other screen, a sheet from the bottom the first time that screen opens.
   Both sit above everything, the home panel and the player included, since
   the tour is about those too.
   ========================================================================== */
.tour { position: fixed; inset: 0; z-index: 1100; }
/* tour.js hides Skip and the switch with the attribute, and .btn and
   .switch-row both set a display that would otherwise win over it. */
.tour [hidden] { display: none !important; }
/* Swallows taps on the page while the walk-through is up, so the cut-out
   is a picture of the target and not a way to set it off mid-sentence. */
.tour-block { position: absolute; inset: 0; }
.tour-spot {
  position: fixed;
  border-radius: calc(var(--radius) + 4px);
  outline: 2px solid var(--accent);
  /* The dimming is the cut-out's own shadow, so the lit part is the one
     place on screen it does not reach. */
  box-shadow: 0 0 0 200vmax rgb(10 10 8 / 0.72);
  pointer-events: none;
  transition: top 240ms ease, left 240ms ease, width 240ms ease, height 240ms ease;
}
.tour--centered .tour-spot {
  top: 50%; left: 50%; width: 0; height: 0;
  outline: 0;
}
.tour-coach {
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  max-width: 28rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
}
.tour--centered .tour-coach { top: 50%; bottom: auto; transform: translateY(-50%); }
.tour-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 400;
  text-transform: none;
}
.tour-body { margin: 0; color: var(--bone-dim); line-height: 1.45; }
.tour-foot { display: flex; align-items: center; gap: 0.5rem; }
.tour-foot .btn { min-height: 44px; }
.tour-dots { display: flex; gap: 6px; margin-right: auto; }
.tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--surface-3); }
.tour-dots i.is-on { background: var(--accent); }
.tour-switch .switch-row-label { font-weight: 400; color: var(--bone-dim); }
/* .switch draws its track in --surface-2, which is close enough to the
   card's own fill that the off state vanished into it. */
.tour-coach .switch, .tour-sheet .switch { background: var(--ground); }
.tour-coach .tour-switch[aria-checked="true"] .switch,
.tour-sheet .tour-switch[aria-checked="true"] .switch { background: var(--accent); }

.tour-scrim {
  position: absolute;
  inset: 0;
  background: rgb(10 10 8 / 0.55);
  opacity: 0;
  transition: opacity 200ms ease;
}
.tour-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 34rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem max(16px, env(safe-area-inset-right, 0px)) calc(1.25rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  border-radius: calc(var(--radius) + 6px) calc(var(--radius) + 6px) 0 0;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform 240ms ease;
}
.tour-sheet .kit-section-label { color: var(--accent); }
.tour--sheet.is-open .tour-scrim { opacity: 1; }
.tour--sheet.is-open .tour-sheet { transform: none; }
@media (prefers-reduced-motion: reduce) {
  .tour-spot, .tour-scrim, .tour-sheet { transition: none; }
}
