.trigger {
  position: relative;
  display: inline-grid !important;
  grid-template-columns: minmax(0, 1fr) 18px;
  flex: 0 0 auto;
  align-items: end !important;
  justify-content: stretch !important;
  gap: 0 !important;
  width: auto;
  min-width: 132px !important;
  max-width: min(420px, 100%);
  padding-block: 7px 3px !important;
  padding-inline: var(--control-padding-x) 28px !important;
  border-color: var(--border) !important;
  background: var(--bg-input-strong) !important;
  box-shadow: none !important;
  color: var(--text-secondary) !important;
  font-weight: 650 !important;
  transform: none !important;
}

.trigger:hover,
.trigger:focus-visible {
  border-color: var(--primary-border-strong) !important;
  background: var(--bg-card) !important;
  box-shadow: 0 0 0 3px var(--focus-ring) !important;
  color: var(--text-primary) !important;
  transform: none !important;
}

.triggerMeta {
  position: absolute;
  inset-block-start: -7px;
  inset-inline-start: var(--space-2);
  display: inline-flex;
  max-width: calc(100% - var(--space-4));
  align-items: center;
  gap: 4px;
  overflow: hidden;
  padding: 0 var(--space-1);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 650;
  line-height: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trigger:hover .triggerMeta,
.trigger:focus-visible .triggerMeta {
  color: var(--primary);
}

.triggerText {
  flex: 0 1 auto;
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--control-font-size);
  line-height: var(--control-line-height);
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.triggerChevron {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--space-2);
  color: var(--text-tertiary);
  transform: translateY(-50%);
}

.paper {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-flyout);
  box-shadow: var(--shadow-panel);
}

.panel {
  display: grid;
  width: min(420px, calc(100vw - 32px));
  gap: var(--space-3);
  padding: var(--space-3);
}

.quickRanges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.quickButton {
  min-width: 0 !important;
  padding-inline: var(--space-2) !important;
}

.rangeFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.rangeField {
  display: grid;
  min-width: 0;
  min-height: 58px;
  align-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-input-strong);
  color: var(--text-primary);
  text-align: start;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard);
}

.rangeField:hover,
.rangeFieldActive {
  border-color: var(--primary-border-active);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.rangeFieldLabel,
.weekday {
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 16px;
}

.rangeFieldValue {
  overflow: hidden;
  color: var(--text-primary);
  font-size: var(--admin-font-size);
  font-weight: 700;
  line-height: var(--admin-line-height);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rangeOverview {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr) minmax(72px, auto);
  align-items: center;
  gap: var(--space-2);
  min-height: 24px;
  color: var(--text-tertiary);
  font-size: 12px;
  line-height: 18px;
}

.rangeEdge {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-weight: 650;
  white-space: nowrap;
}

.rangeEdgeEnd {
  justify-content: flex-end;
}

.rangeEdgeMarker {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 760;
}

.rangeEdgeMarkerStart {
  background: var(--primary);
  color: var(--active-contrast);
}

.rangeEdgeMarkerEnd {
  border: 1px solid var(--primary);
  background: var(--bg-card);
  color: var(--primary);
}

.rangeDistance {
  position: relative;
  overflow: hidden;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rangeDistance::before,
.rangeDistance::after {
  display: inline-block;
  width: 18px;
  height: 1px;
  margin: 0 6px 3px;
  background: var(--primary-border);
  content: "";
}

.calendarHeader {
  display: grid;
  grid-template-columns: var(--control-height) 1fr var(--control-height);
  align-items: center;
  gap: var(--space-2);
}

.calendarTitle {
  color: var(--text-primary);
  font-size: var(--admin-font-size);
  font-weight: 760;
  text-align: center;
}

.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-1);
}

.rangeCalendarGrid {
  column-gap: 0;
}

.weekday {
  display: inline-flex;
  height: 24px;
  align-items: center;
  justify-content: center;
}

.dayButton {
  position: relative;
  display: inline-flex;
  min-width: 0;
  height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--admin-font-size);
  cursor: pointer;
  transition:
    border-color var(--motion-fast) var(--ease-standard),
    background var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard);
}

.dayInRange {
  border-radius: 0;
  background: var(--primary-surface);
  color: var(--primary-strong);
}

.dayButton.dayInRange:hover {
  background: var(--primary-surface-strong);
}

.dayRangeStart {
  border-radius: 0;
  border-start-start-radius: var(--radius-control);
  border-end-start-radius: var(--radius-control);
}

.dayRangeEnd {
  border-radius: 0;
  border-start-end-radius: var(--radius-control);
  border-end-end-radius: var(--radius-control);
}

.dayRangeStart.dayRangeEnd {
  border-radius: var(--radius-control);
}

.dayButton:hover {
  border-color: var(--primary-border);
  background: var(--primary-surface);
}

.dayOutside {
  color: var(--text-tertiary);
}

.daySelected {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--active-contrast);
  font-weight: 760;
}

.daySelected::after {
  position: absolute;
  inset-block-start: 1px;
  inset-inline-end: 3px;
  color: currentcolor;
  content: attr(data-range-edge);
  font-size: 8px;
  font-weight: 760;
  line-height: 10px;
  opacity: 0.82;
}

.daySelected:hover {
  border-color: var(--primary-strong);
  background: var(--primary-strong);
  color: var(--active-contrast);
}

.timeGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.error {
  color: var(--danger);
  font-size: 12px;
  line-height: 18px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

@media (max-width: 760px) {
  .trigger {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
  }
}
