.date-range-trigger {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--text-primary, #1d1d1f);
  text-align: left;
  background: var(--surface-tertiary, rgba(118, 118, 128, 0.08));
  border: 1px solid transparent;
  border-radius: 15px;
  cursor: pointer;
  outline: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.date-range-trigger:hover {
  background: var(--surface-hover, rgba(255, 255, 255, 0.96));
  border-color: var(--separator, rgba(60, 60, 67, 0.16));
}

.date-range-trigger:focus-visible {
  border-color: rgba(var(--accent-rgb, 0, 122, 255), 0.5);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb, 0, 122, 255), 0.13);
}

.date-range-trigger:active {
  transform: scale(0.988);
}

.date-range-trigger__icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: var(--accent, #007aff);
  background: var(--accent-soft, rgba(0, 122, 255, 0.11));
  border-radius: 13px;
}

.date-range-trigger__icon svg,
.date-range-trigger__chevron svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.85;
}

.date-range-trigger__copy {
  min-width: 0;
}

.date-range-trigger__eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--text-tertiary, #86868b);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.date-range-trigger [data-date-range-label] {
  display: block;
  overflow: hidden;
  color: var(--text-primary, #1d1d1f);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-range-trigger__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary, #86868b);
  transition: transform 180ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.date-range-trigger[aria-expanded="true"] .date-range-trigger__chevron {
  transform: rotate(180deg);
}

body.drp-open {
  overflow: hidden;
}

.drp {
  width: min(680px, calc(100vw - 32px));
  max-width: none;
  max-height: min(820px, calc(100dvh - 32px));
  padding: 0;
  overflow: visible;
  color: var(--text-primary, #1d1d1f);
  background: transparent;
  border: 0;
  outline: 0;
}

.drp:not([open]) {
  display: none;
}

.drp::backdrop {
  background: rgba(20, 20, 24, 0.32);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
}

.drp__sheet {
  display: flex;
  max-height: min(820px, calc(100dvh - 32px));
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(var(--accent-rgb, 0, 122, 255), 0.035), transparent 28%),
    var(--surface-solid, #fff);
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.16));
  border-radius: 28px;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.22),
    0 3px 14px rgba(0, 0, 0, 0.08);
  animation: drp-appear 260ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.drp__grabber {
  display: none;
}

.drp__header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 24px 15px;
}

.drp__eyebrow {
  margin: 0 0 4px;
  color: var(--accent, #007aff);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.drp__title {
  margin: 0;
  color: var(--text-primary, #1d1d1f);
  font-size: 25px;
  font-weight: 720;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.drp__close,
.drp__month-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary, #6e6e73);
  background: var(--surface-tertiary, rgba(118, 118, 128, 0.08));
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    transform 160ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.drp__close {
  width: 36px;
  height: 36px;
}

.drp__close svg,
.drp__month-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.drp__close:hover,
.drp__month-button:hover {
  color: var(--accent, #007aff);
  background: var(--accent-soft, rgba(0, 122, 255, 0.11));
}

.drp__close:active,
.drp__month-button:active {
  transform: scale(0.92);
}

.drp__body {
  min-height: 0;
  padding: 0 24px 20px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--separator-strong, rgba(60, 60, 67, 0.25)) transparent;
}

.drp__presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(max-content, 1fr));
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  background: var(--surface-tertiary, rgba(118, 118, 128, 0.08));
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.16));
  border-radius: 14px;
  scrollbar-width: none;
}

.drp__presets::-webkit-scrollbar {
  display: none;
}

.drp__preset {
  min-height: 36px;
  padding: 7px 11px;
  color: var(--text-secondary, #6e6e73);
  font-size: 13px;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.drp__preset:hover {
  color: var(--text-primary, #1d1d1f);
}

.drp__preset:active {
  transform: scale(0.96);
}

.drp__preset[aria-pressed="true"] {
  color: var(--text-primary, #1d1d1f);
  background: var(--surface-solid, #fff);
  box-shadow:
    0 1px 4px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px var(--separator, rgba(60, 60, 67, 0.16));
}

.drp__calendar {
  margin-top: 16px;
  padding: 15px;
  background: var(--surface-tertiary, rgba(118, 118, 128, 0.08));
  border: 1px solid var(--separator, rgba(60, 60, 67, 0.16));
  border-radius: 20px;
}

.drp__calendar-header {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.drp__month-button {
  width: 36px;
  height: 36px;
  background: var(--surface-solid, #fff);
  border-color: var(--separator, rgba(60, 60, 67, 0.16));
  border-radius: 11px;
}

.drp__month {
  margin: 0;
  overflow: hidden;
  color: var(--text-primary, #1d1d1f);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.018em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drp__weekdays,
.drp__week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.drp__weekdays {
  margin-bottom: 5px;
}

.drp__weekdays span {
  padding: 3px 0;
  color: var(--text-tertiary, #86868b);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.drp__grid {
  isolation: isolate;
}

.drp__day {
  position: relative;
  z-index: 0;
  display: grid;
  width: 100%;
  min-width: 34px;
  min-height: 42px;
  aspect-ratio: 1.12;
  place-items: center;
  padding: 0;
  color: var(--text-primary, #1d1d1f);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 560;
  background: transparent;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.drp__day::before {
  position: absolute;
  inset: 4px 0;
  z-index: -2;
  content: "";
  background: transparent;
}

.drp__day-number {
  position: relative;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  transition:
    color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.drp__day.is-outside {
  color: var(--text-tertiary, #86868b);
  opacity: 0.48;
}

.drp__day.is-today:not(.is-range-start):not(.is-range-end) {
  color: var(--accent, #007aff);
  font-weight: 720;
}

.drp__day.is-today:not(.is-range-start):not(.is-range-end) .drp__day-number {
  box-shadow: inset 0 0 0 1.5px rgba(var(--accent-rgb, 0, 122, 255), 0.45);
}

.drp__day.is-in-range::before {
  background: var(--accent-soft, rgba(0, 122, 255, 0.11));
}

.drp__day.is-range-start::before {
  left: 50%;
}

.drp__day.is-range-end::before {
  right: 50%;
}

.drp__day.is-range-start.is-range-end::before {
  display: none;
}

.drp__week .drp__day:first-child::before {
  border-radius: 999px 0 0 999px;
}

.drp__week .drp__day:last-child::before {
  border-radius: 0 999px 999px 0;
}

.drp__day.is-range-start::before {
  border-radius: 999px 0 0 999px;
}

.drp__day.is-range-end::before {
  border-radius: 0 999px 999px 0;
}

.drp__day.is-range-start .drp__day-number,
.drp__day.is-range-end .drp__day-number {
  color: #fff;
  font-weight: 700;
  background: var(--accent, #007aff);
  box-shadow: 0 5px 13px rgba(var(--accent-rgb, 0, 122, 255), 0.28);
}

@media (hover: hover) {
  .drp__day:hover .drp__day-number {
    background: var(--surface-solid, #fff);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.06);
  }

  .drp__day.is-range-start:hover .drp__day-number,
  .drp__day.is-range-end:hover .drp__day-number {
    color: #fff;
    background: var(--accent-strong, #0066d6);
  }
}

.drp__day:active .drp__day-number {
  transform: scale(0.9);
}

.drp__day:focus-visible {
  z-index: 2;
  outline: 3px solid rgba(var(--accent-rgb, 0, 122, 255), 0.34);
  outline-offset: -1px;
}

.drp__selection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 14px;
  background: rgba(var(--accent-rgb, 0, 122, 255), 0.07);
  border: 1px solid rgba(var(--accent-rgb, 0, 122, 255), 0.15);
  border-radius: 16px;
}

.drp__selection-date {
  min-width: 0;
}

.drp__selection-date--end {
  text-align: right;
}

.drp__selection-label {
  display: block;
  margin-bottom: 2px;
  color: var(--text-secondary, #6e6e73);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.drp__selection-date strong {
  display: block;
  overflow: hidden;
  color: var(--text-primary, #1d1d1f);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drp__selection-arrow {
  width: 20px;
  height: 20px;
  color: var(--accent, #007aff);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drp__hint {
  min-height: 18px;
  margin: 8px 2px 0;
  color: var(--text-secondary, #6e6e73);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.drp__footer {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  gap: 10px;
  padding: 14px 24px 22px;
  background: var(--surface-solid, #fff);
  border-top: 1px solid var(--separator, rgba(60, 60, 67, 0.16));
}

.drp__action {
  min-height: 46px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 680;
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    opacity 160ms ease,
    transform 160ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

.drp__action:active {
  transform: scale(0.975);
}

.drp__action--cancel {
  color: var(--text-primary, #1d1d1f);
  background: var(--surface-tertiary, rgba(118, 118, 128, 0.08));
  border-color: var(--separator, rgba(60, 60, 67, 0.16));
}

.drp__action--cancel:hover {
  background: var(--accent-soft, rgba(0, 122, 255, 0.11));
}

.drp__action--apply {
  color: #fff;
  background: var(--accent, #007aff);
  box-shadow: 0 7px 18px rgba(var(--accent-rgb, 0, 122, 255), 0.24);
}

.drp__action--apply:hover {
  background: var(--accent-strong, #0066d6);
}

.drp__action--apply:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  box-shadow: none;
}

html[data-theme="dark"] .drp::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

html[data-theme="dark"] .drp__sheet {
  box-shadow:
    0 36px 100px rgba(0, 0, 0, 0.72),
    0 0 0 0.5px rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .drp__preset[aria-pressed="true"],
html[data-theme="dark"] .drp__day:hover .drp__day-number {
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.42),
    0 0 0 0.5px rgba(255, 255, 255, 0.08);
}

@keyframes drp-appear {
  from {
    opacity: 0;
    transform: scale(0.965) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes drp-sheet-up {
  from {
    opacity: 0.75;
    transform: translateY(34px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .drp {
    inset: auto 0 0;
    width: 100%;
    max-height: calc(100dvh - max(10px, var(--safe-top, 0px)));
    margin: 0;
  }

  .drp__sheet {
    max-height: calc(100dvh - max(10px, var(--safe-top, 0px)));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 26px 26px 0 0;
    animation: drp-sheet-up 300ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
  }

  .drp__grabber {
    display: block;
    width: 38px;
    height: 5px;
    flex: 0 0 auto;
    margin: 8px auto 0;
    background: var(--separator-strong, rgba(60, 60, 67, 0.25));
    border-radius: 999px;
  }

  .drp__header {
    padding: 13px 16px 12px;
  }

  .drp__title {
    font-size: 22px;
  }

  .drp__body {
    padding: 0 12px 15px;
  }

  .drp__presets {
    grid-template-columns: repeat(5, max-content);
  }

  .drp__preset {
    min-width: 74px;
  }

  .drp__calendar {
    margin-top: 12px;
    padding: 11px 7px 9px;
    border-radius: 18px;
  }

  .drp__calendar-header {
    margin: 0 5px 7px;
  }

  .drp__day {
    min-width: 0;
    min-height: 39px;
    aspect-ratio: 1;
  }

  .drp__day-number {
    width: 34px;
    height: 34px;
  }

  .drp__selection {
    margin-top: 11px;
    padding: 11px 12px;
  }

  .drp__selection-date strong {
    font-size: 13px;
  }

  .drp__footer {
    padding:
      12px
      max(12px, var(--safe-right, 0px))
      calc(12px + var(--safe-bottom, 0px))
      max(12px, var(--safe-left, 0px));
  }
}

@media (max-width: 360px) {
  .drp__header {
    padding-top: 10px;
  }

  .drp__eyebrow {
    display: none;
  }

  .drp__presets {
    margin-right: -12px;
    padding-right: 16px;
    border-right: 0;
    border-radius: 14px 0 0 14px;
  }

  .drp__calendar {
    padding-right: 3px;
    padding-left: 3px;
  }

  .drp__day-number {
    width: 32px;
    height: 32px;
  }

  .drp__selection {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .drp__sheet {
    animation: none;
  }

  .drp__day-number,
  .drp__action,
  .drp__close,
  .drp__month-button,
  .drp__preset {
    transition: none;
  }
}
