/* The date picker (lib/date_picker.js): a calendar card with a month and a year drop-down, Monday-first weeks, today ringed,
   the chosen day as a filled circle, and Cancel / Set Date. The month and year lists open beside the card. Theme tokens only. */
.date-picker-box {
  padding-right: 2.6rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23667085'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 1rem;
}
.date-picker-box:disabled { cursor: not-allowed; }

.dp-panel {
  position: fixed;
  z-index: 1400; /* above pop-up forms */
  width: 19rem;
  padding: 1rem 1rem 0.9rem;
  color: var(--lb-ink);
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-soft);
  border-radius: 22px;
  box-shadow: var(--lb-shadow-lg);
  user-select: none;
}
.dp-panel[hidden] { display: none; }

.dp-head { display: flex; align-items: center; justify-content: center; gap: 0.3rem; margin-bottom: 0.6rem; }
.dp-nav { display: grid; place-items: center; width: 2rem; height: 2rem; color: var(--lb-muted); background: transparent; border: 0; border-radius: 50%; }
.dp-nav:hover { color: var(--lb-primary); background: var(--lb-hover); }
.dp-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.8rem; font-size: 1rem; font-weight: 600; color: var(--lb-primary); background: var(--lb-hover); border: 0; border-radius: 12px; }
.dp-pill.plain { color: var(--lb-ink); background: transparent; }
.dp-pill i { font-size: 0.7rem; opacity: 0.75; }
.dp-pill:hover, .dp-pill.is-open { background: var(--lb-primary-soft); color: var(--lb-primary); }

.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dp-week span { padding: 0.35rem 0; font-size: 0.8125rem; font-weight: 700; text-align: center; }
.dp-grid { row-gap: 2px; }
.dp-day {
  display: grid;
  place-items: center;
  height: 2.3rem;
  margin: 0 auto;
  width: 2.3rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--lb-ink);
  background: transparent;
  border: 0;
  border-radius: 50%;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.dp-day:hover:not(:disabled) { background: var(--lb-hover); }
.dp-day.is-other { color: #B7C1D2; }
.dp-day.is-today { background: var(--lb-hover); font-weight: 700; }
.dp-day.is-selected, .dp-day.is-selected:hover { font-weight: 700; color: #fff; background: var(--lb-primary); }
.dp-day:disabled { color: #D3DAE6; cursor: not-allowed; text-decoration: line-through; }
.dp-day:focus-visible { outline: 2px solid var(--lb-primary); outline-offset: 1px; }

.dp-clear { display: block; margin: 0.5rem auto 0; padding: 0.2rem 0.6rem; font-size: 0.8rem; color: var(--lb-muted); background: transparent; border: 0; border-radius: 8px; }
.dp-clear:hover { color: var(--lb-danger); background: var(--lb-danger-soft); }
.dp-foot { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
.dp-foot button { flex: 1; padding: 0.6rem 0; font-weight: 600; border: 0; border-radius: 10px; }
.dp-cancel { color: var(--lb-ink); background: var(--lb-hover); }
.dp-cancel:hover { background: var(--lb-border-soft); }
.dp-set { color: #fff; background: var(--lb-primary); }
.dp-set:hover:not(:disabled) { background: var(--lb-primary-hover); }
.dp-set:disabled { opacity: 0.45; cursor: not-allowed; }

/* The month and year lists: scrolling cards beside the calendar (on its left when there is no room on the right). */
.dp-lists { position: absolute; top: 0; left: calc(100% + 0.5rem); display: flex; gap: 0.5rem; height: 100%; }
.lists-left .dp-lists { left: auto; right: calc(100% + 0.5rem); flex-direction: row-reverse; }
.dp-list { display: flex; flex-direction: column; width: 8.5rem; max-height: 100%; padding: 0.4rem 0; overflow-y: auto; scrollbar-width: thin; background: var(--lb-surface); border: 1px solid var(--lb-border-soft); border-radius: 16px; box-shadow: var(--lb-shadow-lg); }
.dp-item { padding: 0.5rem 1rem; font-size: 0.95rem; text-align: left; color: var(--lb-ink); background: transparent; border: 0; }
.dp-item:hover { background: var(--lb-hover); }
.dp-item.is-chosen { font-weight: 600; color: var(--lb-primary); background: var(--lb-primary-soft); }

/* The date range picker (lib/range_picker.js): a button, and a panel with quick ranges, two months and Cancel / Apply. */
.range-pick-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--lb-ink);
  background: var(--lb-surface);
  border: 1px solid var(--lb-border);
  border-radius: 999px;
  box-shadow: var(--lb-shadow);
  transition: border-color 0.15s ease;
}
.range-pick-button:hover, .range-pick-button[aria-expanded="true"] { border-color: var(--lb-primary); }
.range-pick-button i { color: var(--lb-primary); }

.rp-panel {
  position: fixed;
  z-index: 1400;
  width: min(54rem, calc(100vw - 1rem));
  color: var(--lb-ink);
  background: var(--lb-surface);
  border: 1px solid var(--lb-border-soft);
  border-radius: 20px;
  box-shadow: var(--lb-shadow-lg);
  user-select: none;
}
.rp-panel[hidden] { display: none; }
.rp-body { display: flex; }
.rp-presets { display: flex; flex: none; flex-direction: column; gap: 2px; width: 11rem; max-height: 25rem; padding: 0.7rem; overflow-y: auto; border-right: 1px solid var(--lb-border-soft); }
.rp-preset { padding: 0.5rem 0.8rem; font-size: 0.9rem; text-align: left; color: var(--lb-ink); background: transparent; border: 0; border-radius: 10px; }
.rp-preset:hover { background: var(--lb-hover); }
.rp-preset.is-active { font-weight: 600; color: var(--lb-primary); background: var(--lb-primary-soft); }
.rp-main { flex: 1; min-width: 0; padding: 1rem 1.1rem 0.6rem; }
.rp-inputs { display: flex; align-items: flex-end; gap: 0.6rem; margin-bottom: 0.9rem; }
.rp-inputs label { flex: 1; font-size: 0.8125rem; font-weight: 600; }
.rp-inputs .form-control { margin-top: 0.25rem; font-weight: 400; }
.rp-arrow { padding-bottom: 0.45rem; color: var(--lb-muted); }
.rp-months { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.rp-month-head { display: flex; align-items: center; justify-content: space-between; height: 2rem; margin-bottom: 0.4rem; font-size: 0.9rem; }
.rp-nav, .rp-nav-gap { width: 1.8rem; height: 1.8rem; }
.rp-nav { display: grid; place-items: center; color: var(--lb-muted); background: transparent; border: 0; border-radius: 50%; }
.rp-nav:hover { color: var(--lb-primary); background: var(--lb-hover); }
.rp-week, .rp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.rp-week span { padding: 0.25rem 0; font-size: 0.75rem; text-align: center; color: var(--lb-muted); }
.rp-grid { row-gap: 0; }
.rp-day { height: 2.2rem; font-size: 0.875rem; font-variant-numeric: tabular-nums; color: var(--lb-ink); background: transparent; border: 0; border-radius: 0; }
.rp-day:hover:not(:disabled):not(.is-start):not(.is-end) { background: var(--lb-hover); border-radius: 50%; }
.rp-day.is-between { background: var(--lb-hover); }
.rp-day.is-start, .rp-day.is-end { font-weight: 700; color: #fff; background: var(--lb-primary); border-radius: 50%; position: relative; z-index: 1; }
.rp-day.is-today:not(.is-start):not(.is-end) { font-weight: 700; color: var(--lb-primary); }
.rp-day:disabled { color: #D3DAE6; cursor: not-allowed; }
.rp-foot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.8rem 1.1rem; border-top: 1px solid var(--lb-border-soft); }
.rp-foot button { padding: 0.45rem 1.1rem; font-weight: 600; border: 0; border-radius: 999px; }
.rp-cancel { color: var(--lb-ink); background: var(--lb-hover); }
.rp-cancel:hover { background: var(--lb-border-soft); }
.rp-apply { color: #fff; background: var(--lb-primary); }
.rp-apply:hover { background: var(--lb-primary-hover); }

/* Narrow screens: the quick ranges become a row on top and one month shows. */
@media (max-width: 767.98px) {
  .rp-body { flex-direction: column; }
  .rp-presets { flex-direction: row; width: auto; max-height: none; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--lb-border-soft); }
  .rp-preset { white-space: nowrap; }
  .rp-months { grid-template-columns: 1fr; }
  .rp-month:last-child { display: none; }
}
