/* ==================== */
/* MATERIAL DESIGN 3 COMPONENTS */
/* Component Library */
/* ==================== */

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: 'Roboto Flex', sans-serif;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  transition: background-color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard),
              color var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-standard);
}

/* ==================== */
/* STATE LAYERS & RIPPLE */
/* ==================== */

.md-state-layer {
  position: relative;
  overflow: hidden;
}

.md-state-layer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: currentColor;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  pointer-events: none;
  border-radius: inherit;
}

.md-state-layer:hover::before {
  opacity: 0.08;
}

.md-state-layer:focus-visible::before {
  opacity: 0.12;
}

.md-state-layer:active::before {
  opacity: 0.12;
}

.md-state-layer:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* Ripple Effect */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 0.5;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.md-ripple {
  position: absolute;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0.3;
  animation: ripple 600ms var(--md-sys-motion-easing-standard);
  pointer-events: none;
}

/* ==================== */
/* MATERIAL 3 BUTTONS */
/* ==================== */

.md-button {
  height: 40px;
  padding: 0 24px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  user-select: none;
}

.md-button__label {
  user-select: none;
}

/* Filled Button */
.md-button--filled {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-level0);
}

.md-button--filled:hover {
  box-shadow: var(--md-sys-elevation-level1);
}

.md-button--filled:disabled {
  background-color: rgba(28, 27, 31, 0.12);
  color: rgba(28, 27, 31, 0.38);
  box-shadow: none;
  cursor: not-allowed;
}

/* Filled Tonal Button */
.md-button--tonal {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  box-shadow: var(--md-sys-elevation-level0);
}

.md-button--tonal:hover {
  box-shadow: var(--md-sys-elevation-level1);
}

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

/* Text Button */
.md-button--text {
  background-color: transparent;
  color: var(--md-sys-color-primary);
  padding: 0 12px;
}

/* Icon Button */
.md-icon-button {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: var(--md-sys-shape-corner-full);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  padding: 0;
}

.md-icon-button svg,
.md-icon-button .material-symbols-outlined {
  fill: currentColor;
  color: currentColor;
}

/* ==================== */
/* MATERIAL 3 CARDS */
/* ==================== */

.md-card {
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  transition:
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-card--elevated {
  background-color: var(--md-sys-color-surface-container-low);
  box-shadow: var(--md-sys-elevation-level1);
}

.md-card--elevated:hover {
  box-shadow: var(--md-sys-elevation-level2);
}

.md-card--filled {
  background-color: var(--md-sys-color-surface-container-highest);
  box-shadow: none;
}

.md-card--outlined {
  background-color: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: none;
}

.md-card__content {
  padding: 16px;
}

.md-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.md-card__title {
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.md-card__text {
  color: var(--md-sys-color-on-surface-variant);
  margin: 8px 0;
}

.md-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
}

.md-card__supporting-text {
  color: var(--md-sys-color-on-surface-variant);
}

/* ==================== */
/* NAVIGATION BAR (Bottom) */
/* ==================== */

.md-navigation-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  height: calc(80px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-level2);
  z-index: 100;
}

.md-navigation-bar__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--md-sys-color-on-surface-variant);
  padding: 12px 0;
  transition: color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-navigation-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 32px;
  border-radius: var(--md-sys-shape-corner-full);
  position: relative;
  z-index: 2;
}

.md-navigation-bar__icon .material-symbols-outlined {
  font-size: 24px;
}

.md-navigation-bar__label {
  color: currentColor;
  position: relative;
  z-index: 2;
}

.md-navigation-bar__indicator {
  position: absolute;
  top: 8px;
  width: 64px;
  height: 32px;
  background-color: var(--md-sys-color-secondary-container);
  border-radius: var(--md-sys-shape-corner-full);
  opacity: 0;
  transform: scaleX(0);
  transition:
    opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
    transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
  z-index: 1;
}

.md-navigation-bar__item.active {
  color: var(--md-sys-color-on-secondary-container);
}

.md-navigation-bar__item.active .md-navigation-bar__indicator {
  opacity: 1;
  transform: scaleX(1);
}

/* ==================== */
/* FAB (Floating Action Button) */
/* ==================== */

.md-fab {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  border-radius: var(--md-sys-shape-corner-large);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--md-sys-elevation-level3);
  transition:
    box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  z-index: 99;
}

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

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

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

.md-fab__icon,
.md-fab .material-symbols-outlined {
  fill: currentColor;
  color: currentColor;
}

.md-fab:hover {
  box-shadow: var(--md-sys-elevation-level4);
}

.md-fab:active {
  box-shadow: var(--md-sys-elevation-level3);
}

/* ==================== */
/* TOP APP BAR */
/* ==================== */

.md-top-app-bar {
  position: sticky;
  top: 0;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-level0);
  transition: box-shadow var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
              background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
  z-index: 10;
}

.md-top-app-bar--small {
  min-height: 64px;
}

.md-top-app-bar.scrolled {
  box-shadow: var(--md-sys-elevation-level2);
  background-color: var(--md-sys-color-surface-container);
}

.md-top-app-bar__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 8px 0 16px;
  min-height: 64px;
  gap: 8px;
  width: 100%;
  overflow: hidden;
}

.md-top-app-bar__section {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.md-top-app-bar__section--align-start {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.md-top-app-bar__section--align-end {
  flex-shrink: 0;
}

.md-top-app-bar__title {
  color: var(--md-sys-color-on-surface);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== */
/* CHIPS */
/* ==================== */

.md-chip {
  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);
  background-color: transparent;
  color: var(--md-sys-color-on-surface);
  cursor: pointer;
  transition:
    background-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard),
    border-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-chip--assist {
  border-color: var(--md-sys-color-outline);
  background-color: transparent;
}

.md-chip--filter {
  background-color: transparent;
}

.md-chip--filter.md-chip--selected {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}

.md-chip--suggestion {
  background-color: var(--md-sys-color-surface-container-low);
  border: none;
}

.md-chip__icon,
.md-chip .material-symbols-outlined {
  font-size: 18px;
  fill: currentColor;
  color: currentColor;
}

.md-chip__label {
  user-select: none;
}

.md-chip:hover {
  background-color: rgba(103, 80, 164, 0.08);
}

/* ==================== */
/* FILLED TEXT FIELD */
/* ==================== */

.md-text-field {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.md-text-field--filled {
  height: 56px;
}

.md-text-field__input {
  position: relative;
  width: 100%;
  height: 56px;
  padding: 24px 16px 8px;
  border: none;
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-sys-typescale-body-large-font);
  font-size: var(--md-sys-typescale-body-large-size);
  line-height: var(--md-sys-typescale-body-large-line-height);
  letter-spacing: var(--md-sys-typescale-body-large-tracking);
  z-index: 2;
}

.md-text-field__input:focus {
  outline: none;
}

.md-text-field__label {
  position: absolute;
  left: 16px;
  top: 16px;
  color: var(--md-sys-color-on-surface-variant);
  pointer-events: none;
  transition:
    top var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    font-size var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  z-index: 3;
}

.md-text-field__input:focus ~ .md-text-field__label,
.md-text-field__input:not(:placeholder-shown) ~ .md-text-field__label {
  top: 8px;
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: var(--md-sys-typescale-body-small-line-height);
  color: var(--md-sys-color-primary);
}

.md-text-field__background {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: 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;
  z-index: 0;
}

.md-text-field__state-layer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background-color: var(--md-sys-color-on-surface);
  opacity: 0;
  border-radius: var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small) 0 0;
  transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
  pointer-events: none;
  z-index: 1;
}

.md-text-field:hover .md-text-field__state-layer {
  opacity: 0.08;
}

.md-text-field__indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--md-sys-color-on-surface-variant);
  z-index: 2;
}

.md-text-field__indicator::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--md-sys-color-primary);
  transform: scaleX(0);
  transition: transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
}

.md-text-field__input:focus ~ .md-text-field__indicator::after {
  transform: scaleX(1);
}

/* ==================== */
/* CHECKBOX */
/* ==================== */

.md-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  user-select: none;
}

.md-checkbox__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.md-checkbox__background {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-extra-small);
  transition:
    background-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
    border-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}

.md-checkbox__checkmark {
  position: absolute;
  top: -2px;
  left: -2px;
  fill: var(--md-sys-color-on-primary);
  opacity: 0;
  transform: scale(0);
  transition:
    opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard),
    transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized);
}

.md-checkbox__input:checked + .md-checkbox__background {
  background-color: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
}

.md-checkbox__input:checked + .md-checkbox__background .md-checkbox__checkmark {
  opacity: 1;
  transform: scale(1);
}

/* ==================== */
/* BOTTOM SHEET / MODAL */
/* ==================== */

.md-scrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
  pointer-events: none;
}

.md-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.md-bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
  box-shadow: var(--md-sys-elevation-level3);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized-decelerate);
}

.md-bottom-sheet.visible {
  transform: translateY(0);
}

.md-bottom-sheet__draghandle {
  width: 32px;
  height: 4px;
  background-color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  margin: 12px auto 8px;
  opacity: 0.4;
}

.md-bottom-sheet__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.md-bottom-sheet__header h2 {
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.md-bottom-sheet__content {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 200px);
}

.md-bottom-sheet__actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container);
}

/* Desktop: Convert to Dialog */
@media (min-width: 600px) {
  .md-bottom-sheet {
    max-width: 560px;
    max-height: 80vh;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.9);
    border-radius: var(--md-sys-shape-corner-extra-large);
    opacity: 0;
  }

  .md-bottom-sheet.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    transition:
      transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
      opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
  }

  .md-bottom-sheet__draghandle {
    display: none;
  }
}

/* ==================== */
/* APP CONTAINER */
/* ==================== */

.md-app-container {
  max-width: 600px;
  margin: 0 auto;
  background-color: var(--md-sys-color-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

.md-app-main {
  flex: 1;
  padding: 16px;
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  background-color: var(--md-sys-color-surface);
  -webkit-overflow-scrolling: touch;
}

/* ==================== */
/* LIST ITEMS */
/* ==================== */

.md-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.md-list-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 8px 16px;
  cursor: pointer;
  color: var(--md-sys-color-on-surface);
}

.md-list-item__leading {
  margin-right: 16px;
  color: var(--md-sys-color-on-surface-variant);
}

.md-list-item__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.md-list-item__headline {
  color: var(--md-sys-color-on-surface);
}

.md-list-item__supporting-text {
  color: var(--md-sys-color-on-surface-variant);
}

.md-list-item__trailing {
  margin-left: 16px;
}

/* ==================== */
/* DIVIDER */
/* ==================== */

.md-divider {
  height: 1px;
  background-color: var(--md-sys-color-outline-variant);
  border: none;
  margin: 0;
}

/* ==================== */
/* BANNER (Error Messages) */
/* ==================== */

.md-banner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  margin-bottom: 16px;
}

.md-banner.visible {
  display: flex;
}

.md-banner--error {
  background-color: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.md-banner svg,
.md-banner .material-symbols-outlined {
  fill: currentColor;
  color: currentColor;
  flex-shrink: 0;
}

/* ==================== */
/* PROGRESS INDICATORS */
/* ==================== */

.md-linear-progress {
  width: 100%;
  height: 4px;
  background-color: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
}

.md-linear-progress__bar {
  height: 100%;
  background-color: var(--md-sys-color-primary);
  border-radius: var(--md-sys-shape-corner-full);
  transition: width var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized);
}

.md-linear-progress--indeterminate .md-linear-progress__bar {
  animation: indeterminate 2s var(--md-sys-motion-easing-standard) infinite;
}

@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
    width: 30%;
  }
  50% {
    transform: translateX(50%);
    width: 70%;
  }
  100% {
    transform: translateX(200%);
    width: 30%;
  }
}

/* ==================== */
/* UTILITIES */
/* ==================== */

.md-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== */
/* RESPONSIVE BREAKPOINTS */
/* ==================== */

/* Compact (Mobile) - Default */
@media (max-width: 599px) {
  .md-top-app-bar__title {
    font-size: var(--md-sys-typescale-title-medium-size, 16px);
  }

  .md-top-app-bar__row {
    padding: 0 8px;
  }

  .md-top-app-bar__section--align-end {
    gap: 2px;
  }

  /* Hide username on very small screens */
  .md-top-app-bar__section--align-end #username {
    display: none;
  }

  .md-navigation-bar {
    display: flex;
  }

  .md-fab {
    bottom: 96px;
    right: 16px;
  }
}

/* Medium (Tablet) */
@media (min-width: 600px) and (max-width: 839px) {
  .md-app-container {
    max-width: 100%;
  }
}

/* Expanded (Desktop) */
@media (min-width: 840px) {
  .md-app-container {
    max-width: 1200px;
  }

  .md-fab {
    bottom: 24px;
    right: 24px;
  }
}

/* ==================== */
/* TOP APP BAR LOCATION STATUS */
/* ==================== */

.md-top-app-bar__location-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--md-sys-color-surface-container-high);
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.md-top-app-bar__location-status .material-symbols-outlined {
  font-size: 18px;
  color: var(--md-sys-color-primary);
}

.md-top-app-bar__location-status span {
  color: var(--md-sys-color-on-surface-variant);
}

/* Scrolled state */
.md-top-app-bar--scrolled {
  box-shadow: var(--md-sys-elevation-level2) !important;
  background-color: var(--md-sys-color-surface-container) !important;
}

/* ==================== */
/* TASK MODAL (Bottom Sheet) */
/* ==================== */

.task-modal-scrim {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
  pointer-events: none;
  display: none;
}

.task-modal-scrim.visible {
  opacity: 1;
  pointer-events: auto;
}

.task-modal {
  position: fixed;
  bottom: 0;
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
  max-height: calc(90vh - env(safe-area-inset-top, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background-color: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-extra-large) var(--md-sys-shape-corner-extra-large) 0 0;
  box-shadow: var(--md-sys-elevation-level3);
  z-index: 1001;
  transform: translateY(100%);
  transition: transform var(--md-sys-motion-duration-long2) var(--md-sys-motion-easing-emphasized-decelerate);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.task-modal.visible {
  transform: translateY(0);
}

.task-modal__draghandle {
  width: 32px;
  height: 4px;
  background-color: var(--md-sys-color-on-surface-variant);
  border-radius: var(--md-sys-shape-corner-full);
  margin: 12px auto 8px;
  opacity: 0.4;
}

.task-modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.task-modal__header h2 {
  color: var(--md-sys-color-on-surface);
  margin: 0;
}

.task-modal__content {
  padding: 24px;
}

.task-modal__actions {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  background-color: var(--md-sys-color-surface-container);
}

/* Photo preview card */
.photo-preview-card {
  background-color: var(--md-sys-color-surface-container-highest);
  border-radius: var(--md-sys-shape-corner-large);
  padding: 16px;
  margin: 16px 0;
  box-shadow: var(--md-sys-elevation-level1);
}

.photo-preview-card img {
  width: 100%;
  border-radius: var(--md-sys-shape-corner-medium);
  margin-bottom: 12px;
}

.photo-preview-card__actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Desktop: Convert to Dialog */
@media (min-width: 600px) {
  .task-modal {
    max-width: 560px;
    max-height: 80vh;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.9);
    border-radius: var(--md-sys-shape-corner-extra-large);
    opacity: 0;
  }

  .task-modal.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    transition:
      transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
      opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
  }

  .task-modal__draghandle {
    display: none;
  }
}

/* ==================== */
/* LOADING INDICATORS */
/* ==================== */

.md-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  gap: 16px;
}

.md-circular-progress {
  width: 48px;
  height: 48px;
  border: 4px solid var(--md-sys-color-surface-container-highest);
  border-top-color: var(--md-sys-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.md-loading__text {
  color: var(--md-sys-color-on-surface-variant);
}

/* ==================== */
/* PHOTO OPTIONS MODAL OVERRIDES */
/* ==================== */

.photo-options-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.photo-options-modal.visible {
  opacity: 1;
}

.photo-options-content {
  background: var(--md-sys-color-surface-container-low);
  border-radius: var(--md-sys-shape-corner-extra-large);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--md-sys-elevation-level3);
  transform: scale(0.9);
  transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.photo-options-modal.visible .photo-options-content {
  transform: scale(1);
}

.photo-options-content h3 {
  margin: 0 0 16px 0;
  color: var(--md-sys-color-on-surface);
  text-align: center;
}

.photo-options-content .md-button {
  width: 100%;
  margin-bottom: 12px;
}

.photo-options-content .md-button:last-child {
  margin-bottom: 0;
}

/* ==================== */
/* SUCCESS BUTTON - Green Gradient */
/* ==================== */

.md-button--success {
  background: linear-gradient(135deg, #16a34a 0%, #4ade80 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(74, 222, 128, 0.3);
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.md-button--success::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

.md-button--success:hover {
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.5);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #15803d 0%, #22c55e 100%);
}

.md-button--success:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.4);
}

.md-button--success:disabled {
  background: rgba(74, 222, 128, 0.3);
  box-shadow: none;
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.5);
}

.md-button--success .material-symbols-outlined {
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* ==================== */
/* ERROR BUTTON - Red Gradient */
/* ==================== */

.md-button--error {
  background: linear-gradient(135deg, #dc2626 0%, #f87171 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(248, 113, 113, 0.3);
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.md-button--error::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

.md-button--error:hover {
  box-shadow: 0 4px 20px rgba(248, 113, 113, 0.5);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%);
}

.md-button--error:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(248, 113, 113, 0.4);
}

.md-button--error:disabled {
  background: rgba(248, 113, 113, 0.3);
  box-shadow: none;
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.5);
}

.md-button--error .material-symbols-outlined {
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* ==================== */
/* ERROR TONAL BUTTON - Red tonal for disabled/unavailable states */
/* ==================== */

.md-button--error-tonal {
  background: var(--md-sys-color-error-container, #ffdad6);
  color: var(--md-sys-color-on-error-container, #410002);
  border: none;
  font-weight: 500;
}

.md-button--error-tonal:disabled {
  background: var(--md-sys-color-error-container, #ffdad6);
  color: var(--md-sys-color-on-error-container, #410002);
  opacity: 0.7;
  cursor: not-allowed;
}

.md-button--error-tonal .material-symbols-outlined {
  color: var(--md-sys-color-error, #ba1a1a);
}

/* ==================== */
/* WARNING BUTTON - Orange/Yellow Gradient */
/* ==================== */

.md-button--warning {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
  border: none;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.md-button--warning::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
}

.md-button--warning:hover {
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.5);
  transform: translateY(-2px);
  background: linear-gradient(135deg, #d97706 0%, #fcd34d 100%);
}

.md-button--warning:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.4);
}

.md-button--warning:disabled {
  background: rgba(251, 191, 36, 0.3);
  box-shadow: none;
  cursor: not-allowed;
  color: rgba(255, 255, 255, 0.5);
}

.md-button--warning .material-symbols-outlined {
  color: #ffffff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* ==================== */
/* OUTLINED SUCCESS BUTTON */
/* ==================== */

.md-button--outlined-success {
  background: transparent;
  color: #16a34a;
  border: 2px solid #16a34a;
  font-weight: 600;
}

.md-button--outlined-success:hover {
  background: rgba(74, 222, 128, 0.1);
  border-color: #22c55e;
  color: #15803d;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2);
}

.md-button--outlined-success .material-symbols-outlined {
  color: currentColor;
}

/* ==================== */
/* OUTLINED WARNING BUTTON */
/* ==================== */

.md-button--outlined-warning {
  background: transparent;
  color: #f59e0b;
  border: 2px solid #f59e0b;
  font-weight: 600;
}

.md-button--outlined-warning:hover {
  background: rgba(251, 191, 36, 0.1);
  border-color: #fbbf24;
  color: #d97706;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

.md-button--outlined-warning .material-symbols-outlined {
  color: currentColor;
}

/* ==================== */
/* TOAST NOTIFICATIONS - GLASSMORPHISM */
/* ==================== */

.toast-container {
  position: fixed;
  top: 80px;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 300px;
  max-width: 500px;
  padding: 16px 20px;
  border-radius: 16px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.2),
    0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;

  /* Entrance animation */
  animation: toastSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: top center;
}

@keyframes toastSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-100%) scale(0.9);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast.toast-exit {
  animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
  }
}

.toast__icon {
  flex-shrink: 0;
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.toast__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast__message {
  font-family: 'Roboto Flex', sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.toast__progress-bar {
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  animation: toastProgress 3s linear forwards;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

@keyframes toastProgress {
  0% {
    width: 100%;
  }
  100% {
    width: 0%;
  }
}

/* Toast Type Variants */

.toast--success {
  background: linear-gradient(135deg,
    rgba(22, 163, 74, 0.95) 0%,
    rgba(21, 128, 61, 0.9) 100%);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.toast--success .toast__icon {
  color: #4ade80;
}

.toast--error {
  background: linear-gradient(135deg,
    rgba(220, 38, 38, 0.95) 0%,
    rgba(153, 27, 27, 0.9) 100%);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.toast--error .toast__icon {
  color: #fca5a5;
}

.toast--warning {
  background: linear-gradient(135deg,
    rgba(245, 158, 11, 0.95) 0%,
    rgba(217, 119, 6, 0.9) 100%);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.toast--warning .toast__icon {
  color: #fcd34d;
}

.toast--info {
  background: linear-gradient(135deg,
    rgba(37, 99, 235, 0.95) 0%,
    rgba(29, 78, 216, 0.9) 100%);
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.toast--info .toast__icon {
  color: #93c5fd;
}

/* Mobile responsive */
@media (max-width: 640px) {
  .toast {
    min-width: 280px;
    max-width: calc(100vw - 32px);
  }
}

/* Dark mode enhancements */
.dark-theme .toast {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ==================== */
/* STATUS CHIPS - 3-COLOR SYSTEM */
/* ==================== */

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-chip__icon {
  font-size: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.status-chip__icon--spinning {
  animation: statusSpinning 1.5s linear infinite;
}

@keyframes statusSpinning {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.status-chip__label {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* RED: Pending/Available */
.status-chip--pending {
  background: linear-gradient(135deg,
    rgba(220, 38, 38, 0.95) 0%,
    rgba(185, 28, 28, 0.9) 100%);
  color: #ffffff;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.status-chip--pending .status-chip__icon {
  color: #fca5a5;
}

/* BLUE: Processing */
.status-chip--processing {
  background: linear-gradient(135deg,
    rgba(37, 99, 235, 0.95) 0%,
    rgba(29, 78, 216, 0.9) 100%);
  color: #ffffff;
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.status-chip--processing .status-chip__icon {
  color: #93c5fd;
}

/* GREEN: Completed */
.status-chip--completed {
  background: linear-gradient(135deg,
    rgba(22, 163, 74, 0.95) 0%,
    rgba(21, 128, 61, 0.9) 100%);
  color: #ffffff;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.status-chip--completed .status-chip__icon {
  color: #4ade80;
}

/* Hover effects */
.status-chip:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Dark mode enhancements */
.dark-theme .status-chip {
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.dark-theme .status-chip:hover {
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ==================== */
/* iOS COMPATIBILITY */
/* ==================== */

/* iOS touch optimization - prevent tap delays */
.md-button,
.md-icon-button,
.md-navigation-bar__item,
.md-fab,
.md-card,
.md-list-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* iOS input zoom prevention - 16px minimum font size */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="tel"],
textarea,
select {
  font-size: 16px !important;
}

/* iOS rubber-band scrolling fix */
html {
  overflow: hidden;
  height: 100%;
}

body {
  overflow: auto;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

/* Support older iOS constant() syntax */
@supports (padding-bottom: constant(safe-area-inset-bottom)) {
  .md-navigation-bar {
    height: calc(80px + constant(safe-area-inset-bottom));
    padding-bottom: constant(safe-area-inset-bottom);
  }

  .md-fab {
    bottom: calc(96px + constant(safe-area-inset-bottom));
    right: max(16px, constant(safe-area-inset-right));
  }

  .task-modal {
    padding-bottom: constant(safe-area-inset-bottom);
    max-height: calc(90vh - constant(safe-area-inset-top));
  }

  .md-app-main {
    padding-bottom: calc(96px + constant(safe-area-inset-bottom));
  }
}

/* ==================== */
/* SYNC ANIMATION */
/* ==================== */

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.rotating {
  animation: rotate 1s linear infinite;
}

/* Sync button styles */
#syncBtn {
  transition: opacity 0.2s ease;
}

#syncBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==================== */
/* AUDIO RECORDING */
/* ==================== */

/* Recording indicator dot */
.recording-dot {
  width: 12px;
  height: 12px;
  background-color: var(--md-sys-color-error, #ba1a1a);
  border-radius: 50%;
  animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

/* Audio item in list */
.audio-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--md-sys-color-surface-container);
  border-radius: 12px;
  margin-bottom: 8px;
}

.audio-item audio {
  flex: 1;
  height: 36px;
}

.audio-item .delete-audio-btn {
  background: transparent;
  border: none;
  color: var(--md-sys-color-error);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.audio-item .delete-audio-btn:hover {
  background: var(--md-sys-color-error-container);
}

.audio-item .delete-audio-btn .material-symbols-outlined {
  font-size: 20px;
}
