/*
 * 일정 — 월간 달력.
 * 캘린더 색: 내 일정 = info, 부서 일정 = success, 전사 일정 = warning (ScheduleScope::colorClass).
 * 종일 · 여러 날 일정은 색 면(bar), 시간 일정은 점 + 시각으로 구분한다.
 */
.schedule-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.375rem;
    vertical-align: 0.1em;
    flex-shrink: 0;
    background: var(--sch-color);
}
.is-personal { --sch-color: var(--st-info-fill); --sch-fill: var(--st-info-row); --sch-text: var(--st-info); }
.is-department { --sch-color: var(--st-success-fill); --sch-fill: var(--st-success-row); --sch-text: var(--st-success); }
.is-company { --sch-color: var(--st-warning-fill); --sch-fill: var(--st-warning-row); --sch-text: var(--st-warning); }

.schedule-calendar-head,
.schedule-calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}
.schedule-calendar-head > div {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--tx-muted);
    background: var(--sf-raised);
    border-bottom: 1px solid var(--ln);
}
.schedule-calendar-week + .schedule-calendar-week {
    border-top: 1px solid var(--ln);
}
.schedule-day {
    min-height: 7.5rem;
    padding: 0.25rem 0.25rem 0.375rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.schedule-day + .schedule-day {
    border-left: 1px solid var(--ln-soft);
}
.schedule-day.is-outside {
    background: var(--sf-inset);
}
.schedule-day.is-outside .schedule-day-number {
    color: var(--tx-faint);
}
.schedule-day-number {
    align-self: flex-start;
    min-width: 1.75rem;
    height: 1.75rem;
    line-height: 1.75rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--tx);
    text-decoration: none;
}
.schedule-day-number:hover {
    background: var(--sf-hover);
    color: var(--tx-strong);
}
.is-sunday .schedule-day-number,
.schedule-calendar-head .is-sunday {
    color: var(--st-danger);
}
.is-saturday .schedule-day-number,
.schedule-calendar-head .is-saturday {
    color: var(--st-info);
}
.schedule-day.is-today .schedule-day-number {
    background: var(--tx-strong);
    color: var(--sf-card);
}
.schedule-chip {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    padding: 1px 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--tx);
    text-decoration: none;
    white-space: nowrap;
}
.schedule-chip::before {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--sch-color);
}
.schedule-chip:hover {
    background: var(--sf-hover);
    color: var(--tx-strong);
}
.schedule-chip.is-bar {
    background: var(--sch-fill);
    color: var(--sch-text);
    font-weight: 600;
}
.schedule-chip.is-bar::before {
    display: none;
}
.schedule-chip-time {
    color: var(--tx-muted);
    font-variant-numeric: tabular-nums;
}
.schedule-chip-title {
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-more {
    padding: 0 0.375rem;
    font-size: 0.75rem;
    color: var(--tx-muted);
}

/* 좁은 화면: 칸이 작아 시각은 숨기고 제목만 */
@media (max-width: 575.98px) {
    .schedule-day {
        min-height: 5rem;
        padding: 2px;
    }
    .schedule-chip {
        padding: 0 2px;
        font-size: 0.6875rem;
    }
    .schedule-chip-time,
    .schedule-chip::before {
        display: none;
    }
}

/*
 * 일정 등록 — 일시 칸. 날짜 · 시각은 내용 길이만큼만 차지하게 폭을 못 박는다
 * (전체 폭으로 늘리면 2026-09-18 한 줄에 칸이 한 뼘씩 남았다).
 */
.schedule-when {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.schedule-when-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.schedule-when-label {
    width: 2.25rem;
    flex-shrink: 0;
    margin: 0;
    color: var(--tx-muted);
    font-size: 0.875rem;
}
.schedule-date {
    width: 9.25rem;
    flex: 0 0 auto;
}
.schedule-time {
    width: 7.5rem;
    flex: 0 0 auto;
}
.schedule-when.is-all-day .schedule-time {
    display: none;
}

/* 한 줄(등록 화면): [시작 날짜][시각] ~ [종료 날짜][시각] 1시간 — 좁으면 두 줄로 */
.schedule-when.is-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.625rem;
}
.schedule-when-sep {
    color: var(--tx-muted);
}
.schedule-when:not(.is-inline) .schedule-when-sep {
    display: none;
}
@media (min-width: 576px) {
    .schedule-when.is-inline .schedule-when-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}
@media (max-width: 575.98px) {
    .schedule-when.is-inline .schedule-when-row {
        flex: 1 1 100%;
    }
    .schedule-when.is-inline .schedule-when-sep {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .schedule-when-row {
        flex-wrap: wrap;
    }
    .schedule-date {
        width: calc(100% - 2.75rem - 7.5rem - 0.5rem);
        min-width: 8.5rem;
    }
    .schedule-time {
        width: 7.5rem;
    }
}

.schedule-duration {
    color: var(--tx-muted);
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* 빠른 등록 창의 캘린더 고르기 — 설명은 아래 한 줄(data-scope-description)로 */
.schedule-scope-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.schedule-scope-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--ln);
    border-radius: 999px;
    font-size: 0.875rem;
    cursor: pointer;
    margin: 0;
}
.schedule-scope-pill:hover {
    background: var(--sf-hover);
}
.btn-check:checked + .schedule-scope-pill {
    border-color: var(--sch-color);
    background: var(--sch-fill);
    color: var(--sch-text);
    font-weight: 600;
}
.btn-check:focus-visible + .schedule-scope-pill {
    outline: 2px solid var(--sch-color);
    outline-offset: 2px;
}

/* 날짜 칸의 빈 곳을 누르면 빠른 등록 창이 뜬다 */
.schedule-day[data-quick-date] {
    cursor: pointer;
}
.schedule-day[data-quick-date]:hover {
    background: var(--sf-inset);
}
.schedule-day.is-outside[data-quick-date]:hover {
    background: var(--sf-hover);
}

/* 빠른 등록 창 — 넓게 두 칸(5:5): 왼쪽 제목 · 일시 · 캘린더 | 오른쪽 장소 · 내용. */
@media (min-width: 992px) {
    .schedule-quick-dialog {
        --bs-modal-width: 56rem;
    }
    .schedule-quick-side {
        border-left: 1px solid var(--ln-soft);
    }
    .schedule-quick-side textarea {
        min-height: 8rem;
        resize: none;
    }
}

/*
 * 긴급 — 전자결재 · 일정 공통. 빨간 '긴급' 꼬리표(.urgent-tag), 켜면 빨개지는 토글(.urgent-switch,
 * components/urgent-switch), 상세 화면 맨 위 띠(.urgent-banner).
 * 일정 달력에서는 캘린더 색(누가 보는가)과 따로 꼬리표가 붙고, 같은 날 칸에서 맨 위로 올라간다.
 */
.urgent-tag {
    display: inline-block;
    flex-shrink: 0;
    padding: 0 0.3rem;
    border-radius: 3px;
    background: var(--st-danger-fill);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.45;
    vertical-align: 0.1em;
}
.schedule-chip.is-urgent::before {
    display: none;
}
.schedule-chip.is-urgent .schedule-chip-title {
    font-weight: 600;
}
.schedule-chip.is-bar.is-urgent {
    box-shadow: inset 3px 0 0 var(--st-danger-fill);
}
.urgent-switch .form-check-input:checked {
    background-color: var(--st-danger-fill);
    border-color: var(--st-danger-fill);
}
.urgent-switch .form-check-input:checked + .form-check-label {
    color: var(--st-danger);
    font-weight: 600;
}
.urgent-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--st-danger-row);
    color: var(--st-danger);
    font-weight: 600;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}


/* --------------------------------------------------------------------------
 * 사람이 만든 캘린더의 색(Calendar::COLORS) — 기본 캘린더(.is-personal …)와 같은 세 변수라 칸 · 점 · 알약이 그대로 쓴다.
 * 면 · 글자는 바탕 토큰과 섞어 어두운 화면에서도 맞는다.
 * -------------------------------------------------------------------------- */
.is-cal-blue { --cal: #2f6fde; }
.is-cal-teal { --cal: #0f9aa8; }
.is-cal-green { --cal: #2f9e5b; }
.is-cal-orange { --cal: #e07b1a; }
.is-cal-red { --cal: #d6453d; }
.is-cal-pink { --cal: #d24d8f; }
.is-cal-purple { --cal: #7a5bd6; }
.is-cal-gray { --cal: #6b7785; }
[class*="is-cal-"] {
    --sch-color: var(--cal);
    --sch-fill: color-mix(in srgb, var(--cal) 16%, var(--sf-card));
    --sch-text: color-mix(in srgb, var(--cal) 80%, var(--tx-strong));
}

/* 캘린더 추가 · 수정 창의 색 고르기 — 동그라미, 고른 것은 체크 링 */
.calendar-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.calendar-swatch {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--cal);
    cursor: pointer;
}
.btn-check:checked + .calendar-swatch {
    box-shadow: 0 0 0 2px var(--sf-card), 0 0 0 4px var(--cal);
}
.btn-check:focus-visible + .calendar-swatch {
    outline: 2px solid var(--cal);
    outline-offset: 4px;
}

/* 일정 사이드바 — 구분 제목 옆 +(캘린더 추가), 캘린더 줄(색 네모 = 켜짐, 빈 네모 = 꺼짐), 만든 캘린더는 줄 끝 톱니 */
.side-nav-title-add {
    display: inline-flex;
    margin-left: auto;
    padding: 0.125rem;
    border-radius: 0.375rem;
    color: inherit;
}
.side-nav-title-add:hover {
    background: var(--sf-hover);
    color: var(--theme-primary);
}
.side-nav-title-add svg {
    width: 0.875rem;
    height: 0.875rem;
}
.side-calendar {
    position: relative;
}
.side-calendar-toggle {
    margin: 0;
}
.side-calendar .side-nav-link {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding-right: 2.25rem;
}
.side-calendar-check {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    margin-right: 0;
    border: 2px solid var(--sch-color);
    border-radius: 0.25rem;
    background: var(--sch-color);
    color: #fff;
}
.side-calendar-check svg {
    width: 0.75rem;
    height: 0.75rem;
    stroke-width: 3;
}
.side-calendar .is-off .side-calendar-check {
    background: transparent;
}
.side-calendar .is-off .side-calendar-check svg {
    visibility: hidden;
}
.side-calendar .is-off .menu-text {
    color: var(--tx-muted);
}
.side-calendar-edit {
    position: absolute;
    top: 50%;
    right: 0.75rem;
    display: inline-flex;
    padding: 0.25rem;
    border-radius: 0.375rem;
    color: var(--tx-muted);
    transform: translateY(-50%);
    opacity: 0;
}
.side-calendar:hover .side-calendar-edit,
.side-calendar-edit:focus-visible {
    opacity: 1;
}
.side-calendar-edit:hover {
    background: var(--sf-hover);
    color: var(--theme-primary);
}
.side-calendar-edit svg {
    width: 0.875rem;
    height: 0.875rem;
}
@media (hover: none) {
    /* 손가락으로 쓰는 기기는 올릴 수 없으니 톱니를 늘 보인다 */
    .side-calendar-edit {
        opacity: 1;
    }
}

/* 월간 달력 끌어 옮기기(schedule-calendar.js) — 끄는 일정은 흐리게, 놓을 날 칸은 파란 테두리 */
.schedule-chip[draggable="true"] {
    cursor: grab;
}
.schedule-chip.is-dragging {
    opacity: 0.45;
}
.schedule-day.is-drop-target {
    background: color-mix(in srgb, var(--theme-primary) 10%, var(--sf-card));
    box-shadow: inset 0 0 0 2px var(--theme-primary);
}

/* --------------------------------------------------------------------------
 * 그날 일정 목록 창(schedules/day-modal) · 보기 창의 이전 · 다음(schedules/show-modal)
 *   목록 줄은 손가락으로 누르기 쉬운 높이(3.25rem) — 점 · 시각 · 제목 · 캘린더, 줄 사이 가는 선.
 *   보기 창 맨 위 한 줄: [‹ 10월 7일 (수)] … 2 / 5 (‹)(›) — 근무표 · 달력의 화살표(.mini-calendar-arrow)를 그대로.
 * -------------------------------------------------------------------------- */
.schedule-day-count {
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    background: var(--sf-raised);
    color: var(--tx-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.schedule-day-list {
    display: flex;
    flex-direction: column;
}
.schedule-day-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.625rem 1.25rem;
    border-bottom: 1px solid var(--ln-soft);
    color: var(--tx);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}
.schedule-day-item:last-child {
    border-bottom: 0;
}
.schedule-day-item:active {
    background: var(--sf-hover);
}
@media (hover: hover) {
    .schedule-day-item:hover {
        background: var(--sf-hover);
        color: var(--tx-strong);
    }
}
.schedule-day-item .schedule-dot {
    margin-right: 0;
}
.schedule-day-time {
    flex: none;
    width: 2.75rem;
    color: var(--tx-muted);
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}
.schedule-day-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.schedule-day-calendar {
    flex: none;
    max-width: 6.5rem;
    overflow: hidden;
    color: var(--tx-faint);
    font-size: 0.8125rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-day-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    border-bottom: 1px solid var(--ln-soft);
}
/* 오른쪽 화살표(2rem)와 같은 높이 · 한 줄 높이 1 — 아이콘이 글자 기준선에 붙어 위아래가 어긋나지 않게. */
.schedule-day-back {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    height: 2rem;
    margin-right: auto;
    padding: 0 0.5rem 0 0.25rem;
    border-radius: 6px;
    color: var(--tx-muted);
    font-size: 0.875rem;
    line-height: 1;
    text-decoration: none;
}
.schedule-day-back svg {
    display: block;
    flex: none;
}
@media (hover: hover) {
    .schedule-day-back:hover {
        background: var(--sf-hover);
        color: var(--tx-strong);
    }
}
.schedule-day-position {
    margin-right: 0.25rem;
    color: var(--tx-muted);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}
.schedule-day-nav .mini-calendar-arrow {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
}
.schedule-day-nav .mini-calendar-arrow svg {
    display: block;
}
.mini-calendar-arrow.is-disabled {
    opacity: 0.35;
    pointer-events: none;
}
