:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #eff6ff;
  --green: #16a34a;
  --green-light: #dcfce7;
  --orange: #ea580c;
  --orange-light: #ffedd5;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --red: #dc2626;
  --red-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.15);
  --radius: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* 글씨 크게 모드 — 화면 전체를 20% 확대(zoom). 레이아웃·폰트크기 규칙을 전부 다시 쓰지
   않고도 내용은 그대로 유지한 채 글씨·아이콘·여백을 비례로 키운다(고령 직원 접근성 요청).
   position:fixed 요소(topbar·모달·toast)도 zoom 기준으로 함께 스케일되어 어긋나지 않음. */
html.font-big { zoom: 1.2; }

/* ===== 로딩 ===== */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; background: var(--gray-100); color: var(--gray-500);
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--gray-200); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 로그인 화면 ===== */
.auth-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.auth-logo-img { display: block; max-width: 240px; width: 70%; height: auto; margin: 4px auto 10px; }
.auth-logo { font-size: 20px; font-weight: 700; text-align: center; color: var(--gray-900); }
.auth-sub { text-align: center; color: var(--gray-500); font-size: 13px; margin: 6px 0 22px; }
.auth-tabs { display: flex; background: var(--gray-100); border-radius: 8px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 6px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--gray-500);
}
.auth-tab.active { background: #fff; color: var(--blue); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gray-600); }
.auth-form input {
  padding: 11px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 15px;
}
.auth-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.auth-error { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }
.auth-footer { color: rgba(255,255,255,.85); font-size: 13px; }
.code-box {
  width: 46px; height: 56px; font-size: 24px; font-weight: 700; text-align: center;
  border: 2px solid var(--gray-300); border-radius: 10px; outline: none;
  color: var(--gray-900); transition: border-color .15s;
}
.code-box:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }

/* ===== 버튼 ===== */
.btn-primary {
  background: var(--blue); color: #fff; border: none; padding: 12px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost {
  background: transparent; border: 1px solid var(--gray-300); color: var(--gray-600);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-danger { background: var(--red); color: #fff; border: none; padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary:disabled, .btn-ghost:disabled { opacity: .4; cursor: default; pointer-events: none; }
.icon-btn {
  background: #fff; border: 1px solid var(--gray-300); width: 34px; height: 34px;
  border-radius: 8px; cursor: pointer; font-size: 20px; color: var(--gray-600); line-height: 1;
}
.icon-btn:hover { background: var(--gray-100); }
.icon-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
.icon-btn.fontsize-btn { width: auto; padding: 0 9px; font-size: 14px; font-weight: 800; white-space: nowrap; flex-shrink: 0; }
.icon-btn.fontsize-btn.active { background: var(--blue-light); border-color: var(--blue); color: var(--blue-dark); }

/* ===== 홈 화면 추가 안내 배너 ===== */
.install-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eff6ff; border-bottom: 1px solid #bfdbfe;
  padding: 10px 16px; font-size: 13px; color: #1e40af; line-height: 1.5;
}
.install-banner span { flex: 1; min-width: 160px; }
.install-add-btn {
  background: #2563eb; color: #fff; border: none; border-radius: 8px;
  padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.install-x-btn {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: #64748b; padding: 2px 4px; line-height: 1; flex-shrink: 0;
}

/* ===== 상단바 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: #fff; padding: 10px 20px; border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50; flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 8px; }
.brand-logo { height: 28px; width: auto; }
.brand { font-size: 18px; font-weight: 700; color: var(--gray-900); }
.month-nav { display: flex; align-items: center; gap: 8px; }
.current-month { font-size: 17px; font-weight: 700; min-width: 120px; text-align: center; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
/* 월 이동 버튼 바로 오른쪽에 붙는 접속자 이름 — topbar-right(글씨크게·새로고침·설정·로그아웃)
   과 분리해 그쪽이 덜 복잡해 보이게 함(사용자 요청 2026-07-08). */
.user-name { font-size: 14px; font-weight: 600; color: var(--gray-600); margin-left: 4px; white-space: nowrap; }
/* 글씨 크게/작게 — 가＋/가－ 두 버튼을 가로로 붙여서 하나의 컨트롤처럼 보이게(2026-07-08). */
.fontsize-group { display: flex; gap: 2px; flex-shrink: 0; }

/* ===== 탭바 ===== */
.tabbar {
  display: flex; gap: 4px; background: #fff; padding: 0 12px;
  border-bottom: 1px solid var(--gray-200); overflow-x: auto;
  position: sticky; top: 55px; z-index: 40;
}
.tab-btn {
  position: relative;
  border: none; background: transparent; padding: 12px 14px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--gray-500);
  border-bottom: 3px solid transparent; white-space: nowrap;
}
.tab-btn:hover { color: var(--gray-800); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
/* 새 내용(N) 배지 — 외부에서 새 공지/송영이 들어오면 표시 */
.tab-btn.has-new::after {
  content: "N"; position: absolute; top: 5px; right: 2px;
  min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
  background: #e53935; color: #fff; font-size: 10px; font-weight: 800;
  line-height: 15px; text-align: center;
}

/* ===== 콘텐츠 ===== */
.content { max-width: 1100px; margin: 0 auto; padding: 20px; }
.view-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.view-title { font-size: 19px; font-weight: 700; }
.view-desc { color: var(--gray-500); font-size: 13px; margin-top: 2px; }

/* ===== 카드 / 리스트 ===== */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.empty { text-align: center; color: var(--gray-400); padding: 40px 20px; font-size: 14px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.list-item-main { flex: 1; min-width: 0; }
.list-item-title { font-weight: 600; }
.list-item-sub { color: var(--gray-500); font-size: 13px; margin-top: 2px; }
.list-item-actions { display: flex; gap: 6px; }
/* 액션 버튼/드롭다운은 절대 글자단위로 줄바꿈되지 않도록 — 컨테이너가 좁아서 flex-shrink 로
   눌리면 "삭제"→"삭\n제"처럼 세로로 쪼개짐(2026-07-01 발견). 안 들어가면 그 줄만 가로스크롤. */
.list-item-actions button, .list-item-actions select { white-space: nowrap; flex-shrink: 0; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

/* ===== 달력 ===== */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--gray-200); border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.cal-head { background: var(--gray-50); padding: 10px 0; text-align: center; font-weight: 700; font-size: 13px; color: var(--gray-600); }
.cal-head.sun { color: var(--red); }
.cal-head.sat { color: var(--blue); }
.cal-cell { background: #fff; min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; transition: background .1s; min-width: 0; overflow: hidden; }
.cal-cell:hover { background: var(--blue-light); }
.cal-cell.other-month { background: var(--gray-50); }
.cal-cell.other-month .cal-date { color: var(--gray-300); }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--blue); }
.cal-date { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.cal-date.sun { color: var(--red); }
.cal-date.sat { color: var(--blue); }
.cal-event { font-size: 11px; padding: 2px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.round { background: var(--blue-light); color: var(--blue-dark); }
.cal-event.leave { background: var(--purple-light); color: var(--purple); }
.cal-event.task { background: var(--green-light); color: var(--green); }
.cal-more { font-size: 11px; color: var(--gray-400); padding-left: 4px; }

/* ===== 모달 ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 100;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 460px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--gray-200); }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-400); line-height: 1; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; justify-content: flex-end; }
.modal-body label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--gray-600); }
.modal-body input, .modal-body select, .modal-body textarea {
  padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 15px; font-family: inherit; width: 100%;
}
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.modal-body textarea { resize: vertical; min-height: 70px; }
.form-row { display: flex; gap: 10px; }
.form-row > label { flex: 1; }

/* 날짜별 상세 모달 항목 */
.day-section { margin-bottom: 16px; }
.day-section-title { font-size: 13px; font-weight: 700; color: var(--gray-500); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.day-event-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--gray-50); margin-bottom: 6px; font-size: 13px; }
.day-event-item .ev-main { flex: 1; }

/* ===== 토스트 ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--gray-900); color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 200;
  animation: toast-in .2s ease;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ===== 도구 모음 ===== */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-input { padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; min-width: 180px; }
.filter-select { padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: 8px; font-size: 14px; background: #fff; }

/* ===== 반응형 ===== */
@media (max-width: 720px) {
  .content { padding: 12px; }
  .cal-cell { min-height: 70px; }
  .cal-event { font-size: 10px; }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 16px; }
  .current-month { font-size: 15px; min-width: 90px; }
  .topbar-left { display: none; }
  /* 좁은 화면에서 .list-item-main(이름 등)이 .list-item-actions(드롭다운·버튼)에
     밀려 폭이 거의 0이 되면, 한글은 띄어쓰기가 없어 글자가 세로로 한 자씩 줄바꿈된다
     (2026-07-01 발견 — 직원 목록 "강\n미\n숙" 현상). 좁을 땐 위아래로 쌓아 이름이
     항상 전체 폭을 쓰게 한다. */
  .list-item { flex-direction: column; align-items: stretch; }
  .list-item-actions { flex-wrap: wrap; }
}

/* ===== 송영(주간보호) 보기 ===== */
.sy-wrap { display: flex; flex-direction: column; gap: 14px; }
.sy-day { border: 1px solid var(--gray-200); border-radius: 12px; overflow: hidden; background: #fff; }
.sy-day-hdr { background: var(--gray-50); font-weight: 700; padding: 9px 13px; font-size: 15px; color: var(--gray-800); }
.sy-veh { padding: 9px 13px; border-top: 1px solid var(--gray-100); }
.sy-veh:first-of-type { border-top: none; }
.sy-veh-hdr { font-weight: 600; font-size: 14px; color: var(--gray-700); margin-bottom: 5px; }
.sy-staff { font-weight: 400; color: var(--gray-400); font-size: 13px; }
.sy-slot { font-size: 14px; line-height: 2.0; margin-left: 2px; }
.sy-am, .sy-pm { font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 7px; margin-right: 7px; }
.sy-am { background: #dbeafe; color: #1d4ed8; }
.sy-pm { background: #dcfce7; color: #15803d; }
.sy-person { white-space: nowrap; margin-right: 4px; }
.sy-time { color: var(--gray-400); font-size: 12px; margin-left: 1px; }
/* 내 송영/전체 토글 + 날짜 이동 */
.sy-toggle { display: flex; gap: 8px; margin: 4px 0 14px; }
.sy-tab {
  flex: 1; padding: 10px; border: 1px solid var(--gray-200); background: #fff;
  border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--gray-500); cursor: pointer;
}
.sy-tab.active { background: var(--blue, #2563eb); border-color: var(--blue, #2563eb); color: #fff; }
.sy-datenav { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 14px; }
.sy-date { font-size: 16px; font-weight: 700; min-width: 180px; text-align: center; }
.sy-note { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }

/* ===== 송영 편집 모드(관리자) — 길게 눌러 이동 + 시간수정 + 저장/동기화 ===== */
.sy-tab.sy-edit-tab.active { background: var(--orange, #ea580c); border-color: var(--orange, #ea580c); }
.sy-editbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -6px 0 14px; padding: 8px 10px;
  background: var(--orange-light); border: 1px solid #fed7aa; border-radius: 10px; }
.sy-editstatus { font-size: 12.5px; color: var(--gray-600); font-weight: 600; margin-right: auto; }
.sy-slot-empty { border: 1px dashed var(--gray-300); border-radius: 8px; padding: 2px 6px; }
.sy-drop-hint { font-size: 12px; color: var(--gray-400); font-style: italic; }
.sy-drop-hover { background: #dbeafe !important; outline: 2px dashed var(--blue); outline-offset: -1px; }
/* 이동 가능한 이름칩 — 길게 누르면 이동, 짧게 탭하면 시간수정(둘 다 편집모드 전용) */
.sy-person[data-aid] { cursor: pointer; border-radius: 6px; padding: 1px 3px; }
.sy-person.sy-draggable { border-bottom: 2px dotted var(--blue); }
.sy-drag-source { opacity: .35; }
.sy-drag-ghost {
  position: fixed; transform: translate(-50%, -140%); pointer-events: none; z-index: 999;
  background: var(--blue); color: #fff; padding: 7px 14px; border-radius: 10px;
  font-size: 15px; font-weight: 700; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.3);
}

/* ===== 근무표(개인 월 근무일정) ===== */
.sch-summary { font-size: 14px; color: var(--gray-700); margin: 4px 0 12px; }
.sch-summary b { color: var(--gray-900); }
.sch-grid-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.sch-grid-head > div { text-align: center; font-size: 12px; font-weight: 700; color: var(--gray-500); }
.sch-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sch-cell { min-height: 52px; border-radius: 8px; padding: 4px; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; background: #fff; border: 1px solid var(--gray-200); }
.sch-cell.sch-empty { background: transparent; border: none; }
.sch-d { font-size: 12px; font-weight: 600; color: var(--gray-700); align-self: flex-start; }
.sch-d.sch-sun { color: #d33; } .sch-d.sch-sat { color: #2563eb; }
.sch-lbl { font-size: 12px; font-weight: 700; }
.sch-work { background: #e7f6ec; border-color: #b7e3c5; } .sch-work .sch-lbl { color: #15803d; }
.sch-off  { background: #f1f1f3; border-color: #e0e0e4; } .sch-off  .sch-lbl { color: #888; }
.sch-leave{ background: #f3e8ff; border-color: #e0c8f5; } .sch-leave .sch-lbl { color: #7e22ce; }
.sch-none { background: #fafafa; border-style: dashed; }
.sch-legend { margin-top: 12px; display: flex; gap: 8px; }
.sch-legend .lg { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 7px; }
.lg-work { background: #e7f6ec; color: #15803d; } .lg-off { background: #f1f1f3; color: #888; }
.lg-leave { background: #f3e8ff; color: #7e22ce; }

/* 목욕 — 다중선택 체크박스 박스 */
.chk-box { max-height: 200px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 6px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; background: #fff; }
.chk-item { display: flex; flex-direction: row; align-items: center; gap: 4px; font-weight: 400;
  font-size: 13px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.chk-item:hover { background: var(--gray-50, #f7f7f8); }
.chk-item input { width: auto; flex-shrink: 0; }
