/* 공용 날짜 선택기. 브라우저 기본 달력을 대체해 앱 디자인과 같은 모양으로 맞춘다. */
.dp { position: relative; display: inline-flex; flex-wrap: wrap; align-items: center; min-width: 0; width: 100%; }
.dp-native { position: absolute; left: 12px; bottom: 6px; width: 1px; height: 1px; padding: 0; margin: 0; border: 0; opacity: 0; pointer-events: none; }

.dp-trigger { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: border-color .2s ease, box-shadow .2s ease, transform .12s ease; }
.dp-trigger:hover { border-color: var(--line); }
.dp-trigger:active { transform: scale(.99); }
.dp-trigger:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 122, .18); }
.dp-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 86, 122, .18); }
.dp-trigger .dp-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-trigger.empty .dp-text { color: var(--ghost); }
.dp-trigger .dp-icon { flex-shrink: 0; color: var(--muted); }
.dp-trigger:disabled { background: var(--soft); color: var(--ghost); cursor: not-allowed; }
.dp.invalid .dp-trigger { border-color: var(--danger); }
.dp-error { flex-basis: 100%; margin-top: 4px; color: var(--danger-ink); font-size: 12px; }
.dp-trigger.sm { height: 38px; font-size: 13px; border-radius: 9px; padding: 0 10px; }
.dp-trigger.bare { border: 0; background: transparent; height: auto; padding: 4px 6px; width: auto; font-weight: 600; gap: 4px; }
.dp-trigger.bare:hover { background: var(--soft); border-radius: 8px; }

.dp-backdrop { position: fixed; inset: 0; background: rgba(28, 38, 40, .10); z-index: 80; opacity: 0; transition: opacity .18s ease; }
.dp-backdrop.on { opacity: 1; }

.dp-pop { position: fixed; z-index: 81; width: 302px; max-width: calc(100vw - 24px); padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px rgba(28, 38, 40, .22); transform-origin: top center; animation: dp-in .18s cubic-bezier(.2, .8, .3, 1.1) both; }
@keyframes dp-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }

.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-title { flex: 1; min-width: 0; height: 36px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: 15px; font-weight: 700; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.dp-title:hover { background: var(--soft); }
.dp-title svg { color: var(--muted); transition: transform .2s ease; }
.dp-title[aria-expanded="true"] svg { transform: rotate(180deg); }
.dp-nav { width: 34px; height: 34px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .2s ease; }
.dp-nav:hover { background: var(--accent-soft); }
.dp-nav:disabled { color: var(--disabled); cursor: not-allowed; background: var(--canvas); }

.dp-dows { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 2px; }
.dp-dows span { text-align: center; font-size: 11px; font-weight: 600; color: var(--faint); padding: 4px 0; }
.dp-dows span.sun { color: var(--danger); } .dp-dows span.sat { color: var(--bro); }

.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-day { height: 38px; border: 1px solid transparent; border-radius: 10px; background: transparent; font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.dp-day:hover:not(:disabled) { background: var(--soft); }
.dp-day.sun { color: var(--danger); } .dp-day.sat { color: var(--bro); }
.dp-day.out { color: var(--disabled); } .dp-day.out.sun, .dp-day.out.sat { color: var(--disabled); }
.dp-day.today { border-color: var(--accent); font-weight: 700; }
.dp-day.on, .dp-day.on.sun, .dp-day.on.sat { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 700; }
.dp-day:disabled { color: var(--line); cursor: not-allowed; }
.dp-day:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(36, 86, 122, .25); }

.dp-months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dp-months button { height: 46px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.dp-months button:hover { background: var(--soft); }
.dp-months button.on { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 700; }
.dp-months button.today { border-color: var(--accent); font-weight: 700; }
.dp-months button:disabled { color: var(--disabled); background: var(--canvas); cursor: not-allowed; }

.dp-years { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-height: 232px; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.dp-years button { height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); cursor: pointer; }
.dp-years button:hover { background: var(--soft); }
.dp-years button.on { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 700; }

.dp-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.dp-foot button { height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--accent); cursor: pointer; }
.dp-foot button:hover { background: var(--accent-soft); }
.dp-foot .grow { flex: 1; }
.dp-foot button.dp-clear { color: var(--danger-ink); border-color: var(--danger-line); }

@media (prefers-reduced-motion: reduce) { .dp-pop, .dp-backdrop { animation: none !important; transition: none !important; } }

/* 기존 .field 래퍼(라벨 안에 input 이 들어가는 형태) 안에서는 테두리를 겹치지 않게 한다. */
.field > .dp, label.field > .dp { flex: 1; min-width: 0; }
.field .dp-trigger:not(.bare) { border: 0; background: transparent; height: 100%; min-height: 40px; padding: 0; border-radius: 0; box-shadow: none; }
.field .dp-trigger:not(.bare):focus-visible, .field .dp-trigger:not(.bare)[aria-expanded="true"] { box-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
label.field { height: auto; min-height: 44px; flex-wrap: wrap; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* 오늘 화면 주간 이동 줄 */
.week-nav { gap: 6px; }
.week-nav-arrow { width: 40px; height: 40px; flex-shrink: 0; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; }
.week-nav-arrow:hover { background: var(--soft); color: var(--ink); }
.week-nav-month { display: flex; min-width: 0; justify-content: center; }
.week-nav-month .dp { width: auto; justify-content: center; }
.week-nav-month .dp-trigger.bare { justify-content: center; width: auto; height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14.5px; }
.week-nav-month .dp-trigger.bare:hover { background: var(--soft); }
.week-nav-month .dp-trigger.bare[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.dp-trigger.bare .dp-text { flex: 0 1 auto; }
.dp-trigger.bare .dp-icon { opacity: .8; }

/* 선택기 옆의 조회 버튼이 줄바꿈되지 않게 한다. */
.dp + .btn, .dp + .btn.sm { flex-shrink: 0; white-space: nowrap; }

/* 모달 창 안에서 팝오버(맨 위 층)로 띄울 때 — 브라우저 기본 팝오버 모양(가운데·테두리·여백)을 지운다. */
.dp-backdrop.dp-lifted { margin: 0; padding: 0; border: 0; width: auto; height: auto; inset: 0; overflow: visible; }
.dp-pop.dp-lifted { margin: 0; inset: auto; height: auto; overflow: visible; color: inherit; }
