/* ════════════════════════════════════════════════════════════════════════
   HGDatePicker — Anthropic-style month-grid calendar that replaces the native
   date popups. Selectors are intentionally NOT scoped under #sec-reports: the
   same trigger/popover also enhances the Results toolbar (its own section), and
   the autocomplete pattern (.rep-ac-list) is global for the same reason.

   Aesthetic rule that makes it read as Anthropic-made: a pure-white raised
   popover over the ivory app; clay (--accent) SOLID only on the selected day +
   From/To endpoints; the in-range band is clay @10% with square inner corners;
   today is an UNFILLED clay ring; everything else warm-neutral.
   ════════════════════════════════════════════════════════════════════════ */

/* ── field wrapper + trigger button (mirrors .filters input + .toolbar-date-input) ── */
.dp-field { position: relative; display: inline-flex; }

.dp-trigger {
  min-width: 132px;                       /* same as .toolbar-date-input */
  box-sizing: border-box;
  margin: 0;
  font: inherit;
  font-size: var(--text-base);            /* 13px */
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);        /* 6px, matches .filters input */
  padding: 6px 12px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--dur-fast) var(--ease);
}
.dp-trigger.dp-empty { color: var(--text-faint); }
.dp-trigger:hover { border-color: var(--border-strong); }
.dp-trigger[aria-expanded="true"] { border-color: var(--accent); }

/* ── popover surface (sibling of .rep-ac-list / .menu) ── */
.dp-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  margin: var(--space-1) 0 0;
  padding: var(--space-3);
  width: max-content;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  transform-origin: top left;
  opacity: 0;                              /* hidden until .dp-in (avoids first-frame flash) */
}
.dp-popover.dp-in  { animation: dp-pop-in var(--dur) var(--ease) forwards; }
.dp-popover.dp-out { animation: dp-pop-out var(--dur-fast) var(--ease) forwards; pointer-events: none; }

@keyframes dp-pop-in {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes dp-pop-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-4px) scale(.98); }
}

/* ── header / month nav ── */
.dp-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.dp-month {
  flex: 1;
  text-align: center;
  color: var(--text);
  font-size: var(--text-md);              /* 14px */
  font-weight: var(--fw-medium);
}
.dp-nav {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.dp-nav:hover { background: var(--surface-hover); color: var(--text); }
.dp-nav:disabled { opacity: .45; cursor: not-allowed; background: transparent; }

/* ── weekday header + day grid (7 × 36px) ── */
.dp-weekdays,
.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 36px);
  gap: 2px;
}
.dp-weekdays { margin-bottom: var(--space-1); }
.dp-weekday {
  text-align: center;
  line-height: 20px;
  color: var(--text-faint);
  font-size: var(--text-xs);              /* 11px */
  font-weight: var(--fw-regular);
}
.dp-grid { display: grid; gap: 2px; }

.dp-day {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: var(--text-base);            /* 13px */
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);        /* 8px */
  cursor: pointer;
  position: relative;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.dp-day:hover { background: var(--surface-hover); }
.dp-day.dp-outside { color: var(--text-faint); }

/* in-range band: clay @10%, square so the rounded solid endpoints cap it */
.dp-day.dp-in-range {
  background: var(--accent-tint);
  color: var(--accent-contrast-text);
  border-radius: 0;
}
.dp-day.dp-range-start { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.dp-day.dp-range-end   { border-radius: 0 var(--radius-md) var(--radius-md) 0; }

/* today: UNFILLED clay ring (selected fill wins over it) */
.dp-day.dp-today { box-shadow: inset 0 0 0 1px var(--accent); }
/* a disabled "today" (e.g. Results max < today) is not actionable — drop the
   ring so it doesn't read as a muddy half-opacity marker */
.dp-day.dp-today.dp-disabled { box-shadow: none; }

/* selected single / range endpoint: SOLID clay */
.dp-day.dp-selected {
  background: var(--accent);
  color: var(--text-on-accent);
  font-weight: var(--fw-medium);
  box-shadow: none;                       /* drop the today ring when also selected */
}
.dp-day.dp-selected:hover { background: var(--accent-hover); }

/* disabled */
.dp-day.dp-disabled,
.dp-day.dp-disabled:hover {
  color: var(--text-faint);
  opacity: .45;
  background: transparent;
  cursor: not-allowed;
}

/* focus ring via box-shadow so it isn't clipped on the rounded cell */
.dp-day:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent-ring);
  z-index: 1;
}
.dp-day.dp-today:focus-visible { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 2px var(--accent-ring); }
.dp-day.dp-selected:focus-visible { box-shadow: 0 0 0 2px var(--accent-ring); }

/* ── footer (range echo + Today / Clear) ── */
.dp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.dp-echo {
  font-size: var(--text-sm);              /* 12px */
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.dp-actions { display: inline-flex; gap: var(--space-1); }
.dp-link {
  font: inherit;
  font-size: var(--text-sm);
  color: var(--accent-contrast-text);
  background: transparent;
  border: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease);
}
.dp-link:hover { background: var(--surface-hover); }
.dp-link:disabled { opacity: .45; cursor: not-allowed; background: transparent; }

/* ── mobile: popover fits the viewport; trigger 16px font (mobile.css) kills iOS zoom ── */
@media (max-width: 480px) {
  .dp-popover { width: min(92vw, 320px); }
}

/* reduced motion: kill the entrance/exit (the global theme block also nukes durations) */
@media (prefers-reduced-motion: reduce) {
  .dp-popover { opacity: 1; }
  .dp-popover.dp-in,
  .dp-popover.dp-out { animation: none; }
}
