/* ===== css/tokens.css ===== */
/* ==========================================================================
   Material 3 Expressive — design tokens
   Color scheme matches the Figma "Material 3 Design Kit" (seed #904A42,
   Tonal Spot). Values are verified against the kit's M3/sys/light/* tokens.
   ========================================================================== */

:root {
  color-scheme: light;

  /* ---- Color: light ---- */
  --md-sys-color-primary: #904a42;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #ffdad5;
  --md-sys-color-on-primary-container: #73342d;
  --md-sys-color-secondary: #775652;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #ffdad5;
  --md-sys-color-on-secondary-container: #5d3f3b;
  --md-sys-color-tertiary: #715b2e;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #fddfa6;
  --md-sys-color-on-tertiary-container: #574419;
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #93000a;
  --md-sys-color-surface: #fff8f7;
  --md-sys-color-on-surface: #231918;
  --md-sys-color-surface-variant: #f5ddda;
  --md-sys-color-on-surface-variant: #534341;
  --md-sys-color-surface-dim: #e8d6d4;
  --md-sys-color-surface-bright: #fff8f7;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #fff0ee;
  --md-sys-color-surface-container: #fceae7;
  --md-sys-color-surface-container-high: #f6e4e2;
  --md-sys-color-surface-container-highest: #f1dedc;
  --md-sys-color-outline: #857370;
  --md-sys-color-outline-variant: #d8c2bf;
  --md-sys-color-inverse-surface: #392e2d;
  --md-sys-color-inverse-on-surface: #ffedea;
  --md-sys-color-inverse-primary: #ffb4aa;
  --md-sys-color-shadow: #000000;
  --md-sys-color-scrim: #000000;
  --md-sys-color-primary-fixed: #ffdad5;
  --md-sys-color-primary-fixed-dim: #ffb4aa;
  --md-sys-color-on-primary-fixed: #3b0906;
  --md-sys-color-on-primary-fixed-variant: #73342d;
  --md-sys-color-secondary-fixed: #ffdad5;
  --md-sys-color-secondary-fixed-dim: #e7bdb7;
  --md-sys-color-on-secondary-fixed: #2c1512;
  --md-sys-color-on-secondary-fixed-variant: #5d3f3b;
  --md-sys-color-tertiary-fixed: #fddfa6;
  --md-sys-color-tertiary-fixed-dim: #dfc38c;
  --md-sys-color-on-tertiary-fixed: #261a00;
  --md-sys-color-on-tertiary-fixed-variant: #574419;

  /* Kit add-on: section background used on the documentation canvas */
  --md-addon-section-background: #f5f5f5;

  /* ---- Typography ---- */
  --md-ref-typeface-brand: "Roboto Flex", "Roboto", system-ui, sans-serif;
  --md-ref-typeface-plain: "Roboto Flex", "Roboto", system-ui, sans-serif;
  --md-ref-typeface-display: "Google Sans Flex", "Google Sans", "Roboto Flex", "Roboto", sans-serif;

  /* font: weight size/line-height family — letter-spacing set separately */
  --md-sys-typescale-display-large: 400 57px/64px var(--md-ref-typeface-brand);
  --md-sys-typescale-display-large-tracking: -0.25px;
  --md-sys-typescale-display-medium: 400 45px/52px var(--md-ref-typeface-brand);
  --md-sys-typescale-display-small: 400 36px/44px var(--md-ref-typeface-brand);
  --md-sys-typescale-headline-large: 400 32px/40px var(--md-ref-typeface-brand);
  --md-sys-typescale-headline-medium: 400 28px/36px var(--md-ref-typeface-brand);
  --md-sys-typescale-headline-small: 400 24px/32px var(--md-ref-typeface-brand);
  --md-sys-typescale-title-large: 400 22px/28px var(--md-ref-typeface-brand);
  --md-sys-typescale-title-medium: 500 16px/24px var(--md-ref-typeface-plain);
  --md-sys-typescale-title-medium-tracking: 0.15px;
  --md-sys-typescale-title-small: 500 14px/20px var(--md-ref-typeface-plain);
  --md-sys-typescale-title-small-tracking: 0.1px;
  --md-sys-typescale-body-large: 400 16px/24px var(--md-ref-typeface-plain);
  --md-sys-typescale-body-large-tracking: 0.5px;
  --md-sys-typescale-body-medium: 400 14px/20px var(--md-ref-typeface-plain);
  --md-sys-typescale-body-medium-tracking: 0.25px;
  --md-sys-typescale-body-small: 400 12px/16px var(--md-ref-typeface-plain);
  --md-sys-typescale-body-small-tracking: 0.4px;
  --md-sys-typescale-label-large: 500 14px/20px var(--md-ref-typeface-plain);
  --md-sys-typescale-label-large-tracking: 0.1px;
  --md-sys-typescale-label-medium: 500 12px/16px var(--md-ref-typeface-plain);
  --md-sys-typescale-label-medium-tracking: 0.5px;
  --md-sys-typescale-label-small: 500 11px/16px var(--md-ref-typeface-plain);
  --md-sys-typescale-label-small-tracking: 0.5px;

  /* Emphasized (expressive) */
  --md-sys-typescale-emphasized-display-large: 500 57px/64px var(--md-ref-typeface-brand);
  --md-sys-typescale-emphasized-headline-large: 500 32px/40px var(--md-ref-typeface-brand);
  --md-sys-typescale-emphasized-headline-medium: 500 28px/36px var(--md-ref-typeface-brand);
  --md-sys-typescale-emphasized-headline-small: 500 24px/32px var(--md-ref-typeface-brand);
  --md-sys-typescale-emphasized-title-large: 500 22px/28px var(--md-ref-typeface-brand);
  --md-sys-typescale-emphasized-title-medium: 700 16px/24px var(--md-ref-typeface-plain);
  --md-sys-typescale-emphasized-label-large: 700 14px/20px var(--md-ref-typeface-plain);
  --md-sys-typescale-emphasized-body-large: 500 16px/24px var(--md-ref-typeface-plain);

  /* ---- Shape (corner) ---- */
  --md-sys-shape-corner-none: 0px;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-large-increased: 20px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-extra-large-increased: 32px;
  --md-sys-shape-corner-extra-extra-large: 48px;
  --md-sys-shape-corner-full: 9999px;

  /* ---- Elevation ---- */
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1: 0 1px 2px rgb(0 0 0 / .3), 0 1px 3px 1px rgb(0 0 0 / .15);
  --md-sys-elevation-level2: 0 1px 2px rgb(0 0 0 / .3), 0 2px 6px 2px rgb(0 0 0 / .15);
  --md-sys-elevation-level3: 0 1px 3px rgb(0 0 0 / .3), 0 4px 8px 3px rgb(0 0 0 / .15);
  --md-sys-elevation-level4: 0 2px 3px rgb(0 0 0 / .3), 0 6px 10px 4px rgb(0 0 0 / .15);
  --md-sys-elevation-level5: 0 4px 4px rgb(0 0 0 / .3), 0 8px 12px 6px rgb(0 0 0 / .15);

  /* ---- State layers ---- */
  --md-sys-state-hover-opacity: .08;
  --md-sys-state-focus-opacity: .10;
  --md-sys-state-pressed-opacity: .10;
  --md-sys-state-dragged-opacity: .16;
  --md-sys-state-disabled-container-opacity: .10;
  --md-sys-state-disabled-content-opacity: .38;

  /* ---- Motion: expressive spring approximations ---- */
  --md-sys-motion-spring-fast-spatial: 350ms cubic-bezier(0.42, 1.67, 0.21, 0.90);
  --md-sys-motion-spring-default-spatial: 500ms cubic-bezier(0.38, 1.21, 0.22, 1.00);
  --md-sys-motion-spring-slow-spatial: 650ms cubic-bezier(0.39, 1.29, 0.35, 0.98);
  --md-sys-motion-spring-fast-effects: 150ms cubic-bezier(0.31, 0.94, 0.34, 1.00);
  --md-sys-motion-spring-default-effects: 200ms cubic-bezier(0.34, 0.80, 0.34, 1.00);
  --md-sys-motion-spring-slow-effects: 300ms cubic-bezier(0.34, 0.88, 0.34, 1.00);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
}

/* ---- Color: dark ---- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --md-sys-color-primary: #ffb4aa;
  --md-sys-color-on-primary: #561e18;
  --md-sys-color-primary-container: #73342d;
  --md-sys-color-on-primary-container: #ffdad5;
  --md-sys-color-secondary: #e7bdb7;
  --md-sys-color-on-secondary: #442926;
  --md-sys-color-secondary-container: #5d3f3b;
  --md-sys-color-on-secondary-container: #ffdad5;
  --md-sys-color-tertiary: #dfc38c;
  --md-sys-color-on-tertiary: #3f2e04;
  --md-sys-color-tertiary-container: #574419;
  --md-sys-color-on-tertiary-container: #fddfa6;
  --md-sys-color-error: #ffb4ab;
  --md-sys-color-on-error: #690005;
  --md-sys-color-error-container: #93000a;
  --md-sys-color-on-error-container: #ffdad6;
  --md-sys-color-surface: #1a1110;
  --md-sys-color-on-surface: #f1dedc;
  --md-sys-color-surface-variant: #534341;
  --md-sys-color-on-surface-variant: #d8c2bf;
  --md-sys-color-surface-dim: #1a1110;
  --md-sys-color-surface-bright: #423735;
  --md-sys-color-surface-container-lowest: #140c0b;
  --md-sys-color-surface-container-low: #231918;
  --md-sys-color-surface-container: #271d1c;
  --md-sys-color-surface-container-high: #322826;
  --md-sys-color-surface-container-highest: #3d3231;
  --md-sys-color-outline: #a08c8a;
  --md-sys-color-outline-variant: #534341;
  --md-sys-color-inverse-surface: #f1dedc;
  --md-sys-color-inverse-on-surface: #392e2d;
  --md-sys-color-inverse-primary: #904a42;
  --md-addon-section-background: #201a19;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --md-sys-motion-spring-fast-spatial: 1ms linear;
    --md-sys-motion-spring-default-spatial: 1ms linear;
    --md-sys-motion-spring-slow-spatial: 1ms linear;
    --md-sys-motion-spring-fast-effects: 1ms linear;
    --md-sys-motion-spring-default-effects: 1ms linear;
    --md-sys-motion-spring-slow-effects: 1ms linear;
  }
}


/* ===== css/base.css ===== */
/* ==========================================================================
   Base: reset, type utilities, icons, state layers, ripple, focus
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }

body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* invisible 48dp touch-target extensions may poke past the viewport edge */
  overflow-x: clip;
  transition: background-color var(--md-sys-motion-spring-slow-effects), color var(--md-sys-motion-spring-slow-effects);
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: var(--md-sys-color-primary); }
h1, h2, h3, h4, h5, h6, p { margin: 0; }
[hidden] { display: none !important; }

/* ---- Type utilities ---- */
.t-display-large   { font: var(--md-sys-typescale-display-large); letter-spacing: var(--md-sys-typescale-display-large-tracking); }
.t-display-medium  { font: var(--md-sys-typescale-display-medium); }
.t-display-small   { font: var(--md-sys-typescale-display-small); }
.t-headline-large  { font: var(--md-sys-typescale-headline-large); }
.t-headline-medium { font: var(--md-sys-typescale-headline-medium); }
.t-headline-small  { font: var(--md-sys-typescale-headline-small); }
.t-title-large     { font: var(--md-sys-typescale-title-large); }
.t-title-medium    { font: var(--md-sys-typescale-title-medium); letter-spacing: var(--md-sys-typescale-title-medium-tracking); }
.t-title-small     { font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking); }
.t-body-large      { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
.t-body-medium     { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); }
.t-body-small      { font: var(--md-sys-typescale-body-small); letter-spacing: var(--md-sys-typescale-body-small-tracking); }
.t-label-large     { font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); }
.t-label-medium    { font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); }
.t-label-small     { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); }

/* ---- Material Symbols ---- */
.m3-icon {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: var(--m3-icon-size, 24px);
  line-height: 1;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" var(--m3-icon-fill, 0), "wght" 400, "GRAD" 0, "opsz" 24;
  transition: font-variation-settings var(--md-sys-motion-spring-fast-effects);
}
.m3-icon--filled { --m3-icon-fill: 1; }

/* ---- State layer + ripple ----
   Any element with .m3-interactive gets a hover/focus/press state layer
   painted in its current text color via ::before. JS adds ripples.       */
.m3-interactive { position: relative; isolation: isolate; }
.m3-interactive::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--m3-state-color, currentColor);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
  transition: opacity var(--md-sys-motion-spring-fast-effects);
}
.m3-interactive:hover::before { opacity: var(--md-sys-state-hover-opacity); }
.m3-interactive:focus-visible::before { opacity: var(--md-sys-state-focus-opacity); }
.m3-interactive:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-interactive:disabled::before,
.m3-interactive[aria-disabled="true"]::before { display: none; }

.m3-ripple-surface {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.m3-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--m3-state-color, currentColor);
  opacity: .12;
  transform: scale(0);
  animation: m3-ripple 450ms var(--md-sys-motion-easing-standard) forwards;
}
.m3-ripple.is-fading { animation: m3-ripple 450ms var(--md-sys-motion-easing-standard) forwards, m3-ripple-fade 300ms linear forwards; }
@keyframes m3-ripple { to { transform: scale(1); } }
@keyframes m3-ripple-fade { from { opacity: .12; } to { opacity: 0; } }

/* ---- Focus indicator ---- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--md-sys-color-secondary);
  outline-offset: 2px;
}

/* ---- Scrim ---- */
.m3-scrim {
  position: fixed;
  inset: 0;
  background: var(--md-sys-color-scrim);
  opacity: 0;
  pointer-events: none;
  z-index: 900;
  transition: opacity var(--md-sys-motion-spring-default-effects);
}
.m3-scrim.is-open { opacity: .32; pointer-events: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ---- Touch targets ----
   M3 requires a 48×48dp touch target for every interactive element, even
   when the visible control is smaller (XS/S buttons, icon buttons, chips).
   An invisible ::after extends the hit area without changing layout.       */
:where(.m3-btn, .m3-icon-btn, .m3-chip, .m3-chip__remove, .m3-fab-menu__item)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 48px);
  height: max(100%, 48px);
  transform: translate(-50%, -50%);
}
/* zero-specificity so components positioned absolute/fixed keep their position */
:where(.m3-btn, .m3-icon-btn, .m3-chip, .m3-chip__remove, .m3-fab-menu__item) { position: relative; }

/* ---- Reduced motion: drop decorative motion, keep essential feedback ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .m3-ripple { display: none; }
}


/* ===== css/components/actions.css ===== */
/* ==========================================================================
   ACTIONS — Buttons, Button groups, Icon buttons, Split buttons,
             FAB, Extended FAB, FAB menu
   ========================================================================== */

/* ---------------------------------------------------------------- Buttons */
.m3-btn {
  /* size: S (default) */
  --h: 40px;
  --pad: 16px;
  --gap: 8px;
  --icon: 20px;
  --r-round: 20px;
  --r-square: 12px;
  --r-pressed: 8px;
  --outline-w: 1px;
  --font: var(--md-sys-typescale-label-large);
  --tracking: var(--md-sys-typescale-label-large-tracking);
  --r: var(--r-round);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  height: var(--h);
  min-width: 48px;
  padding: 0 var(--pad);
  border-radius: var(--r);
  font: var(--font);
  letter-spacing: var(--tracking);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  vertical-align: middle;
  flex: none;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  transition:
    border-radius var(--md-sys-motion-spring-fast-spatial),
    padding var(--md-sys-motion-spring-fast-spatial),
    background-color var(--md-sys-motion-spring-default-effects),
    color var(--md-sys-motion-spring-default-effects),
    box-shadow var(--md-sys-motion-spring-default-effects);
}
.m3-btn .m3-icon { --m3-icon-size: var(--icon); }
.m3-btn--square { --r: var(--r-square); }
.m3-btn:active:not(:disabled) { --r: var(--r-pressed); }

.m3-btn--xs { --h: 32px; --pad: 12px; --gap: 4px; --icon: 20px; --r-round: 16px; --r-square: 12px; --r-pressed: 8px; }
.m3-btn--s  { /* defaults */ }
.m3-btn--m  { --h: 56px; --pad: 24px; --gap: 8px; --icon: 24px; --r-round: 28px; --r-square: 16px; --r-pressed: 12px;
              --font: var(--md-sys-typescale-title-medium); --tracking: var(--md-sys-typescale-title-medium-tracking); }
.m3-btn--l  { --h: 96px; --pad: 48px; --gap: 12px; --icon: 32px; --r-round: 48px; --r-square: 28px; --r-pressed: 16px; --outline-w: 2px;
              --font: var(--md-sys-typescale-headline-small); --tracking: 0; }
.m3-btn--xl { --h: 136px; --pad: 64px; --gap: 16px; --icon: 40px; --r-round: 68px; --r-square: 28px; --r-pressed: 16px; --outline-w: 3px;
              --font: var(--md-sys-typescale-headline-large); --tracking: 0; }

/* Color styles */
.m3-btn--filled   { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-btn--tonal    { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-btn--elevated { background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-primary); box-shadow: var(--md-sys-elevation-level1); }
.m3-btn--outlined { background: transparent; color: var(--md-sys-color-on-surface-variant); box-shadow: inset 0 0 0 var(--outline-w) var(--md-sys-color-outline-variant); }
.m3-btn--text     { background: transparent; color: var(--md-sys-color-primary); min-width: 0; padding-inline: max(12px, calc(var(--pad) * .75)); }

.m3-btn--filled:hover:not(:disabled),
.m3-btn--tonal:hover:not(:disabled) { box-shadow: var(--md-sys-elevation-level1); }
.m3-btn--elevated:hover:not(:disabled) { box-shadow: var(--md-sys-elevation-level2); }

/* Toggle buttons: unselected / selected colors and round⇄square morph */
.m3-btn--toggle[aria-pressed] { --r: var(--r-round); }
.m3-btn--toggle[aria-pressed="true"] { --r: var(--r-square); }
.m3-btn--toggle.m3-btn--square[aria-pressed="true"] { --r: var(--r-round); }
.m3-btn--toggle.m3-btn--square[aria-pressed="false"] { --r: var(--r-square); }
.m3-btn--toggle:active:not(:disabled) { --r: var(--r-pressed); }

.m3-btn--toggle.m3-btn--filled[aria-pressed="false"]   { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); }
.m3-btn--toggle.m3-btn--tonal[aria-pressed="true"]     { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-btn--toggle.m3-btn--elevated[aria-pressed="true"]  { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-btn--toggle.m3-btn--outlined[aria-pressed="true"]  { background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); box-shadow: none; }
.m3-btn--toggle[aria-pressed="true"] .m3-icon { --m3-icon-fill: 1; }

.m3-btn:disabled,
.m3-btn[aria-disabled="true"] {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent);
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  box-shadow: none;
  cursor: default;
}
.m3-btn--text:disabled { background: transparent; }
.m3-btn--outlined:disabled { background: transparent; box-shadow: inset 0 0 0 var(--outline-w) color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }

/* ---------------------------------------------------------- Button groups */
.m3-btn-group {
  --group-gap: 12px;
  display: inline-flex;
  align-items: center;
  gap: var(--group-gap);
}
.m3-btn-group--xs { --group-gap: 18px; }
.m3-btn-group--m, .m3-btn-group--l, .m3-btn-group--xl { --group-gap: 8px; }

/* Standard group: pressed button expands, its neighbours compress */
.m3-btn-group--standard > .m3-btn:active:not(:disabled),
.m3-btn-group--standard > .m3-icon-btn:active:not(:disabled) { padding-inline: calc(var(--pad) * 1.3); }
.m3-btn-group--standard > .m3-btn:has(+ .m3-btn:active),
.m3-btn-group--standard > .m3-btn:active + .m3-btn { padding-inline: calc(var(--pad) * .7); }
.m3-btn-group--standard > .m3-icon-btn:active:not(:disabled) { width: calc(var(--w) * 1.15); }
.m3-btn-group--standard > .m3-icon-btn:has(+ .m3-icon-btn:active),
.m3-btn-group--standard > .m3-icon-btn:active + .m3-icon-btn { width: calc(var(--w) * .85); }

/* Connected group */
.m3-btn-group--connected { --group-gap: 2px; --r-inner: 8px; --r-inner-pressed: 4px; display: flex; width: 100%; }
.m3-btn-group--connected.m3-btn-group--xs { --r-inner: 4px; --r-inner-pressed: 4px; }
.m3-btn-group--connected.m3-btn-group--l  { --r-inner: 16px; --r-inner-pressed: 12px; }
.m3-btn-group--connected.m3-btn-group--xl { --r-inner: 20px; --r-inner-pressed: 16px; }
.m3-btn-group--connected > .m3-btn { flex: 1 1 0; min-width: 0; padding-inline: 12px; }
.m3-btn-group--connected > .m3-btn {
  border-radius: var(--r-inner);
}
.m3-btn-group--connected > .m3-btn:first-child { border-radius: var(--r-round) var(--r-inner) var(--r-inner) var(--r-round); }
.m3-btn-group--connected > .m3-btn:last-child  { border-radius: var(--r-inner) var(--r-round) var(--r-round) var(--r-inner); }
.m3-btn-group--connected > .m3-btn:active:not([aria-pressed="true"]) { border-radius: var(--r-inner-pressed); }
.m3-btn-group--connected > .m3-btn:first-child:active:not([aria-pressed="true"]) { border-radius: var(--r-round) var(--r-inner-pressed) var(--r-inner-pressed) var(--r-round); }
.m3-btn-group--connected > .m3-btn:last-child:active:not([aria-pressed="true"]) { border-radius: var(--r-inner-pressed) var(--r-round) var(--r-round) var(--r-inner-pressed); }
.m3-btn-group--connected > .m3-btn[aria-pressed="true"] { border-radius: var(--r-round); }
.m3-btn-group--connected > .m3-btn.m3-btn--tonal[aria-pressed="false"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-btn-group--connected > .m3-btn.m3-btn--tonal[aria-pressed="true"] { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-btn-group--connected > .m3-btn .m3-icon.check {
  width: 0;
  margin-right: calc(var(--gap) * -1);
  transition: width var(--md-sys-motion-spring-fast-spatial), margin var(--md-sys-motion-spring-fast-spatial);
}
.m3-btn-group--connected > .m3-btn[aria-pressed="true"] .m3-icon.check { width: 1em; margin-right: 0; }

/* ----------------------------------------------------------- Icon buttons */
.m3-icon-btn {
  --h: 40px;
  --w: 40px;
  --icon: 24px;
  --r-round: 20px;
  --r-square: 12px;
  --r-pressed: 8px;
  --outline-w: 1px;
  --pad: 8px;
  --r: var(--r-round);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--w);
  height: var(--h);
  border-radius: var(--r);
  color: var(--md-sys-color-on-surface-variant);
  vertical-align: middle;
  transition:
    border-radius var(--md-sys-motion-spring-fast-spatial),
    width var(--md-sys-motion-spring-fast-spatial),
    background-color var(--md-sys-motion-spring-default-effects),
    color var(--md-sys-motion-spring-default-effects);
}
.m3-icon-btn .m3-icon { --m3-icon-size: var(--icon); }
.m3-icon-btn--square { --r: var(--r-square); }
.m3-icon-btn:active:not(:disabled) { --r: var(--r-pressed); }

.m3-icon-btn--xs { --h: 32px; --w: 32px; --icon: 20px; --r-round: 16px; --r-square: 12px; --r-pressed: 8px; }
.m3-icon-btn--m  { --h: 56px; --w: 56px; --icon: 24px; --r-round: 28px; --r-square: 16px; --r-pressed: 12px; }
.m3-icon-btn--l  { --h: 96px; --w: 96px; --icon: 32px; --r-round: 48px; --r-square: 28px; --r-pressed: 16px; --outline-w: 2px; }
.m3-icon-btn--xl { --h: 136px; --w: 136px; --icon: 40px; --r-round: 68px; --r-square: 28px; --r-pressed: 16px; --outline-w: 3px; }
/* widths */
.m3-icon-btn--xs.m3-icon-btn--narrow { --w: 28px; }  .m3-icon-btn--xs.m3-icon-btn--wide { --w: 40px; }
.m3-icon-btn--narrow { --w: 32px; }                  .m3-icon-btn--wide { --w: 52px; }
.m3-icon-btn--m.m3-icon-btn--narrow { --w: 48px; }   .m3-icon-btn--m.m3-icon-btn--wide { --w: 72px; }
.m3-icon-btn--l.m3-icon-btn--narrow { --w: 64px; }   .m3-icon-btn--l.m3-icon-btn--wide { --w: 128px; }
.m3-icon-btn--xl.m3-icon-btn--narrow { --w: 104px; } .m3-icon-btn--xl.m3-icon-btn--wide { --w: 184px; }

.m3-icon-btn--filled   { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-icon-btn--tonal    { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-icon-btn--outlined { box-shadow: inset 0 0 0 var(--outline-w) var(--md-sys-color-outline-variant); color: var(--md-sys-color-on-surface-variant); }
.m3-icon-btn--standard { color: var(--md-sys-color-on-surface-variant); }

.m3-icon-btn--toggle[aria-pressed="true"] { --r: var(--r-square); }
.m3-icon-btn--toggle.m3-icon-btn--square[aria-pressed="true"] { --r: var(--r-round); }
.m3-icon-btn--toggle:active:not(:disabled) { --r: var(--r-pressed); }
.m3-icon-btn--toggle[aria-pressed="true"] .m3-icon { --m3-icon-fill: 1; }
.m3-icon-btn--toggle.m3-icon-btn--filled[aria-pressed="false"]   { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface-variant); }
.m3-icon-btn--toggle.m3-icon-btn--tonal[aria-pressed="true"]     { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-icon-btn--toggle.m3-icon-btn--outlined[aria-pressed="true"]  { background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); box-shadow: none; }
.m3-icon-btn--toggle.m3-icon-btn--standard[aria-pressed="true"]  { color: var(--md-sys-color-primary); }

.m3-icon-btn:disabled {
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  cursor: default;
}
.m3-icon-btn--filled:disabled, .m3-icon-btn--tonal:disabled { background: color-mix(in srgb, var(--md-sys-color-on-surface) 10%, transparent); }
.m3-icon-btn--outlined:disabled { box-shadow: inset 0 0 0 var(--outline-w) color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); }

/* ---------------------------------------------------------- Split buttons */
.m3-split {
  --h: 40px;
  --r-outer: 20px;
  --r-inner: 4px;
  --r-inner-hover: 8px;
  --r-inner-pressed: 8px;
  --pad: 16px;
  --trail-w: 48px;
  --icon: 20px;
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.m3-split--xs { --h: 32px; --r-outer: 16px; --r-inner: 4px; --r-inner-hover: 8px; --r-inner-pressed: 8px; --pad: 12px; --trail-w: 36px; --icon: 20px; }
.m3-split--m  { --h: 56px; --r-outer: 28px; --r-inner: 4px; --r-inner-hover: 12px; --r-inner-pressed: 12px; --pad: 24px; --trail-w: 64px; --icon: 24px; }
.m3-split--l  { --h: 96px; --r-outer: 48px; --r-inner: 8px; --r-inner-hover: 20px; --r-inner-pressed: 20px; --pad: 48px; --trail-w: 104px; --icon: 32px; }
.m3-split--xl { --h: 136px; --r-outer: 68px; --r-inner: 12px; --r-inner-hover: 20px; --r-inner-pressed: 20px; --pad: 64px; --trail-w: 148px; --icon: 40px; }
.m3-split > .m3-btn { --h: inherit; --pad: inherit; --icon: inherit; height: var(--h); }
.m3-split--xs > .m3-btn { --font: var(--md-sys-typescale-label-large); }
.m3-split--m > .m3-btn  { --font: var(--md-sys-typescale-title-medium); --gap: 8px; }
.m3-split--l > .m3-btn  { --font: var(--md-sys-typescale-headline-small); --gap: 12px; }
.m3-split--xl > .m3-btn { --font: var(--md-sys-typescale-headline-large); --gap: 16px; }
.m3-split > .m3-btn .m3-icon { --m3-icon-size: var(--icon); }
.m3-split__lead {
  padding-inline: var(--pad) calc(var(--pad) * .75) !important;
  border-radius: var(--r-outer) var(--r-inner) var(--r-inner) var(--r-outer) !important;
}
.m3-split__lead:hover { border-radius: var(--r-outer) var(--r-inner-hover) var(--r-inner-hover) var(--r-outer) !important; }
.m3-split__lead:active { border-radius: var(--r-outer) var(--r-inner-pressed) var(--r-inner-pressed) var(--r-outer) !important; }
.m3-split__trail {
  width: var(--trail-w);
  min-width: 0 !important;
  padding: 0 !important;
  border-radius: var(--r-inner) var(--r-outer) var(--r-outer) var(--r-inner) !important;
  transition:
    border-radius var(--md-sys-motion-spring-fast-spatial),
    width var(--md-sys-motion-spring-fast-spatial),
    background-color var(--md-sys-motion-spring-default-effects) !important;
}
.m3-split__trail .m3-icon { transition: transform var(--md-sys-motion-spring-default-spatial); margin-left: calc(var(--icon) * -.15); }
.m3-split__trail:hover { border-radius: var(--r-inner-hover) var(--r-outer) var(--r-outer) var(--r-inner-hover) !important; }
.m3-split__trail[aria-expanded="true"] { width: var(--h); border-radius: var(--r-outer) !important; }
.m3-split__trail[aria-expanded="true"] .m3-icon { transform: rotate(180deg); margin-left: 0; }

/* -------------------------------------------------------------------- FAB */
.m3-fab {
  --size: 56px;
  --icon: 24px;
  --r: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: var(--r);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-level3);
  transition:
    box-shadow var(--md-sys-motion-spring-default-effects),
    border-radius var(--md-sys-motion-spring-fast-spatial),
    width var(--md-sys-motion-spring-default-spatial),
    height var(--md-sys-motion-spring-default-spatial),
    background-color var(--md-sys-motion-spring-default-effects),
    color var(--md-sys-motion-spring-default-effects);
}
.m3-fab .m3-icon { --m3-icon-size: var(--icon); }
.m3-fab:hover { box-shadow: var(--md-sys-elevation-level4); }
.m3-fab:active { box-shadow: var(--md-sys-elevation-level3); }
.m3-fab--medium { --size: 80px; --icon: 28px; --r: 20px; }
.m3-fab--large  { --size: 96px; --icon: 36px; --r: 28px; }

.m3-fab--secondary-container { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-fab--tertiary-container  { background: var(--md-sys-color-tertiary-container);  color: var(--md-sys-color-on-tertiary-container); }
.m3-fab--primary   { background: var(--md-sys-color-primary);   color: var(--md-sys-color-on-primary); }
.m3-fab--secondary { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-fab--tertiary  { background: var(--md-sys-color-tertiary);  color: var(--md-sys-color-on-tertiary); }

/* ----------------------------------------------------------- Extended FAB */
.m3-efab {
  --h: 56px;
  --pad: 16px;
  --gap: 8px;
  --icon: 24px;
  --r: 16px;
  --font: var(--md-sys-typescale-title-medium);
  display: inline-flex;
  align-items: center;
  height: var(--h);
  min-width: var(--h);
  padding: 0 calc(var(--pad) + 4px) 0 var(--pad);
  gap: var(--gap);
  border-radius: var(--r);
  font: var(--font);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-level3);
  white-space: nowrap;
  overflow: hidden;
  transition:
    padding var(--md-sys-motion-spring-default-spatial),
    gap var(--md-sys-motion-spring-default-spatial),
    box-shadow var(--md-sys-motion-spring-default-effects);
}
.m3-efab .m3-icon { --m3-icon-size: var(--icon); }
.m3-efab:hover { box-shadow: var(--md-sys-elevation-level4); }
.m3-efab--medium { --h: 80px; --pad: 26px; --gap: 12px; --icon: 28px; --r: 20px; --font: var(--md-sys-typescale-title-large); }
.m3-efab--large  { --h: 96px; --pad: 28px; --gap: 16px; --icon: 36px; --r: 28px; --font: var(--md-sys-typescale-headline-small); }
.m3-efab__label {
  display: inline-block;
  max-width: 240px;
  opacity: 1;
  transition: max-width var(--md-sys-motion-spring-default-spatial), opacity var(--md-sys-motion-spring-fast-effects);
}
.m3-efab.is-collapsed { padding: 0 calc((var(--h) - var(--icon)) / 2); gap: 0; }
.m3-efab.is-collapsed .m3-efab__label { max-width: 0; opacity: 0; }
.m3-efab--secondary-container { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-efab--tertiary-container  { background: var(--md-sys-color-tertiary-container);  color: var(--md-sys-color-on-tertiary-container); }
.m3-efab--primary   { background: var(--md-sys-color-primary);   color: var(--md-sys-color-on-primary); }
.m3-efab--secondary { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-efab--tertiary  { background: var(--md-sys-color-tertiary);  color: var(--md-sys-color-on-tertiary); }

/* --------------------------------------------------------------- FAB menu */
.m3-fab-menu {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.m3-fab-menu__list {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.m3-fab-menu__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 24px 0 20px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font: var(--md-sys-typescale-title-medium);
  letter-spacing: var(--md-sys-typescale-title-medium-tracking);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden; /* closed items leave the accessibility tree and tab order */
  transform: translateY(24px) scale(.6);
  transform-origin: right center;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-spring-fast-effects), transform var(--md-sys-motion-spring-default-spatial), visibility 0s linear;
  transition-delay: calc((var(--n) - var(--i)) * 25ms), calc((var(--n) - var(--i)) * 25ms), calc((var(--n) - var(--i)) * 25ms + 250ms);
}
.m3-fab-menu.is-open .m3-fab-menu__item {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition-delay: calc((var(--n) - var(--i)) * 40ms);
}
.m3-fab-menu__toggle .m3-icon { transition: transform var(--md-sys-motion-spring-default-spatial); }
.m3-fab-menu.is-open .m3-fab-menu__toggle {
  --size: 56px;
  --r: 28px;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.m3-fab-menu.is-open .m3-fab-menu__toggle .m3-icon { transform: rotate(90deg); }
.m3-fab-menu--secondary .m3-fab-menu__item { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-fab-menu--secondary.is-open .m3-fab-menu__toggle { background: var(--md-sys-color-secondary); color: var(--md-sys-color-on-secondary); }
.m3-fab-menu--tertiary .m3-fab-menu__item { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.m3-fab-menu--tertiary.is-open .m3-fab-menu__toggle { background: var(--md-sys-color-tertiary); color: var(--md-sys-color-on-tertiary); }


/* ===== css/components/communication.css ===== */
/* ==========================================================================
   COMMUNICATION — Badges, Loading indicator, Progress indicators,
                   Snackbar, Tooltips
   ========================================================================== */

/* ----------------------------------------------------------------- Badges */
.m3-badge-anchor { position: relative; display: inline-flex; }
.m3-badge {
  position: absolute;
  z-index: 1;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  pointer-events: none;
}
.m3-badge--small {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  top: 0;
  right: 0;
}
.m3-badge--large {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  top: -2px;
  left: calc(100% - 12px);
  font: var(--md-sys-typescale-label-small);
  letter-spacing: var(--md-sys-typescale-label-small-tracking);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.m3-badge-anchor > .m3-icon + .m3-badge--small { top: -1px; right: -1px; }

/* ------------------------------------------------------ Loading indicator */
.m3-loading {
  --size: 48px;
  width: var(--size);
  height: var(--size);
  display: inline-grid;
  place-items: center;
  color: var(--md-sys-color-primary);
  flex: none;
}
.m3-loading svg { width: calc(var(--size) * 38 / 48); height: calc(var(--size) * 38 / 48); overflow: visible; }
.m3-loading path { fill: currentColor; }
.m3-loading--contained {
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
.m3-loading--contained svg { width: calc(var(--size) * 30 / 48); height: calc(var(--size) * 30 / 48); }

/* -------------------------------------------------- Progress — linear */
.m3-linear {
  --thickness: 4px;
  --gap: 4px;
  --value: 0.5;
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: max(var(--thickness), 4px);
  color: var(--md-sys-color-primary);
}
.m3-linear__bar {
  height: var(--thickness);
  width: calc(var(--value) * 100%);
  border-radius: var(--thickness);
  background: currentColor;
  flex: none;
  transition: width var(--md-sys-motion-spring-slow-spatial);
}
.m3-linear__track {
  flex: 1;
  height: var(--thickness);
  margin-left: var(--gap);
  border-radius: var(--thickness);
  background: var(--md-sys-color-secondary-container);
}
.m3-linear__stop {
  position: absolute;
  right: calc((var(--thickness) - 4px) / 2);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.m3-linear--thick { --thickness: 8px; }
.m3-linear--thick .m3-linear__stop { right: 2px; }

.m3-linear--indeterminate { overflow: hidden; border-radius: var(--thickness); }
.m3-linear--indeterminate .m3-linear__track { position: absolute; inset: 0; margin: 0; height: var(--thickness); top: 50%; transform: translateY(-50%); }
.m3-linear--indeterminate .m3-linear__bar {
  position: absolute;
  height: var(--thickness);
  width: auto;
  top: 50%;
  translate: 0 -50%;
  box-shadow: 0 0 0 var(--gap) var(--md-sys-color-surface);
}
.m3-linear--indeterminate .m3-linear__bar--1 { animation: m3-linear-1 2s infinite linear; }
.m3-linear--indeterminate .m3-linear__bar--2 { animation: m3-linear-2 2s infinite linear; }
@keyframes m3-linear-1 {
  0%   { left: -35%; right: 100%; }
  60%  { left: 100%; right: -90%; }
  100% { left: 100%; right: -90%; }
}
@keyframes m3-linear-2 {
  0%, 30% { left: -200%; right: 100%; }
  84%  { left: 107%; right: -8%; }
  100% { left: 107%; right: -8%; }
}

/* Wavy linear (SVG drawn by JS) */
.m3-linear-wavy { display: block; width: 100%; height: 14px; color: var(--md-sys-color-primary); overflow: visible; }
.m3-linear-wavy--thick { height: 20px; }
.m3-linear-wavy svg { width: 100%; height: 100%; overflow: visible; display: block; }
.m3-linear-wavy .wave { fill: none; stroke: currentColor; stroke-linecap: round; }
.m3-linear-wavy .track { fill: none; stroke: var(--md-sys-color-secondary-container); stroke-linecap: round; }
.m3-linear-wavy .stop { fill: currentColor; }

/* -------------------------------------------------- Progress — circular */
.m3-circular {
  --size: 40px;
  width: var(--size);
  height: var(--size);
  display: inline-block;
  color: var(--md-sys-color-primary);
  flex: none;
}
.m3-circular--wavy { --size: 48px; }
.m3-circular svg { width: 100%; height: 100%; overflow: visible; display: block; }
.m3-circular .arc { fill: none; stroke: currentColor; stroke-linecap: round; }
.m3-circular .track { fill: none; stroke: var(--md-sys-color-secondary-container); stroke-linecap: round; }
.m3-circular--indeterminate svg { animation: m3-rotate 1.4s linear infinite; }
.m3-circular--indeterminate .arc { animation: m3-circ-dash 1.4s var(--md-sys-motion-easing-standard) infinite; }
@keyframes m3-rotate { to { transform: rotate(360deg); } }
@keyframes m3-circ-dash {
  0%   { stroke-dasharray: 1 200; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 80 200; stroke-dashoffset: -20; }
  100% { stroke-dasharray: 80 200; stroke-dashoffset: -112; }
}

/* --------------------------------------------------------------- Snackbar */
.m3-snackbar-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(600px, calc(100vw - 32px));
}
.m3-snackbar {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: 48px;
  padding: 6px 4px 6px 16px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-level3);
  font: var(--md-sys-typescale-body-medium);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  transition: opacity var(--md-sys-motion-spring-default-effects), transform var(--md-sys-motion-spring-default-spatial);
}
.m3-snackbar.is-visible { opacity: 1; transform: none; }
.m3-snackbar__text { flex: 1; padding: 8px 0; }
.m3-snackbar .m3-btn--text { color: var(--md-sys-color-inverse-primary); }
.m3-snackbar .m3-icon-btn { color: var(--md-sys-color-inverse-on-surface); }
.m3-snackbar--two-line { flex-wrap: wrap; }
.m3-snackbar--stacked { flex-direction: column; align-items: stretch; padding: 14px 8px 8px 16px; }
.m3-snackbar--stacked .m3-snackbar__actions { display: flex; justify-content: flex-end; }
.m3-snackbar--static { opacity: 1; transform: none; max-width: 560px; }

/* --------------------------------------------------------------- Tooltips */
.m3-tooltip {
  position: fixed;
  z-index: 1100;
  pointer-events: none;
  opacity: 0;
  transform: scale(.85);
  transition: opacity var(--md-sys-motion-spring-fast-effects), transform var(--md-sys-motion-spring-fast-spatial);
}
.m3-tooltip.is-visible { opacity: 1; transform: none; }
.m3-tooltip--plain {
  min-height: 24px;
  max-width: 200px;
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  font: var(--md-sys-typescale-body-small);
  letter-spacing: var(--md-sys-typescale-body-small-tracking);
}
.m3-tooltip--rich {
  max-width: 312px;
  padding: 12px 16px 8px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: var(--md-sys-elevation-level2);
  font: var(--md-sys-typescale-body-medium);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
}
.m3-tooltip--rich.is-visible { pointer-events: auto; }
.m3-tooltip__subhead { font: var(--md-sys-typescale-title-small); letter-spacing: var(--md-sys-typescale-title-small-tracking); color: var(--md-sys-color-on-surface-variant); margin-bottom: 4px; }
.m3-tooltip__actions { display: flex; gap: 8px; margin: 12px -8px 0; }
/* static previews */
.m3-tooltip--static { position: static; opacity: 1; transform: none; display: inline-block; }


/* ===== css/components/containment.css ===== */
/* ==========================================================================
   CONTAINMENT — Bottom sheets, Cards, Carousel, Dialogs, Dividers,
                 Lists, Side sheets
   ========================================================================== */

/* ------------------------------------------------------------------ Cards */
.m3-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  color: var(--md-sys-color-on-surface);
  text-align: left;
  transition: box-shadow var(--md-sys-motion-spring-default-effects);
}
.m3-card--elevated { background: var(--md-sys-color-surface-container-low); box-shadow: var(--md-sys-elevation-level1); }
.m3-card--filled   { background: var(--md-sys-color-surface-container-highest); }
.m3-card--outlined { background: var(--md-sys-color-surface); box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant); }
button.m3-card, a.m3-card { cursor: pointer; text-decoration: none; }
.m3-card--elevated.m3-interactive:hover { box-shadow: var(--md-sys-elevation-level2); }
.m3-card--filled.m3-interactive:hover, .m3-card--outlined.m3-interactive:hover { box-shadow: var(--md-sys-elevation-level1); }
.m3-card--outlined.m3-interactive:hover { box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant), var(--md-sys-elevation-level1); }
.m3-card__header { display: flex; align-items: center; gap: 16px; padding: 12px 4px 12px 16px; min-height: 72px; }
.m3-card__media { aspect-ratio: 16 / 9; background-size: cover; background-position: center; }
.m3-card__media img { width: 100%; height: 100%; object-fit: cover; }
.m3-card__content { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.m3-card__title { font: var(--md-sys-typescale-title-large); }
.m3-card__subhead { font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
.m3-card__text { margin-top: 12px; font: var(--md-sys-typescale-body-medium); letter-spacing: var(--md-sys-typescale-body-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
.m3-card__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; flex-wrap: wrap; }

.m3-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
  display: inline-grid;
  place-items: center;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font: var(--md-sys-typescale-title-medium);
  overflow: hidden;
}
.m3-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------------------- Carousel */
.m3-carousel {
  --gap: 8px;
  --h: 220px;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.m3-carousel::-webkit-scrollbar { display: none; }
@media (pointer: fine) { .m3-carousel { cursor: grab; } }
.m3-carousel.is-dragging { cursor: grabbing; user-select: none; }
.m3-carousel.is-dragging .m3-carousel__item { pointer-events: none; }
.m3-carousel img { user-select: none; -webkit-user-drag: none; }
.m3-carousel__track { position: relative; height: var(--h); }
.m3-carousel__stage {
  position: sticky;
  left: 0;
  top: 0;
  height: var(--h);
  width: 100%;
  overflow: hidden;
}
.m3-carousel__snap { position: absolute; top: 0; width: 1px; height: 1px; scroll-snap-align: start; }
.m3-carousel__item {
  position: absolute;
  top: 0;
  height: var(--h);
  border-radius: var(--md-sys-shape-corner-extra-large);
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
  will-change: transform, width;
}
.m3-carousel__item img {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: var(--full-w, 100%);
  max-width: none;
  transform: translateX(-50%);
  object-fit: cover;
}
.m3-carousel__item:has(.m3-carousel__label)::after {
  content: "";
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(to top, rgb(0 0 0 / .55), transparent);
  opacity: var(--label-o, 1);
  pointer-events: none;
}
.m3-carousel__label {
  z-index: 1;
  position: absolute;
  left: 16px;
  bottom: 16px;
  right: 16px;
  color: #fff;
  font: var(--md-sys-typescale-title-medium);
  text-shadow: 0 1px 4px rgb(0 0 0 / .5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: var(--label-o, 1);
}
/* uncontained */
.m3-carousel--uncontained { display: flex; gap: var(--gap); scroll-snap-type: x mandatory; }
.m3-carousel--uncontained .m3-carousel__item { position: relative; flex: none; width: 260px; scroll-snap-align: start; }
.m3-carousel--uncontained .m3-carousel__item img { width: 100%; }

/* ---------------------------------------------------------------- Dialogs */
.m3-dialog {
  border: 0;
  padding: 24px;
  min-width: 280px;
  max-width: min(560px, calc(100vw - 48px));
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: var(--md-sys-elevation-level3);
  font: var(--md-sys-typescale-body-medium);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  opacity: 0;
  transform: translateY(-24px) scale(.92);
  transform-origin: top center;
  transition:
    opacity var(--md-sys-motion-spring-default-effects),
    transform var(--md-sys-motion-spring-default-spatial),
    overlay 300ms allow-discrete,
    display 300ms allow-discrete;
}
.m3-dialog[open] { opacity: 1; transform: none; }
@starting-style { .m3-dialog[open] { opacity: 0; transform: translateY(-24px) scale(.92); } }
.m3-dialog::backdrop {
  background: rgb(0 0 0 / 0);
  transition: background-color 300ms, overlay 300ms allow-discrete, display 300ms allow-discrete;
}
.m3-dialog[open]::backdrop { background: rgb(0 0 0 / .32); }
@starting-style { .m3-dialog[open]::backdrop { background: rgb(0 0 0 / 0); } }
.m3-dialog__icon { display: flex; justify-content: center; color: var(--md-sys-color-secondary); margin-bottom: 16px; }
.m3-dialog__headline { font: var(--md-sys-typescale-headline-small); color: var(--md-sys-color-on-surface); margin-bottom: 16px; }
.m3-dialog__icon + .m3-dialog__headline { text-align: center; }
.m3-dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.m3-dialog--static { position: static; opacity: 1; transform: none; display: block; margin: 0; }

.m3-dialog--fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: var(--md-sys-color-surface);
  transform: translateY(48px);
}
.m3-dialog--fullscreen[open] { transform: none; }
@starting-style { .m3-dialog--fullscreen[open] { transform: translateY(48px); } }
.m3-dialog__bar { display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 12px 0 4px; }
.m3-dialog__bar .title { flex: 1; font: var(--md-sys-typescale-title-large); color: var(--md-sys-color-on-surface); }
.m3-dialog__body { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 24px; max-width: 640px; }
@media (min-width: 840px) {
  .m3-dialog--fullscreen { width: 560px; height: auto; max-height: 90vh; border-radius: var(--md-sys-shape-corner-extra-large); margin: auto; background: var(--md-sys-color-surface-container-high); }
}

/* --------------------------------------------------------------- Dividers */
.m3-divider { height: 1px; border: 0; margin: 0; background: var(--md-sys-color-outline-variant); }
.m3-divider--inset { margin-left: 16px; }
.m3-divider--middle { margin-inline: 16px; }
.m3-divider--vertical { width: 1px; height: auto; align-self: stretch; }

/* ------------------------------------------------------------------ Lists */
.m3-list { list-style: none; margin: 0; padding: 8px 0; background: var(--md-sys-color-surface); }
.m3-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 8px 24px 8px 16px;
  color: var(--md-sys-color-on-surface);
  text-align: left;
  width: 100%;
  text-decoration: none;
}
.m3-list-item--two { min-height: 72px; }
.m3-list-item--three { min-height: 88px; align-items: flex-start; padding-block: 12px; }
.m3-list-item__leading { color: var(--md-sys-color-on-surface-variant); display: flex; flex: none; }
.m3-list-item__thumb { width: 56px; height: 56px; border-radius: var(--md-sys-shape-corner-small); object-fit: cover; flex: none; }
.m3-list-item__video { width: 114px; height: 64px; border-radius: var(--md-sys-shape-corner-small); object-fit: cover; flex: none; }
.m3-list-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.m3-list-item__overline { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); color: var(--md-sys-color-on-surface-variant); }
.m3-list-item__headline { font: var(--md-sys-typescale-body-large); letter-spacing: var(--md-sys-typescale-body-large-tracking); }
.m3-list-item__supporting {
  font: var(--md-sys-typescale-body-medium);
  letter-spacing: var(--md-sys-typescale-body-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.m3-list-item__trailing-text { font: var(--md-sys-typescale-label-small); letter-spacing: var(--md-sys-typescale-label-small-tracking); color: var(--md-sys-color-on-surface-variant); flex: none; }
.m3-list-item__trailing { color: var(--md-sys-color-on-surface-variant); display: flex; flex: none; }
.m3-list-item[aria-disabled="true"] { opacity: .38; }

/* Expressive segmented list: grouped rounded items with 2px gaps */
.m3-list--segmented { background: transparent; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.m3-list--segmented .m3-list-item {
  background: var(--md-sys-color-surface-container);
  border-radius: 4px;
  transition: border-radius var(--md-sys-motion-spring-fast-spatial), background-color var(--md-sys-motion-spring-default-effects);
}
.m3-list--segmented > li:first-child .m3-list-item { border-top-left-radius: 16px; border-top-right-radius: 16px; }
.m3-list--segmented > li:last-child .m3-list-item  { border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; }
.m3-list--segmented .m3-list-item:hover { border-radius: 12px; }
.m3-list--segmented .m3-list-item[aria-selected="true"] {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-radius: 16px;
}
.m3-list--segmented .m3-list-item[aria-selected="true"] .m3-list-item__leading,
.m3-list--segmented .m3-list-item[aria-selected="true"] .m3-list-item__supporting { color: var(--md-sys-color-on-secondary-container); }
.m3-list--segmented .m3-list-item[aria-selected="true"] .m3-icon { --m3-icon-fill: 1; }

/* ---------------------------------------------------------- Bottom sheets */
.m3-bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  z-index: 950;
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
  box-shadow: var(--md-sys-elevation-level1);
  transform: translate(-50%, 105%);
  visibility: hidden;
  transition: transform var(--md-sys-motion-spring-default-spatial), visibility 0s linear 500ms;
  touch-action: none;
}
.m3-bottom-sheet.is-open { transform: translate(-50%, var(--drag, 0px)); visibility: visible; transition-delay: 0s; }
.m3-bottom-sheet.is-dragging { transition: none; }
.m3-bottom-sheet__handle {
  display: grid;
  place-items: center;
  height: 36px;
  flex: none;
  cursor: grab;
}
.m3-bottom-sheet__handle::after {
  content: "";
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--md-sys-color-on-surface-variant);
  opacity: .4;
}
.m3-bottom-sheet__content { overflow-y: auto; padding: 0 0 24px; touch-action: pan-y; }
.m3-bottom-sheet--static { position: relative; left: 0; transform: none; max-width: 100%; z-index: auto; }
.m3-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 16px 0; }
.m3-sheet-grid .m3-sheet-action {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px;
  border-radius: var(--md-sys-shape-corner-large);
  font: var(--md-sys-typescale-label-medium);
  color: var(--md-sys-color-on-surface);
}
.m3-sheet-action__icon { width: 56px; height: 56px; border-radius: 18px; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); display: grid; place-items: center; }

/* ------------------------------------------------------------- Side sheets */
.m3-side-sheet {
  display: flex;
  flex-direction: column;
  width: 320px;
  max-width: 100%;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
}
.m3-side-sheet__header { display: flex; align-items: center; gap: 4px; padding: 12px 12px 16px 24px; min-height: 72px; }
.m3-side-sheet__header .m3-icon-btn:first-child { margin-left: -12px; }
.m3-side-sheet__title { flex: 1; font: var(--md-sys-typescale-title-large); color: var(--md-sys-color-on-surface-variant); }
.m3-side-sheet__body { flex: 1; overflow-y: auto; padding: 0 24px; display: flex; flex-direction: column; gap: 16px; }
.m3-side-sheet__actions { display: flex; gap: 8px; padding: 16px 24px 24px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.m3-side-sheet--standard { border-left: 1px solid var(--md-sys-color-outline-variant); }
.m3-side-sheet--modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 950;
  width: min(400px, 90vw);
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-large) 0 0 var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-level1);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform var(--md-sys-motion-spring-default-spatial), visibility 0s linear 500ms;
}
.m3-side-sheet--modal.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.m3-side-sheet--modal .m3-side-sheet__actions { border-top: 0; }


/* ===== css/components/navigation.css ===== */
/* ==========================================================================
   NAVIGATION — App bars, Toolbars, Navigation bar, Navigation rail,
                Navigation drawer, Tabs, Search
   ========================================================================== */

/* --------------------------------------------------------------- App bars */
.m3-app-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: background-color var(--md-sys-motion-spring-default-effects);
}
.m3-app-bar.is-scrolled { background: var(--md-sys-color-surface-container); }
.m3-app-bar__row { display: flex; align-items: center; gap: 4px; height: 64px; padding: 0 4px; }
.m3-app-bar__row > .m3-icon-btn { color: var(--md-sys-color-on-surface); }
.m3-app-bar__trailing { display: flex; align-items: center; margin-left: auto; color: var(--md-sys-color-on-surface-variant); }
.m3-app-bar__trailing .m3-icon-btn { color: var(--md-sys-color-on-surface-variant); }
.m3-app-bar__titles { flex: 1; min-width: 0; padding: 0 4px; display: flex; flex-direction: column; }
.m3-app-bar__title { font: var(--md-sys-typescale-title-large); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m3-app-bar__subtitle { font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); color: var(--md-sys-color-on-surface-variant); }
.m3-app-bar--center .m3-app-bar__titles { text-align: center; }

.m3-app-bar__expanded {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  height: var(--expanded-h);
  opacity: var(--expand-o, 1);
  transition: height 60ms linear;
}
.m3-app-bar--medium { --expanded-h: 48px; }
.m3-app-bar--medium.has-subtitle { --expanded-h: 72px; }
.m3-app-bar--medium .m3-app-bar__expanded .m3-app-bar__title { font: var(--md-sys-typescale-headline-medium); }
.m3-app-bar--medium .m3-app-bar__expanded .m3-app-bar__subtitle { font: var(--md-sys-typescale-label-large); }
.m3-app-bar--large { --expanded-h: 56px; }
.m3-app-bar--large.has-subtitle { --expanded-h: 88px; }
.m3-app-bar--large .m3-app-bar__expanded .m3-app-bar__title { font: var(--md-sys-typescale-display-small); white-space: normal; }
.m3-app-bar--large .m3-app-bar__expanded .m3-app-bar__subtitle { font: var(--md-sys-typescale-title-medium); }
.m3-app-bar .m3-app-bar__row .m3-app-bar__title.is-collapsible { opacity: var(--collapsed-o, 0); transition: opacity var(--md-sys-motion-spring-fast-effects); }

.m3-app-bar--search .m3-app-bar__row { gap: 8px; padding: 0 8px 0 4px; height: 72px; }
.m3-app-bar--search .m3-search-bar { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Toolbars */
.m3-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--md-sys-color-on-surface-variant);
}
.m3-toolbar--docked {
  justify-content: space-around;
  width: 100%;
  height: 64px;
  padding: 0 16px;
  background: var(--md-sys-color-surface-container);
}
.m3-toolbar--floating {
  display: inline-flex;
  height: 64px;
  padding: 0 8px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-level3);
}
.m3-toolbar--vertical { flex-direction: column; height: auto; width: 64px; padding: 8px 0; }
.m3-toolbar--vibrant { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.m3-toolbar .m3-icon-btn--standard { color: inherit; }
.m3-toolbar .m3-icon-btn--toggle[aria-pressed="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-toolbar--vibrant .m3-icon-btn--toggle[aria-pressed="true"] { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface); }
.m3-toolbar-group { display: inline-flex; align-items: center; gap: 8px; }
.m3-toolbar-group--vertical { flex-direction: column; }
.m3-toolbar .m3-btn--filled { background: var(--md-sys-color-primary); }
.m3-toolbar--vibrant .m3-btn--filled { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-surface); }

/* --------------------------------------------------------- Navigation bar */
.m3-nav-bar {
  display: flex;
  justify-content: space-around;
  height: 64px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
}
.m3-nav-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 0 8px;
  font: var(--md-sys-typescale-label-medium);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  min-width: 0;
}
.m3-nav-bar__indicator {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  transition: background-color var(--md-sys-motion-spring-default-effects), width var(--md-sys-motion-spring-fast-spatial);
}
.m3-nav-bar__item:hover .m3-nav-bar__indicator::before,
.m3-nav-rail__item:hover .m3-nav-rail__indicator::before { opacity: var(--md-sys-state-hover-opacity); }
.m3-nav-bar__item:active .m3-nav-bar__indicator::before,
.m3-nav-rail__item:active .m3-nav-rail__indicator::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-nav-bar__item[aria-current="page"] { color: var(--md-sys-color-secondary); }
.m3-nav-bar__item[aria-current="page"] .m3-nav-bar__indicator {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  animation: m3-indicator-in var(--md-sys-motion-spring-fast-spatial);
}
.m3-nav-bar__item[aria-current="page"] .m3-icon { --m3-icon-fill: 1; }
@keyframes m3-indicator-in { from { width: 32px; } }

/* Horizontal items (medium windows) */
.m3-nav-bar--horizontal { justify-content: center; gap: 8px; }
.m3-nav-bar--horizontal .m3-nav-bar__item { flex: 0 1 auto; flex-direction: row; padding: 0; }
.m3-nav-bar--horizontal .m3-nav-bar__indicator {
  width: auto;
  height: 40px;
  padding: 0 16px;
  border-radius: 20px;
  display: flex;
  gap: 4px;
  font: var(--md-sys-typescale-label-medium);
}
.m3-nav-bar--horizontal .m3-nav-bar__item[aria-current="page"] .m3-nav-bar__indicator { animation: none; }

/* -------------------------------------------------------- Navigation rail */
.m3-nav-rail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 96px;
  padding: 44px 0 16px;
  gap: 4px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface-variant);
  transition: width var(--md-sys-motion-spring-default-spatial), padding var(--md-sys-motion-spring-default-spatial);
  overflow: hidden;
  flex: none;
}
.m3-nav-rail__header { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 0 20px; margin-bottom: 36px; }
.m3-nav-rail__header .m3-icon-btn { margin-left: 8px; color: var(--md-sys-color-on-surface-variant); }
.m3-nav-rail__fab { margin-top: 4px; }
.m3-nav-rail .m3-efab { --h: 56px; box-shadow: none; }
.m3-nav-rail__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
  min-height: 56px;
  font: var(--md-sys-typescale-label-medium);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  color: var(--md-sys-color-on-surface-variant);
  transition: width var(--md-sys-motion-spring-default-spatial);
}
.m3-nav-rail__indicator {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 56px;
  height: 32px;
  border-radius: 16px;
  white-space: nowrap;
  transition:
    width var(--md-sys-motion-spring-default-spatial),
    height var(--md-sys-motion-spring-default-spatial),
    padding var(--md-sys-motion-spring-default-spatial),
    background-color var(--md-sys-motion-spring-default-effects);
}
.m3-nav-rail__inline-label {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  font: var(--md-sys-typescale-label-large);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  transition: max-width var(--md-sys-motion-spring-default-spatial), opacity var(--md-sys-motion-spring-fast-effects);
}
.m3-nav-rail__label { transition: opacity var(--md-sys-motion-spring-fast-effects); }
.m3-nav-rail__item[aria-current="page"] { color: var(--md-sys-color-secondary); }
.m3-nav-rail__item[aria-current="page"] .m3-nav-rail__indicator { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-nav-rail__item[aria-current="page"] .m3-icon { --m3-icon-fill: 1; }

.m3-nav-rail.is-expanded { width: 240px; padding-inline: 0; }
.m3-nav-rail.is-expanded .m3-nav-rail__item { width: 240px; padding: 0 20px; align-items: stretch; }
.m3-nav-rail.is-expanded .m3-nav-rail__indicator { width: 100%; height: 56px; border-radius: 28px; justify-content: flex-start; padding: 0 16px; }
.m3-nav-rail.is-expanded .m3-nav-rail__inline-label { max-width: 160px; opacity: 1; }
.m3-nav-rail.is-expanded .m3-nav-rail__label { display: none; }
.m3-nav-rail.is-expanded .m3-nav-rail__item[aria-current="page"] .m3-nav-rail__inline-label { color: var(--md-sys-color-on-secondary-container); }
.m3-nav-rail.is-modal.is-expanded {
  background: var(--md-sys-color-surface-container);
  border-radius: 0 var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0;
  box-shadow: var(--md-sys-elevation-level2);
}

/* ------------------------------------------------------ Navigation drawer */
.m3-drawer {
  width: 300px;
  max-width: 100%;
  padding: 12px;
  background: var(--md-sys-color-surface-container-low);
  border-radius: 0 var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large) 0;
}
.m3-drawer__headline { padding: 18px 16px; font: var(--md-sys-typescale-title-small); color: var(--md-sys-color-on-surface-variant); }
.m3-drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 56px;
  padding: 0 24px 0 16px;
  border-radius: 28px;
  font: var(--md-sys-typescale-label-large);
  color: var(--md-sys-color-on-surface-variant);
}
.m3-drawer__item .badge { margin-left: auto; font: var(--md-sys-typescale-label-large); }
.m3-drawer__item[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.m3-drawer__item[aria-current="page"] .m3-icon { --m3-icon-fill: 1; }

/* ------------------------------------------------------------------- Tabs */
.m3-tabs {
  position: relative;
  display: flex;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-surface-variant);
  overflow-x: auto;
  scrollbar-width: none;
}
.m3-tabs::-webkit-scrollbar { display: none; }
.m3-tab {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 90px;
  height: 48px;
  padding: 0 16px;
  font: var(--md-sys-typescale-title-small);
  letter-spacing: var(--md-sys-typescale-title-small-tracking);
  color: var(--md-sys-color-on-surface-variant);
  white-space: nowrap;
}
.m3-tabs--icons .m3-tab { height: 64px; }
.m3-tab__content { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.m3-tab[aria-selected="true"] { color: var(--md-sys-color-primary); }
.m3-tab[aria-selected="true"] .m3-icon { --m3-icon-fill: 1; }
.m3-tabs__indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--md-sys-color-primary);
  transition: transform var(--md-sys-motion-spring-default-spatial), width var(--md-sys-motion-spring-default-spatial);
  pointer-events: none;
}
.m3-tabs--secondary .m3-tab[aria-selected="true"] { color: var(--md-sys-color-on-surface); }
.m3-tabs--secondary .m3-tab__content { flex-direction: row; gap: 8px; }
.m3-tabs--secondary .m3-tabs__indicator { height: 2px; border-radius: 0; }
.m3-tabs--scrollable .m3-tab { flex: 0 0 auto; }

/* ----------------------------------------------------------------- Search */
.m3-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 56px;
  padding: 0 4px;
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  transition: background-color var(--md-sys-motion-spring-default-effects);
}
.m3-search-bar:hover { background: color-mix(in srgb, var(--md-sys-color-surface-container-high), var(--md-sys-color-on-surface) 8%); }
.m3-search-bar__icon { width: 48px; display: grid; place-items: center; flex: none; }
.m3-search-bar input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  color: var(--md-sys-color-on-surface);
}
.m3-search-bar input::placeholder { color: var(--md-sys-color-on-surface-variant); }
.m3-search-bar input::-webkit-search-cancel-button { display: none; }
.m3-search-bar__trailing { display: flex; align-items: center; gap: 0; padding-right: 4px; }
.m3-search-bar .m3-avatar { width: 30px; height: 30px; font: var(--md-sys-typescale-label-medium); margin: 0 5px; }

.m3-search-view {
  position: relative;
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-high);
  overflow: hidden;
  transition: border-radius var(--md-sys-motion-spring-default-spatial), box-shadow var(--md-sys-motion-spring-default-effects);
}
.m3-search-view .m3-search-bar { background: transparent; }
.m3-search-view__results {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--md-sys-motion-spring-default-spatial);
}
.m3-search-view__results > div { overflow: hidden; }
.m3-search-view.is-open { background: var(--md-sys-color-surface-container-high); }
.m3-search-view.is-open .m3-search-view__results { grid-template-rows: 1fr; }
.m3-search-view .m3-divider { background: var(--md-sys-color-outline); }
.m3-search-view .m3-list { background: transparent; }
.m3-search-view .m3-list-item { min-height: 56px; }

.m3-nav-bar__item, .m3-nav-rail__item, .m3-drawer__item { text-decoration: none; -webkit-tap-highlight-color: transparent; }

/* Flexible navigation bar: vertical items on compact windows, horizontal
   items (icon + label inside the indicator) on medium windows (600–839dp). */
@media (min-width: 600px) {
  .m3-nav-bar--flexible { justify-content: center; gap: 8px; }
  .m3-nav-bar--flexible .m3-nav-bar__item { flex: 0 1 auto; flex-direction: row; gap: 4px; padding: 0 16px; height: 40px; margin: auto 0; border-radius: 20px; }
  .m3-nav-bar--flexible .m3-nav-bar__indicator { width: auto; height: auto; background: none !important; animation: none !important; }
  .m3-nav-bar--flexible .m3-nav-bar__indicator::before { display: none; }
  .m3-nav-bar--flexible .m3-nav-bar__item[aria-current="page"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
  .m3-nav-bar--flexible .m3-nav-bar__item:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
  .m3-nav-bar--flexible .m3-nav-bar__item[aria-current="page"]:hover { background: color-mix(in srgb, var(--md-sys-color-secondary-container), var(--md-sys-color-on-secondary-container) 8%); }
}


/* ===== css/components/selection.css ===== */
/* ==========================================================================
   SELECTION — Checkbox, Chips, Date pickers, Menus, Radio button,
               Sliders, Switch, Time pickers
   ========================================================================== */

/* Shared 40px touch/state target used by checkbox, radio and switch handle */
.m3-target {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex: none;
}
.m3-target::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--target-color, var(--md-sys-color-on-surface));
  opacity: 0;
  transition: opacity var(--md-sys-motion-spring-fast-effects);
}
.m3-target::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; }
label:hover > .m3-target::before, .m3-target:hover::before { opacity: var(--md-sys-state-hover-opacity); }
label:active > .m3-target::before { opacity: var(--md-sys-state-pressed-opacity); }
input:focus-visible + .m3-target { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 0; }

.m3-control-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  color: var(--md-sys-color-on-surface);
  -webkit-tap-highlight-color: transparent;
}
.m3-control-label > input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.m3-control-label:has(input:disabled) { cursor: default; color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }
.m3-control-label:has(input:disabled) .m3-target::before { display: none; }

/* --------------------------------------------------------------- Checkbox */
.m3-checkbox__box {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  display: grid;
  place-items: center;
  transition: background-color var(--md-sys-motion-spring-fast-effects), border-color var(--md-sys-motion-spring-fast-effects);
}
.m3-checkbox__box svg { width: 14px; height: 14px; stroke: var(--md-sys-color-on-primary); stroke-width: 2.2; fill: none; }
.m3-checkbox__box .check { stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset var(--md-sys-motion-spring-default-effects); }
.m3-checkbox__box .dash { opacity: 0; }
input:checked + .m3-target { --target-color: var(--md-sys-color-primary); }
input:checked + .m3-target .m3-checkbox__box,
input:indeterminate + .m3-target .m3-checkbox__box { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
input:checked + .m3-target .m3-checkbox__box .check { stroke-dashoffset: 0; }
input:indeterminate + .m3-target .m3-checkbox__box .check { opacity: 0; }
input:indeterminate + .m3-target .m3-checkbox__box .dash { opacity: 1; }
.m3-checkbox--error .m3-checkbox__box { border-color: var(--md-sys-color-error); }
.m3-checkbox--error input:checked + .m3-target .m3-checkbox__box { background: var(--md-sys-color-error); border-color: var(--md-sys-color-error); }
.m3-checkbox--error .m3-checkbox__box svg { stroke: var(--md-sys-color-on-error); }
input:disabled + .m3-target .m3-checkbox__box { border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }
input:disabled:checked + .m3-target .m3-checkbox__box { background: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); border-color: transparent; }
input:disabled + .m3-target .m3-checkbox__box svg { stroke: var(--md-sys-color-surface); }

/* ------------------------------------------------------------ Radio button */
.m3-radio__ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  display: grid;
  place-items: center;
  transition: border-color var(--md-sys-motion-spring-fast-effects);
}
.m3-radio__ring::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  transform: scale(0);
  transition: transform var(--md-sys-motion-spring-fast-spatial);
}
input:checked + .m3-target .m3-radio__ring { border-color: var(--md-sys-color-primary); }
input:checked + .m3-target .m3-radio__ring::after { transform: scale(1); }
input:disabled + .m3-target .m3-radio__ring { border-color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }
input:disabled + .m3-target .m3-radio__ring::after { background: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); }

/* ----------------------------------------------------------------- Switch */
.m3-switch { gap: 16px; }
.m3-switch__track {
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 16px;
  border: 2px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface-container-highest);
  flex: none;
  transition: background-color var(--md-sys-motion-spring-default-effects), border-color var(--md-sys-motion-spring-default-effects);
}
.m3-switch__track .m3-target {
  position: absolute;
  top: 50%;
  left: -6px;
  transform: translate(0, -50%);
  transition: transform var(--md-sys-motion-spring-fast-spatial);
}
.m3-switch__handle {
  position: relative;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  display: grid;
  place-items: center;
  transition: width var(--md-sys-motion-spring-fast-spatial), height var(--md-sys-motion-spring-fast-spatial), background-color var(--md-sys-motion-spring-default-effects);
}
.m3-switch__handle .m3-icon { --m3-icon-size: 16px; color: var(--md-sys-color-surface-container-highest); opacity: 0; transition: opacity var(--md-sys-motion-spring-fast-effects); }
.m3-switch__handle .on { display: none; }
.m3-switch--icons .m3-switch__handle { width: 24px; height: 24px; }
.m3-switch--icons .m3-switch__handle .off { opacity: 1; }
.m3-switch__track::after { content: ""; position: absolute; inset: -10px -2px; }
input:checked + .m3-switch__track { background: var(--md-sys-color-primary); border-color: var(--md-sys-color-primary); }
input:checked + .m3-switch__track .m3-target { transform: translate(20px, -50%); --target-color: var(--md-sys-color-primary); }
input:checked + .m3-switch__track .m3-switch__handle { width: 24px; height: 24px; background: var(--md-sys-color-on-primary); }
input:checked + .m3-switch__track .m3-switch__handle .on { display: inline-flex; opacity: 1; color: var(--md-sys-color-on-primary-container); }
input:checked + .m3-switch__track .m3-switch__handle .off { display: none; }
.m3-switch:active .m3-switch__handle { width: 28px; height: 28px; }
.m3-switch:hover input:checked + .m3-switch__track .m3-switch__handle { background: var(--md-sys-color-primary-container); }
.m3-switch:hover input:not(:checked) + .m3-switch__track .m3-switch__handle { background: var(--md-sys-color-on-surface-variant); }
input:focus-visible + .m3-switch__track { outline: 3px solid var(--md-sys-color-secondary); outline-offset: 2px; }
input:disabled + .m3-switch__track { opacity: .38; }

/* ------------------------------------------------------------------ Chips */
.m3-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-small);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-outline-variant);
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-large);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  white-space: nowrap;
  flex: none;
  transition: background-color var(--md-sys-motion-spring-default-effects), box-shadow var(--md-sys-motion-spring-default-effects), padding var(--md-sys-motion-spring-fast-spatial);
}
.m3-chip .m3-icon { --m3-icon-size: 18px; }
.m3-chip--assist { color: var(--md-sys-color-on-surface); }
.m3-chip--assist .m3-icon { color: var(--md-sys-color-primary); }
.m3-chip:has(> .m3-icon:first-child), .m3-chip:has(> .m3-chip__check) { padding-left: 8px; }
.m3-chip:has(> .m3-chip__remove) { padding-right: 8px; }
.m3-chip--elevated { box-shadow: var(--md-sys-elevation-level1); background: var(--md-sys-color-surface-container-low); }
.m3-chip--elevated:hover { box-shadow: var(--md-sys-elevation-level2); }

.m3-chip__check { width: 0; overflow: hidden; transition: width var(--md-sys-motion-spring-fast-spatial); display: inline-flex; }
.m3-chip--filter { padding-left: 16px; }
.m3-chip--filter[aria-pressed="true"] {
  padding-left: 8px;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  box-shadow: none;
}
.m3-chip--filter[aria-pressed="true"] .m3-chip__check { width: 18px; }
.m3-chip--filter.m3-chip--elevated[aria-pressed="true"] { box-shadow: var(--md-sys-elevation-level1); }
.m3-chip--filter:has(.m3-chip__menu) { padding-right: 8px; }

.m3-chip--input { padding: 0 8px 0 12px; }
.m3-chip--input:has(.m3-chip__avatar) { padding-left: 4px; border-radius: 16px; }
.m3-chip__avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); display: grid; place-items: center; font: var(--md-sys-typescale-label-small); }
.m3-chip__remove { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: inherit; }
.m3-chip__remove:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.m3-chip--input.is-selected { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); box-shadow: none; }
.m3-chip.is-removing { animation: m3-chip-out var(--md-sys-motion-spring-default-effects) forwards; }
@keyframes m3-chip-out { to { opacity: 0; transform: scale(.6); } }
.m3-chip:disabled { color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent); cursor: default; }
.m3-chip:disabled .m3-icon { color: inherit; }

/* ------------------------------------------------------------------ Menus */
.m3-menu {
  --menu-bg: var(--md-sys-color-surface-container-low);
  --menu-fg: var(--md-sys-color-on-surface);
  --menu-fg-variant: var(--md-sys-color-on-surface-variant);
  --menu-sel-bg: var(--md-sys-color-tertiary-container);
  --menu-sel-fg: var(--md-sys-color-on-tertiary-container);
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  min-width: 112px;
  max-width: 280px;
  z-index: 1000;
}
.m3-menu--vibrant {
  --menu-bg: var(--md-sys-color-tertiary-container);
  --menu-fg: var(--md-sys-color-on-tertiary-container);
  --menu-fg-variant: var(--md-sys-color-on-tertiary-container);
  --menu-sel-bg: var(--md-sys-color-tertiary);
  --menu-sel-fg: var(--md-sys-color-on-tertiary);
}
.m3-menu__group {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px;
  background: var(--menu-bg);
  border-radius: 4px;
  box-shadow: var(--md-sys-elevation-level2);
}
.m3-menu__group:first-child { border-top-left-radius: 16px; border-top-right-radius: 16px; }
.m3-menu__group:last-child  { border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; }
.m3-menu__label { padding: 12px 12px 4px; font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); color: var(--menu-fg-variant); }
.m3-menu__item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 4px;
  color: var(--menu-fg);
  font: var(--md-sys-typescale-label-large);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  transition: border-radius var(--md-sys-motion-spring-fast-spatial), background-color var(--md-sys-motion-spring-default-effects);
}
.m3-menu__item:first-child { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.m3-menu__item:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.m3-menu__item:hover, .m3-menu__item:focus-visible { border-radius: 12px; }
.m3-menu__item .m3-icon { --m3-icon-size: 20px; color: var(--menu-fg-variant); }
.m3-menu__item .trailing { margin-left: auto; padding-left: 16px; font: var(--md-sys-typescale-label-large); color: var(--menu-fg-variant); }
.m3-menu__item[aria-checked="true"], .m3-menu__item[aria-selected="true"] {
  background: var(--menu-sel-bg);
  color: var(--menu-sel-fg);
  border-radius: 12px;
}
.m3-menu__item[aria-checked="true"] .m3-icon, .m3-menu__item[aria-selected="true"] .m3-icon,
.m3-menu__item[aria-checked="true"] .trailing { color: var(--menu-sel-fg); --m3-icon-fill: 1; }
.m3-menu__item:disabled { opacity: .38; cursor: default; }
.m3-menu__divider { height: 1px; margin: 4px 12px; background: var(--md-sys-color-outline-variant); }

.m3-menu--popup {
  position: fixed;
  opacity: 0;
  visibility: hidden; /* closed menus leave the accessibility tree and tab order */
  transform: scaleY(.6) translateY(-8px);
  transform-origin: top;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-spring-fast-effects), transform var(--md-sys-motion-spring-default-spatial), visibility 0s linear 250ms;
}
.m3-menu--popup.is-open { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }

/* ---------------------------------------------------------------- Sliders */
.m3-slider {
  --track-h: 16px;
  --handle-h: 44px;
  --r-track: 8px;
  --r-inner: 2px;
  --handle-w: 4px;
  --gap: 6px;
  position: relative;
  height: var(--handle-h);
  width: 100%;
  min-width: 160px;
  touch-action: none;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m3-slider::before { content: ""; position: absolute; inset: min(0px, calc((var(--handle-h) - 48px) / 2)) 0; }
.m3-slider--vertical::before { inset: 0 min(0px, calc((var(--handle-h) - 48px) / 2)); }
.m3-slider--s  { --track-h: 24px; --handle-h: 44px; --r-track: 8px; }
.m3-slider--m  { --track-h: 40px; --handle-h: 52px; --r-track: 12px; }
.m3-slider--l  { --track-h: 56px; --handle-h: 68px; --r-track: 16px; }
.m3-slider--xl { --track-h: 96px; --handle-h: 108px; --r-track: 28px; }

.m3-slider__seg {
  position: absolute;
  top: 50%;
  height: var(--track-h);
  transform: translateY(-50%);
  overflow: hidden;
}
.m3-slider__active { background: var(--md-sys-color-primary); border-radius: var(--r-track) var(--r-inner) var(--r-inner) var(--r-track); }
.m3-slider__inactive { background: var(--md-sys-color-secondary-container); border-radius: var(--r-inner) var(--r-track) var(--r-track) var(--r-inner); }
.m3-slider__inactive--start { border-radius: var(--r-track) var(--r-inner) var(--r-inner) var(--r-track); }
.m3-slider__active--mid { border-radius: var(--r-inner); }
.m3-slider__icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  --m3-icon-size: calc(min(var(--track-h) * .6, 32px));
  pointer-events: none;
}
.m3-slider__icon--active { left: 12px; color: var(--md-sys-color-on-primary); }
.m3-slider__icon--inactive { right: 12px; color: var(--md-sys-color-on-secondary-container); }
.m3-slider__stop {
  position: absolute;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--md-sys-color-on-secondary-container);
  pointer-events: none;
}
.m3-slider__stop.is-active { background: var(--md-sys-color-on-primary); }
.m3-slider__handle {
  position: absolute;
  top: 0;
  width: var(--handle-w);
  height: var(--handle-h);
  margin-left: calc(var(--handle-w) / -2);
  border-radius: 2px;
  background: var(--md-sys-color-primary);
  transition: width var(--md-sys-motion-spring-fast-spatial), margin var(--md-sys-motion-spring-fast-spatial);
  outline-offset: 4px;
}
.m3-slider.is-dragging .m3-slider__handle.is-current,
.m3-slider__handle:focus-visible { --handle-w: 2px; }
.m3-slider__value {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  min-width: 48px;
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  font: var(--md-sys-typescale-label-large);
  transform: translateX(-50%) scale(.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-spring-fast-effects), transform var(--md-sys-motion-spring-fast-spatial);
}
.m3-slider.is-dragging .m3-slider__handle.is-current .m3-slider__value,
.m3-slider__handle:focus-visible .m3-slider__value { opacity: 1; transform: translateX(-50%); }
.m3-slider.is-disabled { opacity: .38; pointer-events: none; filter: grayscale(1); }

/* vertical */
.m3-slider--vertical { width: var(--handle-h); height: 240px; min-width: 0; }
.m3-slider--vertical .m3-slider__seg { top: auto; left: 50%; width: var(--track-h); height: auto; transform: translateX(-50%); }
.m3-slider--vertical .m3-slider__active { border-radius: var(--r-inner) var(--r-inner) var(--r-track) var(--r-track); }
.m3-slider--vertical .m3-slider__inactive { border-radius: var(--r-track) var(--r-track) var(--r-inner) var(--r-inner); }
.m3-slider--vertical .m3-slider__handle { left: 0; top: auto; width: var(--handle-h); height: var(--handle-w); margin: 0 0 calc(var(--handle-w) / -2) 0; }
.m3-slider--vertical .m3-slider__stop { top: auto; left: 50%; margin: 0 0 -2px -2px; }
.m3-slider--vertical .m3-slider__value { bottom: auto; left: calc(100% + 4px); top: 50%; transform: translateY(-50%) scale(.4); }
.m3-slider--vertical.is-dragging .m3-slider__handle.is-current .m3-slider__value,
.m3-slider--vertical .m3-slider__handle:focus-visible .m3-slider__value { transform: translateY(-50%); }
.m3-slider--vertical .m3-slider__icon--active { left: 50%; top: auto; bottom: 12px; transform: translateX(-50%); }

/* ----------------------------------------------------------- Date pickers */
.m3-date-picker {
  width: 360px;
  max-width: 100%;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: var(--md-sys-elevation-level3);
  overflow: hidden;
}
.m3-date-picker--docked { border-radius: var(--md-sys-shape-corner-large); }
.m3-date-picker__header { padding: 16px 12px 12px 24px; }
.m3-date-picker__supporting { font: var(--md-sys-typescale-label-large); letter-spacing: var(--md-sys-typescale-label-large-tracking); }
.m3-date-picker__headline-row { display: flex; align-items: center; justify-content: space-between; margin-top: 36px; }
.m3-date-picker__headline { font: var(--md-sys-typescale-headline-large); color: var(--md-sys-color-on-surface); }
.m3-date-picker .m3-divider { background: var(--md-sys-color-outline-variant); }
.m3-date-picker__nav { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 16px; height: 56px; }
.m3-date-picker__nav .m3-btn--text { color: var(--md-sys-color-on-surface-variant); padding-inline: 8px; }
.m3-date-picker__nav-group { display: flex; align-items: center; }
.m3-date-picker--docked .m3-date-picker__nav { padding: 4px 4px; }
.m3-date-picker__grid { display: grid; grid-template-columns: repeat(7, 48px); justify-content: center; padding: 0 12px 8px; row-gap: 0; }
.m3-date-picker__dow { height: 48px; display: grid; place-items: center; font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface); }
.m3-date-picker__day {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  position: relative;
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
}
.m3-date-picker__day > span {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  isolation: isolate;
  transition: background-color var(--md-sys-motion-spring-fast-effects), border-radius var(--md-sys-motion-spring-fast-spatial);
}
.m3-date-picker__day > span::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; z-index: -1; transition: opacity var(--md-sys-motion-spring-fast-effects); }
.m3-date-picker__day:hover > span::before { opacity: .08; }
.m3-date-picker__day.is-other { color: var(--md-sys-color-on-surface-variant); opacity: .38; }
.m3-date-picker__day.is-today > span { box-shadow: inset 0 0 0 1px var(--md-sys-color-primary); color: var(--md-sys-color-primary); }
.m3-date-picker__day.is-selected > span { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); box-shadow: none; }
.m3-date-picker__day.is-in-range::after { content: ""; position: absolute; inset: 4px 0; background: var(--md-sys-color-secondary-container); z-index: -1; }
.m3-date-picker__day.is-range-start::after { left: 50%; }
.m3-date-picker__day.is-range-end::after { right: 50%; }
.m3-date-picker__day.is-range-start::after, .m3-date-picker__day.is-range-end::after { content: ""; position: absolute; inset: 4px 0; background: var(--md-sys-color-secondary-container); z-index: -1; }
.m3-date-picker__day.is-range-start.is-range-end::after { display: none; }
.m3-date-picker__day { isolation: isolate; }
.m3-date-picker__years { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 0; padding: 8px 12px 16px; max-height: 288px; overflow-y: auto; justify-items: center; }
.m3-date-picker__year { width: 72px; height: 36px; border-radius: 18px; font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface-variant); }
.m3-date-picker__year:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.m3-date-picker__year.is-selected { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-date-picker__actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 12px 12px; }
.m3-date-picker__actions .start { margin-right: auto; }
.m3-date-picker__input { padding: 8px 24px 16px; }

/* ----------------------------------------------------------- Time pickers */
.m3-time-picker {
  display: inline-flex;
  flex-direction: column;
  width: 328px;
  max-width: 100%;
  padding: 24px;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: var(--md-sys-elevation-level3);
}
.m3-time-picker__headline { font: var(--md-sys-typescale-label-medium); letter-spacing: var(--md-sys-typescale-label-medium-tracking); margin-bottom: 20px; }
.m3-time-picker__selector { display: flex; align-items: flex-start; gap: 12px; }
.m3-time-picker__fields { display: flex; align-items: center; gap: 0; }
.m3-time-picker__field {
  width: 96px;
  height: 80px;
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface);
  font: 400 57px/64px var(--md-ref-typeface-brand);
  display: grid;
  place-items: center;
  text-align: center;
  border: 0;
  outline: none;
  transition: background-color var(--md-sys-motion-spring-default-effects);
}
.m3-time-picker__field[aria-pressed="true"], input.m3-time-picker__field:focus {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}
input.m3-time-picker__field:focus { box-shadow: inset 0 0 0 2px var(--md-sys-color-primary); }
.m3-time-picker__colon { width: 24px; text-align: center; font: 400 57px/64px var(--md-ref-typeface-brand); color: var(--md-sys-color-on-surface); }
.m3-time-picker__field-wrap { display: flex; flex-direction: column; gap: 7px; }
.m3-time-picker__field-label { font: var(--md-sys-typescale-body-small); }
.m3-time-picker__period {
  display: flex;
  flex-direction: column;
  width: 52px;
  height: 80px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-small);
  overflow: hidden;
}
.m3-time-picker__period button {
  flex: 1;
  font: var(--md-sys-typescale-title-medium);
  color: var(--md-sys-color-on-surface-variant);
}
.m3-time-picker__period button + button { border-top: 1px solid var(--md-sys-color-outline); }
.m3-time-picker__period button[aria-pressed="true"] { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.m3-time-picker__dial {
  position: relative;
  width: 256px;
  height: 256px;
  margin: 36px auto 0;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-highest);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.m3-time-picker__dial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.m3-time-picker__dial .hand { stroke: var(--md-sys-color-primary); stroke-width: 2; }
.m3-time-picker__dial .center { fill: var(--md-sys-color-primary); }
.m3-time-picker__dial .knob { fill: var(--md-sys-color-primary); }
.m3-time-picker__num {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  display: grid;
  place-items: center;
  font: var(--md-sys-typescale-body-large);
  color: var(--md-sys-color-on-surface);
  pointer-events: none;
  z-index: 1;
}
.m3-time-picker__num.is-selected { color: var(--md-sys-color-on-primary); }
.m3-time-picker__actions { display: flex; align-items: center; gap: 8px; margin-top: 24px; margin-right: -12px; margin-left: -12px; }
.m3-time-picker__actions .spacer { flex: 1; }
.m3-time-picker--input .m3-time-picker__field { height: 72px; }
.m3-time-picker--input .m3-time-picker__period { height: 72px; }

@media (min-width: 720px) {
  .m3-time-picker--horizontal { width: 584px; }
  .m3-time-picker--horizontal .m3-time-picker__body { display: flex; gap: 52px; align-items: flex-start; }
  .m3-time-picker--horizontal .m3-time-picker__selector { flex-direction: column; }
  .m3-time-picker--horizontal .m3-time-picker__period { flex-direction: row; width: 216px; height: 38px; }
  .m3-time-picker--horizontal .m3-time-picker__period button + button { border-top: 0; border-left: 1px solid var(--md-sys-color-outline); }
  .m3-time-picker--horizontal .m3-time-picker__dial { margin: 0; }
  .m3-time-picker--horizontal .m3-time-picker__field { width: 96px; height: 80px; }
}


/* ===== css/components/inputs.css ===== */
/* ==========================================================================
   TEXT INPUTS — Filled and outlined text fields
   ========================================================================== */

.m3-field {
  --field-h: 56px;
  --pad-start: 16px;
  --pad-end: 16px;
  --label-color: var(--md-sys-color-on-surface-variant);
  --indicator: var(--md-sys-color-on-surface-variant);
  --caret: var(--md-sys-color-primary);
  position: relative;
  display: inline-flex;
  flex-direction: column;
  width: 280px;
  max-width: 100%;
  vertical-align: top;
}
.m3-field--full { width: 100%; }
.m3-field__box {
  position: relative;
  display: flex;
  align-items: center;
  min-height: var(--field-h);
  cursor: text;
}
.m3-field__input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  caret-color: var(--caret);
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  padding: 24px var(--pad-end) 8px var(--pad-start);
  height: var(--field-h);
  resize: none;
  appearance: none;
}
textarea.m3-field__input { height: auto; min-height: 96px; padding-top: 28px; }
select.m3-field__input { cursor: pointer; padding-right: 48px; }
.m3-field__input::placeholder { color: transparent; }
.m3-field__input:focus::placeholder { color: var(--md-sys-color-on-surface-variant); }

.m3-field__label {
  position: absolute;
  left: var(--pad-start);
  top: 50%;
  transform: translateY(-50%);
  max-width: calc(100% - var(--pad-start) - var(--pad-end));
  font: var(--md-sys-typescale-body-large);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  color: var(--label-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transform-origin: left top;
  transition:
    top var(--md-sys-motion-spring-default-spatial),
    font-size var(--md-sys-motion-spring-default-spatial),
    line-height var(--md-sys-motion-spring-default-spatial),
    color var(--md-sys-motion-spring-fast-effects);
}
textarea ~ .m3-field__label { top: 28px; }
/* floating */
.m3-field__input:focus ~ .m3-field__label,
.m3-field__input:not(:placeholder-shown) ~ .m3-field__label,
select.m3-field__input ~ .m3-field__label {
  top: 8px;
  transform: none;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: var(--md-sys-typescale-body-small-tracking);
}
.m3-field:focus-within { --label-color: var(--md-sys-color-primary); --indicator: var(--md-sys-color-primary); }

.m3-field__icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-sys-color-on-surface-variant);
  display: inline-flex;
  pointer-events: none;
}
.m3-field__icon--leading { left: 12px; }
.m3-field__icon--trailing { right: 12px; }
.m3-field__icon.m3-icon-btn { pointer-events: auto; right: 4px; }
.m3-field--leading { --pad-start: 52px; }
.m3-field--trailing { --pad-end: 52px; }
.m3-field__prefix, .m3-field__suffix { font: var(--md-sys-typescale-body-large); color: var(--md-sys-color-on-surface-variant); padding-top: 16px; }
.m3-field__prefix { padding-left: var(--pad-start); margin-right: -12px; }
.m3-field__suffix { padding-right: 16px; margin-left: -8px; }
.m3-field:has(.m3-field__prefix) .m3-field__input:placeholder-shown:not(:focus) ~ .m3-field__prefix { opacity: 0; }

.m3-field__supporting {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 16px 0;
  font: var(--md-sys-typescale-body-small);
  letter-spacing: var(--md-sys-typescale-body-small-tracking);
  color: var(--md-sys-color-on-surface-variant);
  min-height: 20px;
}

/* --- Filled --- */
.m3-field--filled .m3-field__box {
  background: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
  isolation: isolate;
}
.m3-field--filled .m3-field__box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--md-sys-color-on-surface);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--md-sys-motion-spring-fast-effects);
}
.m3-field--filled .m3-field__box:hover::before { opacity: var(--md-sys-state-hover-opacity); }
.m3-field--filled .m3-field__box::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--indicator);
  transition: height var(--md-sys-motion-spring-fast-spatial), background-color var(--md-sys-motion-spring-fast-effects);
}
.m3-field--filled:focus-within .m3-field__box::after { height: 2px; }

/* --- Outlined --- */
.m3-field--outlined .m3-field__outline {
  position: absolute;
  inset: -5px 0 0;
  margin: 0;
  padding: 0 calc(var(--pad-start) - 4px);
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  pointer-events: none;
  transition: border-color var(--md-sys-motion-spring-fast-effects);
}
.m3-field--outlined .m3-field__box:hover .m3-field__outline { border-color: var(--md-sys-color-on-surface); }
.m3-field--outlined:focus-within .m3-field__outline { border: 2px solid var(--md-sys-color-primary); padding-inline: calc(var(--pad-start) - 5px); }
.m3-field__outline legend {
  padding: 0;
  max-width: 0.01px;
  height: 11px;
  visibility: hidden;
  white-space: nowrap;
  font-size: 12px;
  line-height: 16px;
  transition: max-width 50ms linear;
}
.m3-field__outline legend span { padding: 0 4px; display: inline-block; opacity: 0; }
.m3-field--outlined .m3-field__input:focus ~ .m3-field__outline legend,
.m3-field--outlined .m3-field__input:not(:placeholder-shown) ~ .m3-field__outline legend,
.m3-field--outlined select.m3-field__input ~ .m3-field__outline legend { max-width: 100%; transition-duration: 100ms; }
.m3-field--outlined .m3-field__input { padding-block: 16px; }
.m3-field--outlined textarea.m3-field__input { padding-top: 16px; }
.m3-field--outlined .m3-field__input:focus ~ .m3-field__label,
.m3-field--outlined .m3-field__input:not(:placeholder-shown) ~ .m3-field__label,
.m3-field--outlined select.m3-field__input ~ .m3-field__label { top: -8px; }
.m3-field--outlined .m3-field__prefix, .m3-field--outlined .m3-field__suffix { padding-top: 0; }
.m3-field--outlined textarea ~ .m3-field__label { top: 18px; }

/* --- Error --- */
.m3-field.is-error, .m3-field:has(.m3-field__input:user-invalid) {
  --label-color: var(--md-sys-color-error);
  --indicator: var(--md-sys-color-error);
  --caret: var(--md-sys-color-error);
}
.m3-field.is-error .m3-field__supporting, .m3-field:has(.m3-field__input:user-invalid) .m3-field__supporting { color: var(--md-sys-color-error); }
.m3-field.is-error .m3-field__outline, .m3-field:has(.m3-field__input:user-invalid) .m3-field__outline { border-color: var(--md-sys-color-error) !important; }
.m3-field.is-error .m3-field__icon--trailing { color: var(--md-sys-color-error); }

/* --- Disabled --- */
.m3-field:has(.m3-field__input:disabled) { opacity: .38; pointer-events: none; }
