/* colors.css — M3 Color Roles */
/* Not a module of its own: NewStyle emits it as the first half of the tokens
   module, ahead of tokens.css. style.WithColor replaces this half — and only
   this half — with a palette generated by yttrium/color, so every non-color
   token has exactly one definition (tokens.css). */

/*
 * Baseline M3 light theme (seed: blue, #0061a4).
 * Override these on :root (or a scoped selector) with your seed-color palette
 * to theme the entire UI without touching any other rule.
 */
:root {
  /* Tell the browser which scheme is active so native widgets (focus rings,
     form controls, scrollbars) render in the matching style. */
  color-scheme: light;

  /* Primary */
  --material-color-primary: #0061a4;
  --material-color-on-primary: #ffffff;
  --material-color-primary-container: #d1e4ff;
  --material-color-on-primary-container: #001d36;

  /* Secondary */
  --material-color-secondary: #535f70;
  --material-color-on-secondary: #ffffff;
  --material-color-secondary-container: #d7e3f8;
  --material-color-on-secondary-container: #101c2b;

  /* Tertiary */
  --material-color-tertiary: #6b5778;
  --material-color-on-tertiary: #ffffff;
  --material-color-tertiary-container: #f3daff;
  --material-color-on-tertiary-container: #251431;

  /* Error */
  --material-color-error: #ba1a1a;
  --material-color-on-error: #ffffff;
  --material-color-error-container: #ffdad6;
  --material-color-on-error-container: #410002;

  /* Success and Warning — non-standard M3 roles, included as custom extensions */
  --material-color-success: #4c665b;
  --material-color-success-container: #c8edd0;
  --material-color-on-success-container: #002111;
  --material-color-warning: #8d6e63;
  --material-color-warning-container: #ffe0b2;
  --material-color-on-warning-container: #341a00;

  /* Surface */
  --material-color-background: #fdfcff;
  --material-color-on-background: #1a1c1e;
  --material-color-surface: #fdfcff;
  --material-color-on-surface: #1a1c1e;
  --material-color-surface-variant: #dfe2eb;
  --material-color-on-surface-variant: #43474e;
  --material-color-surface-container-lowest: #ffffff;
  --material-color-surface-container-low: #f4f3f7;
  --material-color-surface-container: #eeedf1;
  --material-color-surface-container-high: #e8e8eb;
  --material-color-surface-container-highest: #e2e2e6;

  /* Outline */
  --material-color-outline: #73777f;
  --material-color-outline-variant: #c3c6cf;

  /* Inverse */
  --material-color-inverse-surface: #2f3033;
  --material-color-inverse-on-surface: #f1f0f4;
  --material-color-inverse-primary: #9fcaff;
  --material-color-scrim: #000000;
}

/* Dark scheme token overrides */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --material-color-primary: #9fcaff;
    --material-color-on-primary: #003258;
    --material-color-primary-container: #00497d;
    --material-color-on-primary-container: #d1e4ff;

    --material-color-secondary: #bbc7db;
    --material-color-on-secondary: #253140;
    --material-color-secondary-container: #3b4858;
    --material-color-on-secondary-container: #d7e3f8;

    --material-color-tertiary: #d7bee4;
    --material-color-on-tertiary: #3b2948;
    --material-color-tertiary-container: #523f5f;
    --material-color-on-tertiary-container: #f3daff;

    --material-color-error: #ffb4ab;
    --material-color-on-error: #690005;
    --material-color-error-container: #93000a;
    --material-color-on-error-container: #ffdad6;

    --material-color-success: #a8f5be;
    --material-color-success-container: #005227;
    --material-color-on-success-container: #a8f5be;
    --material-color-warning: #ffddb5;
    --material-color-warning-container: #7a4f00;
    --material-color-on-warning-container: #ffddb5;

    --material-color-background: #1a1c1e;
    --material-color-on-background: #e2e2e6;
    --material-color-surface: #1a1c1e;
    --material-color-on-surface: #e2e2e6;
    --material-color-surface-variant: #43474e;
    --material-color-on-surface-variant: #c3c6cf;
    --material-color-surface-container-lowest: #0d0e11;
    --material-color-surface-container-low: #1a1c1e;
    --material-color-surface-container: #1e2022;
    --material-color-surface-container-high: #282a2d;
    --material-color-surface-container-highest: #333538;

    --material-color-outline: #8d9199;
    --material-color-outline-variant: #43474e;

    --material-color-inverse-surface: #e2e2e6;
    --material-color-inverse-on-surface: #2f3033;
    --material-color-inverse-primary: #0061a4;
  }
}

/* tokens.css — M3 Design Tokens */
/* Dependencies: none. Color roles live in colors.css, which NewStyle emits
   ahead of this file as part of the same module. */

:root {
  /* Terminal / code display (fixed dark regardless of scheme) */
  --material-color-code-background: #1e1e1e;
  --material-color-code-color: #d4d4d4;

  --material-top-bar-height: 64px;
  --material-button-height: 40px;

  /* M3 type scale. Each role is a `font` shorthand value (weight size/line-height
     family) with its tracking beside it, so a component sets a role in two
     declarations and cannot pair a size with the wrong line height:
       font: var(--material-type-label-large);
       letter-spacing: var(--material-tracking-label-large); */
  --material-font-family: "Roboto", sans-serif;
  --material-type-display-large: 400 57px/64px var(--material-font-family);
  --material-type-display-medium: 400 45px/52px var(--material-font-family);
  --material-type-display-small: 400 36px/44px var(--material-font-family);
  --material-type-headline-large: 400 32px/40px var(--material-font-family);
  --material-type-headline-medium: 400 28px/36px var(--material-font-family);
  --material-type-headline-small: 400 24px/32px var(--material-font-family);
  --material-type-title-large: 400 22px/28px var(--material-font-family);
  --material-type-title-medium: 500 16px/24px var(--material-font-family);
  --material-type-title-small: 500 14px/20px var(--material-font-family);
  --material-type-body-large: 400 16px/24px var(--material-font-family);
  --material-type-body-medium: 400 14px/20px var(--material-font-family);
  --material-type-body-small: 400 12px/16px var(--material-font-family);
  --material-type-label-large: 500 14px/20px var(--material-font-family);
  --material-type-label-medium: 500 12px/16px var(--material-font-family);
  --material-type-label-small: 500 11px/16px var(--material-font-family);
  /* M3 Expressive's emphasized styles are each role at a heavier weight. One
     weight stands in for the fifteen twins: set it after the role's font. */
  --material-weight-emphasized: 700;
  --material-tracking-display-large: -0.25px;
  --material-tracking-display-medium: 0;
  --material-tracking-display-small: 0;
  --material-tracking-headline-large: 0;
  --material-tracking-headline-medium: 0;
  --material-tracking-headline-small: 0;
  --material-tracking-title-large: 0;
  --material-tracking-title-medium: 0.15px;
  --material-tracking-title-small: 0.1px;
  --material-tracking-body-large: 0.5px;
  --material-tracking-body-medium: 0.25px;
  --material-tracking-body-small: 0.4px;
  --material-tracking-label-large: 0.1px;
  --material-tracking-label-medium: 0.5px;
  --material-tracking-label-small: 0.5px;

  /* Elevation — M3 levels 1-5 (resting: 0-3; 4-5 reserved for hover/pressed).
     Components reference a level for their resting state and +1 on hover. */
  --material-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --material-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --material-elevation-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --material-elevation-4: 0 2px 3px rgba(0, 0, 0, 0.3), 0 6px 10px 4px rgba(0, 0, 0, 0.15);
  --material-elevation-5: 0 4px 4px rgba(0, 0, 0, 0.3), 0 8px 12px 6px rgba(0, 0, 0, 0.15);

  /* Shape scale (M3 Expressive corner radii). Expressive kept large (16dp)
     and extra-large (28dp) and added the two "increased" steps beside them. */
  --material-shape-none: 0px;
  --material-shape-extra-small: 4px;
  --material-shape-small: 8px;
  --material-shape-medium: 12px;
  --material-shape-large: 16px;
  --material-shape-large-increased: 20px;
  --material-shape-extra-large: 28px;
  --material-shape-extra-large-increased: 32px;
  --material-shape-extra-extra-large: 48px;
  --material-shape-full: 9999px;

  /* State layer opacities (M3: hover 8%, focus 10%, pressed 10%, dragged 16%).
     A state layer is the component's content color at one of these opacities,
     drawn over its container. */
  --material-state-hover: 0.08;
  --material-state-focus: 0.1;
  --material-state-pressed: 0.1;
  --material-state-dragged: 0.16;

  /* Focus indicator (M3: 3dp, secondary, 2dp outside the component). Use as
     outline: var(--material-focus-ring) with the offset below; a component
     whose ring must sit inside its bounds negates the width instead. */
  --material-focus-ring-width: 3px;
  --material-focus-ring: var(--material-focus-ring-width) solid var(--material-color-secondary);
  --material-focus-ring-offset: 2px;

  /* Scrim behind modal surfaces (M3: the scrim role at 32%). */
  --material-scrim: color-mix(in srgb, var(--material-color-scrim) 32%, transparent);

  /* Motion — M3 easing sets. The emphasized set captures the expressive style;
     standard is for small utility transitions. Durations follow the spec's
     short/medium tiers. */
  --material-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --material-ease-standard-decelerate: cubic-bezier(0, 0, 0, 1);
  --material-ease-standard-accelerate: cubic-bezier(0.3, 0, 1, 1);
  --material-ease-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --material-ease-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
  --material-duration-short-1: 50ms;
  --material-duration-short-2: 100ms;
  --material-duration-short-3: 150ms;
  --material-duration-short-4: 200ms;
  --material-duration-medium-1: 250ms;
  --material-duration-medium-2: 300ms;

  /* M3 Expressive springs, for spatial changes — size, shape, position. Each
     is the spec's spring (damping ratio / stiffness: fast 0.6/800, default
     0.8/380, slow 0.8/200) sampled into a linear() easing, and is only that
     spring when paired with its own duration:
       transition: border-radius var(--material-spring-fast-duration) var(--material-spring-fast);
     They overshoot, so color and opacity keep the easing curves above. */
  --material-spring-fast: linear(0, 0.44, 0.93, 1.09, 1.06, 1.01, 0.99, 0.99, 1);
  --material-spring-fast-duration: 350ms;
  --material-spring-default: linear(0, 0.38, 0.8, 0.97, 1.01, 1.01, 1, 1, 1);
  --material-spring-default-duration: 500ms;
  --material-spring-slow: linear(0, 0.35, 0.76, 0.96, 1.01, 1.01, 1.01, 1, 1);
  --material-spring-slow-duration: 650ms;

  /* M3 Expressive navigation: 96dp collapsed rail, 220–360dp expanded, and a
     64dp bottom bar. Application CSS that must clear the fixed bottom bar
     (a docked FAB, say) should read --material-nav-bar-height, plus the
     safe-area inset, rather than repeat the number. */
  --rail-width-collapsed: 96px;
  --rail-width-expanded: 240px;
  --material-nav-bar-height: 64px;

  /* The check glyph as a mask image, for controls that draw their own
     checkmark (checkbox, switch handle, selected chip) without the icon font:
       mask: var(--material-icon-check) center / contain no-repeat; */
  --material-icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");

  /* Icon sizing tokens */
  --icon-size-xl: 24px; /* Extra large icons */
  /* M3 app bar leading/trailing icon button container */
  --icon-container-appbar: 48px;

  /* Spacing scale (used via var(--space-xs), etc.) */
  --space-3xs: 2px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

/* Expressive motion overshoots; a user who asked for less gets the end state
   at once. Every transition reads its duration from a token, so zeroing the
   tokens is the whole of it — 1ms rather than 0 so transitionend still fires. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --material-duration-short-1: 1ms;
    --material-duration-short-2: 1ms;
    --material-duration-short-3: 1ms;
    --material-duration-short-4: 1ms;
    --material-duration-medium-1: 1ms;
    --material-duration-medium-2: 1ms;
    --material-spring-fast-duration: 1ms;
    --material-spring-default-duration: 1ms;
    --material-spring-slow-duration: 1ms;
  }
}


/* reset.css — Reset & Base Styles */
/* Dependencies: tokens */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  background: var(--material-color-background);
  color: var(--material-color-on-background);
  /* Body Medium, written out: the unitless line height must inherit as a
     ratio, so an unstyled heading scales its own leading. The role token's
     20px would inherit as 20px. */
  font-family: var(--material-font-family);
  font-size: 14px;
  letter-spacing: 0.25px;
  line-height: 1.43;
  margin: 0;
  /* Dynamic viewport (100vh fallback): with a collapsible URL bar, 100vh is
     the *largest* viewport, so a 100vh-min-height document is taller than the
     visible screen and the document itself scrolls — carrying the in-flow
     appbar out of view while fixed chrome (drawer, bottom bar) stays put. */
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
}

a {
  color: var(--material-color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid var(--material-color-outline-variant);
  margin: 16px 0;
}

img,
video {
  height: auto;
  max-width: 100%;
}


/* layout.css — App Layout Shell, Top Bar & Page Structure */
/* Dependencies: tokens, reset. The app bar and the rail/bar/backdrop are
   styled by component/appbar and component/navrail, which supply their CSS
   via style.WithComponent. */

/* ─── App Layout Shell (mobile-first) ────────────────────────────────────── */

/*
 * The shell is a CSS grid so the chrome's flat siblings — .app-bar,
 * .navigation-rail, .page-content — place themselves without a
 * wrapper element. The navigation component declares and owns its own open
 * signal; the shell neither names it nor requires the consumer to.
 *
 * Mobile base: single column, no rail. Desktop (≥ sm): two columns with rail.
 */
.app-layout {
  display: grid;
  grid-template-areas:
    "appbar"
    "content";
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/*
 * While the mobile drawer is open the document itself must not scroll: a
 * touch on the fixed backdrop would otherwise fall through to the document
 * and scroll the in-flow appbar out of view (the fixed drawer stays, which
 * looks broken). The body class is bound from the same ytMobileNavOpen
 * signal in layout.html — keep the class name in sync.
 */
body.yt-nav-drawer-open {
  overflow: hidden;
}

.page-content {
  display: flex;
  flex-direction: column;
  grid-area: content;
  min-height: 0; /* let the grid item shrink so it scrolls instead of growing */
  min-width: 0;
  overflow-y: auto;
}

/*
 * The shell's banner slot. The shell owns only the wrapper — its full width
 * and its place at the top of the scrollable content — while the banner's own
 * chrome (background, icon, actions) belongs to whatever HTML the application
 * stamps here, so a support strip and a product notice can look different
 * without the shell knowing either exists.
 */
.page-banner {
  width: 100%;
  margin: 0;
}

main {
  flex: 1;
  margin: 0 auto;
  max-width: var(--material-max-width, 1200px);
  padding: var(--space-md) var(--space-sm) var(--space-xl);
  width: 100%;
}

/* sm breakpoint: 600px (tablet portrait & up) */
@media (min-width: 600px) {
  main {
    padding: var(--space-lg);
  }
}

/* md breakpoint: 968px (small desktop & up) */
@media (min-width: 968px) {
  main {
    padding: var(--space-xl);
  }
}

/* The shell's own footer only: a bare `footer` selector also matched the
   <footer> inside cards and the login card, handing them this margin and
   border. :where() keeps the specificity of the old element selector, so an
   application's `footer { … }` override still wins. */
:where(.page-content) > footer {
  border-top: 1px solid var(--material-color-outline-variant);
  color: var(--material-color-on-surface-variant);
  display: flex;
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  justify-content: space-between;
  margin-top: 48px;
  padding: var(--space-sm) var(--space-lg);
}

/* ─── Responsive Shell (mobile-first min-width) ─────────────────────────── */

/* The rail and bottom nav bar own their own visibility across breakpoints in
 * component/navrail's drawer.css; this section only reflows the shell grid.
 *
 * sm breakpoint: 600px. Desktop shell reflows to two columns with a rail area. */
@media (min-width: 600px) {
  .app-layout {
    grid-template-areas:
      "appbar appbar"
      "rail   content";
    grid-template-columns: auto 1fr;
  }
}

/* ─── Page Structure ─────────────────────────────────────────────────────── */

.page-header {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: 20px;
}

@media (min-width: 600px) {
  .page-header {
    align-items: center;
    grid-template-columns: 1fr auto;
  }
}

/* Page titles: Title Large. */
.page-header h1 {
  color: var(--material-color-on-surface);
  font: var(--material-type-title-large);
  letter-spacing: var(--material-tracking-title-large);
  margin: 0;
}


/* forms.css — Form Elements */
/* Dependencies: tokens, reset */

.form-grid {
  display: grid;
  gap: var(--space-sm);
  max-width: 420px;
}

.form-inline {
  align-items: end;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  max-width: none;
}

/* Text inputs. .search-input is the same field in a compact, fixed-width
   form for list toolbars. */
.form-input,
.search-input {
  background: var(--material-color-surface);
  border: 1px solid var(--material-color-outline);
  border-radius: var(--material-shape-extra-small);
  color: var(--material-color-on-surface);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  padding: var(--space-sm) var(--space-md);
  transition: border-color var(--material-duration-short-4) var(--material-ease-standard);
  width: 100%;
}

.search-input {
  padding-block: var(--space-2xs);
  width: 220px;
}

:is(.form-input, .search-input):focus {
  border-color: var(--material-color-primary);
  box-shadow: 0 0 0 1px var(--material-color-primary);
  outline: none;
}

:is(.form-input, .search-input):hover:not(:focus) {
  border-color: var(--material-color-on-surface);
}

textarea.form-input {
  min-height: 96px;
  resize: vertical;
}

.form-label {
  color: var(--material-color-on-surface-variant);
  display: block;
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
  margin-bottom: var(--space-2xs);
}


/* icons.css — Icon Styling */
/* Dependencies: tokens, reset */

/* Material Symbols Outlined, Regular. Self-hosted beside this rule as
   style/icons.woff2 and served by Style.IconFontHandler. NewStyle rewrites the
   URL below to Style.IconFontPath — a content-addressed "/icons.<hash>.woff2" —
   before hashing the bundle, so edit the literal here and let it do that. The
   URL is absolute because Layout.Stylesheet is overridable: a relative one
   would resolve against a consumer-chosen stylesheet path. font-display: block
   hides the glyph until the font loads — an icon's text content is the ligature
   name, so a swap period would render "chevron_right" as words. */
@font-face {
  font-display: block;
  font-family: "Material Symbols Outlined";
  font-style: normal;
  font-weight: 400;
  src: url("/icons.ac53b05afbca.woff2") format("woff2");
}

.icon {
  direction: ltr;
  display: inline-block;
  flex-shrink: 0;
  font-family: "Material Symbols Outlined";
  font-feature-settings: "liga";
  /* M3 spec default icon size is 24dp; smaller contexts (chips: 18dp,
     buttons: 20dp) override via --icon-size on their container. */
  font-size: var(--icon-size, 24px);
  font-style: normal;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1;
  text-transform: none;
  user-select: none;
  white-space: nowrap;
  word-wrap: normal;
}


/* lists.css — List Components */
/* Dependencies: tokens, reset */

ul,
ol {
  margin-top: 0;
  padding-left: 0;
}

ul {
  list-style: circle inside;
}

ol {
  list-style: decimal inside;
}

li {
  margin-bottom: 4px;
}

ul > li > a {
  background-color: transparent;
  color: var(--material-color-primary);
  text-decoration: none;
}

ul ul,
ul ol,
ol ol,
ol ul {
  font-size: 90%;
  margin: 4px 0 4px 16px;
}

/* Key-value pairs: read-only label/value rows in a <dl>. Not an M3 component;
   a shared class like .form-grid or .data-table, kept here because two or more
   applications render detail cards this way. Two columns wide (label hugs its
   content, value takes the rest), one column on narrow screens. */
.kv-list {
  display: grid;
  gap: var(--space-2xs) var(--space-md);
  grid-template-columns: max-content 1fr;
  margin: 0;
}

.kv-list dt {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
}

.kv-list dd {
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  margin: 0; /* UA default indents dd */
}

@media (max-width: 599px) {
  .kv-list {
    grid-template-columns: 1fr;
  }
}


/* tables.css — Table Styling */
/* Dependencies: tokens, reset */

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  padding: var(--space-xs) var(--space-md);
  text-align: left;
}

td {
  border-bottom: 1px solid var(--material-color-outline-variant);
}

tr:last-child td {
  border-bottom: none;
}

.data-table th {
  background: var(--material-color-surface-container);
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-label-medium);
  letter-spacing: 0.08em; /* wider than the role's: the header is uppercase */
  text-transform: uppercase;
}

.data-table tr:hover td {
  background: color-mix(
    in srgb,
    var(--material-color-on-surface) calc(var(--material-state-hover) * 100%),
    var(--material-color-surface)
  );
}


/* state-indicators.css — State Indicators */
/* Dependencies: tokens, reset */

.empty,
.loading {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  text-align: center;
}

.loading {
  padding: var(--space-lg);
}

.empty {
  padding: var(--space-xl);
}


/* utilities.css — Essential Display & Text Utilities */
/* Dependencies: tokens, reset */

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
}

.text-primary {
  color: var(--material-color-primary);
}


/* button.css — Material 3 Button */
/* Owned by package button; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset — declared by Button.Requires(). */

/*
 * M3 Expressive button. The default is the 40dp "small" size: Label Large,
 * 16dp side padding, a 20dp icon, fully rounded. Each style sets
 * --button-container and --button-label and nothing else; the base rule
 * paints them, and the state layer is the label color (currentColor) over the
 * container, so no style restates its hover. Each size sets the geometry
 * properties the same way.
 *
 * A press springs the corners in to --button-radius-pressed. The round
 * radius is half the height rather than the "full" token so that the spring
 * has a real distance to travel: from 9999px the corner would not visibly
 * move until the last frame.
 *
 * The transparent 1px border is part of every button so the outlined style —
 * which only colors it — is the same height as the rest.
 */
.button {
  --button-container: transparent;
  --button-label: var(--material-color-primary);
  --button-height: var(--material-button-height);
  --button-padding: var(--space-md);
  --button-radius: calc(var(--button-height) / 2);
  --button-radius-square: var(--material-shape-medium);
  --button-radius-pressed: var(--material-shape-small);
  align-items: center;
  background: var(--button-container);
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  color: var(--button-label);
  cursor: pointer;
  display: inline-flex;
  font: var(--material-type-label-large);
  gap: var(--space-xs);
  justify-content: center;
  letter-spacing: var(--material-tracking-label-large);
  min-height: var(--button-height);
  padding: 0 var(--button-padding);
  position: relative; /* anchors the ::before state layer */
  text-align: center;
  text-decoration: none;
  transition:
    border-radius var(--material-spring-fast-duration) var(--material-spring-fast),
    box-shadow var(--material-duration-short-4) var(--material-ease-standard);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  /* M3 spec: a button's leading/trailing icon is 20dp. */
  --icon-size: 20px;
}

/* a:hover in reset.css underlines links and outranks the base rule above. */
.button:hover {
  text-decoration: none;
}

.button:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* State layer — the content color at the hover/focus/pressed opacity. */
.button::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  /* Cover the border too, so the layer matches the visible container. */
  inset: -1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

.button:hover::before {
  opacity: var(--material-state-hover);
}

.button:focus-visible::before {
  opacity: var(--material-state-focus);
}

.button:active::before {
  opacity: var(--material-state-pressed);
}

.button:disabled,
.button[aria-disabled="true"] {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.38;
  pointer-events: none;
}

/* Sizes and shape */

/* Medium — 56dp, Title Medium, a 24dp icon. */
.button.medium {
  --button-height: 56px;
  --button-padding: var(--space-lg);
  --button-radius-square: var(--material-shape-large);
  --button-radius-pressed: var(--material-shape-medium);
  --icon-size: 24px;
  font: var(--material-type-title-medium);
  letter-spacing: var(--material-tracking-title-medium);
}

/* Large — 96dp, Headline Small, a 32dp icon. */
.button.large {
  --button-height: 96px;
  --button-padding: 48px;
  --button-radius-square: var(--material-shape-extra-large);
  --button-radius-pressed: var(--material-shape-large);
  --icon-size: 32px;
  font: var(--material-type-headline-small);
  gap: var(--space-sm);
  letter-spacing: var(--material-tracking-headline-small);
}

.button.square {
  --button-radius: var(--button-radius-square);
}

.button:active {
  border-radius: var(--button-radius-pressed);
}

/* Filled styles */

.button.primary {
  --button-container: var(--material-color-primary);
  --button-label: var(--material-color-on-primary);
}

.button.tonal {
  --button-container: var(--material-color-secondary-container);
  --button-label: var(--material-color-on-secondary-container);
}

/* Danger, warning and success are yttrium extensions, not M3 button styles. */
.button.danger {
  --button-container: var(--material-color-error);
  --button-label: var(--material-color-on-error);
}

.button.warning {
  --button-container: var(--material-color-warning-container);
  --button-label: var(--material-color-on-warning-container);
}

.button.success {
  --button-container: var(--material-color-success-container);
  --button-label: var(--material-color-on-success-container);
}

/* Filled buttons rest at elevation 0; hover raises them one level and a press
   returns them to rest (M3: "All Material buttons increase elevation by 1
   level when hovered"). */
.button:is(.primary, .tonal, .danger, .warning, .success):not(.outlined.danger):hover:not(:active) {
  box-shadow: var(--material-elevation-1);
}

/* Elevated — the only button style with a resting elevation (level 1, level 2
   on hover, 0 when disabled). */
.button.elevated {
  --button-container: var(--material-color-surface-container-low);
  box-shadow: var(--material-elevation-1);
}

.button.elevated:hover:not(:active) {
  box-shadow: var(--material-elevation-2);
}

/* Toggle (selection) buttons rest unselected and fill with the primary
   color when selected, across all styles. */
.button:is(.elevated, .primary, .tonal).selected {
  --button-container: var(--material-color-primary);
  --button-label: var(--material-color-on-primary);
}

/* Selecting a toggle also swaps its shape — round to square, square to
   round — on the same spring as the press. */
.button.selected {
  --button-radius: var(--button-radius-square);
}

.button.square.selected {
  --button-radius: calc(var(--button-height) / 2);
}

/* Outlined — no container, an outline-variant stroke (M3 Expressive). */
.button.outlined {
  --button-container: transparent;
  --button-label: var(--material-color-primary);
  border-color: var(--material-color-outline-variant);
}

/* Outlined + a filled style keeps that style's fill; the stroke takes its
   color so the pair reads as one shape. Outlined + danger is the exception:
   a destructive action that stays quiet until confirmed. */
.button.outlined.primary {
  --button-container: var(--material-color-primary);
  --button-label: var(--material-color-on-primary);
  border-color: var(--material-color-primary);
}

.button.outlined.danger {
  --button-container: transparent;
  --button-label: var(--material-color-error);
  border-color: var(--material-color-error);
}

.button.text {
  padding-inline: var(--space-sm);
}

/* Buttons in a row keep their own heights: a flex row would otherwise
   stretch a small button to match a large neighbor. */
.button-group {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Connected group (M3 Expressive; it replaces the segmented button): 2dp
   apart, the group's outer corners keep the button's own radius and the
   inner ones are small, tightening further on press. A .selected button
   springs to fully round, whatever the group's shape. The selected rule
   comes last because it ties the edge rules on specificity. */
.button-group.connected {
  gap: var(--space-3xs);
}

.button-group.connected > .button {
  --button-radius-inner: var(--material-shape-small);
  border-radius: var(--button-radius-inner);
}

.button-group.connected > .button:active {
  --button-radius-inner: var(--material-shape-extra-small);
}

.button-group.connected > .button:first-child {
  border-end-start-radius: var(--button-radius);
  border-start-start-radius: var(--button-radius);
}

.button-group.connected > .button:last-child {
  border-end-end-radius: var(--button-radius);
  border-start-end-radius: var(--button-radius);
}

.button-group.connected > .button.selected {
  border-radius: calc(var(--button-height) / 2);
}


/* icon-button.css — Material 3 Icon Button */
/* Owned by package iconbutton; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset, icons — declared by IconButton.Requires(). */

/*
 * Icon button: a 40dp container with a 24dp icon. The M3 styles are
 * .standard (no container), .filled, .tonal and .outlined. The unmodified
 * default — a primary-container fill — and .neutral / .warning / .success /
 * .danger are yttrium's own and predate them.
 *
 * Geometry follows button.css: each size sets --icon-button-size and its two
 * corner radii, and a press springs the corners in. The round radius is half
 * the size, not the "full" token, so the spring has a real distance to travel.
 */
.button-icon {
  --button-container: var(--material-color-primary-container);
  --button-label: var(--material-color-on-primary-container);
  --icon-button-size: 40px;
  --button-radius: calc(var(--icon-button-size) / 2);
  --button-radius-square: var(--material-shape-medium);
  --button-radius-pressed: var(--material-shape-small);
  align-items: center;
  background: var(--button-container);
  border: 1px solid transparent;
  border-radius: var(--button-radius);
  color: var(--button-label);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: var(--icon-button-size);
  justify-content: center;
  padding: 0;
  position: relative; /* anchors the ::before state layer */
  text-decoration: none;
  transition: border-radius var(--material-spring-fast-duration) var(--material-spring-fast);
  width: var(--icon-button-size);
  -webkit-tap-highlight-color: transparent;
  --icon-size: 24px;
}

.button-icon.standard {
  --button-container: transparent;
  --button-label: var(--material-color-on-surface-variant);
}

.button-icon.filled {
  --button-container: var(--material-color-primary);
  --button-label: var(--material-color-on-primary);
}

.button-icon.tonal {
  --button-container: var(--material-color-secondary-container);
  --button-label: var(--material-color-on-secondary-container);
}

.button-icon.outlined {
  --button-container: transparent;
  --button-label: var(--material-color-on-surface-variant);
  border-color: var(--material-color-outline-variant);
}

.button-icon.neutral {
  --button-container: var(--material-color-surface-variant);
  --button-label: var(--material-color-on-surface-variant);
}

.button-icon.warning {
  --button-container: var(--material-color-warning-container);
  --button-label: var(--material-color-on-warning-container);
}

.button-icon.success {
  --button-container: var(--material-color-success-container);
  --button-label: var(--material-color-on-success-container);
}

.button-icon.danger {
  --button-container: var(--material-color-error-container);
  --button-label: var(--material-color-on-error-container);
}

/* M3 extra-small: a 32dp container with a 20dp icon. */
.button-icon.extra-small {
  --icon-button-size: 32px;
  --icon-size: 20px;
}

/* Medium — a 56dp container with a 24dp icon. */
.button-icon.medium {
  --icon-button-size: 56px;
  --button-radius-square: var(--material-shape-large);
  --button-radius-pressed: var(--material-shape-medium);
}

/* Large — a 96dp container with a 32dp icon. */
.button-icon.large {
  --icon-button-size: 96px;
  --button-radius-square: var(--material-shape-extra-large);
  --button-radius-pressed: var(--material-shape-large);
  --icon-size: 32px;
}

.button-icon.square {
  --button-radius: var(--button-radius-square);
}

.button-icon:active {
  border-radius: var(--button-radius-pressed);
}

.button-icon:hover {
  text-decoration: none;
}

.button-icon:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* State layer — the content color at the hover/focus/pressed opacity. */
.button-icon::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  /* Cover the border too, so the layer matches the visible container. */
  inset: -1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

.button-icon:hover::before {
  opacity: var(--material-state-hover);
}

.button-icon:focus-visible::before {
  opacity: var(--material-state-focus);
}

.button-icon:active::before {
  opacity: var(--material-state-pressed);
}

.button-icon:disabled,
.button-icon[aria-disabled="true"] {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.38;
  pointer-events: none;
}


/* card.css — Material 3 Card */
/* Owned by package card; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset — declared by Card.Requires(). */

.card {
  background: var(--material-color-surface);
  border: 1px solid var(--material-color-outline-variant);
  border-radius: var(--material-shape-medium);
  overflow: hidden;
}

/* Elevated cards rest at level 1 (M3: card = elevated, level 1). */
.card.elevated {
  background: var(--material-color-surface-container-low);
  border: none;
  box-shadow: var(--material-elevation-1);
}

/* Filled cards: solid surface-container-highest, no border, no shadow. */
.card.filled {
  background: var(--material-color-surface-container-highest);
  border: none;
}

/* Outlined cards use the unvariant .card base (flat surface with an
   outline-variant border). */

.card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
}

/* Card text levels — scoped to body/header so the bare classes can't restyle
   buttons/links in the action row. */
.card-body .primary {
  color: var(--material-color-on-surface);
  font: var(--material-type-body-large);
  letter-spacing: var(--material-tracking-body-large);
  margin: 0;
}

.card-body .secondary,
.card-header .secondary {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  margin: 0;
}

.card-body .supporting {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  margin: 0;
}

.card-controls {
  align-items: center;
  display: flex;
  gap: var(--space-xs);
}

/* Action rows: stacked full-width on mobile (buttons stretch to the card's
   content box, which is the correct look at narrow widths); natural-width
   side by side from sm (600px) up, so desktop cards don't grow giant slabs.
   Without this wrapper the buttons are .card-body flex children and stretch
   to full width at every viewport. */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* sm breakpoint: 600px (tablet portrait & up) */
@media (min-width: 600px) {
  .card-actions {
    flex-direction: row;
  }
}

.card-grid {
  display: grid;
  gap: var(--space-xs); /* M3: max 8dp between cards */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

/* Single-column stack of full-width cards. Use when the cards are detail
   sections that should never wrap side by side (e.g., project/playbook
   detail pages). */
.card-list {
  display: grid;
  gap: var(--space-xs);
  grid-template-columns: 1fr;
}

/* Media: fill the card width, drop the inline baseline gap, crop to any
   inline aspect-ratio. */
.card-media img {
  display: block;
  object-fit: cover;
  width: 100%;
}

/* Rounded (portrait-style) media sits inset with a large radius. */
.card-media img.rounded {
  border-radius: var(--material-shape-large-increased);
  margin: var(--space-md);
}

.card-header {
  align-items: center;
  border-bottom: 1px solid var(--material-color-outline-variant);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
}

/* The title's element level is configurable (h2–h4); all levels share the
   same M3 card-title treatment. */
.card-header h2,
.card-header h3,
.card-header h4 {
  color: var(--material-color-on-surface);
  font: var(--material-type-title-small);
  letter-spacing: var(--material-tracking-title-small);
  margin: 0;
}

.card-footer {
  align-items: center;
  border-top: 1px solid var(--material-color-outline-variant);
  display: flex;
  justify-content: flex-end;
  padding: var(--space-sm) var(--space-md);
}

/* sm breakpoint: 600px (tablet portrait & up) */
@media (min-width: 600px) {
  .card-header {
    flex-wrap: nowrap;
  }
}

/* Directly actionable card: the container is the <a>. M3 requires a hover
   cue, a focus ring, and feedback — non-actionable cards get none. */
.card.clickable,
.card.clickable:hover {
  cursor: pointer;
  position: relative; /* anchors the ::before state layer */
  text-decoration: none;
  transition: box-shadow var(--material-duration-short-4) var(--material-ease-standard);
}

/* Elevated rests at level 1; hover raises one level. Filled/outlined have no
   resting shadow; hover lifts them to level 1. */
.card.elevated.clickable:hover {
  box-shadow: var(--material-elevation-2);
}

.card.filled.clickable:hover,
.card.outlined.clickable:hover {
  box-shadow: var(--material-elevation-1);
}

/* State layer — on-surface at the hover/focus/pressed opacity. The role is
   named because the container is an <a>, whose currentColor is the link
   color; the card's own overflow: hidden clips the layer to its corners. */
.card.clickable::before {
  background: var(--material-color-on-surface);
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

.card.clickable:hover::before {
  opacity: var(--material-state-hover);
}

.card.clickable:focus-visible::before {
  opacity: var(--material-state-focus);
}

.card.clickable:active::before {
  opacity: var(--material-state-pressed);
}

.card.clickable:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}


/* banner.css — Semantic Banners */
/* Dependencies: tokens, reset, icons */

.banner {
  align-items: center;
  border-radius: var(--material-shape-medium);
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--material-color-surface-variant);
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
}

/* Variant-specific left border and icon coloring */
.banner.banner-error {
  border-left: 4px solid var(--material-color-error);
}

.banner.banner-error .icon {
  color: var(--material-color-error);
}

.banner.banner-warning {
  border-left: 4px solid var(--material-color-warning);
}

.banner.banner-warning .icon {
  color: var(--material-color-warning);
}

.banner.banner-success {
  border-left: 4px solid var(--material-color-success);
}

.banner.banner-success .icon {
  color: var(--material-color-success);
}

.banner.banner-info {
  border-left: 4px solid var(--material-color-primary);
}

.banner.banner-info .icon {
  color: var(--material-color-primary);
}

/* Leading icon */
.banner > .icon:first-child {
  flex-shrink: 0;
  --icon-size: 18px;
}

/* Dismiss button — positioned at end, minimal emphasis */
.banner-dismiss {
  margin-left: auto;
  opacity: 0.7;
  transition: opacity var(--material-duration-short-4) var(--material-ease-standard);
}

.banner-dismiss:hover {
  opacity: 1;
}


/* fab.css — Material 3 Floating Action Button */
/* Owned by package fab; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset, icons — declared by Fab.Requires(). */

/* M3 Expressive spec highlights:
 * - The FAB represents the primary action of a screen; only one per screen.
 * - Three sizes: FAB 56dp, medium 80dp, large 96dp, with large (16dp),
 *   large-increased (20dp) and extra-large (28dp) corners and 24/28/36dp
 *   icons. The extended shape keeps each size's height and corner and adds
 *   a label (Title Medium / Title Large / Headline Small).
 * - Small (40dp) is the baseline M3 size Expressive retired; it stays for
 *   dense surfaces and has no extended form of its own.
 * - Default color is primary-container / on-primary-container.
 * - States: hover adds an 8% state layer; focus and pressed add a 10%
 *   state layer. Elevation rests at level 3, level 4 on hover.
 */

/* Each size sets the --fab-* properties below and nothing else; the base and
   extended rules read them, so a size modifier can never fight the extended
   shape over width or height. */
.button-fab {
  --fab-size: 56px;
  --fab-radius: var(--material-shape-large);
  --fab-padding: var(--space-md);
  --fab-gap: var(--space-xs);
  --icon-size: 24px;
  align-items: center;
  background-color: var(--material-color-primary-container);
  /* The spec's FAB is a filled container with no stroke. This reset is
     load-bearing: without it a <button> keeps the UA-default 2px outset
     border, which reads as a non-Material ring around the fill. */
  border: none;
  border-radius: var(--fab-radius);
  box-sizing: border-box;
  /* M3 spec: the FAB rests at elevation 3 and raises to 4 on hover. */
  box-shadow: var(--material-elevation-3);
  color: var(--material-color-on-primary-container);
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  font: var(--material-type-title-medium);
  gap: var(--fab-gap);
  height: var(--fab-size);
  justify-content: center;
  letter-spacing: var(--material-tracking-title-medium);
  position: relative; /* anchors the ::before state layer */
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
  width: var(--fab-size);
}

.button-fab:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* State layer — the content color at 8% on hover, 10% on focus and pressed.
   currentColor is each color style's on-container role, so the color styles
   below need no layer rule of their own. */
.button-fab::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}
.button-fab:hover::before {
  opacity: var(--material-state-hover);
}
.button-fab:focus-visible::before {
  opacity: var(--material-state-focus);
}
.button-fab:active::before {
  opacity: var(--material-state-pressed);
}
.button-fab:hover {
  /* FAB rests at level 3; hover raises it to level 4 (M3). */
  box-shadow: var(--material-elevation-4);
  /* a:hover in reset.css underlines links and, at (0,1,1), beats the
   * .button-fab base rule's text-decoration: none — same fix as .button. */
  text-decoration: none;
}

/* Sizes */

/* Small — 40dp, baseline M3 only. */
.button-fab.small {
  --fab-size: 40px;
  --fab-radius: var(--material-shape-medium);
  --fab-padding: var(--space-sm);
}

/* Medium — 80dp. */
.button-fab.medium {
  --fab-size: 80px;
  --fab-radius: var(--material-shape-large-increased);
  --fab-padding: 26px;
  --fab-gap: var(--space-sm);
  --icon-size: 28px;
  font: var(--material-type-title-large);
  letter-spacing: var(--material-tracking-title-large);
}

/* Large — 96dp, for full-bleed, low-content screens. */
.button-fab.large {
  --fab-size: 96px;
  --fab-radius: var(--material-shape-extra-large);
  --fab-padding: 28px;
  --fab-gap: var(--space-md);
  --icon-size: 36px;
  font: var(--material-type-headline-small);
  letter-spacing: var(--material-tracking-headline-small);
}

/* Extended — the size's height and corner, as wide as its icon and label. */
.button-fab-extended {
  padding-inline: var(--fab-padding);
  width: auto;
}

/* Color styles */
.button-fab.secondary {
  background-color: var(--material-color-secondary-container);
  color: var(--material-color-on-secondary-container);
}
.button-fab.tertiary {
  background-color: var(--material-color-tertiary-container);
  color: var(--material-color-on-tertiary-container);
}


/* switch.css — Material 3 Switch per https://m3.material.io/components/switch/specs */
/* Owned by package switches; folded into the bundle via style.WithComponent(switches.Switch{}). */
/* Dependencies: tokens, reset — declared by Switch.Requires(). */

/* M3 spec measurements:
 * - Track: 52dp wide × 32dp high, fully rounded. Unselected it is
 *   surface-container-highest with a 2dp outline; selected it is primary.
 * - Handle: 16dp unselected, 24dp selected or carrying an icon, 28dp pressed.
 *   Outline color unselected, on-primary selected.
 * - Handle icon: 16dp — a check when selected, a close when unselected (only
 *   in the both-icons mode).
 * - State layer: a 40dp circle centered on the handle — on-surface when
 *   unselected, primary when selected.
 * - Target: 48dp tall.
 */

.switch {
  --switch-layer: var(--material-color-on-surface);
  align-items: center;
  color: var(--material-color-on-surface);
  cursor: pointer;
  display: inline-flex;
  gap: var(--space-sm);
  min-height: 48px;
  /* Containing block for the visually-hidden input below: without a
     positioned ancestor its absolute position falls back to the viewport,
     the input escapes the nearest overflow clip, and the document grows —
     a second, stray scrollbar. */
  position: relative;
  user-select: none;
  /* A switch with no label has no text to take a baseline from, so its
     baseline is the bottom of the track and text beside it sits low.
     Aligning on the center keeps the two on one visual row; see chip.css. */
  vertical-align: middle;
}

.switch:has(> input:disabled) {
  cursor: default;
}

/* Native input is visually hidden but accessible to screen readers and keyboard. */
.switch > input {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* Track — the visible pill, and the containing block for the handle. The 2dp
 * border is present in both states (transparent once selected) so the handle
 * offsets below, which are measured from the padding box, never change. */
.switch-track {
  background-color: var(--material-color-surface-container-highest);
  border: 2px solid var(--material-color-outline);
  border-radius: var(--material-shape-full);
  flex-shrink: 0;
  height: 32px; /* M3 spec: 32dp track height */
  position: relative;
  /* Color takes the 200ms standard curve; the handle's size and slide, below,
     take the fast spring. */
  transition:
    background-color var(--material-duration-short-4) var(--material-ease-standard),
    border-color var(--material-duration-short-4) var(--material-ease-standard);
  width: 52px; /* M3 spec: 52dp track width */
}

/* Handle — the moving circle inside the track.
 *
 * Absolutely positioned so the handle is out of flow. .switch is an
 * inline-level box placed on its line by its baseline, and a flex
 * container's baseline chains to the baseline of its first in-flow item.
 * An in-flow handle that animates size (16/24/28dp) moves that baseline,
 * shifting the whole line box with every toggle. Out of flow, the size
 * change is paint-only.
 *
 * It is placed by its center: 16dp in from the track's outer edge (14dp
 * from the padding box) when unselected, and 20dp further when selected.
 * Centering means the handle can change size without moving. */
.switch-handle {
  align-items: center;
  background-color: var(--material-color-outline);
  border-radius: var(--material-shape-full);
  display: flex;
  height: 16px; /* M3 spec: unselected handle */
  justify-content: center;
  left: 14px;
  position: absolute;
  top: 50%;
  transition:
    background-color var(--material-duration-short-4) var(--material-ease-standard),
    height var(--material-spring-fast-duration) var(--material-spring-fast),
    translate var(--material-spring-fast-duration) var(--material-spring-fast),
    width var(--material-spring-fast-duration) var(--material-spring-fast);
  translate: -50% -50%;
  width: 16px;
}

/* An unselected handle that carries an icon is 24dp, like the selected one. */
.switch-handle.has-icon-unselected {
  height: 24px;
  width: 24px;
}

/* Selected — the slide keys on :checked alone (never on a class baked in at
 * render time), so toggling the checkbox client-side moves the handle. */
.switch:has(> input:checked) {
  --switch-layer: var(--material-color-primary);
}

.switch > input:checked + .switch-track {
  background-color: var(--material-color-primary);
  border-color: transparent;
}

.switch > input:checked + .switch-track .switch-handle {
  background-color: var(--material-color-on-primary);
  height: 24px; /* M3 spec: selected handle */
  translate: calc(-50% + 20px) -50%;
  width: 24px;
}

/* Pressed — the handle grows to 28dp in either state. The selector outranks
   the size rules above so the press wins over them. */
.switch:not(:has(> input:disabled)):active > input + .switch-track .switch-handle {
  height: 28px;
  width: 28px;
}

/* Handle icons, drawn as masks so the switch needs no icon font. */
.switch-handle.has-icon-unselected::after,
.switch > input:checked + .switch-track .switch-handle.has-icon-selected::after {
  content: "";
  height: 16px; /* M3 spec: 16dp icon */
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E")
    center / contain no-repeat;
  background-color: var(--material-color-surface-container-highest);
  width: 16px;
}

.switch > input:checked + .switch-track .switch-handle.has-icon-selected::after {
  background-color: var(--material-color-on-primary-container);
  mask-image: var(--material-icon-check);
}

/* State layer — a 40dp circle centered on the handle. */
.switch-handle::before {
  background: var(--switch-layer);
  border-radius: var(--material-shape-full);
  content: "";
  height: 40px;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
  translate: -50% -50%;
  width: 40px;
}

@media (hover: hover) {
  .switch:not(:has(> input:disabled)):hover .switch-handle::before {
    opacity: var(--material-state-hover);
  }
}

.switch > input:focus-visible + .switch-track .switch-handle::before {
  opacity: var(--material-state-focus);
}

.switch:not(:has(> input:disabled)):active .switch-handle::before {
  opacity: var(--material-state-pressed);
}

/* Focus visible — keyboard navigation indicator */
.switch > input:focus-visible + .switch-track {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* Disabled (M3): unselected — a 12% track and outline with a 38% handle;
   selected — a 12% on-surface track with a surface handle. */
.switch > input:disabled + .switch-track {
  background-color: color-mix(in srgb, var(--material-color-surface-container-highest) 12%, transparent);
  border-color: color-mix(in srgb, var(--material-color-on-surface) 12%, transparent);
}

.switch > input:disabled + .switch-track .switch-handle {
  background-color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
}

.switch > input:disabled:checked + .switch-track {
  background-color: color-mix(in srgb, var(--material-color-on-surface) 12%, transparent);
  border-color: transparent;
}

.switch > input:disabled:checked + .switch-track .switch-handle {
  background-color: var(--material-color-surface);
}

.switch-label {
  font: var(--material-type-body-large);
  letter-spacing: var(--material-tracking-body-large);
}

.switch:has(> input:disabled) .switch-label {
  color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
}


/* checkbox.css — Material 3 Expressive Checkbox */
/* Owned by package checkbox; folded into the bundle via style.WithComponent(checkbox.Checkbox{}). */
/* Dependencies: tokens, reset — declared by Checkbox.Requires(). */

/* M3 spec highlights:
 * - Container: 18dp square, 2dp corner, 2dp on-surface-variant outline;
 *   selected or indeterminate it fills with primary and shows an on-primary
 *   icon.
 * - State layer: a 40dp circle centered on the container — on-surface when
 *   unselected, primary when selected — at the hover/focus/pressed opacity.
 * - Target: 48dp tall.
 * - Disabled: on-surface at 38%, no state layer.
 */

.checkbox {
  --checkbox-layer: var(--material-color-on-surface);
  align-items: center;
  color: var(--material-color-on-surface);
  cursor: pointer;
  display: inline-flex;
  gap: var(--space-2xs);
  min-height: 48px;
  /* Containing block for the visually-hidden input below: without a
     positioned ancestor its absolute position falls back to the viewport,
     the input escapes the nearest overflow clip, and the document grows —
     a second, stray scrollbar. */
  position: relative;
  user-select: none;
}

.checkbox:has(> input:disabled) {
  cursor: default;
}

/* A set of related checkboxes, one per row. A checkbox is inline by default
   so it can sit in a line of text or a toolbar; a group stacks them, each at
   its own width so only the checkbox and its label are clickable. */
.checkbox-group {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
}

/* Native input is visually hidden but accessible to screen readers and keyboard. */
.checkbox > input {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
}

/* Container box — the visible square. The 11dp margin reserves the 40dp
   state-layer circle in layout, so the layer never overlaps the label. */
.checkbox-container {
  align-items: center;
  border: 2px solid var(--material-color-on-surface-variant);
  border-radius: 2px; /* M3 spec: 2dp corner shape */
  display: inline-flex;
  flex-shrink: 0;
  height: 18px; /* M3 spec: 18dp container size */
  justify-content: center;
  margin: 11px;
  position: relative; /* anchors the ::before state layer */
  /* M3 spec: selection controls animate over 200ms, standard curve. */
  transition:
    background-color var(--material-duration-short-4) var(--material-ease-standard),
    border-color var(--material-duration-short-4) var(--material-ease-standard);
  width: 18px; /* M3 spec: 18dp container size */
}

/* State layer — a 40dp circle around the 18dp container. The offset is from
   the padding box, which the 2dp border leaves 14dp wide: (40 - 14) / 2. */
.checkbox-container::before {
  background: var(--checkbox-layer);
  border-radius: var(--material-shape-full);
  content: "";
  inset: -13px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

@media (hover: hover) {
  .checkbox:not(:has(> input:disabled)):hover .checkbox-container::before {
    opacity: var(--material-state-hover);
  }
}

.checkbox > input:focus-visible + .checkbox-container::before {
  opacity: var(--material-state-focus);
}

.checkbox:not(:has(> input:disabled)):active .checkbox-container::before {
  opacity: var(--material-state-pressed);
}

/* Focus-visible ring for keyboard navigation */
.checkbox > input:focus-visible + .checkbox-container {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* Icon layer (checkmark / dash via ::after) */
.checkbox-icon {
  align-items: center;
  display: inline-flex;
  justify-content: center;
}

/* The checkmark box stays in layout in every state; visibility — not
 * content — hides the glyph. If the 12px box disappeared on unchecked boxes,
 * checked and unchecked checkboxes would compute different flex baselines
 * and misalign by (18-12)/2 whenever they share an inline line. The mask
 * swap below only chooses *which* glyph shows, not whether it does. */
.checkbox-icon::after {
  content: "";
  visibility: hidden;
  display: block;
  width: 12px;
  height: 12px;
  mask-image: var(--material-icon-check);
  mask-size: contain;
  mask-repeat: no-repeat;
  background-color: var(--material-color-on-primary);
}

/* Selected and indeterminate — primary fill, and the state layer turns
   primary with it. data-indeterminate is the server-rendered state;
   :indeterminate covers a script setting the DOM property. */
.checkbox:has(> input:is(:checked, :indeterminate, [data-indeterminate])) {
  --checkbox-layer: var(--material-color-primary);
}

.checkbox > input:is(:checked, :indeterminate, [data-indeterminate]) + .checkbox-container {
  background-color: var(--material-color-primary);
  border-color: transparent;
}

.checkbox > input:checked + .checkbox-container .checkbox-icon::after {
  visibility: visible;
}

/* Indeterminate — horizontal dash */
.checkbox > input:is(:indeterminate, [data-indeterminate]) + .checkbox-container .checkbox-icon::after {
  visibility: visible;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 13H5v-2h14v2z'/%3E%3C/svg%3E");
}

/* Disabled — on-surface at 38% for the outline (unselected) or the fill
   (selected), per M3. The rules follow the selected ones so they win. */
.checkbox > input:disabled + .checkbox-container {
  border-color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
}

.checkbox > input:disabled:is(:checked, :indeterminate, [data-indeterminate]) + .checkbox-container {
  background-color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
  border-color: transparent;
}

.checkbox > input:disabled + .checkbox-container .checkbox-icon::after {
  background-color: var(--material-color-surface);
}

/* Label text — same color regardless of checked state per spec */
.checkbox-label {
  font: var(--material-type-body-large);
  letter-spacing: var(--material-tracking-body-large);
}

.checkbox:has(> input:disabled) .checkbox-label {
  color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
}


/* drawer.css — Navigation Rail and Bottom Bar (M3 Expressive) */
/* Owned by package navrail; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset — declared by Drawer.Requires(). */

/* ─── Navigation Rail (desktop/tablet, ≥ 600px) ─────────────────────────── */

/*
 * M3 Expressive geometry. Collapsed: a 96dp rail of stacked destinations —
 * a 56×32dp pill behind the 24dp icon, the label beneath it. Expanded: each
 * destination is a 56dp-tall pill hugging its icon and label, 20dp in from
 * the rail edge with 16dp of its own padding.
 *
 * Those numbers keep the icon still when the rail toggles: collapsed, the
 * pill is centered in 96dp (20dp in) and the icon centered in the pill (16dp
 * further); expanded, 20dp rail padding plus 16dp row padding. Both put the
 * icon's left edge at 36dp — change one side and the icon jumps on toggle.
 * That equality needs the collapsed rail's full 96dp, which is why it keeps
 * overflow-y: hidden: a scrollbar would narrow the box and shift the pill.
 *
 * The rail stretches to fill grid row 2 (viewport height minus the top bar);
 * min-height: 0 lets it shrink so the expanded rail can scroll instead.
 */
.navigation-rail {
  --rail-width: var(--rail-width-collapsed);
  align-items: stretch;
  background: var(--material-color-surface);
  display: none; /* mobile: the bottom bar navigates instead; shown at sm */
  flex-direction: column;
  grid-area: rail;
  min-height: 0;
  overflow: hidden;
  padding: var(--space-xs) 0 var(--space-sm);
  /* no transition — instant expand/collapse per user request */
  width: var(--rail-width);
  z-index: 50;
}

.rail-destinations {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2xs);
}

.rail-footer {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  margin-top: auto;
  padding-block: var(--space-xs) var(--space-2xs);
}

/* Collapsed destination: icon pill over label, 64dp tall in all. */
.rail-destination {
  align-items: center;
  color: var(--material-color-on-surface-variant);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: 6px 0;
  text-decoration: none;
  width: 100%;
}

/*
 * Logout is a form submission, not a link: a GET logout is triggerable by any
 * <img> tag on any page. The button carries .rail-destination so it reads
 * identically to the anchors beside it, and needs only the UA button styles
 * reset to match them.
 */
.rail-logout {
  display: flex; /* so the button is a flex item and hugs like the anchors */
  flex-direction: column;
}

button.rail-destination {
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
}

.rail-destination:hover {
  color: var(--material-color-on-surface);
  text-decoration: none;
}

.rail-destination:focus-visible {
  outline: none; /* the ring is drawn on the pill, below */
}

/* The active indicator while collapsed, and the anchor for its state layer. */
.rail-icon-container {
  align-items: center;
  border-radius: var(--material-shape-full);
  display: flex;
  flex-shrink: 0;
  height: 32px;
  justify-content: center;
  position: relative;
  transition: background var(--material-duration-short-4) var(--material-ease-standard);
  width: 56px;
  --icon-size: 24px;
}

.rail-destination:focus-visible .rail-icon-container {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

.rail-label {
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
  text-align: center;
  white-space: nowrap;
}

.rail-destination[aria-current] {
  color: var(--material-color-secondary);
}

.rail-destination[aria-current] .rail-icon-container {
  background: var(--material-color-secondary-container);
  color: var(--material-color-on-secondary-container);
}

/* State layer: the content color over whichever box is the indicator — the
   icon pill while collapsed, the whole row once expanded (below). */
.rail-icon-container::before,
.bar-icon-container::before,
.navigation-rail:is(.expanded, .open) .rail-destination::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

:is(.rail-destination, .bar-destination):hover :is(.rail-icon-container, .bar-icon-container)::before,
.navigation-rail:is(.expanded, .open) .rail-destination:hover::before {
  opacity: var(--material-state-hover);
}

:is(.rail-destination, .bar-destination):focus-visible :is(.rail-icon-container, .bar-icon-container)::before,
.navigation-rail:is(.expanded, .open) .rail-destination:focus-visible::before {
  opacity: var(--material-state-focus);
}

:is(.rail-destination, .bar-destination):active :is(.rail-icon-container, .bar-icon-container)::before,
.navigation-rail:is(.expanded, .open) .rail-destination:active::before {
  opacity: var(--material-state-pressed);
}

/*
 * Expanded layout. It follows the class, not the viewport: a user-collapsed
 * rail must keep the stacked layout at every width, and a media query that
 * pinned the layout at lg+ would silently outrank the toggle. Wide viewports
 * still *start* expanded — layout.html seeds the nav store's ytNavExpanded state
 * from the viewport when no preference is stored.
 *
 * .open is the same rail raised as the mobile drawer (below); it shares this
 * layout whatever the stored expand state, because a drawer of bare icons
 * would defeat the point of opening it.
 */
.navigation-rail:is(.expanded, .open) {
  --rail-width: var(--rail-width-expanded);
  overflow-y: auto;
  padding-inline: 20px;
  /* Reserve the scrollbar gutter whether or not it is visible, so the label
     column keeps one width and the rail never reflows when it appears. */
  scrollbar-gutter: stable;
}

.navigation-rail:is(.expanded, .open) .rail-destination {
  align-self: flex-start;
  border-radius: var(--material-shape-full);
  flex-direction: row;
  gap: var(--space-xs);
  height: 56px;
  padding: 0 var(--space-md);
  position: relative;
  width: auto;
}

/* The row is the indicator now; the icon pill shrinks to the bare icon. */
.navigation-rail:is(.expanded, .open) .rail-icon-container {
  background: none;
  height: 24px;
  outline: none;
  width: 24px;
}

.navigation-rail:is(.expanded, .open) .rail-icon-container::before {
  content: none;
}

.navigation-rail:is(.expanded, .open) .rail-label {
  font: var(--material-type-label-large);
  letter-spacing: var(--material-tracking-label-large);
}

.navigation-rail:is(.expanded, .open) .rail-destination[aria-current] {
  background: var(--material-color-secondary-container);
  color: var(--material-color-on-secondary-container);
}

.navigation-rail:is(.expanded, .open) .rail-destination:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* ─── Navigation Bar (mobile, < 600px) ──────────────────────────────────── */

.navigation-bar {
  align-items: center;
  background: var(--material-color-surface-container);
  bottom: 0;
  display: flex; /* mobile: visible; hidden at the sm breakpoint below */
  /*
   * Keep the 64dp content region (--material-nav-bar-height), but grow the box
   * and pad the bottom by the device safe-area inset (home indicator / gesture
   * bar) so destinations never crowd the physical screen edge. Falls back to
   * 0px where no inset exists. Requires viewport-fit=cover on the viewport
   * meta for env() to resolve non-zero.
   */
  height: calc(var(--material-nav-bar-height) + env(safe-area-inset-bottom, 0px));
  justify-content: space-around;
  left: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  position: fixed;
  right: 0;
  z-index: 100;
}

/* 6 + 32 (pill) + 4 + 16 (label) + 6 = the bar's 64dp. */
.bar-destination {
  align-items: center;
  color: var(--material-color-on-surface-variant);
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2xs);
  padding: 6px 0;
  text-decoration: none;
}

.bar-destination:hover {
  color: var(--material-color-on-surface);
  text-decoration: none;
}

.bar-destination:focus-visible {
  outline: none; /* the ring is drawn on the pill */
}

.bar-destination:focus-visible .bar-icon-container {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

.bar-destination[aria-current] {
  color: var(--material-color-secondary);
}

.bar-destination[aria-current] .bar-icon-container {
  background: var(--material-color-secondary-container);
  color: var(--material-color-on-secondary-container);
}

/* The active indicator: the same 56×32dp pill as the collapsed rail. */
.bar-icon-container {
  align-items: center;
  border-radius: var(--material-shape-full);
  display: flex;
  height: 32px;
  justify-content: center;
  position: relative;
  width: 56px;
  --icon-size: 24px;
}

.bar-label {
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
}

/* ─── Responsive Visibility (mobile-first) ──────────────────────────────── */

/*
 * Mobile base (above): the bottom navigation bar is shown and the rail hidden.
 * sm breakpoint: 600px — the rail replaces the bottom bar on tablet & up.
 */
@media (min-width: 600px) {
  .navigation-rail {
    display: flex;
  }

  .navigation-bar {
    display: none;
  }
}

/* ─── Navigation Toggle (hosted by the top app bar's leading slot) ───────── */

/*
 * The toggle writes this component's signal, so the drawer owns both its markup
 * and its styling; the bar only positions it. At < 600px it opens the mobile
 * navigation modal (the rail is hidden there); at the sm breakpoint and up it
 * expands/collapses the rail. One button, both surfaces.
 */
/*
 * The app bar spec sizes leading and trailing icon buttons at 48dp, so the
 * toggle uses the bar's icon container size, not the rail's.
 *
 * The toggle's glyph sits on the rail's icon axis, so the menu icon lines up
 * with the destination icons beneath it in both rail states (and with the
 * mobile drawer's). That axis is the center of the collapsed rail — 48dp
 * with a 96dp rail. The margin is what is left after half the button (24dp)
 * and the app bar's own 4dp leading padding: 48 − 24 − 4 = 20dp. It is
 * written from the tokens so a rail-width change keeps the alignment; the
 * 4dp is appbar.css's padding-inline and must change with it.
 */
.nav-toggle {
  align-items: center;
  background: transparent;
  border: none;
  border-radius: var(--material-shape-full);
  color: var(--material-color-on-surface-variant);
  cursor: pointer;
  display: flex; /* visible on every surface; the click behavior splits by width */
  flex-shrink: 0;
  height: var(--icon-container-appbar);
  justify-content: center;
  margin-left: calc(var(--rail-width-collapsed) / 2 - var(--icon-container-appbar) / 2 - var(--space-2xs));
  position: relative; /* anchors the ::before state layer */
  width: var(--icon-container-appbar);
  --icon-size: 24px;
}

/* State layer — the content color at the hover/focus/pressed opacity. */
.nav-toggle::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

.nav-toggle:hover::before {
  opacity: var(--material-state-hover);
}

.nav-toggle:focus-visible::before {
  opacity: var(--material-state-focus);
}

.nav-toggle:active::before {
  opacity: var(--material-state-pressed);
}

/* M3 accessibility: focus indicators on app bar controls. */
.nav-toggle:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* ─── Mobile Navigation Modal (< 600px) ──────────────────────────────────── */

/*
 * Mobile navigation drawer (< 600px): the appbar hamburger raises the rail as
 * a full-height drawer over a backdrop — the spec's remedy for a bar with
 * more than five destinations, in the shape YouTube and m3.material.io use.
 * The drawer reuses the rail's own markup (every destination, overflow ones
 * included, plus the footer logout) instead of a second list to keep in sync.
 *
 * The nav store's ytMobileNavOpen state drives both surfaces: :class lands
 * the .open class on the rail, x-show toggles the backdrop's display.
 * Neither is persisted — a drawer left open on a phone must not reopen on the
 * next visit, unlike the rail's expand state (which is stored).
 *
 * Stacking while open: rail (200) > backdrop (150) > bottom bar (100). The
 * backdrop and drawer both start below the appbar (top: top-bar-height), so
 * the hamburger stays on top and remains the toggle.
 */
.nav-backdrop {
  background: var(--material-scrim);
  bottom: 0;
  display: block;
  left: 0;
  position: fixed;
  right: 0;
  top: var(--material-top-bar-height);
  z-index: 150;
}

@media (min-width: 600px) {
  .nav-backdrop {
    display: none;
  }
}

/*
 * Scroll lock: while the drawer is open the body carries yt-nav-drawer-open
 * (layout.html binds the class from the same signal that opens the drawer).
 * Freezing the page's own scroll container stops the background page from
 * scrolling under the scrim mid-gesture — the classic mobile "rubber band
 * behind the drawer" artifact. Closing the drawer removes the class and the
 * page resumes exactly where it was.
 */
body.yt-nav-drawer-open .page-content {
  overflow: hidden;
}

/*
 * The mobile base hides the rail; .open re-shows it as a fixed, full-height,
 * left-anchored drawer. The expanded (labelled, row) layout comes from the
 * shared :is(.expanded, .open) rules above; only the drawer's own placement
 * and surface live here, scoped to <600px so the desktop rail is untouched.
 */
@media (max-width: 599px) {
  .navigation-rail.open {
    /* M3: a modal navigation surface sits on surface-container. */
    background: var(--material-color-surface-container);
    border-right: 1px solid var(--material-color-outline-variant);
    box-shadow: var(--material-elevation-4);
    display: flex;
    /* Dynamic viewport, with the static fallback: on phones with a
       collapsible URL bar, 100vh is the *largest* viewport, so the drawer's
       bottom (the footer logout) would render below the visible fold.
       100dvh tracks the visible area as the bar shows and hides. */
    height: calc(100vh - var(--material-top-bar-height));
    height: calc(100dvh - var(--material-top-bar-height));
    /* The drawer's own scroll must not chain into the page behind the
       scrim — that rubber-bands the background mid-gesture. */
    overscroll-behavior: contain;
    left: 0;
    position: fixed;
    top: var(--material-top-bar-height);
    width: min(var(--rail-width-expanded), 85vw);
    z-index: 200;
  }
}


/* appbar.css — Material 3 Top App Bar (M3 Expressive) */
/* Owned by package appbar; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset — declared by each variant's Requires(). */

/*
 * The bar places itself into the shell's "appbar" grid area. The grid that
 * defines that area belongs to layout.css; only the element's own placement
 * lives here.
 *
 * The leading slot is a flex child like the headline, so whatever a
 * navigation component renders into it aligns without the bar knowing what
 * it is.
 *
 * M3 Expressive ships four variants — small (64dp), medium flexible
 * (112dp), large flexible (120dp), and search (64dp). All share: flat color
 * (no stroke, no shadow), surface at rest, surface container on scroll.
 * layout.html toggles .scrolled on the bar's own scroll offset.
 *
 * The flexible variants hug their text: the icons keep a row at the top and
 * the headline block takes a full-width row beneath, so the bar grows when a
 * subtitle appears.
 */
.app-bar {
  align-items: center;
  background: var(--material-color-surface);
  display: flex;
  grid-area: appbar;
  min-height: var(--material-top-bar-height);
  /* M3 spec: 4dp at each end; the 48dp icon buttons supply the rest. */
  padding-inline: var(--space-2xs);
  z-index: 40;
}

.app-bar.scrolled {
  background: var(--material-color-surface-container);
}

/* Shared text block: headline plus optional subtitle. flex:1 lets trailing
   actions sit at the container's end. 12px past the 4px container padding
   puts the text 16dp from the edge, matching the spec diagrams. */
.app-bar-text {
  flex: 1;
  margin-inline: 12px;
  min-width: 0;
}

.app-bar-headline {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar-subtitle {
  color: var(--material-color-on-surface-variant);
  margin: 0;
}

/* --- Small: 64dp, one-line headline (Title Large) --- */

.app-bar-small {
  height: var(--material-top-bar-height);
}

.app-bar-small .app-bar-headline {
  font: var(--material-type-title-large);
  letter-spacing: var(--material-tracking-title-large);
  white-space: nowrap;
}

/* Subtitle on the small bar: Label Medium — fits the fixed 64dp. */
.app-bar-small .app-bar-subtitle {
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
}

/* --- Flexible (medium 112dp, large 120dp): two rows, hugs its text --- */

/*
 * The icons keep a 64dp row at the top (8 + 48 + 8) and the text block wraps
 * onto a row of its own beneath, the full width of the bar. The markup is the
 * same flat list the small bar uses — leading, text, trailing — so the two
 * rows are made with wrapping and order rather than wrappers:
 *
 *   order -1  the leading slot (the first child, when it is not the text)
 *   order  0  a ::before spacer, then the trailing actions it pushes right
 *   order  1  the text, forced onto the next line by its 100% basis
 *
 * align-content keeps the icon row at the top and the text at the bottom when
 * min-height is taller than the two rows, e.g. a bar with no icons at all.
 */
.app-bar-medium,
.app-bar-large {
  align-content: space-between;
  flex-wrap: wrap;
  padding-block: var(--space-xs) var(--space-sm);
}

.app-bar-medium {
  min-height: 112px;
}

.app-bar-large {
  min-height: 120px;
}

:is(.app-bar-medium, .app-bar-large)::before {
  content: "";
  flex: 1;
}

:is(.app-bar-medium, .app-bar-large) > :first-child:not(.app-bar-text) {
  order: -1;
}

:is(.app-bar-medium, .app-bar-large) > .app-bar-text {
  flex-basis: 100%;
  /* The icon row is 48dp of button plus the bar's 8dp top padding; 8dp more
     completes its 64dp before the text begins. */
  margin-top: var(--space-xs);
  order: 1;
}

/* Medium: Headline Medium, subtitle Label Large. */
.app-bar-medium .app-bar-headline {
  font: var(--material-type-headline-medium);
  letter-spacing: var(--material-tracking-headline-medium);
}

.app-bar-medium .app-bar-subtitle {
  font: var(--material-type-label-large);
  letter-spacing: var(--material-tracking-label-large);
}

/* Large: Display Small, subtitle Title Medium. */
.app-bar-large .app-bar-headline {
  font: var(--material-type-display-small);
  letter-spacing: var(--material-tracking-display-small);
}

.app-bar-large .app-bar-subtitle {
  font: var(--material-type-title-medium);
  letter-spacing: var(--material-tracking-title-medium);
}

/* --- Search: 64dp, a hinted search field in place of the headline --- */

.app-bar-search .app-bar-search-field {
  align-items: center;
  background: var(--material-color-surface-container);
  border-radius: var(--material-shape-full);
  display: flex;
  flex: 1;
  height: 40px;
  margin-inline: 12px; /* 16dp from the edge, like the text block */
  min-width: 0;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

/* Hint text: Body Large, on surface variant. */
.app-bar-search-hint {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-large);
  letter-spacing: var(--material-tracking-body-large);
}

/* On scroll the field steps up a surface role. */
.app-bar-search.scrolled .app-bar-search-field {
  background: var(--material-color-surface-container-highest);
}


/* dialog.css — Material 3 Dialog (native <dialog>) */
/* Owned by package dialog; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset, buttons — declared by Confirm.Requires(). */

/*
 * Built on the native element, so the browser owns centring (via its default
 * modal positioning), the focus trap, Esc-to-close, and the backdrop. There is
 * no .dialog-overlay: ::backdrop replaces it, and nothing here re-implements
 * behavior the element already provides.
 *
 * The UA stylesheet gives <dialog> a border and a fixed max-width; both are
 * reset here so the M3 surface tokens govern the look.
 */
.dialog {
  background: var(--material-color-surface-container-high);
  border: none;
  border-radius: var(--material-shape-extra-large);
  /* M3 spec: dialogs rest at elevation level 3. */
  box-shadow: var(--material-elevation-3);
  color: var(--material-color-on-surface);
  max-width: 560px; /* M3 spec: 280–560dp wide */
  min-width: 280px;
  padding: var(--space-lg);
  text-align: left;
}

/* A closed <dialog> is display:none in the UA stylesheet; keep it that way
   regardless of the display value the rules above imply. */
.dialog:not([open]) {
  display: none;
}

.dialog::backdrop {
  background: var(--material-scrim);
}

/* Supporting text: Body Medium, on-surface-variant. */
.dialog p {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  margin: 0 0 var(--space-lg);
}

.dialog .button-group {
  justify-content: flex-end;
}


/* login.css — Login card shell */
/* Owned by package login; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset, cards, buttons, forms, banners, icons —
   declared by Card.Requires(). */

.login-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100%;
}

.card.login-card {
  max-width: 400px;
  padding: var(--space-xl);
  width: 100%;
}

.login-footer {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-md);
}

.login-footer a {
  color: var(--material-color-primary);
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
}


/* badge.css — Material 3 Badges */
/* Owned by package badge; folded into the bundle via style.WithComponent. */
/* Dependencies: tokens, reset — declared by Badge.Requires(). */

/*
 * M3 spec:
 *   - Small badge: 6dp circle dot (3dp corner radius), no text.
 *     Indicates an unread notification or status change.
 *   - Large badge: pill with label up to four characters, height 16dp,
 *     max width for four chars ~34dp, corner radius 8dp.
 *   - Color: Error background, On error label text (Label Small).
 *
 * Badges are anchored inside an icon's bounding box at the upper trailing
 * edge. The parent component (e.g., navrail) handles positioning; badge.css
 * only defines size/shape/color.
 */

/* Small badge — dot variant */
.badge.small {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%; /* circular per spec: 3dp radius on 6dp diameter */
  background-color: var(--material-color-error);
}

/* Large badge — pill variant with label */
.badge.large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 16px;
  padding: 0 4px;
  border-radius: 8px; /* M3 spec: Large badge shape = 8dp corner radius */
  background-color: var(--material-color-error);
  color: var(--material-color-on-error);
  font: var(--material-type-label-small);
  letter-spacing: var(--material-tracking-label-small);
  white-space: nowrap;
}


/* chip.css — Material 3 Chips */
/* Owned by package chip; folded into the bundle via style.WithComponent(chip.Chip{}). */
/* Dependencies: tokens, reset — declared by Chip.Requires(). */

/* M3 spec highlights:
 * - Height 32dp, 8dp corner radius (a rounded rectangle, not a pill).
 * - Label Large; 16dp horizontal padding, 8dp on a side that holds an icon;
 *   8dp between elements; icons are 18dp.
 * - Every variant rests flat and outlined (outline-variant, no fill). A
 *   selected filter or input chip fills with secondary-container and drops
 *   the outline.
 * - Assist chips carry an on-surface label and a primary leading icon; the
 *   other variants use on-surface-variant throughout.
 * - Default elevation is 0; only elevate when placed on complex backgrounds.
 */

/* Base chip container — shared across all variants. Every variant is a real
   <button>, so normalize the UA button font and give it a pointer cursor.
 *
 * vertical-align: middle is load-bearing when chips share a text line in a
 * block container: inline-level boxes align by baseline, and a flex
 * container's baseline chains to its first in-flow item. A chip whose lead
 * is a Material Icons ligature (icon fonts sit lower than the text
 * baseline) would be lifted several pixels relative to text-led siblings.
 * Aligning on the center keeps same-line chips on one visual row. */
.chip {
  align-items: center;
  background: none;
  border: 1px solid var(--material-color-outline-variant);
  border-radius: var(--material-shape-small);
  color: var(--material-color-on-surface-variant);
  cursor: pointer;
  display: inline-flex;
  font: var(--material-type-label-large);
  gap: var(--space-xs);
  letter-spacing: var(--material-tracking-label-large);
  min-height: 32px;
  padding: 0 var(--space-md);
  position: relative; /* anchors the ::before state layer */
  user-select: none;
  vertical-align: middle;
  white-space: nowrap;
  /* M3 spec: chip icons are 18dp — the global .icon default is 24dp. */
  --icon-size: 18px;
}

/* A side that holds an icon pads 8dp instead of 16dp. */
.chip:has(> .chip-icon) {
  padding-left: var(--space-xs);
}

.chip:has(> .chip-trailing) {
  padding-right: var(--space-xs);
}

.chip:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* State layer — the content color at the hover/focus/pressed opacity. */
.chip::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3) var(--material-ease-standard);
}

.chip:hover::before {
  opacity: var(--material-state-hover);
}

.chip:focus-visible::before {
  opacity: var(--material-state-focus);
}

.chip:active::before {
  opacity: var(--material-state-pressed);
}

/* M3 disabled: content at 38%, outline at 12%, no state layer. */
.chip:disabled {
  border-color: color-mix(in srgb, var(--material-color-on-surface) 12%, transparent);
  color: color-mix(in srgb, var(--material-color-on-surface) 38%, transparent);
  cursor: default;
}

.chip:disabled::before {
  content: none;
}

/* Assist — the label steps up to on-surface and the leading icon to primary. */
.chip.assist {
  color: var(--material-color-on-surface);
}

.chip.assist:not(:disabled) .chip-icon {
  color: var(--material-color-primary);
}

/* Selected (filter, input) — filled, no outline. */
.chip.selected {
  background: var(--material-color-secondary-container);
  border-color: transparent;
  color: var(--material-color-on-secondary-container);
}

/* Leading and trailing icon slots */
.chip-icon,
.chip-trailing {
  align-items: center;
  display: inline-flex;
  flex-shrink: 0;
  height: 18px;
  justify-content: center;
  width: 18px;
}

/* Selected filter checkmark — drawn as a mask in the content color, so the
   chip needs no icon font for it. */
.chip-check::after {
  background: currentColor;
  content: "";
  height: 18px;
  mask: var(--material-icon-check) center / contain no-repeat;
  width: 18px;
}


/* schedule.css — Admin schedule board */
/* Dependencies: tokens, reset, chip */

/*
 * Lane view: a tall Unassigned deck on the left, one lane per technician on
 * the right, each lane holding Mon–Sun day cells that scroll horizontally.
 *
 * Surfaces are layered by tone, not by shadow — the M3 tonal ladder
 * page → lane → day cell → card (raised containers step up, day cells step
 * down into the lane) reads correctly in both light and dark schemes, where
 * a dark-theme shadow would be nearly invisible.
 *
 * The board is the one full-bleed page in the app: yttrium constrains main
 * to a 1200px content column (a prose readability default) and pads it with
 * its standard gutter, but the board needs the whole viewport and supplies
 * its own. This rule only fires where .schedule-board exists.
 */
main:has(.schedule-board) {
  /* The board owns its own gutter (.schedule-board padding); main's standard
     inline padding would double it, so zero the inline half here. */
  max-width: none;
  padding-inline: 0;
}

.schedule-board {
  /* One card width for the whole board: tray cards and lane cards share it so
     a pool reads as the same object wherever it sits. Lane day cells add the
     day-body well's padding (2×4px) + border (2×1px) around that width. */
  --pool-card-width: 150px;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-md);
}

/* Page header — standard splysher page pattern: large title + subtitle.
   The board body fills the rest of the viewport below it. */
.schedule-header {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Week navigation — one row: ‹ Today  date range  ›. The range sits inline
   between the controls so the whole thing reads as a single unit; it wraps
   under on narrow screens. */

.week-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.week-range {
  margin-inline: var(--space-2xs);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  color: var(--material-color-on-surface-variant);
  white-space: nowrap;
}

.week-btn {
  position: relative; /* anchors the ::before state layer */
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  color: var(--material-color-on-surface-variant);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--material-shape-full);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
}

/* State layer — the label color at the M3 hover opacity. */
.week-btn::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: -1px; /* cover the transparent border too */
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.week-btn:hover::before {
  opacity: var(--material-state-hover);
}

/* Today — a visible M3 outlined pill, not bare text: Google Calendar's
   Today is an outlined button, and a borderless pill reads as a label here.
   The chevrons stay borderless icon buttons. */

.week-btn.week-today {
  border-color: var(--material-color-outline);
  color: var(--material-color-on-surface);
  font-weight: 500;
}

.week-btn.week-today:hover {
  border-color: var(--material-color-outline);
}

/* Filter bar */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}

/* Technician filter chips container */

.tech-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  overflow-x: auto;
  padding-block: var(--space-3xs);
  max-width: 100%;
}

@media (max-width: 600px) {
  .tech-filters {
    flex-wrap: nowrap;
  }
}

/* Board — the Unassigned deck sits above the technician lanes at every width.
   It is sticky under the app bar so a drag from the tray can reach any lane
   without scrolling back up (the property the old left-rail layout provided). */

.board-layout {
  display: grid;
  /* Single column: the deck is a full-width band above the lanes at every
     width, so day cells get the whole viewport on phones. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-md);
}

/* Unassigned tray — a static section above the lanes, scrolling with the
   page. A pinned band covers the lanes on scroll (and most of the screen on
   phones), and tap-to-place makes pinning unnecessary: the carry bar keeps
   the payload reachable without the tray itself staying put. Same surface
   step as a lane. */

.deck-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--material-shape-medium);
  background-color: var(--material-color-surface-container);
  overflow: hidden;
}

.deck-head {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  font: var(--material-type-title-small);
  letter-spacing: var(--material-tracking-title-small);
  color: var(--material-color-on-surface-variant);
  border-bottom: 1px solid var(--material-color-outline-variant);
}

/* The deck's filter box reuses .search-field but sits inside the header row, so
   it drops the page-level min-height and caps its width to what fits beside the
   "Unassigned" label. It binds the board's Alpine q state (see schedule-board.html). */
.deck-search {
  flex: 0 1 auto;
  max-width: 240px;
  min-height: 36px;
}

@media (max-width: 599px) {
  /* On a phone the header row is tight; let the box take whatever room is left. */
  .deck-search {
    flex: 1 1 auto;
    max-width: none;
  }
}

/* The tray body is now a wrapping row of cards (a horizontal band), not the
   old tall vertical column. Cards keep their day-cell width so they read as
   chips in the tray and wrap to further rows as unassigned grows. */

.deck-body {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: var(--space-xs);
  padding: var(--space-sm);
  /* Cap the section so a large backlog scrolls inside it instead of pushing
     the technician lanes far down the page. */
  max-height: min(40vh, 320px);
  max-height: min(40dvh, 320px);
  overflow-y: auto;
  border-radius: var(--material-shape-medium);
  /* No background: the panel behind it is the same tone a lane is, so the
     well must not paint a second step inside it — an empty deck would read
     as well-in-well where an empty lane reads as one well. Day bodies keep
     their -low well because a day cell is a direct child of the lane. */
  border: 1px dashed transparent;
  transition:
    background-color var(--material-duration-short-3)
      var(--material-ease-standard),
    border-color var(--material-duration-short-3) var(--material-ease-standard);
}

/* Cards in the tray sit side by side at the board's shared card width (they
   are width:100% inside day cells); they wrap rather than stretch to fill
   the band. */

.deck-body .pool-card {
  flex: 0 0 auto;
  width: var(--pool-card-width);
}

.deck-body.receptive {
  border-style: dashed;
  border-color: var(--material-color-primary);
}

.deck-body.drag-over {
  /* primary-container matches the .carrying card, so a drop target and its
     payload read as one system. */
  background-color: var(--material-color-primary-container);
  border-color: var(--material-color-primary);
  border-style: solid;
}

/* Right panel — technician lanes stacked vertically */

.lanes-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  /* Exactly one week: seven day cells, six gaps, the lane-days side padding.
     Lets lanes cap at the week's width on wide screens. */
  --week-width: calc(7 * 160px + 6 * var(--space-xs) + 2 * var(--space-md));
}

/* Lane — one technician as a contained Material-style card with day cells inside.
   Elevation comes from tone alone: one step above the page, no shadow. */

.lane {
  display: flex;
  flex-direction: column;
  /* Stop stretching past Sunday on wide screens; full-width (scrolling) on narrow ones. */
  width: min(100%, var(--week-width));
  border-radius: var(--material-shape-medium);
  background-color: var(--material-color-surface-container);
  overflow: hidden;
}

/* Tech name header — spans full width of the card */

.lane-head {
  padding: var(--space-sm) var(--space-md);
  /* title-small (500): no M3 type role uses weight 600. */
  font: var(--material-type-title-small);
  letter-spacing: var(--material-tracking-title-small);
  color: var(--material-color-on-surface);
  border-bottom: 1px solid var(--material-color-outline-variant);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.lane-route-link {
  position: relative; /* anchors the ::before state layer */
  color: var(--material-color-primary);
  text-decoration: none;
  padding: 4px;
  border-radius: var(--material-shape-full);
  display: inline-flex;
  align-items: center;
}

.lane-route-link::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.lane-route-link:hover::before {
  opacity: var(--material-state-hover);
}

.lane-route-link .icon {
  font-size: 18px;
}

/* Horizontal scroll container for day cells within a lane */

.lane-scroll {
  overflow-x: auto;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

/* Row of day cells — Mon through Sun */

.lane-days {
  display: flex;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  width: max-content;
  min-height: 56px;
}

/* Day cell — one vertical column within a lane */

.day-cell {
  flex-shrink: 0;
  /* Card width + the day-body well's padding and border. */
  width: calc(var(--pool-card-width) + 10px);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.day-head {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--material-shape-medium);
  /* One step above the lane so the header row of the grid reads clearly. */
  background-color: var(--material-color-surface-container-high);
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
  color: var(--material-color-on-surface-variant);
  text-align: center;
}

/* Day body — the drop target area within a day cell */

.day-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-height: 48px;
  overflow-y: auto;
  padding: var(--space-2xs);
  border-radius: var(--material-shape-medium);
  /* Inset one step below the lane: the day cells are wells the cards sit in,
     so even an empty week shows the seven-column grid. */
  background-color: var(--material-color-surface-container-low);
  border: 1px solid var(--material-color-outline-variant);
  transition:
    background-color var(--material-duration-short-3)
      var(--material-ease-standard),
    border-color var(--material-duration-short-3) var(--material-ease-standard);
}

.day-body.receptive {
  border-style: dashed;
  border-color: var(--material-color-primary);
}

.day-body.drag-over {
  /* primary-container matches the .carrying card, so a drop target and its
     payload read as one system. */
  background-color: var(--material-color-primary-container);
  border-color: var(--material-color-primary);
  border-style: solid;
}

/* Scrollbars */

.lane-scroll::-webkit-scrollbar,
.day-body::-webkit-scrollbar,
.deck-body::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.lane-scroll::-webkit-scrollbar-thumb,
.day-body::-webkit-scrollbar-thumb,
.deck-body::-webkit-scrollbar-thumb {
  background-color: var(--material-color-outline-variant);
  border-radius: var(--material-shape-full);
}

/* Pool card — wrapper div with button inside (select cannot go in a button).
   Sits one step above the day-body well it lives in. No accent stripe: the
   stop-order chip is the only primary touch on a card, which keeps the drag
   affordances (primary drop states) from competing with card identity. */

.pool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  width: 100%;
  min-height: 64px;
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--material-shape-medium);
  background-color: var(--material-color-surface-container-highest);
  color: var(--material-color-on-surface);
  transition:
    box-shadow var(--material-duration-short-3) var(--material-ease-standard),
    opacity var(--material-duration-short-3) var(--material-ease-standard);
}

/* State layer — the label color at the M3 hover opacity. */
.pool-card::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.pool-card:hover {
  /* Deliberate exception to the board's tone-only rule: the card is the one
     element that lifts, so it earns a hover elevation. */
  box-shadow: var(--material-elevation-4);
}

.pool-card:hover::before {
  opacity: var(--material-state-hover);
}

.pool-card.dragging {
  opacity: 0.38;
}

/* Tap-to-place equivalent of a drag in flight */
.pool-card.carrying {
  background-color: var(--material-color-primary-container);
  color: var(--material-color-on-primary-container);
  outline: 2px solid var(--material-color-primary);
  outline-offset: -2px;
}

.pool-card.carrying .pool-address,
.pool-card.carrying .pool-customer {
  color: inherit;
}

/* Card body button — the draggable/tappable part */
.pool-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2xs);
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: grab;
}

.pool-card-body:focus-visible {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

.pool-card-body:active {
  cursor: grabbing;
}

/* Stop order within a day — an M3 assist chip: the sequence is driving order
   (1 → 2 → 3), not a status, so primary-container is the right emphasis. */
.pool-order {
  flex-shrink: 0;
  align-self: flex-start;
  min-width: 20px;
  padding: 1px 5px;
  border-radius: var(--material-shape-full);
  background-color: var(--material-color-primary-container);
  color: var(--material-color-on-primary-container);
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.pool-card.carrying .pool-order {
  color: inherit;
}

.pool-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  min-width: 0;
  flex: 1;
}

/* Address and customer clip rather than wrap to keep card heights consistent */
.pool-address,
.pool-customer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-address {
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
  color: var(--material-color-on-surface);
}

.pool-customer {
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  color: var(--material-color-on-surface-variant);
}

/* Technician selector below card content */
.tech-select {
  flex-shrink: 0;
  min-width: 80px;
  max-width: 120px;
  padding: var(--space-3xs) var(--space-2xs);
  border-radius: var(--material-shape-full);
  background-color: color-mix(in srgb, currentcolor 6%, transparent);
  color: inherit;
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  cursor: pointer;
}

.tech-select:focus {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

/* Drop target area on each card — captures drag events for insert-at-position */
.pool-card-drop {
  position: absolute;
  inset: -4px;
  z-index: 1;
  pointer-events: none; /* let clicks pass through to the button below */
}

/* Carry bar — tap-to-place status line */
.carry-bar {
  position: fixed;
  inset-inline: var(--space-md);
  bottom: 88px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  border-radius: var(--material-shape-extra-small);
  background-color: var(--material-color-inverse-surface);
  color: var(--material-color-inverse-on-surface);
  /* The carry bar is a lifted status line, not a board surface — it keeps
     its elevation. */
  box-shadow: var(--material-elevation-4);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
}

.carry-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carry-cancel {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 var(--space-sm);
  border: none;
  border-radius: var(--material-shape-full);
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--material-color-inverse-primary);
  cursor: pointer;
}

.carry-cancel:hover {
  background-color: color-mix(
    in srgb,
    var(--material-color-inverse-primary) 12%,
    transparent
  );
}

/* sm breakpoint: 600px */
@media (min-width: 600px) {
  .carry-bar {
    inset-inline: auto var(--space-lg);
    bottom: var(--space-lg);
    min-width: 320px;
  }
}

/* lg breakpoint: 1240px — columns wide enough to show most of the week */
@media (min-width: 1240px) {
  /* Make tech selector more compact on wider screens */
  .tech-select {
    min-width: 70px;
    max-width: 100px;
  }
}

/* ---------------------------------------------------------------------------
   New customer — optional pool rows
--------------------------------------------------------------------------- */

/* The form stacks two cards and a footer button; give the block rhythm. */
.customer-new {
  display: grid;
  gap: var(--space-md);
}

/* One row per pool being added alongside the customer. */
.pool-rows {
  display: grid;
  gap: var(--space-md);
}

/* Row: fields on the left, remove button pinned to the right. */
.pool-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

/* "Pool" label above the row's fields. */
.pool-row-title {
  margin: 0 0 var(--space-xs);
  /* title-small: the old 13px/600 was off the M3 scale entirely. */
  font: var(--material-type-title-small);
  letter-spacing: var(--material-tracking-title-small);
  color: var(--material-color-on-surface-variant);
}

/* The row's fields wrap under the title, so flex-grow past them. */
.pool-row > div {
  flex: 1;
}

/* Remove button sits at the row's top edge. */
.pool-row .button-icon {
  margin-top: var(--space-sm);
}


/* fab.css — screen-level FAB placement for Splysher pages.
 * The component (yttrium component/fab) owns the look; this page-level
 * class owns where it floats. M3 convention: 16dp from the right and
 * bottom screen edges. Below the sm breakpoint the fixed bottom
 * navigation bar (--material-nav-bar-height) plus safe-area inset sits
 * below it, so the FAB rides above it there. */
.fab-dock {
  bottom: var(--space-md);
  position: fixed;
  right: var(--space-md);
  z-index: 45; /* above content (appbar is 40), below menus (59/60) and the rail (50+) */
}

@media (max-width: 599px) {
  .fab-dock {
    bottom: calc(
      var(--material-nav-bar-height) + var(--space-md) +
        env(safe-area-inset-bottom, 0px)
    );
  }
}


/* service-record.css — Log Service form layout. The switch component
 * (yttrium component/switches) is inline-flex by design, which suits a
 * lone boolean field; a group of them needs a vertical stack. */
.switch-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Quantity stepper: [-] value [+] for chemical quantities. */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.stepper-btn {
  /* M3 minimum touch target (48dp); no token exists for it, so the literal
     is deliberate — rem math would give 42px at the app's 14px root. */
  width: 48px;
  height: 48px;
  border: 1px solid var(--material-color-outline);
  background: var(--material-color-surface-container-low);
  color: var(--material-color-on-surface);
  font-size: 20px; /* M3 icon size */
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stepper-btn:first-child {
  border-radius: var(--material-shape-small) 0 0 var(--material-shape-small);
}

.stepper-btn:last-child {
  border-radius: 0 var(--material-shape-small) var(--material-shape-small) 0;
}

.stepper-value {
  width: 4rem;
  text-align: center;
  border-left: none;
  border-right: none;
  border-radius: 0;
}


/* chemistry.css — pool profile "Chemical health" status chips. Each reading is
 * judged against its target band (lib.Band); the chip carries that verdict so
 * a glance answers "is this in balance?" without parsing raw numbers. Colors
 * reuse yttrium's non-standard M3 success/warning/error roles: in-range is not
 * an error, low/high are attention states, and "none" stays neutral outline. */

.chem-status {
  display: inline-block;
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--material-shape-full);
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
}

.chem-in {
  background-color: var(--material-color-success-container);
  color: var(--material-color-on-success-container);
}

.chem-low,
.chem-high {
  background-color: var(--material-color-warning-container);
  color: var(--material-color-on-warning-container);
}

.chem-none {
  background-color: transparent;
  border: 1px solid var(--material-color-outline-variant);
  color: var(--material-color-on-surface-variant);
}


/* dashboard.css — the owner dashboard's year-to-date figures.
 * The cards and their text levels are yttrium's (card-grid, .primary,
 * .secondary); this only tints the figure by what it means. The selectors
 * name .primary so they outrank yttrium's own color for it. */
.card-body .primary.figure-positive {
  color: var(--material-color-success);
}

.card-body .primary.figure-negative {
  color: var(--material-color-error);
}

.card-body .primary.figure-info {
  color: var(--material-color-primary);
}


/* settings.css — the Settings page's section rail. The page is one URL and one
 * handler; this splits its cards into a two-column layout with a sticky left
 * nav that links to each section by fragment. Below sm (600px) the rail
 * becomes a horizontal chip row above the content, so phones keep the grouping
 * without a permanent column. The active link is styled from aria-current —
 * the scroll-spy script in settings.html owns that attribute, so no class
 * name couples the CSS to the JS. */

.settings-layout {
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 600px) {
  .settings-layout {
    align-items: start;
    grid-template-columns: 180px minmax(0, 1fr);
  }

  /* The rail is a sticky sibling inside the scroll container (.page-content),
   * so it pins while its column scrolls and releases at the content's end. */
  .settings-nav {
    position: -webkit-sticky;
    position: sticky;
    top: var(--space-md);
  }
}

.settings-nav {
  display: flex;
  gap: var(--space-xs);
}

@media (min-width: 600px) {
  .settings-nav {
    flex-direction: column;
  }
}

/* The links are full-width tonal chips on mobile and a dense list on desktop.
 * State follows the M3 idiom elsewhere in the app: hover/press state layer at
 * currentColor, active destination as a primary-container tonal surface. */
.settings-link {
  align-items: center;
  background-color: transparent;
  border-radius: var(--material-shape-full);
  color: var(--material-color-on-surface-variant);
  display: inline-flex;
  font: var(--material-type-label-large);
  gap: var(--space-xs);
  letter-spacing: var(--material-tracking-label-large);
  min-height: 40px;
  padding: 8px var(--space-md);
  position: relative;
  text-decoration: none;
}

.settings-link::before {
  background-color: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  position: absolute;
  transition: opacity 120ms ease-out; /* state-layer cadence, matching app.css */
}

.settings-link:hover::before {
  opacity: var(--material-state-hover);
}

.settings-link:active::before {
  opacity: var(--material-state-pressed);
}

/* :has() keeps the active style declarative — the script only writes
 * aria-current, never a class. */
.settings-link:has([aria-current]) {
  background-color: var(--material-color-primary-container);
  color: var(--material-color-on-primary-container);
}

/* Data section import panel. The block's content is server-rendered and
 * swapped in by fetch (owner/data.go), so its classes live here with the rest
 * of the page rather than in a shared stylesheet. */
.import-result {
  margin-top: var(--space-md);
}

/* State markers on the swapped block. The error state doubles as the
 * destructive-action callout; success is a quiet positive confirmation. */
.import-error {
  background: var(--material-color-error-container);
  border-radius: var(--material-shape-small);
  color: var(--material-color-on-error-container);
  padding: var(--space-sm) var(--space-md);
}

.import-success {
  background: var(--material-color-primary-container);
  border-radius: var(--material-shape-small);
  color: var(--material-color-on-primary-container);
  padding: var(--space-sm) var(--space-md);
}

.import-source,
.import-note {
  color: var(--material-color-on-surface-variant);
  margin-bottom: var(--space-xs);
}

/* Warnings double as the destructive-action callout for replace mode. */
.import-warning {
  background: var(--material-color-error-container);
  border-radius: var(--material-shape-small);
  color: var(--material-color-on-error-container);
  padding: var(--space-sm) var(--space-md);
}

.import-result .button {
  margin-top: var(--space-sm);
}


/* support.css — the compact "supporting tenant X" chip that sits in the app bar's
 * trailing slot while a platform admin is scoped to a company. It replaces the old
 * full-width banner: one tonal pill names the tenant and current lens, and tapping
 * it opens a small menu (lens switcher + back-to-platform link). The markup is
 * self-contained Alpine from supportChip in ui.go; this file owns only its look. */

/* The wrapper anchors the absolutely-positioned menu to the chip's right edge.
   It is a flex child of .app-bar, so it sits at the bar's trailing end after the
   headline (see appbar.css). */
.support-chip {
  position: relative;
}

/* A tonal pill that reads as an informational indicator, not a primary action —
   secondary-container keeps it distinct from the page's real buttons. Sized to sit
   comfortably inside the fixed 64dp bar. */
.support-chip-toggle {
  align-items: center;
  background-color: var(--material-color-secondary-container);
  border-radius: var(--material-shape-full);
  color: var(--material-color-on-secondary-container);
  cursor: pointer;
  display: inline-flex;
  font: var(--material-type-label-large);
  gap: var(--space-2xs);
  letter-spacing: var(--material-tracking-label-large);
  min-height: 32px;
  padding: 4px var(--space-sm) 4px var(--space-xs);
  position: relative; /* anchors the ::before state layer */
}

.support-chip-toggle .icon {
  font-size: var(--icon-size-md, 18px);
}

/* The company name is user data and can be long; cap it so a wide tenant never
   pushes the headline off the bar. The lens label stays fixed-width-ish beside it. */
.support-chip-name {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chip-lens {
  color: var(--material-color-on-secondary-container);
  opacity: 0.8;
}

/* M3 state layer — the pill's own label colour at hover/press opacity, matching
   the idiom in app.css and settings.css. */
.support-chip-toggle::before {
  background-color: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.support-chip-toggle:hover::before {
  opacity: var(--material-state-hover);
}

.support-chip-toggle:active::before {
  opacity: var(--material-state-pressed);
}

/* The menu drops from the chip's right edge, below the bar. It must clear the bar
   (z-index 40) and stay inside the viewport on narrow screens — right-aligned so a
   long company name never pushes it off the left. */
.support-chip-menu {
  background-color: var(--material-color-surface-container-high);
  border-radius: var(--material-shape-medium);
  box-shadow: var(--material-elevation-2, 0 1px 3px rgba(0, 0, 0, 0.4));
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 15rem;
  padding: var(--space-sm);
  position: absolute;
  right: 0;
  top: calc(100% + var(--space-2xs));
  z-index: 60;
}

.support-chip-menu select {
  width: 100%;
}

/* The back-to-platform link reads as a menu item, not a page hyperlink. */
.support-chip-menu a {
  align-items: center;
  border-radius: var(--material-shape-full);
  color: var(--material-color-primary);
  display: inline-flex;
  font: var(--material-type-label-large);
  letter-spacing: var(--material-tracking-label-large);
  min-height: 40px;
  padding-inline: var(--space-sm);
  position: relative; /* anchors the ::before state layer */
  text-decoration: none;
}

.support-chip-menu a::before {
  background-color: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.support-chip-menu a:hover::before {
  opacity: var(--material-state-hover);
}

/* On a phone the bar is tight; let the chip's name shrink harder so the toggle and
   headline both fit. */
@media (max-width: 599px) {
  .support-chip-name {
    max-width: 6rem;
  }
}


/* app.css — small layout helpers used across Splysher's pages. Moved from
 * yttrium, which keeps only what Material 3 specifies or two or more
 * applications use. */
.flex-center {
  align-items: center;
  display: flex;
  justify-content: center;
}

.form-row {
  align-items: center;
  display: flex;
  gap: var(--space-sm);
}

/* Screen-reader-only label. yttrium defines no such utility and the name is a
 * de-facto convention, so it lives here (finding: settings.html referenced an
 * undefined .visually-hidden). Clip rather than display:none so assistive tech
 * still reads the text. */
.visually-hidden {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Helper/supporting text under a field or heading. Replaces the repeated
 * inline `style="margin:4px 0 0;font-size:.85rem"` hack across edit forms. */
.field-help {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  margin: 4px 0 0;
}

/* Supporting line under a page's app-bar headline (e.g. the route date). The
 * heading itself now lives in the app bar, so this sits at the top of the
 * content region as the page-level sibling of .field-help. */
.page-subtitle {
  color: var(--material-color-on-surface-variant);
  font: var(--material-type-body-small);
  letter-spacing: var(--material-tracking-body-small);
  margin: 0 0 var(--space-sm);
}

/* Inline action row (Edit / Delete) in a page header. Stacks full-width on a
 * phone, sits inline from the sm breakpoint up — yttrium's .card-actions does
 * this for cards; this is its page-header sibling. Replaces the repeated
 * `style="display:inline;margin-left:.5rem"` form wrappers. */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.header-actions form {
  display: inline;
}

/* A row of small icon actions inside a table cell, spaced for touch without an
 * inline margin hack. */
.row-actions {
  align-items: center;
  display: flex;
  gap: var(--space-xs);
}

/* Profile photo in a detail card. yttrium's .card-media is for full-bleed card
 * headers; these are inset thumbnails, so they get their own aspect-ratio box
 * that scales down on a phone instead of the fixed 320x240 inline style. */
.detail-photo {
  border-radius: var(--material-shape-medium);
  height: auto;
  max-height: 240px;
  max-width: min(100%, 320px);
  object-fit: cover;
}

/* Current-photo thumbnail inside an edit form. Same inset idea as .detail-
 * photo but sized for a form field, replacing the repeated inline
 * `max-width/max-height/border-radius` style on the upload previews. */
.form-thumb {
  border-radius: var(--material-shape-extra-small);
  max-height: 180px;
  max-width: 240px;
}

/* Inset sub-panel inside a card body — an add-new form or a per-role block on
 * the settings page. Replaces the repeated inline `background/padding/
 * border-radius` boxes with one tonal step below the card surface. */
.sub-panel {
  background: var(--material-color-surface-container-low);
  border-radius: var(--material-shape-small);
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
}

/* --- Shared list-page utilities ------------------------------------------ *
 * These were defined in schedule.css but are used across the owner, contractor,
 * and platform list pages (search toolbar, sortable headers, pager, empty
 * states), so they belong with the other app-wide helpers here. */

/* Search field built from tokens (yttrium's component/search is docs only) */
.search-field {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1 1 240px;
  min-width: 0;
  max-width: 420px;
  min-height: 48px;
  padding-inline: var(--space-md);
  border-radius: var(--material-shape-full);
  background-color: var(--material-color-surface-container-high);
  color: var(--material-color-on-surface);
}

.search-field:focus-within {
  outline: var(--material-focus-ring);
  outline-offset: var(--material-focus-ring-offset);
}

.search-icon {
  flex-shrink: 0;
  font-size: var(--icon-size-xl);
  color: var(--material-color-on-surface-variant);
}

.search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  /* body-large (16px): the M3 size that keeps mobile inputs from zooming. */
  font: var(--material-type-body-large);
  letter-spacing: var(--material-tracking-body-large);
  color: inherit;
}

.search-field input:focus {
  outline: none;
}

.search-field input::-webkit-search-cancel-button {
  display: none; /* replaced by .search-clear */
}

.search-clear,
.filter-clear {
  position: relative; /* anchors the ::before state layer */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  flex-shrink: 0;
  min-height: 40px;
  padding-inline: var(--space-sm);
  border: none;
  border-radius: var(--material-shape-full);
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--material-color-primary);
  cursor: pointer;
}

.search-clear {
  min-width: 40px;
  padding-inline: 0;
  color: var(--material-color-on-surface-variant);
}

/* State layer — each control's own label color at the M3 hover opacity. */
.search-clear::before,
.filter-clear::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.search-clear:hover::before,
.filter-clear:hover::before {
  opacity: var(--material-state-hover);
}

/* Sortable column headers — the link IS the header text; it must not look
   like a hyperlink (no underline, inherits the th's weight and alignment). */
.data-table th a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  color: inherit;
  text-decoration: none;
}

.data-table th a:hover {
  color: var(--material-color-primary);
}

/* Pager — prev/next under the table; hidden by the template when there is
   nothing to page through. */
.pager {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-block-start: var(--space-md);
}

.pager a,
.pager span {
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--material-shape-full);
  font: var(--material-type-body-medium);
  letter-spacing: var(--material-tracking-body-medium);
}

.pager a {
  position: relative; /* anchors the ::before state layer */
  color: var(--material-color-primary);
  text-decoration: none;
}

.pager a::before {
  background: currentColor;
  border-radius: inherit;
  content: "";
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity var(--material-duration-short-3)
    var(--material-ease-standard);
}

.pager a:hover::before {
  opacity: var(--material-state-hover);
}

.pager .pager-pos {
  color: var(--material-color-on-surface-variant);
}

/* Empty-state line for list pages and the schedule board. */
.empty-state,
.empty-inline {
  margin: 0;
  align-self: center;
  padding: var(--space-sm);
  font-size: 14px;
  color: var(--material-color-on-surface-variant);
}

/* --- Responsive data tables (finding #1) --------------------------------- *
 * yttrium's tables.css is a plain horizontal table with no breakpoint — per
 * its scope rule the mobile treatment is the application's to own. Below the
 * sm breakpoint we re-flow each row into a stacked card: every cell becomes a
 * block, and each cell prints its column header as a leading label via the
 * data-label attribute the templates set on <td>. This keeps the table markup
 * (and its sort links) intact for desktop while making it readable at 360px. */
@media (max-width: 599px) {
  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table thead {
    /* Visually hidden but kept for screen readers / column semantics. */
    border: 0;
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .responsive-table tr {
    border: 1px solid var(--material-color-outline-variant);
    border-radius: var(--material-shape-medium);
    margin-bottom: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
  }

  .responsive-table td {
    /* Cell becomes a label/value line; the header text comes from data-label. */
    border: 0;
    display: flex;
    gap: var(--space-sm);
    justify-content: space-between;
    padding: 2px 0;
    text-align: right;
  }

  .responsive-table td::before {
    color: var(--material-color-on-surface-variant);
    content: attr(data-label);
    font: var(--material-type-label-large);
    letter-spacing: var(--material-tracking-label-large);
    text-align: left;
  }

  /* A cell with no data-label (e.g. an actions-only cell) drops the empty
   * label and left-aligns its controls. */
  .responsive-table td:not([data-label]) {
    justify-content: flex-start;
    padding-top: var(--space-xs);
  }
}

/* For genuinely wide matrices that cannot stack (the RBAC permission grid), a
 * horizontal scroll container is the honest mobile affordance — a matrix has no
 * single sensible "primary" column to stack around. */
.table-scroll {
  -webkit-overflow-scrolling: touch;
  overflow-x: auto;
}

/* --- Status / role / count labels (finding #4) --------------------------- *
 * M3 reserves .badge for error signals; a status, role, or count is a label,
 * so it renders as a tonal pill. This mirrors the primary-container chip the
 * schedule board and chemistry readouts already use, in one place. */
.pill {
  background: var(--material-color-secondary-container);
  border-radius: var(--material-shape-small);
  color: var(--material-color-on-secondary-container);
  display: inline-block;
  font: var(--material-type-label-medium);
  letter-spacing: var(--material-tracking-label-medium);
  padding: var(--space-3xs) var(--space-xs);
}

.pill.pill-success {
  background: var(--material-color-primary-container);
  color: var(--material-color-on-primary-container);
}

.pill.pill-warning {
  background: var(--material-color-tertiary-container);
  color: var(--material-color-on-tertiary-container);
}

.pill.pill-error {
  background: var(--material-color-error-container);
  color: var(--material-color-on-error-container);
}

/* --- Permission matrix (finding #14) ------------------------------------- *
 * The role-permission grid is a dense resource×action matrix of M3 checkboxes.
 * It never stacks on mobile — the columns are the point — so it scrolls
 * horizontally (.table-scroll wraps it). Each cell centres its checkbox and
 * drops the label text (the aria-label carries it), keeping the matrix tight
 * while each box still meets the 48dp touch target the component provides. */
.perm-grid td.perm-cell {
  padding: 0;
  text-align: center;
}

.perm-grid .checkbox {
  justify-content: center;
}
