* { box-sizing: border-box; }
html, body {
  /* 페이지 전체가 좌우로 스크롤되는 것은 막고, 표처럼 필요한 곳만 .table-scroll/.wh-scroll-wrap으로 개별 스크롤되게 합니다. */
  overflow-x: hidden;
  max-width: 100%;
}
body {
  font-family: "맑은 고딕", "Malgun Gothic", -apple-system, sans-serif;
  color: #222;
  margin: 0;
  background: #f5f6f8;
}
.topnav {
  background: #17324a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 1000;
}
/* 1행: 병원명(좌측)/알림(우측). 2행: 메뉴 항목들. 두 행 모두 같은 폭으로 가운데 정렬됩니다. */
.topnav-row {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  gap: 18px;
  align-items: center;
}
.topnav-row-title { justify-content: space-between; padding-bottom: 6px; }
.topnav-row-menu { flex-wrap: wrap; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.08); }
.topnav a { color: #cfe0ee; text-decoration: none; font-size: 14px; }
.topnav a:hover { color: #fff; }
.brand { font-weight: 500; font-size: 13px; color: #9db6c9; letter-spacing: 0.2px; }
.version-tag { color: #5c7185; font-size: 11px; }
.nav-push-btn {
  background: transparent; border: 1px solid #3c5568; color: #cfe0ee; border-radius: 12px;
  padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.nav-push-btn:hover { color: #fff; border-color: #6a8aa3; }
.nav-push-btn.on { background: #2c6e49; border-color: #2c6e49; color: #fff; }
.nav-push-btn:disabled { opacity: 0.5; cursor: default; }

/* 계약서 미리보기 상단 액션 바 — 메인 네비바 바로 아래에 붙여서 스크롤해도 계속 보이게 */
.contract-action-bar {
  position: sticky; top: 78px; z-index: 999; /* 상단 네비가 2행이 되면서 높이가 늘어난 만큼 조정 */
  background: #f5f6f8; margin: 0 -16px 16px; padding: 12px 16px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  border-bottom: 1px solid #dde3e8; box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.print-action-bar {
  position: sticky; top: 0; z-index: 999;
  background: #f5f6f8; text-align: center; padding: 14px;
  border-bottom: 1px solid #dde3e8; box-shadow: 0 2px 6px rgba(0,0,0,.05);
}

.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  background: none; border: none; color: #cfe0ee; font-size: 14px; cursor: pointer; padding: 0; font-family: inherit;
}
.nav-dropdown-btn:hover { color: #fff; }
.nav-dropdown-menu {
  display: none; position: absolute; top: 28px; left: 0; background: #fff; border: 1px solid #d5dde3;
  border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.15); min-width: 180px; z-index: 1001; overflow: hidden;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a {
  display: block; padding: 10px 14px; color: #17324a !important; font-size: 14px; white-space: nowrap;
}
.nav-dropdown-menu a:hover { background: #eef2f6; }
.container { max-width: 920px; margin: 24px auto; padding: 0 16px 60px; }

h1, h2, h3 { color: #17324a; }
table { border-collapse: collapse; width: 100%; margin: 10px 0; }
table.list-table th, table.list-table td, .party-table td, .sig-table td, table.cred-table td, table.cred-table th, table.wage-table td, table.wage-table th {
  border: 1px solid #ccc;
  padding: 8px 10px;
  font-size: 14px;
}
table.list-table th, table.cred-table th, table.wage-table th { background: #eef2f6; }
table.list-table td:not(.amount) { text-align: center; }

/* 좁은 화면(모바일/태블릿)에서 칸이 부족하면 글자가 세로로 한 글자씩 쪼개져 보이는 문제 방지.
   표 자체를 가로 스크롤 가능한 블록으로 바꿔서, 칸이 억지로 눌리는 대신 옆으로 스크롤되게
   합니다 (요일 근로시간표에 이미 쓰던 .wh-scroll-wrap과 같은 접근을 표에 직접 적용). */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 10px 0;
}
.table-scroll table { margin: 0; }
/* 데이터 칸은 억지로 눌려서 한글이 세로로 쪼개지지 않도록 줄바꿈을 막고, 대신 표 전체가
   옆으로 스크롤되게 합니다. 마지막 칸(버튼들)은 그대로 둬서 좁은 화면에서 버튼이 세로로
   쌓이는 지금 모습을 유지합니다 — 그쪽은 이미 자연스럽게 보입니다. */
.table-scroll table.list-table th:not(:last-child), .table-scroll table.list-table td:not(:last-child),
.table-scroll table.cred-table th:not(:last-child), .table-scroll table.cred-table td:not(:last-child),
.table-scroll table.submission-table th:not(:last-child), .table-scroll table.submission-table td:not(:last-child) {
  white-space: nowrap;
}

.card { background: #fff; border: 1px solid #dde3e8; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 6px; border: none;
  background: #17324a; color: #fff; cursor: pointer; text-decoration: none; font-size: 14px;
  white-space: nowrap; /* 좁은 표 칸 안에서 버튼 글자가 한 글자씩 세로로 쪼개지는 것 방지 */
}
.btn.secondary { background: #6c7a89; }
.btn.danger { background: #b0413e; }
input, select, textarea {
  padding: 7px 10px; border: 1px solid #ccd3d9; border-radius: 5px; font-size: 14px; width: 100%; max-width: 360px;
}
textarea { max-width: none; }
label { display: block; margin: 10px 0 4px; font-weight: bold; font-size: 13px; color: #444; }
.flash { background: #fff3cd; border: 1px solid #ffe08a; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash.warn-banner { background: #fdeceb; border-color: #f0b8b4; color: #8a2f2b; font-weight: bold; }
.warn { color: #b0413e; font-size: 13px; margin: 4px 0; }
.hint { color: #667; font-size: 12px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.link-row { display: flex; gap: 8px; align-items: center; max-width: 520px; }
.link-row .link-display { max-width: none; flex: 1; background: #f5f7f9; color: #333; }
.submission-table td, .submission-table th { padding: 8px 10px; }
.badge { display: inline-block; background: #b0413e; color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 11px; margin-left: 6px; }
.file-preview img { max-width: 100%; max-height: 480px; border: 1px solid #dde3e8; border-radius: 6px; }
.compare-table td { vertical-align: top; }
.compare-table .old-value { color: #888; }
/* 이번에 실제로 교체될 항목(제출된 값이 있는 항목)에만 취소선을 긋습니다.
   전에는 모든 "기존 값" 칸에 무조건 취소선이 그어져서, 제출을 안 한
   항목까지 마치 삭제되는 것처럼 보이는 문제가 있었습니다. */
.compare-table .old-value.will-replace { text-decoration: line-through; }
.compare-table .new-value { color: #17324a; font-weight: bold; }
.compare-table .new-value.no-submit { color: #999; font-weight: normal; }

/* ---- 계약서 본문 ---- */
.contract-page {
  background: #fff; max-width: 760px; margin: 0 auto; padding: 40px 48px;
  font-size: 14px; line-height: 1.7; box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.contract-page h2 { text-align: center; margin-bottom: 24px; }
.contract-page h3 { margin-top: 22px; margin-bottom: 6px; font-size: 15.5px; }
.contract-page p { margin: 4px 0; }
.contract-page .note, .contract-page .rule-note { color: #666; font-style: italic; font-size: 13px; }
/* 계약서 본문 폭(760px)에 맞춰서, 그 바로 옆에 붙는 카드(특약사항 등)도 같은 폭으로 정렬 */
.card.contract-width { max-width: 760px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
.party-table { margin: 10px 0 16px; width: 100%; table-layout: fixed; }
.party-table td:first-child { background: #f2f2f2; font-weight: bold; width: 150px; white-space: nowrap; padding-right: 12px; }
.party-label-rowspan { text-align: center; vertical-align: middle; }
.party-stamp { height: 40px; vertical-align: middle; margin: 0 4px; }
.salary-box { background: #f7f9fb; border: 1px solid #dbe3ea; border-radius: 6px; padding: 14px 18px; margin: 14px 0; }
.salary-title { font-weight: bold; margin-bottom: 8px; }
.salary-table td:first-child { width: 220px; color: #444; }
.net-row td { font-weight: bold; background: #eef4ea; }

.sig-date { margin-top: 30px; text-align: center; }
.sig-table { margin-top: 16px; }
.sig-label { width: 110px; background: #f2f2f2; font-weight: bold; text-align: center; }
.sig-cell { position: relative; height: 70px; vertical-align: middle; }
.sig-img { height: 60px; margin-left: 14px; vertical-align: middle; }
.sig-blank { color: #999; margin-left: 14px; }
.sig-footer { text-align: center; font-weight: bold; margin-top: 18px; }

/* ---- 서명 캡처 화면 ---- */
.sign-wrap { max-width: 760px; margin: 0 auto; }
.sign-pad-box { background: #fff; border: 2px dashed #9aa7b0; border-radius: 8px; margin-top: 16px; }
#sigPad { width: 100%; height: 220px; touch-action: none; display: block; }
.sign-actions { display: flex; gap: 10px; margin-top: 12px; }
.contract-scroll { max-height: 45vh; overflow-y: auto; border: 1px solid #dde3e8; border-radius: 8px; padding: 0; }
.contract-scroll .contract-page { box-shadow: none; padding: 24px 28px; }

@media print {
  body { background: #fff; }
  .topnav, .no-print { display: none !important; }
  .contract-page { box-shadow: none; padding: 0; max-width: none; }
  .container { margin: 0; max-width: none; padding: 0; }
}

/* ---- 근로시간표 (읽기용, 직원 화면/관리자 화면 공통) ---- */
.wh-summary-row { display: flex; gap: 24px; margin: 10px 0 16px; flex-wrap: wrap; }
.wh-stat { background: #eef4ea; border-radius: 8px; padding: 10px 18px; text-align: center; min-width: 120px; }
.wh-stat.wh-stat-ot { background: #fdf3e2; }
.wh-stat.wh-stat-total { background: #e3edf5; border: 1px solid #b9cfe0; }
.wh-stat-num { display: block; font-size: 22px; font-weight: bold; color: #17324a; }
.wh-stat-label { display: block; font-size: 12px; color: #667; margin-top: 2px; }
.wh-grid { border-collapse: collapse; width: 100%; table-layout: fixed; margin-bottom: 8px; }
.wh-grid th, .wh-grid td { border: 1px solid #d5dde3; text-align: center; padding: 10px 4px; font-size: 14px; vertical-align: top; }
.wh-grid th { background: #eef2f6; font-weight: bold; }
.wh-grid td.wh-off, .wh-grid th.wh-off { background: #f7f7f7; color: #aaa; }
.wh-time { font-weight: bold; font-size: 15px; }
.wh-ot { font-size: 12px; color: #a06a00; margin-top: 2px; }
.wh-break { font-size: 12px; color: #667; margin-top: 2px; }
.wh-note { font-size: 11px; color: #888; margin-top: 4px; }

/* ---- 근로시간표 (편집용 그리드) ---- */
.wh-edit-grid { border-collapse: collapse; width: 100%; margin: 14px 0; }
.wh-edit-grid th, .wh-edit-grid td { border: 1px solid #d5dde3; padding: 8px 6px; text-align: center; font-size: 13px; }
.wh-edit-grid th { background: #eef2f6; }
.wh-edit-grid td.wh-label-col { text-align: left; font-weight: bold; background: #fafbfc; white-space: nowrap; }
.wh-edit-grid input[type="time"], .wh-edit-grid input[type="number"], .wh-edit-grid input[type="text"] {
  width: 100%; max-width: none; padding: 5px 4px; font-size: 13px;
}
.wh-edit-grid input[type="checkbox"] { width: 20px; height: 20px; }
.wh-edit-grid td.wh-day-off input:not([type="checkbox"]) { background: #f2f2f2; color: #bbb; }

/* 표 안에서 바로 읽기/수정 전환되는 셀 (연도별 최저임금, 근속연수 등) */
input.inline-edit[readonly] { border: none; background: transparent; color: #222; padding: 4px 2px; }
input.inline-edit:not([readonly]) { border: 1px solid #17324a; background: #fffbe8; }
input.align-center { text-align: center; }
input.align-right { text-align: right; }
.wage-table input[type="number"], .wage-table input[type="text"] { width: 100%; box-sizing: border-box; }

/* 요일 7개짜리 표는 태블릿 세로모드 등 좁은 화면에서 넘칠 수 있어서, 표 자체 폭은
   유지하고 바깥 박스만 가로 스크롤 되게 감쌉니다 (레이아웃 깨짐 대신 옆으로 스와이프). */
.wh-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0; border-radius: 6px; }
.wh-scroll-wrap .wh-edit-grid, .wh-scroll-wrap .wh-grid { min-width: 640px; margin: 0; }

/* on/off 슬라이드 토글 스위치 (체크박스 그대로 두고 보이는 모양만 바꿈) */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; vertical-align: middle; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #ccc; border-radius: 26px; transition: background-color .15s;
}
.switch .slider::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background-color: #fff; border-radius: 50%; transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background-color: #17324a; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch-row { display: flex; align-items: center; gap: 10px; }

/* ---- 시장 급여 시세 막대그래프 ---- */
.mw-bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mw-bar-label { width: 220px; font-size: 12.5px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mw-bar-track { flex: 1; background: #eef2f6; border-radius: 4px; height: 18px; overflow: hidden; }
.mw-bar-fill { background: #17324a; height: 100%; border-radius: 4px; }
.mw-bar-value { width: 90px; text-align: right; font-size: 12.5px; font-weight: bold; flex-shrink: 0; }

/* ---- 급여 상세 내역 (근로시간/지급/최저임금체크/공제) ---- */
.pb-block { margin-bottom: 18px; }
.pb-heading { font-weight: bold; color: #17324a; margin-bottom: 6px; font-size: 14px; }
.pb-table { width: 100%; border-collapse: collapse; }
.pb-table td, .pb-table th { border: 1px solid #dde3e8; padding: 7px 10px; font-size: 13.5px; }
.pb-table th { background: #eef2f6; text-align: center; }
.pb-table td:first-child { color: #444; width: 45%; }
.pb-table tr.pb-sub-row td { background: #f7f9fb; font-weight: bold; }
.pb-table tr.pb-total-row td { background: #eef4ea; font-weight: bold; }
.pb-warn { color: #b0413e; font-size: 12.5px; margin: 4px 0; }
.pb-minwage { padding: 10px 14px; border-radius: 6px; font-size: 14px; }
.pb-minwage.pb-ok { background: #eef4ea; color: #2b5d34; }
.pb-minwage.pb-fail { background: #fdeceb; color: #8a2f2b; }
.pb-net { background: #eef4ea; border-radius: 8px; padding: 14px 18px; text-align: center; }
.pb-net .pb-heading { text-align: center; }
.pb-net-amount { font-size: 24px; font-weight: bold; color: #17324a; margin: 0; }
.amount { text-align: right; font-variant-numeric: tabular-nums; }
input.money-input { text-align: right; }
.pb-explainer { background: #fdf3e2; border: 1px solid #f0d9a8; border-radius: 8px; padding: 10px 16px; margin-bottom: 16px; font-size: 13.5px; }
.pb-explainer summary { cursor: pointer; font-weight: bold; color: #8a5a00; }
.pb-explainer ul { margin: 10px 0 4px; padding-left: 20px; }
.pb-explainer li { margin-bottom: 8px; line-height: 1.5; color: #444; }

/* 계약서에서 사람/조건마다 달라지는 값(채워 넣는 부분)을 한눈에 띄게 표시 */
.fill { color: #b8551b; font-weight: bold; text-decoration: underline; text-decoration-color: #e0a978; text-underline-offset: 3px; }
.fill-missing { color: #b0413e; font-weight: bold; }
.fill-missing a { color: #b0413e; }
.pb-calc-table { width: 100%; border-collapse: collapse; }
.pb-calc-table td { border: 1px solid #dde3e8; padding: 7px 10px; font-size: 13px; vertical-align: middle; }
.pb-calc-table .pb-lb { width: 28px; text-align: center; font-weight: bold; color: #8a5a00; background: #fdf3e2; }
.pb-calc-table td:nth-child(2) { width: 185px; color: #444; white-space: nowrap; }
.pb-calc-table .pb-formula { color: #667; font-size: 12.5px; }
.pb-calc-table tr.pb-sub-row td { background: #f7f9fb; }
.pb-calc-table tr.pb-total-row td { background: #eef4ea; font-weight: bold; }
.pb-unit { font-size: 11px; font-weight: normal; color: #889; }
