:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --line: #e3e6ea;
    --text: #22262b;
    --muted: #7a828c;
    --accent: #2f6df6;
    --accent-soft: #e8f0ff;
    --open: #fff4e5;
    --middle: #e9f7ee;
    --night: #eae7fb;
    --rest: #fbeef0;
    --weekend: #d1454b;
    --sunday: #d1454b;
    --saturday: #2f6df6;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

header.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 clamp(16px, 3vw, 32px);
    height: 56px;
}

.brand {
    font-weight: 700;
    font-size: 16px;
    margin-right: 16px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex: 0 0 auto;
}

.brand span { color: var(--accent); }

/* overflow 를 두면 하위 절대배치(관리자 메뉴 드롭다운)가 잘려서 안 보인다 — visible 유지.
   탭 수가 관리자 메뉴로 줄어 >1180px 에선 한 줄에 들어오고, ≤1180px 은 드로어(세로)라 넘침 없음. */
nav.tabs { display: flex; gap: 2px; flex-wrap: nowrap; }

nav.tabs a {
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 13.5px;
    white-space: nowrap;   /* '주간 스케 줄' 처럼 중간에서 줄바꿈되지 않게 */
}

nav.tabs a:hover { background: var(--bg); color: var(--text); }
nav.tabs a.active { background: var(--accent-soft); color: var(--accent); }

/* 근무 스케줄 내부 서브탭(주간/월간) */
.schtabs { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line);
           border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.schtabs a { padding: 7px 18px; border-radius: 8px; text-decoration: none; color: var(--muted);
             font-weight: 700; font-size: 14px; }
.schtabs a.on { background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

/* 안 읽은 공지 배지(네비 '공지' 탭) */
.nav-badge {
    display: inline-block;
    margin-left: 5px;
    min-width: 18px;
    padding: 1px 6px;
    background: #e03131;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    border-radius: 10px;
    vertical-align: middle;
}
.nav-badge.hidden { display: none; }

/* 관리자 메뉴(총괄) 드롭다운 — 일반 탭과 구분되는 별도 색 */
.admin-menu { position: relative; display: inline-flex; }
.admin-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
    font-weight: 700; font-size: 13.5px;
    background: #eef1fb; color: #3f4db8; border: 1px solid #d7def6;
}
.admin-toggle::after {
    content: ""; width: 0; height: 0;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid currentColor; opacity: .65;
}
.admin-menu:hover .admin-toggle,
.admin-menu.active .admin-toggle { background: #e2e7f8; }
.admin-menu.active .admin-toggle { box-shadow: inset 0 0 0 1px #b9c4ee; }
.admin-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0;
    background: var(--card); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 12px 30px rgba(20, 24, 30, 0.14); padding: 6px; min-width: 168px;
    display: none; z-index: 45;
}
.admin-menu.open .admin-dropdown { display: block; }
.admin-dropdown a {
    display: block; padding: 9px 12px; border-radius: 7px;
    color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.admin-dropdown a:hover { background: var(--bg); color: var(--text); }
.admin-dropdown a.active { background: var(--accent-soft); color: var(--accent); }

/* 우측 사용자/매장 영역 */
.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.topbar-user form { display: inline; margin: 0; }
.topbar-user .who {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.store-select {
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    max-width: 150px;
    cursor: pointer;
}
.store-badge {
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}
.admin-chip {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 3px 9px;
    margin: 2px 4px 2px 0;
    font-size: 12px;
}

/* ===== 총괄(super) 전용 관리 콘솔 강조 — 실장 화면과 확실히 구분 ===== */
/* 상단 얇은 인디고 라인: 크롬 자체가 실장과 달라 보이게 한다 */
.topbar.super { border-top: 3px solid #3f4db8; }

/* 네비 아래 항상 노출되는 콘솔 바: 총괄임을 알리고 관리 중인 지점을 크게 보여준다 */
.super-bar {
    background: linear-gradient(90deg, #eef1fb 0%, #f7f9ff 60%, #ffffff 100%);
    border-bottom: 1px solid #d7def6;
}
.super-bar-inner {
    max-width: 1280px; margin: 0 auto;
    display: flex; align-items: center; gap: 12px;
    padding: 8px clamp(16px, 3vw, 32px);
}
.super-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: #3f4db8; color: #fff;
    font-weight: 800; font-size: 12.5px; white-space: nowrap;
    padding: 6px 13px; border-radius: 999px;
}
.super-badge::before { content: "\2605"; font-size: 12px; line-height: 1; }
.super-store-picker {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid #c7d0ee; border-radius: 10px;
    padding: 4px 8px 4px 13px;
}
.super-store-label { font-size: 12px; font-weight: 700; color: #5b63a8; white-space: nowrap; }
.super-store-select {
    border: none; background: transparent; cursor: pointer;
    font-size: 15px; font-weight: 800; color: #1f2a63;
    padding: 3px 4px; max-width: 220px;
}
.super-store-select:focus { outline: none; }
.super-manage-link {
    margin-left: auto;
    display: inline-flex; align-items: center; white-space: nowrap;
    font-size: 13px; font-weight: 700; color: #3f4db8; text-decoration: none;
    padding: 7px 14px; border: 1px solid #c7d0ee; border-radius: 8px; background: #fff;
}
.super-manage-link:hover { background: #eef1fb; }

/* 네비 접기(모바일 드로어). 데스크톱에선 인라인, 아래 요소들은 숨김 */
.nav-collapse { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; gap: 8px; }
.nav-collapse .topbar-user { margin-left: auto; }
.hamburger, .drawer-close, .nav-scrim, .topbar-store-mini { display: none; }

main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 32px) 60px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

h1.title { font-size: 20px; margin: 0; }
.subtitle { color: var(--muted); margin: 4px 0 0; font-size: 13px; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 20px;
}

/* Buttons */
.btn {
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--weekend); border-color: #f0d3d4; }
.btn.small { padding: 5px 9px; font-size: 12px; }

/* Tables */
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { background: #fafbfc; font-weight: 700; color: var(--muted); font-size: 12px; }

/* Schedule grid */
.schedule th, .schedule td { text-align: center; }
.schedule .rowlabel { background: #fafbfc; font-weight: 700; width: 90px; }
.schedule td.shift-OPEN { background: var(--open); }
.schedule td.shift-MIDDLE { background: var(--middle); }
.schedule td.shift-NIGHT { background: var(--night); }
.schedule .rest td { background: #fbeef0; color: #99525a; }
.schedule .count td { font-weight: 700; }
.namechip { display: block; padding: 2px 0; white-space: nowrap; }
.empty-cell { color: var(--muted); }

/* Employee table */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
}
.tag.kitchen { background: var(--middle); color: #2e8b57; }
.tag.hall { background: var(--accent-soft); color: var(--accent); }
.dayoff-chip {
    display: inline-block;
    background: #fbeef0;
    color: #99525a;
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 12px;
    margin: 1px;
}

/* Calendar */
.calendar { table-layout: fixed; }
.calendar th { text-align: center; }
.calendar td { height: 84px; vertical-align: top; }
.calendar .daynum { font-weight: 700; font-size: 13px; }
.calendar .note { font-size: 11px; color: var(--weekend); margin-top: 4px; line-height: 1.35; }
.calendar td.sun .daynum, .calendar th.sun { color: var(--sunday); }
.calendar td.sat .daynum, .calendar th.sat { color: var(--saturday); }
.calendar td.holiday { background: #fdf1f2; }
.calendar td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-nav { display: flex; align-items: center; gap: 10px; }
.cal-nav .month-label { font-weight: 700; font-size: 18px; min-width: 120px; text-align: center; }

/* Forms / modal */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(20, 24, 30, 0.45);
    z-index: 50;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: 14px;
    width: 420px;
    max-width: calc(100vw - 40px);
    /* 창 높이가 짧을 때 모달이 화면을 넘겨 버튼이 잘리는 문제 방지 → 내부 스크롤 */
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 22px;
}
.modal h3 { margin: 0 0 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field input, .field select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}
.dayoff-options { display: flex; flex-wrap: wrap; gap: 6px; }
.dayoff-options label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--line);
    padding: 5px 9px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}
.dayoff-options input { width: auto; }

/* 운영 상태 토글 (매장 추가/수정) */
.field label.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.field .status-toggle input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; }
.status-toggle .on  { color: #2e8b57; }
.status-toggle .off { color: var(--weekend); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.open { background: var(--open); border: 1px solid #f0d9b8; }
.dot.middle { background: var(--middle); border: 1px solid #bfe6cd; }
.dot.night { background: var(--night); border: 1px solid #cfc7ef; }

.muted { color: var(--muted); }
.right { text-align: right; }

/* 월간 스케줄 달력 */
.msched { table-layout: fixed; width: 100%; }
.msched th { text-align: center; }
.msched td { height: 100px; vertical-align: top; padding: 4px 5px; cursor: pointer; }
.msched td.empty { background: #fafbfc; cursor: default; }
.msched td:not(.empty):hover { background: #f2f6ff; }
.msched .mday { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.msched .daynum { font-weight: 700; font-size: 12px; }
.msched th.sun, .msched td.sun .daynum { color: var(--sunday); }
.msched th.sat, .msched td.sat .daynum { color: var(--saturday); }
.msched td.holiday { background: #fdf1f2; }
.msched td.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.msched .dholi { font-size: 10px; color: var(--weekend); }
.msched .mshift { font-size: 10.5px; line-height: 1.35; border-left: 3px solid #ccc; padding-left: 5px; margin-bottom: 2px; }
.msched .mshift .shlab { font-weight: 700; color: var(--muted); margin-right: 3px; }
.mshift.sh-OPEN { border-left-color: #efb15f; }
.mshift.sh-MIDDLE { border-left-color: #5fbf8c; }
.mshift.sh-NIGHT { border-left-color: #9a8fe0; }
/* 데스크톱: 이름 표시, 인원수 배지는 숨김(모바일에서만 노출) */
.msched .shcount { display: none; }

/* 날짜 편집 모달의 시간대 섹션 */
.dshift { border: 1px solid var(--line); border-left: 4px solid #ccc; border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.dshift.sh-OPEN { border-left-color: #efb15f; }
.dshift.sh-MIDDLE { border-left-color: #5fbf8c; }
.dshift.sh-NIGHT { border-left-color: #9a8fe0; }
.dshift-head { font-weight: 700; margin-bottom: 6px; }
.dshift-body { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.dshift-add { display: flex; gap: 6px; }
.dshift-add select { flex: 1; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; }

/* 상태 배너 (초안 / 편집 중) */
.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-left: 4px solid var(--accent);
}
.banner.editing { border-left-color: #2e8b57; }
.banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 서브 탭 */
.subtabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.subtabs button {
    border: none; background: none; padding: 10px 14px; font-weight: 700; font-size: 14px;
    color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabpane { display: none; }
.tabpane.active { display: block; }
.section-title { font-size: 15px; font-weight: 700; margin: 6px 0 10px; }
.flag { color: var(--weekend); font-weight: 700; }
.alert-card {
    background: #fbeef0; border: 1px solid #f0d3d4; border-radius: 10px;
    padding: 12px 14px; margin-bottom: 10px; color: #99333a;
}

/* 편집 가능한 스케줄 셀의 칩/추가 버튼 */
.schedule td { position: relative; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 3px 6px;
    margin: 2px;
    font-size: 13px;
    white-space: nowrap;
}
.chip-note {
    color: #99525a;
    font-size: 11px;
    background: #fbeef0;
    border-radius: 4px;
    padding: 0 5px;
}
.chip-x {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 2px;
}
.chip-x:hover { color: var(--weekend); }
.addcell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 2px;
    border: 1px dashed var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}
.addcell:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.schedule.editable td.shift-OPEN,
.schedule.editable td.shift-MIDDLE,
.schedule.editable td.shift-NIGHT { text-align: left; vertical-align: top; }

/* 가로 스크롤 래퍼 (모바일에서 넓은 표) */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* 2단 레이아웃 (공휴일/휴무일) — 모바일에서 1단으로 */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 주간 스케줄: 좁은 화면에서는 가로 스크롤, 첫 열(시간대)은 고정 */
.schedule { min-width: 620px; }
.schedule .rowlabel {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 1px 0 0 var(--line);
}
.schedule thead .rowlabel { z-index: 3; }

/* ===== 네비: 탭이 한 줄에 안 들어가는 폭부터 햄버거 드로어로 전환 =====
   관리 탭이 9개라 대략 1180px 이하에선 인라인 배치가 비좁아 줄바꿈된다.
   이 구간부터는 우측 슬라이드 드로어로 접어 깔끔하게 보여준다. */
@media (max-width: 1180px) {
    .brand { margin-right: 0; }

    /* 햄버거 버튼 */
    .hamburger { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px;
                 width: 40px; height: 38px; padding: 0 10px; border: 1px solid var(--line);
                 border-radius: 9px; background: #fff; cursor: pointer; flex: 0 0 auto; }
    .hamburger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }

    /* 상단 현재 매장 요약 */
    .topbar-store-mini { display: inline-block; margin-left: auto; max-width: 40vw;
                         overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                         font-size: 13px; font-weight: 700; color: var(--accent); }

    /* nav-collapse → 우측 슬라이드 드로어 */
    .nav-collapse {
        position: fixed; top: 0; right: 0; bottom: 0;
        width: 82%; max-width: 320px;
        flex-direction: column; align-items: stretch; gap: 0;
        background: var(--card); border-left: 1px solid var(--line);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.14);
        padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
        transform: translateX(105%); transition: transform 0.22s ease;
        z-index: 60; overflow-y: auto;
    }
    body.nav-open .nav-collapse { transform: none; }
    body.nav-open { overflow: hidden; }

    .drawer-close { display: block; align-self: flex-end; border: none; background: none;
                    font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; }

    .nav-collapse .tabs { flex-direction: column; align-items: stretch; gap: 2px; overflow: visible; margin-top: 4px; }
    .nav-collapse .tabs a { padding: 13px 12px; font-size: 15px; border-radius: 9px; white-space: nowrap; }

    /* 관리자 메뉴: 드로어에선 인라인으로 펼침(절대배치 해제) */
    .nav-collapse .admin-menu { display: block; width: 100%; }
    .nav-collapse .admin-toggle { width: 100%; justify-content: space-between; padding: 13px 12px; font-size: 15px; }
    .nav-collapse .admin-dropdown { position: static; box-shadow: none; border: none; padding: 2px 0 2px 10px;
                                    min-width: 0; margin-top: 2px; }
    .nav-collapse .admin-dropdown a { padding: 11px 12px; font-size: 15px; }

    .nav-collapse .topbar-user {
        margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line);
        flex-direction: column; align-items: stretch; gap: 10px;
    }
    .nav-collapse .topbar-user .who { display: block; font-size: 13px; color: var(--muted); }
    .nav-collapse .store-select { max-width: none; width: 100%; font-size: 15px; padding: 10px; }
    .nav-collapse .topbar-user .btn { width: 100%; justify-content: center; padding: 11px; }
    .nav-collapse .topbar-user form { display: block; margin: 0; }
    .nav-collapse .topbar-user form button { width: 100%; justify-content: center; padding: 11px; }
    .nav-collapse .store-badge { align-self: flex-start; }

    /* 드로어 배경 스크림 */
    .nav-scrim { display: block; position: fixed; inset: 0; background: rgba(20, 24, 30, 0.42);
                 opacity: 0; pointer-events: none; transition: opacity 0.22s ease; z-index: 55; }
    body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
}

/* ===== 폰 콘텐츠 최적화 (표/모달/헤더 등) ===== */
@media (max-width: 680px) {
    body { font-size: 14px; -webkit-text-size-adjust: 100%; }

    .topbar-inner { height: 54px; gap: 10px; }
    .brand { font-size: 15px; }

    /* 총괄 콘솔 바: 좁은 폭에선 줄바꿈하고 지점 셀렉터가 넓게 */
    .super-bar-inner { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
    .super-store-picker { flex: 1 1 100%; }
    .super-store-select { flex: 1; max-width: none; }
    .super-manage-link { margin-left: 0; }

    main { padding: 16px 12px 48px; }
    .page-head { gap: 10px; }
    h1.title { font-size: 18px; }
    .subtitle { font-size: 12px; }
    .card { padding: 14px; border-radius: 10px; margin-bottom: 16px; }

    .two-col { grid-template-columns: 1fr; gap: 16px; }

    /* 표를 손가락에 맞게 조금 더 크게 터치되도록 */
    .btn { padding: 9px 13px; }
    .btn.small { padding: 7px 10px; }

    /* 주간 스케줄 셀 촘촘하게 */
    .schedule th, .schedule td { padding: 6px 6px; font-size: 12px; }
    .schedule .rowlabel { width: 56px; }
    .namechip { font-size: 12px; }

    /* 직원 표: id 열 숨김 */
    .col-id { display: none; }

    /* 월간 달력 촘촘하게 (7열 그대로 화면에 맞춤) */
    .calendar th, .calendar td { padding: 3px 2px; }
    .calendar td { height: 58px; }
    .calendar .daynum { font-size: 12px; }
    .calendar .note { font-size: 9px; margin-top: 2px; line-height: 1.25; }

    /* 달력 네비게이션 한 줄로 정렬 */
    .cal-nav { width: 100%; justify-content: space-between; }
    .cal-nav .month-label { min-width: auto; font-size: 16px; }
    .cal-nav .btn { padding: 8px 10px; }

    /* 모달을 하단 시트 형태로 */
    .modal-backdrop { align-items: flex-end; }
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;   /* 화면 넘치면 시트 내부 스크롤 */
        border-radius: 16px 16px 0 0;
        padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
    }
    .field input, .field select { padding: 11px 12px; font-size: 16px; } /* iOS 확대 방지: 16px */
    .dayoff-options label { padding: 8px 11px; }
    .modal-actions .btn { flex: 1; justify-content: center; padding: 11px; }

    /* 페이지 헤더: 제목과 '추가' 버튼을 세로로 쌓고 버튼은 폭 꽉 채워 누르기 쉽게 */
    .page-head { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
    .page-head > div { min-width: 0; }
    .page-head > .btn { width: 100%; justify-content: center; padding: 11px; }
    /* 표 안 액션 버튼: 줄바꿈될 때 세로 간격 확보 */
    td .btn.small { margin: 2px 0; }
    /* 서브탭/세그먼트도 좁으면 가로 스크롤 */
    .subtabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .subtabs::-webkit-scrollbar { display: none; }
    .subtabs button { white-space: nowrap; }

    /* 월간 스케줄(관리): 모바일은 이름 나열 대신 시간대별 인원 수. 날짜를 누르면 상세(이름·편집) 모달 */
    .msched td { height: auto; min-height: 52px; padding: 3px 3px; }
    .msched .mday { margin-bottom: 4px; }
    .msched .mshift { display: flex; align-items: center; gap: 5px; font-size: 11px;
        padding-left: 5px; margin-bottom: 3px; line-height: 1.3; }
    .msched .mshift .shlab { margin-right: auto; }
    .msched .mshift .shnames { display: none; }
    .msched .mshift .shcount { display: inline-flex; align-items: center; justify-content: center;
        min-width: 20px; height: 17px; padding: 0 5px; border-radius: 9px;
        background: #eef1f4; font-weight: 700; font-size: 11px; color: #4b5563; }
}
