/* Eira — slim app layer over Blades CSS (the maintained successor of Pico CSS; it keeps Pico's
 * markup, classes and --pico-* variables, so "Pico" below means the Blades base layer).
 *
 * Pico provides the base (typography, light/dark, forms, articles, nav). This file only:
 *   1. maps Pico and app-specific states onto the central Eira Glacier Blue theme;
 *   2. adds app-specific bits Pico has no primitive for — status dots, badges, the card grid;
 *   3. nudges sizing up for legibility / touch (hard-of-hearing, possibly older audience).
 * Keep it small: prefer Pico's semantic defaults over new classes. */

/* Theme colours live exclusively in static/theme.css.
 * This file contains component/layout rules only. */

/* Slightly larger base type + comfortable touch targets for legibility/a11y.
 * Keep the app on a deliberately small set of type/control roles so visually equal
 * elements stay equal across Routing, Adapters, WiFi, and Hardware. */
:root {
  --pico-font-size: 106.25%; /* ~17px base */

  --ui-font-size-standard: 1rem;
  --ui-font-size-secondary: 0.9rem;
  --ui-font-size-control: 0.85rem;
  --ui-font-size-meta: 0.78rem;
  --ui-font-size-card-title: 1.05rem;

  --ui-control-height: 2.75rem;
  --ui-control-height-compact: 2.6rem; /* ~44px at the Eira base size */
  --ui-device-field-height: 3rem;
  --ui-control-radius: var(--pico-border-radius);

  --ui-space-xs: 0.35rem;
  --ui-space-sm: 0.5rem;
  --ui-space-md: 0.75rem;
  --ui-space-lg: 1rem;
}

body {
  font-size: var(--ui-font-size-standard);
}

/* Comfortable touch target for the interactive controls — but NOT the small toggles
 * (checkbox / radio / switch) or the range track, which Pico sizes itself; forcing a tall
 * min-height on those distorts them. */
button,
[role="button"],
select,
summary,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  min-height: var(--ui-control-height); /* ~44px touch target */
}

/* High-visibility keyboard focus across the application. */
:focus-visible {
  outline: 4px solid var(--eira-focus);
  outline-offset: 2px;
}

/* Page landmarks keep Pico's vertical rhythm. pico.css shipped this rule; blades.css leaves it to
 * the page. */
body > header,
body > main,
body > footer {
  padding-block: var(--pico-block-spacing-vertical);
}

/* ---- Top nav / brand ----------------------------------------------------- */
header.container > nav.app-nav {
  --pico-nav-element-spacing-vertical: 0.6rem;
  align-items: center;
}
header.container > nav.app-nav > ul:first-child {
  flex: 0 0 auto;
}
header.container > nav.app-nav > ul:last-child {
  min-width: 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}
/* Present the logo as a rounded app tile. */
.brand img {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  min-width: 4.5rem;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 24%;
  box-shadow: 0 1px 3px var(--eira-shadow);
  flex: 0 0 auto;
}
nav li > a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--eira-nav-accent);
}
nav li > a:is(:hover, :focus) {
  color: var(--eira-nav-accent-hover);
}
nav a[aria-current="page"] {
  color: var(--eira-nav-accent);
  font-weight: 600;
}

/* The header has one action only: the application menu. Keep Pico's native details/dropdown
   behaviour and only turn the summary into a clear hamburger trigger aligned to the right. */
.app-menu {
  position: relative;
}
.app-menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--eira-icon-accent);
}
.app-menu > summary::after {
  display: none;
}
.app-menu > summary:not([role]) {
  border-color: transparent;
  background: transparent;
}
.app-menu > summary:hover,
.app-menu[open] > summary {
  background: var(--pico-secondary-background);
  color: var(--eira-nav-accent-hover);
}
details.dropdown.app-menu > summary + ul {
  right: 0;
  left: auto;
  width: max-content;
  min-width: 15rem;
  max-width: calc(100vw - 1rem);
  transform-origin: top right;
}
/* Colour the icon itself: Pico's `details.dropdown > summary:not([role])` outranks the summary
   rules above and would paint it in the placeholder colour. */
.app-menu > summary svg {
  width: 1.7rem;
  height: 1.7rem;
  color: var(--eira-icon-accent);
}
.app-menu > summary:hover svg,
.app-menu[open] > summary svg {
  color: var(--eira-nav-accent-hover);
}
.app-menu > ul a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--eira-nav-accent) !important;
  background: transparent;
  font-weight: 400;
}
.app-menu > ul a svg {
  color: inherit;
}
.app-menu > ul a[aria-current="page"] {
  color: var(--eira-nav-accent) !important;
  background: var(--pico-secondary-background);
  font-weight: 600;
}
.app-menu > ul a:not([aria-current="page"]):is(:hover, :focus) {
  color: var(--pico-color) !important;
  background: transparent;
  font-weight: 400;
}
.app-menu > ul a[aria-current="page"]:is(:hover, :focus) {
  color: var(--eira-nav-accent) !important;
  background: var(--pico-secondary-background);
  font-weight: 600;
}

@media (max-width: 40rem) {
  .brand img {
    width: 3.75rem;
    height: 3.75rem;
    min-width: 3.75rem;
  }
}

/* ---- Icons --------------------------------------------------------------- */
/* Monochromatic, inherit the surrounding text/brand color, scale with font-size. */
.nav-icon {
  width: 1.2em;
  height: 1.2em;
  flex: none;
}
/* Heading marks (page <h1> and section <h2>): a calm Glacier Blue accent before the title. */
.heading-icon {
  width: 1em;
  height: 1em;
  flex: none;
  margin-right: 0.55rem;
  color: var(--eira-icon-accent);
  vertical-align: -0.12em;
}
/* Routing card headers: in/out arrow badge sits left of the card name. */
.io-head {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.io-badge {
  display: inline-flex;
  align-items: center;
  color: var(--eira-icon-accent);
}
.io-arrow {
  /* Height-locked; width follows the per-kind viewBox so the wider (landscape)
     output glyphs keep the same arc size as the square input glyph. */
  height: 1.6em;
  width: auto;
  flex: none;
}

/* ---- Page headings ------------------------------------------------------- */
/* Pico flushes the hgroup title and subtitle together and leaves only ~1rem below the group.
   Give the subtitle a little air under the title, and a clearer gap before the page body
   (the Adapters sections, the routing/WiFi cards). */
hgroup > :first-child:not(:last-child) {
  margin-bottom: var(--ui-space-sm);
}
hgroup {
  margin-bottom: 2.25rem;
}

/* ---- Card grids ---------------------------------------------------------- */
.section-title {
  margin: 1.5rem 0 0.75rem;
}
.card-grid {
  display: grid;
  gap: var(--ui-space-lg);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .card-grid {
    /* Min in rem (not px) so it scales with the rem-sized segmented mode bar as Pico bumps the root
       font on wider screens — the card stays a touch wider than the bar, so the pills never wrap. */
    grid-template-columns: repeat(auto-fit, minmax(24rem, 1fr));
  }
}
.card-grid > article {
  margin: 0; /* grid gap handles spacing */
  min-width: 0; /* allow dense adapter content to shrink inside the grid track */
}
article > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-sm);
  margin-bottom: var(--ui-space-md);
}
article > header .adapter-name {
  font-weight: 600;
  font-size: var(--ui-font-size-card-title);
}

/* ---- Status dot + short label ------------------------------------------- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--ui-font-size-control);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--dot, var(--pico-muted-border-color));
  box-shadow: 0 0 0 0.18rem var(--ring, var(--eira-neutral-ring));
}
.status-connected,
.status-streaming {
  --dot: var(--eira-success);
  --ring: var(--eira-success-ring);
}
.status-busy,
.status-connecting {
  --dot: var(--eira-warning);
  --ring: var(--eira-warning-ring);
}
.status-idle {
  --dot: var(--eira-neutral);
  --ring: var(--eira-neutral-ring);
}
.status-error {
  --dot: var(--eira-error);
  --ring: var(--eira-error-ring);
}

/* ---- Badges (capability, wired/wireless, maturity) ----------------------- */
.badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 1rem;
  font-size: var(--ui-font-size-meta);
  font-weight: 600;
  line-height: 1.5;
  background: var(--pico-secondary-background);
  color: var(--pico-secondary-inverse);
}
.badge-soft {
  background: var(--eira-badge-soft-bg);
  color: var(--eira-badge-soft-text);
}
/* The adapter currently routed as the live input — filled Glacier Blue so it reads as "the one". */
.badge-active-input {
  background: var(--eira-control-accent);
  color: var(--eira-control-accent-text);
  margin-left: 0.4rem;
}
/* Mode controls (Bluetooth adapter card): two segmented bars (direction + transport) laid out by a
   flex row that wraps. Side by side when the card is wide enough; stacked when it is not. */
.mode-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.6rem;
}
/* Each bar is a self-contained segmented control: a radio group rendered as a pill strip. It never
   breaks internally (nowrap), so when space runs out the whole bar wraps to the next row rather than
   splitting mid-pill. Pills size to their label, so wide labels like "LE Audio" never clip. The
   hidden <input> sits right before its <span>, so the adjacent-sibling combinator styles the
   selected/disabled/focus states — no :has() needed. */
.segmented {
  display: flex;
  flex-wrap: nowrap;
  /* Pico sets `fieldset { width: 100% }`; override so each bar is only as wide as its pills, lets
     the two sit side by side, and stops the pills stretching to fill the card. */
  flex: 0 0 auto;
  /* fit-content, not auto: as a block-level flex box the bar would otherwise stretch to its
     container (e.g. when a longer note sits below it) and the last pill looks too wide. */
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--pico-form-element-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
}
.segmented label {
  margin: 0;
  display: flex;
}
/* Visually hide the native radio; its sibling <span> is the visible button. */
.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.segmented span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ui-control-height-compact);
  padding: 0.3rem 0.7rem;
  font-size: var(--ui-font-size-control);
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  border-left: 1px solid var(--pico-form-element-border-color);
  transition: background 0.12s ease;
}
.segmented label:first-of-type span {
  border-left: 0;
}
.segmented input:checked + span {
  background: var(--eira-device-field-bg);
  color: var(--pico-color);
  box-shadow: inset 0 0 0 1px var(--eira-device-field-border);
}
.segmented input:not(:checked):not(:disabled) + span:hover {
  background: var(--pico-secondary-background);
}
/* Off direction makes transport inapplicable: every transport radio is disabled, dimming each. */
.segmented input:disabled + span {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Keyboard focus ring, since the input itself is invisible. */
.segmented input:focus-visible + span {
  outline: 4px solid var(--eira-focus);
  outline-offset: -4px;
}
/* Pico gives every fieldset a 1rem bottom margin; inside the flex row it cannot collapse and
   becomes dead space trapped at the bottom of .mode-controls. Compensating on the next element
   (the old -1rem on .discoverable-toggle) broke whenever that element was display:none'd away
   (ASHA/output-only cards hide the toggle), pushing the error/note banners ~1rem lower there.
   Zero it at the source so the spacing below the bars is the same on every card. */
.mode-controls fieldset {
  margin-bottom: 0;
}

/* The switch is a sub-option of the input mode above it (the identity MAC/USB lines now live up
   in the header subtitle, not between); the gap above is the .mode-controls margin. Wider gap
   below to the device list. */
.discoverable-toggle {
  margin: 0 0 1.6rem;
}

/* The transport choice only means something while a direction is on, and clicking a radio on a
   deactivated card just re-renders it back (irritating no-op) — so hide the bar whenever both
   direction switches are off. CSS-hidden only, never removed: the checked radio must keep
   submitting with the /mode form so re-activating a direction restores the remembered transport
   instead of the A2DP server default. Driven by live checkbox state like .discoverable-toggle
   above, so the bar appears the instant a direction is switched on. */
article:not(:has(.direction-toggles input:checked)) .mode-controls .segmented {
  display: none;
}

.maturity {
  font-size: var(--ui-font-size-control);
  color: var(--pico-muted-color);
  margin: 0.35rem 0 0;
}
.maturity-experimental {
  color: var(--eira-warning);
}
.maturity-planned {
  color: var(--eira-error);
}
/* Direction toggles (both adapter cards): independent on/off switches (input and/or output) — the
   multi-select counterpart to the single-select transport bar beside them on Bluetooth cards. Laid
   out as an inline row that wraps; keeps Pico's fieldset bottom margin so it lines up with the
   segmented bar and spaces the audio card's badges below. */
.direction-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  flex: 0 0 auto;
  width: auto;
}
.direction-toggles label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--ui-font-size-control);
  white-space: nowrap;
}
.direction-toggles input[type="checkbox"] {
  margin: 0;
}
/* ASHA is output-only: the disabled Input toggle (and its label) dims to read as not-applicable. */
.direction-toggles label:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}
/* Line/Mic capture-source picker on a dual-input audio card — an inline radio row with a small inline
   legend, sitting just under the direction toggles (same compact type scale). */
.input-source-choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  border: 0;
  padding: 0;
}
.input-source-choice .input-source-label {
  font-size: var(--ui-font-size-control);
  font-weight: bold;
}
.input-source-choice label {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: var(--ui-font-size-control);
  white-space: nowrap;
}
.input-source-choice input[type="radio"] {
  margin: 0;
}
/* Unobtrusive one-line identity subtitle directly under the adapter name (MAC · connection/USB). The
   header carries a 0.75rem bottom margin, so pull it up to sit tight under the name, then leave a
   small gap before the direction controls below. */
.adapter-meta {
  font-size: var(--ui-font-size-meta);
  color: var(--pico-muted-color);
  margin: -0.55rem 0 0.65rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
/* Action-failure banner on an adapter card (e.g. a remove that BlueZ rejected). */
.card-error {
  font-size: var(--ui-font-size-control);
  color: var(--eira-error);
  background: var(--eira-error-bg);
  border: 1px solid var(--eira-error-border);
  border-radius: var(--ui-control-radius);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
}

/* Informational banner on an adapter card (guidance, not a fault — e.g. "assign this hearing
   aid to an ear on the Routing page"). Muted, so it reads as a hint next to the red .card-error. */
.card-note {
  font-size: var(--ui-font-size-control);
  color: var(--pico-muted-color);
  border: 1px solid var(--pico-muted-border-color, var(--pico-muted-color));
  border-radius: var(--ui-control-radius);
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
}

/* Card-level transport-honesty banner (the connected device is not using the selected transport,
   e.g. LE Audio selected but the connection is classic A2DP). Amber like .adapter-warning — an
   expectation warning, not an action failure; sits in the maturity hint's slot under the mode bar. */
.card-warning {
  font-size: var(--ui-font-size-control);
  color: var(--eira-warning-text);
  background: var(--eira-warning-bg);
  border: 1px solid var(--eira-warning-border);
  border-radius: var(--ui-control-radius);
  padding: 0.5rem 0.75rem;
  margin: 0.35rem 0 0;
}

/* Page-level advisory banner above the adapter sections (e.g. a sound card claimed by another
   login session). Amber, not the red .card-error, since it's a misconfiguration warning rather
   than an action failure. */
.adapter-warning {
  font-size: var(--ui-font-size-secondary);
  color: var(--eira-warning-text);
  background: var(--eira-warning-bg);
  border: 1px solid var(--eira-warning-border);
  border-radius: var(--ui-control-radius);
  padding: 0.6rem 0.85rem;
  margin: 0 0 1rem;
}

/* Inline pairing-failure hint under a scan row. A failed pair leaves the row in place (htmx skips
   the delete on 4xx); the Pair button toggles .pair-failed on the row to reveal this. Scoped to the
   scan list so the row can wrap the hint onto its own line without affecting the paired list. */
.scan-results .device-list li {
  flex-wrap: wrap;
}
.scan-error {
  display: none;
  flex-basis: 100%;
  font-size: var(--ui-font-size-control);
  color: var(--eira-error);
  margin-top: 0.15rem;
}
li.pair-failed .scan-error {
  display: block;
}

/* Full-width guidance line under a paired-device row (same wrap trick as .scan-error) — e.g. a
   hearing aid listed on an adapter whose transport is not ASHA, where classic Connect cannot
   reach it. Wrap is scoped via :has so rows without a hint keep the single-line layout. */
.device-list li:has(.row-hint) {
  flex-wrap: wrap;
}
.row-hint {
  flex-basis: 100%;
  font-size: var(--ui-font-size-control);
  color: var(--pico-muted-color);
  margin: 0;
}

/* ---- Device list --------------------------------------------------------- */
.device-list {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
}
.endpoint-group + .endpoint-group {
  margin-top: 1rem;
}
.endpoint-group-title {
  margin: 0 0 0.35rem;
  font-size: var(--ui-font-size-meta);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pico-muted-color);
}
.device-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  padding: 0.55rem 0;
  border-top: 1px solid var(--pico-muted-border-color);
}
.device-list li:first-child {
  border-top: 0;
}
.device-list .device-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.device-name-editable {
  overflow: visible;
}
.device-alias-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.device-alias-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: var(--ui-control-height-compact);
  height: var(--ui-control-height-compact);
  margin: 0;
  padding: 0.25rem 0.5rem;
  font-size: var(--ui-font-size-control);
}
/* Keep the actual device selectors/editors visually prominent on both core audio pages.
   Device names are the central Eira routing element, so they intentionally match the card-title
   type role. This selector is deliberately narrow: other form fields and boxes stay at their
   normal weight and size. */
.device-alias-input,
#audio_input,
#left_output,
#right_output {
  background-color: var(--eira-device-field-bg);
  border-color: var(--eira-device-field-border);
  min-height: var(--ui-device-field-height);
  height: var(--ui-device-field-height);
  padding-block: 0.5rem;
  font-size: var(--ui-font-size-card-title);
  font-weight: 600;
  line-height: 1.2;
}
/* Blades' input margin-bottom outranks .device-alias-input's margin and pushed the line's other
   content below the field's centre. */
.device-alias-line .device-alias-input {
  margin: 0;
}
/* The ear side ("(right)") is shown inside the name field's frame, after the name; the field keeps
   room for it so a long name ends in an ellipsis instead of running under it. */
.device-alias-line.has-side {
  position: relative;
}
.device-alias-line.has-side .device-alias-input {
  padding-inline-end: 4.75rem;
}
.device-side {
  position: absolute;
  inset-inline-end: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-control);
  white-space: nowrap;
}
.endpoint-radio {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  border: 0.18rem solid var(--eira-input-border);
  border-radius: 50%;
  background: var(--eira-input-bg);
  cursor: pointer;
}

.endpoint-radio:checked {
  background: var(--eira-control-accent);
  border-color: var(--eira-control-accent);
}
.audio-endpoint-list .device-alias-input {
  width: 100%;
}
.device-list .device-addr {
  display: block;
  font-size: var(--ui-font-size-meta);
  color: var(--pico-muted-color);
}
.device-list .row-actions {
  display: flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}
/* Paired Bluetooth devices always keep their two actions side by side. Scan-result rows are
   not .paired-device-list entries and keep their single Pair button unchanged. */
.device-list-wrap {
  min-width: 0;
  max-width: 100%;
}
.device-list-wrap .paired-device-list .row-actions {
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: var(--ui-space-xs);
}
.device-list .row-actions button {
  margin: 0;
  padding: 0.3rem 0.7rem;
  min-height: var(--ui-control-height-compact);
  font-size: var(--ui-font-size-control);
  width: auto;
}
/* Keep Connect / Disconnect / Remove compact and exactly aligned in the horizontal action row. */
.device-list-wrap .paired-device-list .row-actions button {
  box-sizing: border-box;
  flex: 0 1 9rem;
  width: 9rem;
  min-width: 0;
  padding: 0.25rem 0.4rem;
  min-height: var(--ui-control-height-compact);
  font-size: var(--ui-font-size-control);
  white-space: nowrap;
  overflow: hidden;
}
.device-list-wrap .paired-device-list .row-actions .btn-idle,
.device-list-wrap .paired-device-list .row-actions .btn-busy {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Adapter action hierarchy: Connect/Reconnect uses a softer Glacier Blue, while Disconnect is
   deliberately neutral. Remove remains the existing outline action. */
.device-list-wrap .paired-device-list .row-actions button:not(.secondary) {
  background: var(--eira-connect-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}
.device-list-wrap .paired-device-list .row-actions button:not(.secondary):is(:hover, :active, :focus) {
  background: var(--eira-connect-hover-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}
/* Neutral filled actions share one visual role across Adapters and Hardware. */
.device-list-wrap .paired-device-list .row-actions button.secondary:not(.outline),
.hw-actions button.secondary:not(.outline),
.hardware-toolbar button.secondary:not(.outline) {
  background: var(--eira-disconnect-bg);
  border-color: var(--eira-disconnect-border);
  color: var(--eira-disconnect-text);
}
.device-list-wrap .paired-device-list .row-actions button.secondary:not(.outline):is(:hover, :active, :focus),
.hw-actions button.secondary:not(.outline):is(:hover, :active, :focus),
.hardware-toolbar button.secondary:not(.outline):is(:hover, :active, :focus) {
  background: var(--eira-disconnect-hover-bg);
  border-color: var(--eira-disconnect-border);
  color: var(--eira-disconnect-text);
}

/* ON switches use the same accent as the highlighted device-field border instead of the harder
   primary blue. OFF keeps Pico's neutral switch colour. */
#adapter-cards input[type="checkbox"][role="switch"]:checked {
  background-color: var(--eira-control-accent);
  border-color: var(--eira-control-accent);
}

/* 1080 px is Eira's narrow reference viewport for the full control UI. At that width the Adapters
   page must fit the same viewport as Routing without horizontal scrolling or browser zooming. Keep
   all grid/flex children shrinkable; below the reference width cards may wrap, but must not force
   the page wider than the viewport. */
@media (max-width: 1080px) {
  #adapter-cards,
  #adapter-cards .card-grid,
  #adapter-cards .card-grid > article,
  #adapter-cards .device-list,
  #adapter-cards .device-list li,
  #adapter-cards .device-name,
  #adapter-cards .device-alias-line,
  #adapter-cards .audio-endpoint-details {
    min-width: 0;
    max-width: 100%;
  }

  #adapter-cards .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  }

  #adapter-cards .device-list li {
    gap: 0.45rem;
  }
}
/* ---- Compact adapter direction sections --------------------------------- */
/* Adapter cards show only their hardware name plus Input/Output rows by default. Adapter-wide
   properties and secondary controls appear only while at least one direction is expanded. */
.adapter-shared-properties,
.adapter-open-only {
  display: none;
}
article:has(.adapter-section-body:not([hidden])) .adapter-shared-properties {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--pico-muted-border-color);
  /* No bottom border: the first Input/Output section below draws its own top border, and two
     rules with a gap between them looked like a stray double line. */
}
article:has(.adapter-section-body:not([hidden])) .adapter-open-only {
  display: block;
}
.adapter-property {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}
.adapter-property-label,
.device-info-label {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-meta);
  font-weight: 600;
}
.adapter-property-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--ui-font-size-control);
}
.adapter-transport-form,
.adapter-section-mode-form {
  margin: 0;
}
.transport-lock-note {
  display: block;
  margin-top: 0.45rem;
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-meta);
}
.adapter-transport-form .segmented {
  margin: 0;
}
.adapter-section {
  margin: 0;
  border-top: 1px solid var(--pico-muted-border-color);
}
.adapter-section:last-of-type {
  border-bottom: 1px solid var(--pico-muted-border-color);
}
.adapter-section-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 2.75rem;
  align-items: center;
  gap: 0.65rem;
  min-height: 3rem;
}
.adapter-section-title {
  min-width: 0;
  font-weight: 600;
}
.adapter-section-title-toggle {
  width: auto;
  min-height: var(--ui-control-height-compact);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
}
.adapter-section-title-toggle:is(:hover, :active, :focus) {
  background: transparent;
  box-shadow: none;
  color: inherit;
}
.adapter-section-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--ui-control-height-compact);
  margin: 0;
  font-size: var(--ui-font-size-control);
  font-weight: 600;
  white-space: nowrap;
}
.adapter-section-switch input[type="checkbox"] {
  margin: 0;
}
.adapter-section-toggle {
  width: var(--ui-control-height-compact);
  min-width: var(--ui-control-height-compact);
  height: var(--ui-control-height-compact);
  min-height: var(--ui-control-height-compact);
  margin: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.adapter-section-toggle::before {
  content: "▸";
  font-size: 1.45rem;
  line-height: 1;
}
.adapter-section-toggle[aria-expanded="true"]::before {
  content: "▾";
}
.adapter-section-body {
  padding: 0.35rem 0 0.75rem;
}
.adapter-section-body[hidden] {
  display: none;
}
.adapter-section-body .discoverable-toggle {
  display: flex;
  align-items: center;
  min-height: var(--ui-control-height-compact);
  margin: 0 0 0.75rem;
}
.adapter-section[data-section-key$=":input"]:not(:has(.adapter-section-switch input[name="input"]:checked)) .discoverable-toggle {
  display: none;
}

/* Expanded device information is deliberately vertical and compact: name, address, status,
   latency and actions each get their own line instead of competing for horizontal space. */
.device-list-wrap .device-detail-row,
.audio-connected-device-list .audio-device-detail-row {
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
}
.device-list-wrap .device-detail-row .device-name,
.audio-connected-device-list .audio-device-detail-row .device-name {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  overflow: visible;
}
.device-info-line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 0;
}
.device-info-line .device-addr {
  overflow-wrap: anywhere;
}
.device-list-wrap .device-detail-row .row-actions {
  align-self: flex-start;
}
.audio-endpoint-list .audio-endpoint-row {
  align-items: flex-start;
}
.audio-endpoint-list .audio-endpoint-row > .device-alias-input,
.audio-endpoint-list .audio-endpoint-details {
  min-width: 0;
}

.empty-note {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-secondary);
  margin: 0.5rem 0 0;
}

/* ---- Add device ---------------------------------------------------------- */
/* A single scan button (no disclosure) sits below the device list with clear separation. */
.add-device {
  margin-top: 1rem;
}
/* Auto-width outline button — distinct from the filled per-row "Pair" buttons, and not the
   full-bleed bar Pico gives buttons by default, which dwarfed the rest of the card. */
.add-device-btn {
  width: auto;
  margin: 0;
  padding: 0.4rem 0.9rem;
  min-height: var(--ui-control-height-compact);
  font-size: var(--ui-font-size-control);
}
/* Idle vs. busy labels: htmx adds .htmx-request to the button while its request is in flight (the
   scan "Scanning…" and the Pair "Pairing…"). Show the spinner + busy label then, the plain label
   otherwise. Keep the button content centered so the swap doesn't shift its width awkwardly. */
.busy-label-btn .btn-idle,
.busy-label-btn .btn-busy {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}
.busy-label-btn .btn-busy {
  display: none;
}
.busy-label-btn.htmx-request .btn-idle {
  display: none;
}
.busy-label-btn.htmx-request .btn-busy {
  display: inline-flex;
}
/* Keep the busy button readable (the global .htmx-request dim would wash out the spinner). */
.busy-label-btn.htmx-request {
  opacity: 1;
}
.spinner {
  width: 1em;
  height: 1em;
  flex: none;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 1.6s;
  }
}
.add-device .scan-results:not(:empty) {
  margin-top: 0.75rem;
}

/* Header above the found-devices list: a count on the left, "Clear" on the right. Clear empties
   the whole scan-results container (a pure client-side DOM op — results are never cached
   server-side), removing the leftover discoveries that linger after the wanted device is paired. */
.scan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.scan-count {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-control);
}

/* Compact outline button, matching the "Scan to add a device" button's sizing so the two read as
   a pair rather than the full-bleed bar Pico gives buttons by default. */
.scan-clear {
  width: auto;
  min-width: 4.5em;
  margin: 0;
  padding: 0.3rem 0.8rem;
  min-height: var(--ui-control-height-compact);
  font-size: var(--ui-font-size-control);
}

/* Match the per-row "Pair" button's width to "Clear" so the two read as an even pair (the idle
   "Pair" label is short; min-width keeps it from looking cramped next to Clear). */
.scan-results .device-list .row-actions button {
  min-width: 4.5em;
  padding: 0.3rem 0.8rem;
  background: var(--eira-connect-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}
.scan-results .device-list .row-actions button:is(:hover, :active, :focus) {
  background: var(--eira-connect-hover-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}

/* ---- Routing controls ---------------------------------------------------- */
.control {
  margin: 0.9rem 0;
}
.control > label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}
.range-row input[type="range"] {
  flex: 1;
  margin: 0;
  accent-color: var(--eira-range-thumb);
}
.range-row input[type="range"]::-webkit-slider-thumb {
  background: var(--eira-range-thumb);
}
.range-row input[type="range"]::-moz-range-thumb {
  background: var(--eira-range-thumb);
}
.range-row .value {
  font-variant-numeric: tabular-nums;
  min-width: 3.4rem;
  text-align: right;
  font-weight: 600;
}
.range-row .inc,
.range-row .dec {
  width: 2.75rem;
  flex: 0 0 auto;
  padding: 0;
  font-size: 1.3rem;
  line-height: 1;
}

/* Routing exposes the existing manual A2DP recovery as a quiet text action in the former output
   label position while the transparent control keeps the standard touch target. Keep that slot on
   both output cards so their device selectors stay vertically aligned when only one side is A2DP. */
.routing-output-action {
  min-height: var(--ui-control-height);
}
.routing-reconnect {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: var(--ui-control-height);
  margin: 0 0 0.35rem;
  padding: 0 0.2rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pico-muted-color);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}
.routing-reconnect:hover,
.routing-reconnect:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--pico-primary);
}
.routing-reconnect[hidden] {
  display: none;
}

/* Keep the vertical distance below the two output cards equal to the gap between routing cards. */
.routing-output-grid {
  margin-bottom: 1rem;
}

/* JS-blocked banner (Pico-styled via inline role). */
.js-warning {
  display: none;
}

/* ---- HTMX busy affordance ------------------------------------------------ */
.htmx-request,
.htmx-request.status {
  opacity: 0.6;
}

/* The Adapters page poller (#adapter-cards) refreshes in the background on a timer; it must not
   dim the whole section like a user-initiated action does. Opt it out of the busy affordance so the
   automatic refresh is invisible — this also prevents a "stuck dim" if a poll is aborted mid-flight
   (e.g. by hx-sync) and the htmx-request class lingers. The id beats the class on specificity. */
#adapter-cards.htmx-request {
  opacity: 1;
}

/* The same for one card's own fast self-poll while an ASHA aid connects: it ran every 1.5 s and
   dimmed the card on each request, which looked like a flicker. */
.adapter-card-self-poll.htmx-request {
  opacity: 1;
}

/* ---- WiFi page (JS-rendered markup) -------------------------------------- */
/* Keep WiFi on the same typography/control system as Routing and Adapters.
   These selectors are intentionally page-specific so unrelated form controls keep
   their existing semantics. */
.info-value {
  font-size: var(--ui-font-size-standard);
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 var(--ui-space-sm);
}

:where(
  label[for="currentApPassword"],
  label[for="newApPassword"],
  label[for="confirmNewApPassword"],
  label[for="manualWifiSsid"],
  label[for="manualWifiPassword"]
) {
  font-size: var(--ui-font-size-control);
  font-weight: 600;
}

/* Shared first-class editable field role. WiFi credentials use the same visual language as
   Routing/Adapters device fields; surrounding labels/help text keep their quieter roles. */
.eira-device-field {
  min-height: var(--ui-device-field-height);
  height: var(--ui-device-field-height);
  padding-block: 0.5rem;
  border-radius: var(--ui-control-radius);
  background-color: var(--eira-device-field-bg);
  border-color: var(--eira-device-field-border);
  font-size: var(--ui-font-size-card-title);
  font-weight: 600;
  line-height: 1.2;
}

/* Shared action roles. WiFi intentionally reuses the same three visual actions as Adapters:
   Connect/action, neutral filled (Disconnect-like), and secondary outline (Remove-like). */
.eira-action {
  box-sizing: border-box;
  width: auto;
  height: var(--ui-control-height-compact);
  min-height: var(--ui-control-height-compact);
  margin: 0;
  padding: 0.25rem 0.7rem;
  border-radius: var(--ui-control-radius);
  font-size: var(--ui-font-size-control);
  line-height: 1.2;
  white-space: nowrap;
}

.eira-action-primary {
  background: var(--eira-connect-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}
.eira-action-primary:is(:hover, :active, :focus) {
  background: var(--eira-connect-hover-bg);
  border-color: var(--eira-connect-border);
  color: var(--eira-connect-text);
}

.eira-action-neutral {
  background: var(--eira-disconnect-bg);
  border-color: var(--eira-disconnect-border);
  color: var(--eira-disconnect-text);
}
.eira-action-neutral:is(:hover, :active, :focus) {
  background: var(--eira-disconnect-hover-bg);
  border-color: var(--eira-disconnect-border);
  color: var(--eira-disconnect-text);
}
.muted-note,
.status-message {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-secondary);
  white-space: pre-line;
}
.wifi-list {
  margin-top: 0.5rem;
}
.wifi-list-item {
  padding: 0.6rem 0;
  border-top: 1px solid var(--pico-muted-border-color);
}
.wifi-list-item:first-child {
  border-top: 0;
}
.wifi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.wifi-details {
  min-width: 0;
}
.wifi-connection-status {
  display: block;
  font-size: var(--ui-font-size-meta);
  color: var(--pico-muted-color);
}
.wifi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ui-space-xs);
}
.wifi-actions button {
  flex: 0 0 auto;
}
.wifi-password-row {
  display: none;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.wifi-password-row.active {
  display: flex;
}
.wifi-password-input {
  flex: 1;
  margin: 0;
}
.disabled-action {
  opacity: 0.6;
  pointer-events: none;
}

/* Shared confirmation modal (partials/confirm_dialog.html + confirm-dialog.js).
   The Pico <dialog> supplies the overlay, card, and layout; we only narrow the
   card and style the destructive confirm action. */
#confirm-dialog > article {
  max-width: 28rem;
}
#confirm-dialog #confirm-dialog-message {
  margin-bottom: 0;
  white-space: pre-line;
}
/* Header is the app's flex row (title left, close right); drop Pico's close-button
   vertical margins so the icon stays vertically centered against the title. */
#confirm-dialog > article > header > [rel="prev"] {
  margin-top: 0;
  margin-bottom: 0;
}
/* Destructive confirm button (e.g. remove/forget). */
button.destructive {
  --pico-background-color: var(--eira-error);
  --pico-border-color: var(--eira-error-border);
  --pico-color: var(--eira-inverse);
}
/* Pico's focused/hovered button switches its text to --pico-primary-inverse (the Connect text
   colour); keep the destructive text. The confirm button is focused as soon as the dialog opens. */
button.destructive:is(:hover, :active, :focus) {
  --pico-background-color: var(--eira-error-hover);
  --pico-border-color: var(--eira-error-hover);
  --pico-color: var(--eira-inverse);
}

/* ---- 404 page ------------------------------------------------------------ */
/* Centered, calm — a big watermark code over a friendly note and route-back links. */
.notfound {
  text-align: center;
  max-width: 32rem;
  margin: 3rem auto;
}
.notfound-code {
  font-size: clamp(4rem, 18vw, 7rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 0.5rem;
  color: var(--pico-primary);
  opacity: 0.85;
  letter-spacing: 0.05em;
}
.notfound hgroup {
  margin-bottom: 1.75rem;
}
.notfound code {
  word-break: break-all;
}
.notfound-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}
.notfound-links a[role="button"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

/* ===== Hardware monitor ================================================== */
/* The /hardware page: a responsive grid of Pico <article> metric cards, each
   a list of label/value rows, plus thin temp/load bars and yes/no health
   colouring. Polled (no page reload) by the page's inline script. */
.hw-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.hw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.hw-actions button {
  margin: 0;
  width: auto;
  min-height: var(--ui-control-height-compact);
  padding: 0.3rem 0.7rem;
  border-radius: var(--ui-control-radius);
  font-size: var(--ui-font-size-control);
}
.hw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: var(--ui-space-lg);
}
.hw-grid > article {
  margin: 0;
}
.metric-list {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-xs);
}
.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ui-space-md);
}
.metric-row > span {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-secondary);
  line-height: 1.35;
}
.metric-row > strong {
  font-size: var(--ui-font-size-standard);
  line-height: 1.35;
  text-align: right;
  word-break: break-word;
}
.metric-row-stack {
  flex-direction: column;
  align-items: stretch;
}
.metric-row-stack > strong {
  text-align: left;
  white-space: pre-line;
}
/* Thin progress bar used for CPU temperature/load. */
.metric-bar {
  height: 0.4rem;
  border-radius: 0.4rem;
  background: var(--pico-secondary-background);
  overflow: hidden;
}
.metric-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 0.4rem;
  background: var(--eira-control-accent);
  transition: width 0.4s ease;
}
/* Yes/No health colouring for the power-throttle + PipeWire rows. */
.metric-ok {
  color: var(--eira-success);
}
.metric-warn {
  color: var(--eira-error);
}


.hardware-card-header {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.hardware-header-button {
  margin: 0;
  width: auto;
  min-height: var(--ui-control-height-compact);
  padding: 0.3rem 0.7rem;
  border-radius: var(--ui-control-radius);
  font-size: var(--ui-font-size-control);
}

#a2dpLeftReconnectButton,
#a2dpRightReconnectButton {
  min-height: var(--ui-control-height-compact);
  padding: 0.3rem 0.7rem;
  border-radius: var(--ui-control-radius);
  font-size: var(--ui-font-size-control);
}

/* --------------------------------------------------------------------------
 * Hardware / ASHA
 * -------------------------------------------------------------------------- */

.asha-card-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.asha-health-box {
    align-items: flex-end;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.asha-health {
    border-radius: 999px;
    font-size: var(--ui-font-size-control);
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.asha-health-reason {
    color: var(--muted-color);
    font-size: var(--ui-font-size-meta);
    line-height: 1.2;
    max-width: 18rem;
    text-align: right;
}

.asha-health-ok {
    background: var(--eira-success-bg);
    color: var(--eira-success);
}

.asha-health-warn {
    background: var(--eira-warning-status-bg);
    color: var(--eira-warning);
}

.asha-health-bad {
    background: var(--eira-error-status-bg);
    color: var(--eira-error);
}

.asha-health-unknown {
    background: var(--eira-neutral-bg);
    color: var(--eira-neutral);
}

.asha-summary {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    margin-bottom: 1rem;
}

.asha-summary-item {
    background: var(--pico-card-sectioning-background-color);
    border: 1px solid var(--pico-card-border-color);
    border-radius: 0.75rem;
    padding: 0.75rem;
}

.asha-summary-item span,
.asha-summary-item small {
    color: var(--muted-color);
    display: block;
}

.asha-summary-item strong {
    display: block;
    font-size: 1.15rem;
    margin: 0.25rem 0;
}

.asha-summary-item small {
    font-size: var(--ui-font-size-meta);
    line-height: 1.25;
}

.asha-section-title {
    color: var(--muted-color);
    font-size: var(--ui-font-size-control);
    font-weight: 700;
    letter-spacing: 0.04em;
    margin: 1rem 0 0.35rem;
    text-transform: uppercase;
}

.asha-metric-list .metric-row strong {
    white-space: nowrap;
}

.asha-metric-trigger {
    background: var(--eira-error-status-bg-soft);
    border-radius: 0.4rem;
    color: var(--eira-error);
    padding: 0.05rem 0.35rem;
}

/* ---- Per-output latency calibration -------------------------------------- */
/* Latency belongs to the concrete output device, not the routing slot. Reuse the familiar Routing
 * range-row directly below an active output so offsets remain easy to compare visually. */
.audio-endpoint-details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.latency-control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
  min-width: 0;
}
.latency-label {
  color: var(--pico-muted-color);
  font-size: var(--ui-font-size-meta);
  white-space: nowrap;
}
.latency-range-row {
  width: 100%;
}
.latency-range-row .latency-offset-slider {
  min-width: 4rem;
}
.latency-range-row .latency-value {
  min-width: 4.6rem;
}

/* ---- Optional Routing mute controls ------------------------------------- */
.app-setting-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ui-space-lg);
  margin: 0;
  cursor: pointer;
}
.app-setting-copy {
  display: grid;
  gap: 0.2rem;
}
.app-setting-copy small {
  color: var(--pico-muted-color);
  font-weight: 400;
}
.app-setting-switch-row input[type="checkbox"][role="switch"] {
  flex: 0 0 auto;
  margin: 0;
}
.app-setting-switch-row input[type="checkbox"][role="switch"]:checked {
  background-color: var(--eira-control-accent);
  border-color: var(--eira-control-accent);
}

.channel-mute-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--ui-space-lg);
}
.channel-mute-actions .channel-mute-button {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ui-device-field-height);
  height: var(--ui-device-field-height);
  margin: 0;
  padding-block: 0.5rem;
  border-radius: var(--ui-control-radius);
  box-shadow: none;
  font-size: var(--ui-font-size-card-title);
  font-weight: 400;
  line-height: 1.2;
}
.channel-mute-actions .channel-mute-button.is-muted {
  border: 2px solid var(--eira-control-accent);
  background: var(--eira-device-field-bg);
  color: var(--eira-text-primary);
}
.channel-mute-actions .channel-mute-button.is-muted:is(:hover, :active, :focus) {
  border-color: var(--eira-control-accent-hover);
  background: var(--eira-primary-hover);
  color: var(--eira-text-primary);
}

@media (min-width: 768px) {
  .channel-mute-actions {
    /* Match the horizontal geometry of the Left/Right device fields above the card. */
    gap: calc(var(--ui-space-lg) + (2 * var(--pico-block-spacing-horizontal)));
  }
}

/* Shown while the audio handler is still bringing its graph up after an eira (re)start. A box like
   the other notices, so it is noticed; the spinner uses theme colours that every palette defines. */
.adapter-starting {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 1rem;
  padding: 0.65rem 0.9rem;
  font-size: var(--ui-font-size-control);
  font-weight: 600;
  background: var(--eira-device-field-bg);
  border: 1px solid var(--eira-device-field-border);
  border-radius: var(--ui-control-radius);
}
.adapter-starting .spinner {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  border: 3px solid var(--eira-device-field-border);
  border-top-color: var(--eira-control-accent);
  border-radius: 50%;
  animation: eira-spin 0.9s linear infinite;
}
@keyframes eira-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .adapter-starting .spinner {
    animation: none;
  }
}
