/* Shared calendar for native date fields across the ERP. */
input.smart-date-input {
    cursor: pointer;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364778f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M7 3v4M17 3v4M3 10h18'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8rem center;
}

.flatpickr-calendar.smart-date-calendar {
    z-index: 2100;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, .16);
    overflow: hidden;
}
.flatpickr-calendar.smart-date-calendar.open { animation: none; }
.light-style .flatpickr-calendar.smart-date-calendar.open,
.dark-style .flatpickr-calendar.smart-date-calendar.open { z-index: 2100; }
.smart-date-calendar .flatpickr-months,
.smart-date-calendar .flatpickr-weekdays { background: #f8f9ff; }
.smart-date-calendar .flatpickr-months { padding: .65rem .6rem; }
.smart-date-calendar .flatpickr-month { display: flex; align-items: center; justify-content: center; height: 1.9rem; }
.smart-date-calendar .flatpickr-current-month {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .3rem;
    width: auto;
    height: auto;
    padding: 0;
    font-size: .875rem;
    line-height: 1.2;
    transform: none;
}
.smart-date-calendar .flatpickr-current-month .flatpickr-monthDropdown-months {
    appearance: none;
    width: auto;
    height: 1.9rem;
    padding: 0 1.1rem 0 .35rem;
    border-radius: .4rem;
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364778f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .15rem center;
    color: #334155;
    font-size: .875rem;
    font-weight: 600;
}
.smart-date-calendar .flatpickr-current-month .numInputWrapper {
    width: 4.8ch;
    border: 1px solid #dce3ee;
    border-radius: .4rem;
    background: #fff;
}
.smart-date-calendar .flatpickr-current-month .numInputWrapper:hover { background: #fff; }
.smart-date-calendar .flatpickr-current-month .numInputWrapper span { display: none; }
.smart-date-calendar .flatpickr-current-month input.cur-year,
.smart-date-calendar .flatpickr-current-month input.cur-year[disabled] {
    width: 100%;
    height: 1.8rem;
    padding: 0;
    color: #334155;
    font-size: .875rem;
    font-weight: 700;
    text-align: center;
    opacity: 1;
}
.smart-date-calendar .flatpickr-current-month input.cur-year:focus { box-shadow: 0 0 0 2px #696cff40; }
.smart-date-calendar .flatpickr-current-month > .flatpickr-monthDropdown-months,
.smart-date-calendar .flatpickr-current-month > .numInputWrapper { display: none; }
.smart-date-heading { display: flex; align-items: center; justify-content: center; gap: .3rem; }
.smart-date-trigger {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    height: 1.9rem;
    padding: 0 .5rem;
    border: 1px solid #dce3ee;
    border-radius: .4rem;
    background: #fff;
    color: #334155;
    font-family: inherit;
    font-size: .8125rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}
.smart-date-trigger::after {
    content: '';
    width: .35rem;
    height: .35rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
}
.smart-date-trigger:hover,
.smart-date-trigger[aria-expanded="true"] { border-color: #696cff; background: #eef0ff; color: #4144c6; }
.smart-date-trigger:focus-visible,
.smart-date-search:focus { outline: 2px solid #696cff; outline-offset: 1px; }
.smart-date-menu {
    position: absolute;
    z-index: 6;
    top: 3.35rem;
    right: .55rem;
    left: .55rem;
    padding: .6rem;
    border: 1px solid #e2e8f0;
    border-radius: .65rem;
    background: #fff;
    box-shadow: 0 12px 28px #0f172a26;
    text-align: left;
}
.smart-date-menu[hidden] { display: none; }
.smart-date-search {
    width: 100%;
    height: 2rem;
    padding: 0 .65rem;
    border: 1px solid #dce3ee;
    border-radius: .4rem;
    background: #fff;
    color: #334155;
    font-family: inherit;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1;
}
.smart-date-options { max-height: 11rem; overflow-y: auto; margin-top: .45rem; }
.smart-date-option {
    display: block;
    width: 100%;
    padding: .42rem .55rem;
    border: 0;
    border-radius: .35rem;
    background: transparent;
    color: #475569;
    font-family: inherit;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}
.smart-date-option:hover,
.smart-date-option:focus-visible { background: #eef0ff; color: #4144c6; outline: none; }
.smart-date-option[aria-selected="true"] { background: #696cff; color: #fff; font-weight: 700; }
.smart-date-option:disabled,
.smart-date-option:disabled:hover { background: transparent; color: #64748b !important; cursor: not-allowed; }
.smart-date-empty { padding: .6rem .4rem; color: #64748b; font-size: .75rem; }
.smart-date-range-note {
    margin-top: .45rem;
    padding: .45rem .15rem 0;
    border-top: 1px solid #e9edf5;
    color: #64748b;
    font-size: .6875rem;
    line-height: 1.3;
}
.smart-date-range-note[hidden] { display: none; }
.smart-date-calendar .flatpickr-day { border-radius: 8px; }
.smart-date-calendar .flatpickr-day:hover,
.smart-date-calendar .flatpickr-day:focus { background: #eef0ff; border-color: #eef0ff; }
.smart-date-calendar .flatpickr-day.selected,
.smart-date-calendar .flatpickr-day.startRange,
.smart-date-calendar .flatpickr-day.endRange {
    background: #696cff;
    border-color: #696cff;
    color: #fff;
}
.smart-date-calendar .flatpickr-day.today { border-color: #696cff; }
.smart-date-actions {
    display: flex;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .75rem;
    border-top: 1px solid #e9edf5;
    background: #fff;
}
.smart-date-actions button {
    border: 0;
    background: transparent;
    color: #696cff;
    font-size: .75rem;
    font-weight: 600;
    padding: .25rem .4rem;
    border-radius: 6px;
}
.smart-date-actions button:hover { background: #eef0ff; }
.smart-date-actions button:disabled { color: #64748b !important; cursor: default; background: transparent; }
.dark-style .smart-date-calendar .flatpickr-months,
.dark-style .smart-date-calendar .flatpickr-weekdays { background: #323249; }
.dark-style .smart-date-calendar .flatpickr-current-month .flatpickr-monthDropdown-months,
.dark-style .smart-date-calendar .flatpickr-current-month input.cur-year,
.dark-style .smart-date-calendar .flatpickr-current-month input.cur-year[disabled] { color: #cbcbe2; }
.dark-style .smart-date-calendar .flatpickr-current-month .numInputWrapper { border-color: #565876; background: #38384e; }
.dark-style .smart-date-calendar .flatpickr-current-month .numInputWrapper:hover { background: #38384e; }
.dark-style .smart-date-trigger,
.dark-style .smart-date-search { border-color: #565876; background: #38384e; color: #cbcbe2; }
.dark-style .smart-date-trigger:hover,
.dark-style .smart-date-trigger[aria-expanded="true"] { border-color: #a5a6ff; background: #444564; }
.dark-style .smart-date-menu { border-color: #565876; background: #323249; }
.dark-style .smart-date-option { color: #cbcbe2; }
.dark-style .smart-date-option:hover,
.dark-style .smart-date-option:focus-visible { background: #444564; }
.dark-style .smart-date-option[aria-selected="true"] { background: #696cff; color: #fff; }
.dark-style .smart-date-option:disabled,
.dark-style .smart-date-option:disabled:hover { background: transparent; color: #a3a4cc !important; }
.dark-style .smart-date-empty { color: #a3a4cc; }
.dark-style .smart-date-range-note { border-color: #565876; color: #a3a4cc; }
.dark-style .smart-date-calendar .smart-date-actions { background: #323249; border-color: #444564; }
.dark-style .smart-date-calendar .smart-date-actions button { color: #a5a6ff; }
.dark-style .smart-date-calendar .smart-date-actions button:hover { background: #444564; }
.dark-style .smart-date-calendar .smart-date-actions button:disabled { color: #a3a4cc !important; background: transparent; }
