/* =========================================================
   DATE PICKERS (DayRangePicker + the YTD picker on Executive Overview)
   Popover with a header, quick chips, a calendar with a continuous range band, From / To fields and
   Cancel / Set. Nothing on the page changes until Set is pressed.
   ========================================================= */

:root {
    --dp-blue: #2563eb;
    --dp-blue-dark: #1d4ed8;
    --dp-blue-soft: #e8f0fe;
    --dp-blue-faint: #f3f7ff;
    --dp-text: #1f2937;
    --dp-muted: #64748b;
    --dp-faint: #94a3b8;
    --dp-border: #e2e8f0;
    --dp-radius: 16px;
}

/* ---------- popover shell ---------- */

.dp-popover {
    width: 340px !important;
    min-width: 340px !important;
    max-width: calc(100vw - 24px) !important;

    padding: 0 !important;
    overflow: hidden;

    border: 1px solid var(--dp-border);
    border-radius: var(--dp-radius) !important;

    box-shadow:
        0 16px 40px rgba(15, 23, 42, 0.14),
        0 2px 8px rgba(15, 23, 42, 0.06) !important;
}

.dp-popover--ytd {
    width: 340px !important;
    min-width: 340px !important;
}


/* ---------- header ---------- */

.dp-head {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 16px 18px 12px;
}

.dp-head-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--dp-blue);

    background: var(--dp-blue-soft);
    border-radius: 10px;
}

.dp-head-icon .mud-icon-root {
    font-size: 1.25rem;
}

.dp-head-title {
    color: var(--dp-text);

    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25;
}

.dp-head-sub {
    margin-top: 2px;

    color: var(--dp-muted);

    font-size: 0.75rem;
    line-height: 1.3;
}


/* ---------- quick chips ---------- */

.dp-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    padding: 0 18px 14px;
}

.dp-chip {
    padding: 6px 14px;

    color: #475569;

    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.2;

    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 999px;

    cursor: pointer;
    user-select: none;

    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dp-chip:hover {
    color: var(--dp-blue-dark);
    background: var(--dp-blue-soft);
}

.dp-chip--active {
    color: var(--dp-blue-dark);
    font-weight: 600;

    background: var(--dp-blue-soft);
    border-color: #bcd2fb;
}


/* ---------- calendar ---------- */

.dp-calendar {
    padding: 4px 14px 14px;

    border-top: 1px solid #f1f5f9;
}

.dp-month-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 10px 0 8px;
}

.dp-month-title {
    color: var(--dp-text);

    font-size: 0.9375rem;
    font-weight: 600;
}

.dp-nav {
    width: 32px;
    height: 32px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #475569;

    background: transparent;
    border: none;
    border-radius: 50%;

    cursor: pointer;
}

.dp-nav:hover:not(:disabled) {
    background: #f1f5f9;
}

.dp-nav:disabled {
    color: #cbd5e1;
    cursor: not-allowed;
}

.dp-weekdays,
.dp-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.dp-weekdays span {
    padding-bottom: 6px;

    color: var(--dp-faint);

    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: center;
    text-transform: uppercase;
}

.dp-grid {
    row-gap: 2px;
}

.dp-cell {
    position: relative;

    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--dp-text);

    font-size: 0.8125rem;

    cursor: pointer;
}

/* the circle that carries the number; the cell itself carries the range band behind it */
.dp-day {
    position: relative;
    z-index: 1;

    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    transition: background 0.12s ease, color 0.12s ease;
}

.dp-cell:hover:not(.dp-cell--disabled):not(.dp-cell--start):not(.dp-cell--end) .dp-day {
    background: #eef2f7;
}

.dp-cell--outside {
    color: #cbd5e1;
}

.dp-cell--disabled {
    color: #d3dae4;

    cursor: not-allowed;
    pointer-events: none;
}

/* range band: a continuous strip behind the numbers, rounded at both ends of the range and at the row edges */
.dp-cell--in-range::before,
.dp-cell--start:not(.dp-cell--end)::before,
.dp-cell--end:not(.dp-cell--start)::before {
    content: "";

    position: absolute;
    top: 2px;
    bottom: 2px;
    left: 0;
    right: 0;

    background: var(--dp-blue-soft);
}

.dp-cell--start:not(.dp-cell--end)::before {
    left: 50%;
}

.dp-cell--end:not(.dp-cell--start)::before {
    right: 50%;
}

.dp-cell--in-range:nth-child(7n + 1)::before {
    border-radius: 19px 0 0 19px;
}

.dp-cell--in-range:nth-child(7n)::before {
    border-radius: 0 19px 19px 0;
}

.dp-cell--in-range .dp-day {
    color: var(--dp-blue-dark);
    font-weight: 500;
}

.dp-cell--start .dp-day,
.dp-cell--end .dp-day {
    color: #fff;
    font-weight: 600;

    background: var(--dp-blue);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}


/* ---------- footer: From / To + buttons ---------- */

.dp-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;

    padding: 14px 18px 16px;

    background: #fafbfd;
    border-top: 1px solid #eef1f6;
}

.dp-fields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.dp-field {
    min-width: 0;
    flex: 1 1 0;

    display: flex;
    flex-direction: column;
    gap: 1px;

    padding: 7px 12px;

    background: #fff;
    border: 1px solid var(--dp-border);
    border-radius: 10px;
}

.dp-field--focus {
    border-color: var(--dp-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dp-field-label {
    color: var(--dp-faint);

    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.dp-field-value {
    color: var(--dp-text);

    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.dp-field-value--empty {
    color: var(--dp-faint);

    font-weight: 500;
}

.dp-fields .dp-fields-arrow.mud-icon-root {
    flex: 0 0 auto;

    color: #b6c0cf;
    font-size: 1rem;
}

.dp-days-badge {
    flex: 1 0 100%;

    color: var(--dp-muted);

    font-size: 0.75rem;
    text-align: center;
}

.dp-days-badge:empty {
    display: none;
}

.dp-actions {
    display: flex;
    gap: 10px;
}

.dp-btn {
    height: 38px;
    flex: 1 1 0;

    color: #475569;

    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;

    background: #fff;
    border: 1px solid var(--dp-border);
    border-radius: 10px;

    cursor: pointer;

    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.dp-btn:hover {
    background: #f1f5f9;
}

.dp-btn--primary {
    color: #fff;

    background: var(--dp-blue);
    border-color: var(--dp-blue);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.dp-btn--primary:hover {
    background: var(--dp-blue-dark);
}

.dp-btn:disabled {
    opacity: 0.45;

    cursor: not-allowed;
    pointer-events: none;
}


/* ---------- YTD picker (Executive Overview): same shell, year chips + month grid ---------- */

.dp-popover .ytd-year-row {
    flex-wrap: nowrap !important;
    gap: 6px;

    padding: 0 18px 4px !important;
}

.dp-popover .ytd-year-chip {
    flex: 1 1 0;

    padding: 6px 0;

    text-align: center;

    color: #475569;

    font-size: 0.8125rem;
    font-weight: 500;

    background: #f1f5f9;
    border: 1px solid transparent;
}

.dp-popover .ytd-year-chip:hover {
    color: var(--dp-blue-dark);
    background: var(--dp-blue-soft);
}

.dp-popover .ytd-year-chip--active,
.dp-popover .ytd-year-chip--active:hover {
    color: #fff;
    font-weight: 600;

    background: var(--dp-blue);
    border-color: var(--dp-blue);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.dp-popover .ytd-month-grid {
    gap: 6px;

    padding: 8px 18px 14px !important;
}

.dp-popover .ytd-month-cell {
    height: 38px;

    border-radius: 10px;
}

.dp-popover .ytd-month-cell--active {
    color: #fff;
    font-weight: 600;

    background: var(--dp-blue);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.dp-popover .ytd-range-note {
    padding: 10px 18px;

    color: var(--dp-muted);

    font-size: 0.75rem;

    background: #fafbfd;
    border-top: 1px solid #eef1f6;
}

.dp-popover .ytd-range-note + .dp-footer {
    border-top: none;
}
