/* The calendar of datepicker.js. The colours come from the page's own
   tokens: style.css and catalog.css name them --bg-panel, --text-primary,
   ...; m.css names them --panel, --fg, ...; the fallbacks cover both. */
input.date-field {
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 7px center;
    background-size: 15px 15px;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}
input.date-field.date-bad { border-color: var(--error, var(--bad, #dc2626)); }

.datepicker {
    position: absolute;
    z-index: 2000;
    width: 252px;
    padding: 8px;
    background: var(--bg-panel, var(--panel, #fff));
    color: var(--text-primary, var(--fg, #1f2937));
    border: 1px solid var(--border, var(--line, #e5e7eb));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font: 13px/1.3 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    user-select: none;
}
.datepicker[hidden] { display: none; }
.dp-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.dp-title { flex: 1; text-align: center; font-weight: 600; }
.dp-nav {
    width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent;
    color: var(--text-secondary, var(--fg-2, #4b5563)); font-size: 16px; line-height: 1; cursor: pointer;
}
.dp-nav:hover:not(:disabled), .dp-nav:focus-visible { background: var(--bg-hover, var(--input, #e9ecf0)); color: var(--text-primary, var(--fg, #1f2937)); }
.dp-nav:disabled { opacity: 0.3; cursor: default; }
.dp-week, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-week span { text-align: center; font-size: 11px; color: var(--text-muted, var(--muted, #6b7280)); padding: 2px 0 4px; }
.dp-day {
    height: 30px; border: 0; border-radius: 6px; background: transparent; color: inherit;
    font: inherit; font-variant-numeric: tabular-nums; cursor: pointer;
}
.dp-day:hover:not(:disabled), .dp-day:focus-visible { background: var(--bg-hover, var(--input, #e9ecf0)); outline: none; }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--accent, #4f46e5); }
.dp-day.on { background: var(--accent, #4f46e5); color: var(--on-accent, #fff); font-weight: 600; }
.dp-day:disabled { opacity: 0.3; cursor: default; }
.dp-foot { display: flex; gap: 12px; justify-content: flex-end; margin-top: 6px; min-height: 4px; }
.dp-link { border: 0; background: transparent; color: var(--accent, #4f46e5); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 4px; }
.dp-link:hover { text-decoration: underline; }
