.date-range-popover { width: 320px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain; left: auto; right: 0; box-sizing: border-box; padding: 10px; background: var(--surface-paper, var(--paper)); }
.date-range-custom { padding-top: 7px; }
.filter-item-date { max-width: 100%; }
.filter-item-date .filter-item-label { min-width: 0; overflow-wrap: anywhere; }
.date-custom-toggle { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 38px; padding: 7px 9px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink); font: 700 .8rem var(--sans); text-align: left; cursor: pointer; }
.date-custom-toggle svg { flex: 0 0 auto; width: 17px; height: 17px; color: var(--brand-heading); }
.date-custom-toggle[aria-expanded="true"] { color: var(--brand-heading); }
.date-range-popover:has(.date-calendar:not([hidden])) .date-preset-list { display: none; }
.date-range-popover:has(.date-calendar:not([hidden])) .date-range-custom { border-top: 0; padding-top: 0; }
.date-calendar { min-width: 0; border-top: 1px solid var(--rule); padding-top: 12px; }
.date-calendar[hidden] { display: none; }
.date-calendar-header { display: flex; align-items: center; gap: 5px; margin-bottom: 9px; }
.date-calendar-heading { display: flex; flex: 1; align-items: center; justify-content: center; gap: 4px; min-width: 0; }
.date-calendar-heading select { min-width: 0; max-width: 58%; border: 1px solid var(--rule); border-radius: var(--radius); padding: 6px 3px; background: var(--surface-paper, var(--paper)); color: var(--ink); font: 700 .8rem var(--sans); cursor: pointer; color-scheme: light; }
html[data-theme="dark"] .date-calendar-heading select { color-scheme: dark; }
.date-calendar-nav { flex: 0 0 32px; height: 34px; padding: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-alt); color: var(--brand-heading); font: 500 1.5rem/1 var(--sans); cursor: pointer; }
/* The days take a finger's swipe through the months (calendar.js). */
.date-calendar-grid { touch-action: none; }
.date-calendar-weekdays, .date-calendar-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.date-calendar-weekdays { margin-bottom: 5px; color: var(--muted); text-align: center; font: 700 .65rem/1.7 var(--sans); }
.date-calendar-week { margin-bottom: 3px; }
.date-calendar-day { min-width: 0; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 0; background: transparent; color: var(--ink); font: 600 .8rem var(--sans); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.date-calendar-day.is-other-month { color: var(--muted); font-weight: 400; }
.date-calendar-day[aria-current="date"] { text-decoration: underline; text-underline-offset: 4px; }
.date-calendar-day.is-in-range { background: var(--paper-sunk); }
/* Days outside the dates that can be picked (bounds in calendar.js). */
.date-calendar-day.is-out-of-bounds { color: var(--muted); opacity: .4; cursor: default; }
.date-calendar-day.is-endpoint { border-radius: var(--radius); background: var(--brand-heading); color: var(--paper); font-weight: 800; }
.date-calendar-hint { min-height: 2.8em; margin: 9px 2px 0; color: var(--ink-soft); font: 400 .72rem/1.4 var(--sans); }
.date-calendar button:focus-visible, .date-calendar select:focus-visible, .date-custom-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; position: relative; z-index: 1; }
@media (hover: hover) {
  .date-custom-toggle:hover, .date-calendar-nav:hover { background: var(--paper-sunk); }
  .date-calendar-day:hover:not(.is-endpoint, :disabled) { border-color: var(--rule-strong); background: var(--paper-alt); }
}
/* Datum ends the PC's line of filters, so the popover opens leftwards from
   its right edge; on a phone Datum starts its own line. */
@media (max-width: 720px) { .date-range-popover { left: 0; right: auto; } }
@media (max-width: 600px) {
  .date-range-popover { width: min(320px, calc(100vw - 32px)); max-width: calc(100vw - 32px); left: 50%; right: auto; transform: translateX(-50%); }
  .date-calendar-day { height: 40px; font-size: .85rem; }
  .date-calendar-nav { flex-basis: 36px; height: 38px; }
  .date-calendar-heading select { font-size: 16px; }
}
