/* 근태관리시스템 스타일 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e3e8f0;
  --text: #1c2430;
  --sub: #64748b;
  --accent: #2b5cd9;
  --accent-soft: #e8effc;
  --ok: #15803d;
  --ok-soft: #e6f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --err: #b91c1c;
  --err-soft: #fdecec;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Pretendard", "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 레이아웃 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0;
  background: #1a2437; color: #cdd6e4;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo {
  padding: 20px 18px 14px; color: #fff;
  font-size: 17px; font-weight: 700; letter-spacing: -.3px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .logo small { display: block; font-size: 11px; font-weight: 400; color: #8fa2bd; margin-top: 2px; }
.sidebar nav { padding: 10px 0 20px; flex: 1; }
.sidebar .nav-section { font-size: 11px; color: #7d8ba1; padding: 14px 18px 4px; letter-spacing: .5px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 18px; color: #c3cede; font-size: 13.5px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar nav a.active { background: var(--accent); color: #fff; }
.sidebar nav a .ico { width: 17px; text-align: center; }
.sidebar .badge-mini {
  margin-left: auto; background: #ef4444; color: #fff; border-radius: 99px;
  font-size: 10.5px; padding: 0 6px; line-height: 16px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 22px; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16.5px; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--sub); font-size: 13px; }
.topbar .who b { color: var(--text); }
.bell { position: relative; font-size: 18px; color: var(--sub); }
.bell .cnt {
  position: absolute; top: -6px; right: -9px; background: #ef4444; color: #fff;
  font-size: 10px; border-radius: 99px; padding: 0 5px; line-height: 15px; font-weight: 700;
}
.content { padding: 22px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* 모바일 메뉴 버튼(햄버거) — 기본 숨김, 모바일에서만 표시 */
.menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text); padding: 4px 6px; margin-left: -4px;
}
.nav-overlay { display: none; }

/* ── 카드/그리드 */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 .more { margin-left: auto; font-size: 12.5px; font-weight: 400; }
.grid { display: grid; gap: 16px; margin-bottom: 18px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid .card { margin-bottom: 0; }
@media (max-width: 1000px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .sidebar { width: 190px; }
}

/* 스탯 */
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .num { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.stat .num small { font-size: 13px; font-weight: 500; color: var(--sub); }
.stat .lbl { color: var(--sub); font-size: 12.5px; }

/* ── 테이블 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; color: var(--sub); font-weight: 600; font-size: 12.5px;
  padding: 8px 10px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
  background: #fafbfd;
}
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #f8fafd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .c { text-align: center; }
.tbl-scroll { overflow-x: auto; }
.tbl .dim td { color: #9aa6b5; }
.tbl .off td { background: #fbfcfe; color: #9aa6b5; }
.tbl .today td { background: var(--accent-soft); }

/* ── 상태 라벨 */
.pill {
  display: inline-block; padding: 1.5px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.in { background: var(--ok-soft); color: var(--ok); }
.pill.done { background: #e8eaef; color: #4a5568; }
.pill.leave { background: var(--warn-soft); color: var(--warn); }
.pill.out { background: #e7f0fb; color: #1d5aa8; }
.pill.none { background: var(--err-soft); color: var(--err); }
.pill.off { background: #f1f3f7; color: #8b97a7; }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.gray { background: #eef0f4; color: #5a6676; }
.pill.red { background: var(--err-soft); color: var(--err); }
.pill.green { background: var(--ok-soft); color: var(--ok); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }

/* ── 버튼/폼 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { background: #f5f7fb; }
.btn.danger { background: var(--err); }
.btn.ok { background: var(--ok); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  border: 1px solid #cbd4e1; border-radius: 8px; padding: 7px 10px;
  background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--sub); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }

/* ── 플래시 */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--err-soft); color: var(--err); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }

/* ── 기타 */
.muted { color: var(--sub); font-size: 12.5px; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.right { text-align: right; }
.flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.flex .spacer { flex: 1; }
.warn-box { background: var(--warn-soft); border: 1px solid #f3ddb8; border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.err-text { color: var(--err); }
.ok-text { color: var(--ok); }
.kbd { background: #eef1f6; border-radius: 5px; padding: 1px 6px; font-size: 12px; }

.progress { background: #edf0f5; border-radius: 99px; height: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; }
.progress.over > div { background: var(--err); }

/* 알림 드롭다운 */
.notif-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { font-weight: 600; }
.notif-item .time { color: var(--sub); font-size: 11.5px; font-weight: 400; }

/* 로그인 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #1a2437 0%, #24406e 100%);
}
.login-box {
  background: #fff; border-radius: 16px; padding: 36px 34px; width: 360px;
  box-shadow: 0 24px 60px rgba(10, 20, 40, .35);
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box .sub { color: var(--sub); font-size: 13px; margin-bottom: 22px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box input { padding: 11px 12px; }
.login-box .btn { justify-content: center; padding: 11px; font-size: 14.5px; }

/* 결재 도장 표시 */
.appr-line { display: flex; gap: 0; border: 1.5px solid var(--text); width: fit-content; }
.appr-line .cell { border-right: 1px solid var(--text); text-align: center; }
.appr-line .cell:last-child { border-right: none; }
.appr-line .cell .t { font-size: 11px; border-bottom: 1px solid var(--text); padding: 2px 14px; background: #f7f8fa; }
.appr-line .cell .v { min-height: 48px; min-width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; gap: 1px; }

/* 전자결재 도장 */
.estamp {
  display: inline-block; border: 1.5px solid #1d4ed8; color: #1d4ed8;
  border-radius: 4px; padding: 0 6px; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; line-height: 16px; white-space: nowrap;
}
.estamp-date { font-size: 9.5px; color: #1d4ed8; }
@media print {
  .estamp, .estamp-date { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ── 모바일(휴대폰) 반응형 */
@media (max-width: 760px) {
  .menu-btn { display: inline-flex; align-items: center; }
  .layout { display: block; }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; width: 250px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-overlay.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
  .main { min-height: 100vh; }
  .topbar { padding: 0 10px; gap: 8px; height: 52px; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .who { display: none; }               /* 좁은 화면에서 역할 텍스트 숨김 */
  .content { padding: 12px; }
  .card { padding: 14px; margin-bottom: 14px; }
  /* 넓은 표는 표 자체를 가로 스크롤(페이지 전체가 밀리지 않도록). 셀은 줄바꿈 안 함 → 글자 단위로 깨지지 않음 */
  table.tbl { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .form-row { gap: 8px; }
  .form-row > * { flex: 1 1 auto; min-width: 0; }
  /* iOS 입력 시 자동 확대 방지 + 터치 타깃 확대 */
  input, select, textarea { font-size: 16px; padding: 9px 11px; }
  .btn { padding: 9px 15px; }
  .btn.sm { padding: 6px 11px; font-size: 13px; }
  .login-box { width: min(360px, 92vw); padding: 28px 22px; }
  .print-page { width: auto; padding: 16px; }
}

/* ── 인쇄 서식 */
.print-page {
  background: #fff; width: 720px; margin: 20px auto; padding: 48px 56px;
  border: 1px solid var(--line);
  font-family: "Batang", "바탕", "Malgun Gothic", serif; color: #000;
}
.print-page h1 { text-align: center; font-size: 26px; letter-spacing: 12px; margin: 8px 0 22px; }
.print-page table.form { width: 100%; border-collapse: collapse; font-size: 13px; }
.print-page table.form th, .print-page table.form td { border: 1px solid #000; padding: 8px 10px; }
.print-page table.form th { background: #f2f2f2; font-weight: 600; text-align: center; white-space: nowrap; }
.print-actions { text-align: center; margin: 16px; }
/* 일괄 인쇄 — 서식마다 새 페이지 */
.pf-sheet { page-break-after: always; }
.pf-sheet:last-child { page-break-after: auto; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .print-actions, .flash { display: none !important; }
  .print-page { border: none; margin: 0; width: auto; padding: 10mm 8mm; }
  .content { padding: 0; }
  .pf-sheet { break-after: page; page-break-after: always; }
  .pf-sheet:last-child { break-after: auto; page-break-after: auto; }
}

/* ── 월별 근태 달력 (개인별 현황) */
.cal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cal-nav { display: flex; gap: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.cal-legend .lg { font-size: 12px; color: var(--sub); margin-right: 2px; }
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 720px; }
table.cal th { padding: 6px; text-align: center; font-size: 13px; border: 1px solid var(--line); background: #f7f9fc; font-weight: 600; }
table.cal th.sun, table.cal .sun { color: var(--err); }
table.cal th.sat, table.cal .sat { color: var(--accent); }
.cal-cell { border: 1px solid var(--line); vertical-align: top; height: 98px; padding: 4px 5px; overflow: hidden; }
.cal-cell.empty { background: #fafbfd; }
.cal-daynum { font-weight: 600; font-size: 13px; margin-bottom: 3px; display: flex; justify-content: space-between; align-items: baseline; gap: 4px; }
.cal-holi { font-size: 10.5px; color: var(--err); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-badges { display: flex; flex-direction: column; gap: 2px; }
.cal-badges .pill { font-size: 10.5px; padding: 1px 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; box-sizing: border-box; }
.cal-work { font-size: 10.5px; color: #5a6676; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-note { font-size: 11px; }
/* 셀 배경 — 예외(휴가/출장/휴일/미기록)만 눈에 띄게, 평상 근무는 중립 */
.cal-cell.cc-off { background: #f1f3f7; }
.cal-cell.cc-holiday-work { background: #eef1f6; }
.cal-cell.cc-leave { background: var(--warn-soft); }
.cal-cell.cc-leave-part { background: #fff8ec; }
.cal-cell.cc-trip { background: #e7f0fb; }
.cal-cell.cc-absent { background: var(--err-soft); }
.cal-cell.cc-work, .cal-cell.cc-future { background: #fff; }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 선택적 근로시간제 적용일 — 보라색 왼쪽 띠(배경색과 겹치지 않게 inset) */
.cal-cell.flexday { box-shadow: inset 5px 0 0 #7c3aed; }
.cal-flex { font-size: 10px; color: #6d28d9; background: #ede9fe; border-radius: 4px; padding: 0 5px; font-weight: 600; }
.pill.violet { background: #ede9fe; color: #6d28d9; }
@media (max-width: 720px) {
  .cal-cell { height: 84px; }
  .cal-badges .pill { font-size: 10px; }
}
@media print {
  .cal-nav, .cal-legend { display: none !important; }
  table.cal { min-width: 0; }
  .cal-cell { height: auto; min-height: 70px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
