.crp-wrap{
    position:relative;
    display:inline-block;
}

.crp-input{
    min-width:240px;
    height:42px;
    border:1px solid #ced4da;
    border-radius:12px;
    font-size:13px;
    color:#333;
    background:#fff;
    cursor:pointer;
}

.crp-input:focus{
    border-color:var(--main-orange) !important;
    box-shadow:0 0 0 .2rem rgba(235,119,25,.18) !important;
}

.crp-popup{
    position:absolute;
    top:calc(100% + 6px);
    left:0;
    z-index:3000;
    width:560px;
    background:#fff;
    border:1px solid #f0d4bc;
    border-radius:10px;
    box-shadow:0 8px 18px rgba(0,0,0,.10);
    overflow:hidden;
}

.crp-top-inputs{
    display:grid;
    grid-template-columns:1fr 16px 1fr;
    align-items:center;
    gap:4px;
    padding:8px 10px;
    border-bottom:1px solid #f3e4d7;
    background:#fff;
}

.crp-top-input{
    height:30px;
    border:1px solid #ced4da;
    border-radius:8px;
    padding:0 8px;
    font-size:12px;
    color:#333;
    outline:none;
}

.crp-top-input:focus{
    border-color:var(--main-orange);
    box-shadow:0 0 0 .15rem rgba(235,119,25,.18);
}

.crp-top-sep{
    text-align:center;
    color:#777;
    font-weight:600;
}

.crp-calendars{
    display:grid;
    grid-template-columns:1fr 1fr;
}

.crp-panel + .crp-panel{
    border-left:1px solid #f3e4d7;
}

.crp-head{
    height:34px;
    background:#ff8c2f;
    color:#fff;
    display:grid;
    grid-template-columns:24px 24px 1fr 24px 24px;
    align-items:center;
    padding:0 4px;
    gap:2px;
}

.crp-title{
    text-align:center;
    font-size:11px;
    font-weight:700;
    letter-spacing:.1px;
    white-space:nowrap;
}

.crp-nav{
    width:22px;
    height:22px;
    border:none;
    background:transparent;
    color:#fff;
    border-radius:999px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:11px;
    cursor:pointer;
    transition:.15s ease;
}

.crp-nav:hover{
    background:rgba(255,255,255,.18);
}

.crp-weekdays{
    display:grid;
    grid-template-columns:repeat(7,1fr);
    gap:1px;
    padding:6px 6px 2px;
}

.crp-weekday{
    text-align:center;
    font-size:10px;
    font-weight:600;
    color:#666;
    padding:1px 0;
}

.crp-days{
    display:grid;
    grid-template-columns:repeat(7,1fr);
    gap:1px;
    padding:0 7px 9px;
    min-height:166px;
}

.crp-day{
    height:27px;
    border:none;
    background:transparent;
    color:#333;
    font-size:11px;
    border-radius:0;
    transition:.15s;
    position:relative;
}

.crp-day:hover:not(.is-other-month){
    background:#fff2e6;
    color:var(--main-orange);
}

.crp-day.is-other-month{
    color:#c7c7c7;
}

.crp-day.is-today{
    box-shadow:inset 0 0 0 1px #ffb37c;
    border-radius:999px;
}

.crp-day.is-start,
.crp-day.is-end{
    background:var(--main-orange) !important;
    color:#fff !important;
    border-radius:999px !important;
    font-weight:700;
    z-index:2;
}

.crp-day.is-in-range{
    background:#ffe7d1;
    color:#333;
}

.crp-day.is-in-range.range-left{
    border-top-left-radius:999px;
    border-bottom-left-radius:999px;
}

.crp-day.is-in-range.range-right{
    border-top-right-radius:999px;
    border-bottom-right-radius:999px;
}

.crp-presets{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:4px;
    padding:6px;
    border-top:1px solid #f3e4d7;
    background:#fff;
}

.crp-preset-btn{
    height:24px;
    border:1px solid #efc9a7;
    border-radius:999px;
    background:#fff8f2;
    color:var(--main-orange);
    font-size:10px;
    font-weight:600;
    transition:.15s;
}

.crp-preset-btn:hover,
.crp-preset-btn.is-active{
    background:var(--main-orange);
    border-color:var(--main-orange);
    color:#fff;
}
.crp-wrap{
    position: relative;
}

.crp-wrap .crp-input{
    padding-right: 40px;
}
.crp-clear-btn{
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: #f1f3f5;
    color: #6b7280;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    z-index: 3;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: .15s ease;
}

.crp-wrap.has-value:hover .crp-clear-btn,
.crp-wrap.has-value:focus-within .crp-clear-btn{
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.crp-clear-btn:hover{
    background: #eb7719;
    color: #fff;
}

@media (max-width: 768px){
    .crp-wrap{
        display:block;
        width:100%;
        max-width:100%;
    }

    .crp-input{
        min-width:0;
        width:100%;
        height:36px;
        font-size:12px;
    }

    .crp-popup{
        width:min(100vw - 16px, 360px);
        max-width:calc(100vw - 16px);
        max-height:min(70dvh, 520px);
        overflow-y:auto;
        border-radius:10px;
    }

    .crp-top-inputs{
        padding:6px 8px;
        gap:3px;
    }

    .crp-top-input{
        height:28px;
        font-size:11px;
        padding:0 6px;
    }

    .crp-head{
        height:28px;
        grid-template-columns:20px 20px 1fr 20px 20px;
        padding:0 2px;
    }

    .crp-title{
        font-size:10px;
    }

    .crp-nav{
        width:18px;
        height:18px;
        font-size:10px;
    }

    .crp-weekdays{
        padding:4px 4px 1px;
        gap:0;
    }

    .crp-weekday{
        font-size:9px;
        padding:0;
    }

    .crp-days{
        gap:0;
        padding:0 4px 6px;
        min-height:140px;
    }

    .crp-day{
        height:22px;
        font-size:10px;
    }

    .crp-presets{
        gap:3px;
        padding:5px;
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .crp-preset-btn{
        height:22px;
        font-size:9px;
    }
}

/* PWA mobile: retain both months, compact enough for narrow screens. */
@media (display-mode: standalone) and (max-width: 480px){
    .crp-popup{
        width:calc(100vw - 12px);
        max-width:calc(100vw - 12px);
        max-height:78dvh;
    }

    .crp-top-inputs{ padding:4px 6px; }
    .crp-top-input{ height:25px; font-size:10px; padding:0 4px; }
    .crp-head{ height:25px; grid-template-columns:16px 16px minmax(0,1fr) 16px 16px; gap:0; padding:0 1px; }
    .crp-title{ font-size:8px; }
    .crp-nav{ width:16px; height:16px; font-size:8px; }
    .crp-weekdays{ padding:3px 2px 0; }
    .crp-weekday{ font-size:8px; }
    .crp-days{ padding:0 2px 4px; min-height:118px; }
    .crp-day{ height:19px; font-size:9px; }
    .crp-presets{ padding:4px; gap:2px; }
    .crp-preset-btn{ height:20px; font-size:8px; }
}

/* Dark-only: this asset loads after shared theme CSS. Geometry remains unchanged. */
html[data-theme="dark"] .crp-popup {
    background:#000000 !important;
    border-color:#333333 !important;
    box-shadow:0 8px 18px rgba(0,0,0,.42) !important;
    color:#f5f5f5 !important;
}
html[data-theme="dark"] .crp-top-inputs,
html[data-theme="dark"] .crp-presets {
    background:#000000 !important;
    border-color:#333333 !important;
}
html[data-theme="dark"] .crp-top-input {
    background:#111111 !important;
    border-color:#333333 !important;
    color:#f5f5f5 !important;
}
html[data-theme="dark"] .crp-weekday,
html[data-theme="dark"] .crp-top-sep,
html[data-theme="dark"] .crp-day.is-other-month {
    color:#a3a3a3 !important;
}
html[data-theme="dark"] .crp-day {
    background:transparent !important;
    color:#f5f5f5 !important;
}
html[data-theme="dark"] .crp-panel + .crp-panel {
    border-color:#333333 !important;
}
html[data-theme="dark"] .crp-day.is-today {
    box-shadow:inset 0 0 0 1px #c87830 !important;
}
html[data-theme="dark"] .crp-day.is-in-range,
html[data-theme="dark"] .crp-day:hover:not(.is-other-month),
html[data-theme="dark"] .crp-preset-btn:not(.is-active):not(:hover) {
    background:#1a1a1a !important;
    border-color:#444444 !important;
    color:#ffad62 !important;
}
html[data-theme="dark"] .crp-clear-btn:not(:hover) {
    background:#111111 !important;
    color:#a3a3a3 !important;
}
