/* =========================================================
   Material 3 Components — Sturm und Gewitterjagd Tirol
   Setzt m3.css voraus.
   ========================================================= */

/* ============ BUTTONS ============ */
/* Common ripple-like state layer */
.m3-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 24px;
  border-radius: var(--md-sys-shape-corner-full);
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-sys-typescale-label-large-font);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
              box-shadow var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.m3-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.m3-btn:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-btn:focus-visible::before { opacity: var(--md-sys-state-focus-opacity); outline: none; }
.m3-btn:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-btn .material-symbols-outlined { font-size: 18px; }

/* Filled */
.m3-btn--filled        { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-btn--filled:hover  { box-shadow: var(--md-sys-elevation-level1); }

/* Tonal */
.m3-btn--tonal         { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }

/* Tonal Tertiary (Lime-Akzent) */
.m3-btn--tertiary      { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }

/* Outlined */
.m3-btn--outlined      { background: transparent; color: var(--md-sys-color-primary); border: 1px solid var(--md-sys-color-outline); }

/* Text */
.m3-btn--text          { background: transparent; color: var(--md-sys-color-primary); padding-left: 12px; padding-right: 12px; }

/* Elevated */
.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--elevated:hover{ box-shadow: var(--md-sys-elevation-level2); }

/* Sizes */
.m3-btn--sm { min-height: 32px; padding: 6px 16px; font-size: var(--md-sys-typescale-label-medium-size); }
.m3-btn--lg { min-height: 56px; padding: 16px 32px; font-size: 16px; }
.m3-btn--block { display: flex; width: 100%; }

/* ============ ICON BUTTON ============ */
.m3-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: var(--md-sys-shape-corner-full);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  -webkit-tap-highlight-color: transparent;
}
.m3-icon-btn::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.m3-icon-btn:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-icon-btn:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.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--lg { width: 48px; height: 48px; }

/* ============ FAB ============ */
.m3-fab {
  position: relative;
  min-width: 56px; height: 56px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  box-shadow: var(--md-sys-elevation-level3);
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/1 var(--md-sys-typescale-label-large-font);
  transition: box-shadow var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.m3-fab::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.m3-fab:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-fab:hover          { box-shadow: var(--md-sys-elevation-level4); }
.m3-fab:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-fab--surface  { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-primary); }
.m3-fab--primary  { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.m3-fab--tertiary { background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container); }
.m3-fab--extended { min-width: 80px; }
.m3-fab--sm  { width: 40px; min-width: 40px; height: 40px; border-radius: var(--md-sys-shape-corner-medium); padding: 0; }
.m3-fab--lg  { width: 96px; height: 96px; border-radius: var(--md-sys-shape-corner-extra-large); padding: 0; }
.m3-fab--lg .material-symbols-outlined { font-size: 36px; }

/* ============ CARD ============ */
.m3-card {
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 16px;
  position: relative;
  transition: box-shadow var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}
.m3-card--elevated  { background: var(--md-sys-color-surface-container-low); box-shadow: var(--md-sys-elevation-level1); }
.m3-card--elevated:hover { box-shadow: var(--md-sys-elevation-level2); }
.m3-card--filled    { background: var(--md-sys-color-surface-container-highest); }
.m3-card--outlined  { background: var(--md-sys-color-surface); border: 1px solid var(--md-sys-color-outline-variant); }
.m3-card--clickable { cursor: pointer; -webkit-tap-highlight-color: transparent; text-decoration: none; color: inherit; display: block; }
.m3-card--clickable::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--md-sys-color-on-surface); opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  pointer-events: none;
}
.m3-card--clickable:hover::after  { opacity: var(--md-sys-state-hover-opacity); }
.m3-card--clickable:active::after { opacity: var(--md-sys-state-pressed-opacity); }

/* ============ CHIP ============ */
.m3-chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-small);
  border: 1px solid var(--md-sys-color-outline-variant);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/1 var(--md-sys-typescale-label-large-font);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  text-decoration: none;
  transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
              border-color var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  -webkit-tap-highlight-color: transparent;
}
.m3-chip .material-symbols-outlined { font-size: 18px; }
.m3-chip::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--md-sys-color-on-surface); opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-chip:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-chip:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-chip.is-selected, .m3-chip[aria-selected="true"] {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}
.m3-chip--assist { /* base */ }
.m3-chip--input  { padding-left: 12px; padding-right: 12px; }
.m3-chip--suggestion { background: transparent; }

/* ============ TOP APP BAR ============ */
.m3-top-app-bar {
  position: sticky; top: 0; z-index: 30;
  height: 64px;
  padding: 0 4px 0 4px;
  display: flex; align-items: center; gap: 4px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: background var(--md-sys-motion-duration-short3);
}
.m3-top-app-bar--scrolled { background: var(--md-sys-color-surface-container); box-shadow: 0 1px 0 var(--md-sys-color-outline-variant); }
.m3-top-app-bar__leading { display: flex; align-items: center; }
.m3-top-app-bar__title {
  flex: 1;
  font: var(--md-sys-typescale-title-large-weight) var(--md-sys-typescale-title-large-size)/var(--md-sys-typescale-title-large-line-height) var(--md-sys-typescale-title-large-font);
  padding: 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m3-top-app-bar__trailing { display: flex; align-items: center; gap: 4px; padding-right: 4px; }

/* Center-aligned variant */
.m3-top-app-bar--center .m3-top-app-bar__title { text-align: center; }

/* Large variant: shrinks on scroll */
.m3-top-app-bar--large {
  height: auto;
  flex-wrap: wrap;
  padding-bottom: 28px;
}
.m3-top-app-bar--large .m3-top-app-bar__row { display: flex; align-items: center; width: 100%; padding: 4px 4px 0; gap: 4px; }
.m3-top-app-bar--large .m3-top-app-bar__title {
  font: 700 32px/40px var(--md-ref-typeface-brand);
  letter-spacing: -0.01em;
  padding: 16px 16px 0;
  flex: 0 0 100%;
}

/* ============ BOTTOM NAVIGATION BAR ============ */
.m3-bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  height: 80px;
  background: var(--md-sys-color-surface-container);
  display: flex; align-items: stretch;
  padding: 12px 0 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  /* shadow above to lift it off content */
  box-shadow: 0 -1px 0 var(--md-sys-color-outline-variant);
}
.m3-bottom-nav__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4px;
  padding: 0 4px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.m3-bottom-nav__indicator {
  width: 64px; height: 32px;
  border-radius: var(--md-sys-shape-corner-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  position: relative;
  transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}
.m3-bottom-nav__indicator::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3);
}
.m3-bottom-nav__item:hover .m3-bottom-nav__indicator::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-bottom-nav__item:active .m3-bottom-nav__indicator::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-bottom-nav__indicator .material-symbols-outlined { font-size: 24px; }
.m3-bottom-nav__label {
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-sys-typescale-label-medium-font);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}
.m3-bottom-nav__item.is-active {
  color: var(--md-sys-color-on-surface);
}
.m3-bottom-nav__item.is-active .m3-bottom-nav__indicator {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.m3-bottom-nav__item.is-active .m3-bottom-nav__indicator .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
.m3-bottom-nav__item.is-active .m3-bottom-nav__label {
  font-weight: 600;
}
.m3-bottom-nav__badge {
  position: absolute; top: -4px; right: 16px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font: 600 10px/16px var(--md-ref-typeface-plain);
  display: inline-flex; align-items: center; justify-content: center;
}

/* Reserve space so content isn't covered */
body.has-bottom-nav { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* ============ NAVIGATION DRAWER (modal) ============ */
.m3-scrim {
  position: fixed; inset: 0; z-index: 80;
  background: var(--md-sys-color-scrim);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              visibility 0s var(--md-sys-motion-duration-medium2);
}
.m3-scrim.is-open { opacity: 0.4; visibility: visible; transition-delay: 0s; }

.m3-drawer {
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 90;
  width: min(360px, 90vw);
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  padding: 12px 12px 12px 16px;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform var(--md-sys-motion-duration-long1) var(--md-sys-motion-easing-emphasized-decel);
  display: flex; flex-direction: column; gap: 4px;
}
.m3-drawer.is-open { transform: translateX(0); }
.m3-drawer__head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 8px;
  font: 700 22px/28px var(--md-ref-typeface-brand);
  color: var(--md-sys-color-on-surface);
}
.m3-drawer__head__close { margin-left: auto; }
.m3-drawer__section-label {
  padding: 18px 16px 8px;
  font: var(--md-sys-typescale-title-small-weight) var(--md-sys-typescale-title-small-size)/var(--md-sys-typescale-title-small-line-height) var(--md-sys-typescale-title-small-font);
  letter-spacing: var(--md-sys-typescale-title-small-tracking);
  color: var(--md-sys-color-on-surface-variant);
  text-transform: uppercase;
}
.m3-drawer__item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 56px;
  padding: 0 24px 0 16px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-sys-typescale-label-large-font);
  -webkit-tap-highlight-color: transparent;
}
.m3-drawer__item::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-drawer__item:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-drawer__item:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-drawer__item.is-active {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.m3-drawer__item.is-active .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.m3-drawer__item .count {
  margin-left: auto;
  font: var(--md-sys-typescale-label-small-weight) var(--md-sys-typescale-label-small-size)/1 var(--md-sys-typescale-label-small-font);
}

body.no-scroll { overflow: hidden; }

/* ============ NAVIGATION RAIL (Desktop, Admin) ============ */
.m3-rail {
  position: sticky; top: 0;
  width: 80px; min-width: 80px;
  height: 100vh;
  background: var(--md-sys-color-surface);
  display: flex; flex-direction: column;
  padding: 8px 0;
  align-items: center;
  gap: 4px;
  overflow-y: auto;
  border-right: 1px solid var(--md-sys-color-outline-variant);
}
.m3-rail__menu  { margin: 12px 0 8px; }
.m3-rail__fab   { margin-bottom: 16px; }
.m3-rail__item {
  position: relative;
  width: 80px;
  padding: 8px 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.m3-rail__indicator {
  position: relative;
  width: 56px; height: 32px;
  border-radius: var(--md-sys-shape-corner-full);
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
}
.m3-rail__indicator::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-rail__item:hover .m3-rail__indicator::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-rail__item:active .m3-rail__indicator::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-rail__item.is-active .m3-rail__indicator {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.m3-rail__item.is-active .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.m3-rail__item.is-active { color: var(--md-sys-color-on-surface); }
.m3-rail__label {
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/1 var(--md-sys-typescale-label-medium-font);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}
.m3-rail__brand {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  display: grid; place-items: center;
  font: 700 18px/1 var(--md-ref-typeface-brand);
  margin-bottom: 8px;
}
.m3-rail__divider { width: 56px; height: 1px; background: var(--md-sys-color-outline-variant); margin: 8px 0; }
.m3-rail__bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; }
.m3-rail__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--md-sys-color-tertiary-container); color: var(--md-sys-color-on-tertiary-container);
  display: grid; place-items: center;
  font: 700 14px/1 var(--md-ref-typeface-plain);
}

/* ============ LIST ITEM ============ */
.m3-list { display: flex; flex-direction: column; }
.m3-list-item {
  position: relative;
  display: flex; align-items: center; gap: 16px;
  min-height: 56px;
  padding: 8px 16px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.m3-list-item::before {
  content: ""; position: absolute; inset: 0;
  background: currentColor; opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-list-item:hover::before  { opacity: var(--md-sys-state-hover-opacity); }
.m3-list-item:active::before { opacity: var(--md-sys-state-pressed-opacity); }
.m3-list-item__leading { width: 40px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--md-sys-color-on-surface-variant); }
.m3-list-item__body { flex: 1; min-width: 0; }
.m3-list-item__headline { font: var(--md-sys-typescale-body-large-weight) var(--md-sys-typescale-body-large-size)/var(--md-sys-typescale-body-large-line-height) var(--md-sys-typescale-body-large-font); }
.m3-list-item__support { font: var(--md-sys-typescale-body-medium-weight) var(--md-sys-typescale-body-medium-size)/var(--md-sys-typescale-body-medium-line-height) var(--md-sys-typescale-body-medium-font); color: var(--md-sys-color-on-surface-variant); }
.m3-list-item__trailing { color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-label-small-weight) var(--md-sys-typescale-label-small-size)/1 var(--md-sys-typescale-label-small-font); }
.m3-divider { height: 1px; background: var(--md-sys-color-outline-variant); margin: 0; border: 0; }

/* ============ TEXT FIELDS (outlined) ============ */
.m3-field { position: relative; display: block; }
.m3-field input,
.m3-field select,
.m3-field textarea {
  width: 100%;
  height: 56px;
  padding: 18px 16px 6px;
  font: var(--md-sys-typescale-body-large-weight) var(--md-sys-typescale-body-large-size)/var(--md-sys-typescale-body-large-line-height) var(--md-sys-typescale-body-large-font);
  color: var(--md-sys-color-on-surface);
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  outline: none;
  transition: border-color var(--md-sys-motion-duration-short3);
}
.m3-field textarea { height: auto; min-height: 96px; resize: vertical; padding-top: 24px; }
.m3-field input:focus,
.m3-field select:focus,
.m3-field textarea:focus { border-color: var(--md-sys-color-primary); border-width: 2px; padding-left: 15px; padding-right: 15px; }
.m3-field label {
  position: absolute;
  top: 18px; left: 12px;
  padding: 0 4px;
  background: var(--md-sys-color-background);
  color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-body-large-weight) var(--md-sys-typescale-body-large-size)/1 var(--md-sys-typescale-body-large-font);
  pointer-events: none;
  transition: top var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
              font-size var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
              color var(--md-sys-motion-duration-short3);
}
.m3-field input:focus + label,
.m3-field input:not(:placeholder-shown) + label,
.m3-field select:focus + label,
.m3-field select:not(:placeholder-shown) + label,
.m3-field textarea:focus + label,
.m3-field textarea:not(:placeholder-shown) + label {
  top: -8px;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--md-sys-color-primary);
}
.m3-field__support {
  font: var(--md-sys-typescale-body-small-weight) var(--md-sys-typescale-body-small-size)/var(--md-sys-typescale-body-small-line-height) var(--md-sys-typescale-body-small-font);
  letter-spacing: var(--md-sys-typescale-body-small-tracking);
  color: var(--md-sys-color-on-surface-variant);
  padding: 4px 16px 0;
}

/* ============ SWITCH ============ */
.m3-switch {
  --switch-w: 52px;
  --switch-h: 32px;
  position: relative;
  display: inline-block;
  width: var(--switch-w); height: var(--switch-h);
  flex-shrink: 0;
}
.m3-switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.m3-switch__track {
  position: absolute; inset: 0;
  background: var(--md-sys-color-surface-container-highest);
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  transition: background var(--md-sys-motion-duration-short3), border-color var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-switch__thumb {
  position: absolute;
  top: 8px; left: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
              width var(--md-sys-motion-duration-short3),
              height var(--md-sys-motion-duration-short3),
              top var(--md-sys-motion-duration-short3),
              left var(--md-sys-motion-duration-short3),
              background var(--md-sys-motion-duration-short3);
  pointer-events: none;
}
.m3-switch input:checked ~ .m3-switch__track {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}
.m3-switch input:checked ~ .m3-switch__thumb {
  width: 24px; height: 24px;
  top: 4px; left: 24px;
  background: var(--md-sys-color-on-primary);
}

/* ============ SEGMENTED BUTTON ============ */
.m3-segmented {
  display: inline-flex;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
  height: 40px;
}
.m3-segmented button {
  position: relative;
  flex: 1;
  padding: 0 16px;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/1 var(--md-sys-typescale-label-large-font);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  border: none;
  border-right: 1px solid var(--md-sys-color-outline);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.m3-segmented button:last-child { border-right: none; }
.m3-segmented button::before { content: ""; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity var(--md-sys-motion-duration-short3); }
.m3-segmented button:hover::before { opacity: var(--md-sys-state-hover-opacity); }
.m3-segmented button.is-selected,
.m3-segmented button[aria-selected="true"] {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}
.m3-segmented button .material-symbols-outlined { font-size: 18px; }

/* ============ BADGES ============ */
.m3-badge {
  display: inline-flex; align-items: center;
  height: 16px; min-width: 16px; padding: 0 6px;
  border-radius: 8px;
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font: 600 11px/16px var(--md-ref-typeface-plain);
}
.m3-badge--lg { height: 24px; min-width: 24px; padding: 0 8px; border-radius: 12px; font-size: 13px; line-height: 24px; }

/* ============ WARN LEVEL CHIPS ============ */
.m3-warn-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-small);
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/1 var(--md-sys-typescale-label-large-font);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.m3-warn-chip--1 { background: var(--md-sys-color-warn-1-container); color: var(--md-sys-color-on-warn-1-container); }
.m3-warn-chip--2 { background: var(--md-sys-color-warn-2-container); color: var(--md-sys-color-on-warn-2-container); }
.m3-warn-chip--3 { background: var(--md-sys-color-warn-3-container); color: var(--md-sys-color-on-warn-3-container); }
.m3-warn-chip--4 { background: var(--md-sys-color-warn-4-container); color: var(--md-sys-color-on-warn-4-container); }
.m3-warn-chip--5 { background: var(--md-sys-color-warn-5-container); color: var(--md-sys-color-on-warn-5-container); }

.m3-warn-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
}
.m3-warn-dot--1 { background: var(--md-sys-color-warn-1); }
.m3-warn-dot--2 { background: var(--md-sys-color-warn-2); }
.m3-warn-dot--3 { background: var(--md-sys-color-warn-3); }
.m3-warn-dot--4 { background: var(--md-sys-color-warn-4); }
.m3-warn-dot--5 { background: var(--md-sys-color-warn-5); }

/* ============ LAYOUT HELPERS ============ */
.m3-container { width: 100%; padding: 0 16px; }
@media (min-width: 600px)  { .m3-container { padding: 0 24px; } }
@media (min-width: 905px)  { .m3-container { max-width: 840px; margin: 0 auto; } }
@media (min-width: 1240px) { .m3-container { max-width: 1040px; } }
@media (min-width: 1440px) { .m3-container { max-width: 1240px; } }

.m3-stack { display: flex; flex-direction: column; gap: 16px; }
.m3-row   { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
