/* ============ 근태·스케줄 통합 관리 ============ */
:root{
  --bg:#f2f5f9; --panel:#ffffff; --line:#d9e0ea; --line2:#e8edf4;
  --ink:#1c2733; --sub:#5d6b7c; --brand:#2456a6; --brand-d:#173d7a;
  --sat:#eaf2fd; --sun:#fdecec; --hol:#fdecec; --acc:#f4f8ee;
  --radius:10px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
[hidden]{display:none !important}
body{
  background:var(--bg); color:var(--ink);
  font-family:"Pretendard","Malgun Gothic","맑은 고딕",system-ui,-apple-system,sans-serif;
  font-size:14px; line-height:1.45;
}
b{font-weight:700}

/* ---------- 상단바 ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  background:linear-gradient(90deg,var(--brand-d),var(--brand));
  color:#fff; padding:10px 18px; position:sticky; top:0; z-index:50;
}
.brand{font-size:17px; font-weight:800; letter-spacing:-.2px}
.brand .org{font-size:13px; font-weight:500; opacity:.85; margin-left:10px}
.top-actions{display:flex; align-items:center; gap:8px}
.badge{background:rgba(255,255,255,.16); border:1px solid rgba(255,255,255,.35); padding:3px 10px; border-radius:20px; font-size:12.5px; font-weight:700}
.lockbtn{background:rgba(255,255,255,.14); color:#fff; border:1px solid rgba(255,255,255,.4)}
.lockbtn:hover{background:rgba(255,255,255,.26)}
.lockbtn.unlocked{background:#ffb64d; color:#4a2d00; border-color:#ffb64d; font-weight:800}

/* 연도 조정 */
.yearctl{display:inline-flex; align-items:center; gap:3px; padding:2px 6px}
.ybtn{border:0; background:transparent; color:#fff; opacity:.7; cursor:pointer; font-size:11px; padding:2px 5px; border-radius:5px; line-height:1}
.ybtn:hover{opacity:1; background:rgba(255,255,255,.2)}
#yearBadge{min-width:46px; text-align:center; display:inline-block}

/* 저장 버튼 */
.savebtn{background:rgba(255,255,255,.14); color:#fff; border:1px solid rgba(255,255,255,.4)}
.savebtn:hover{background:rgba(255,255,255,.26)}
@keyframes savePulse{
  0%,100%{background:#ffb64d; box-shadow:0 0 0 0 rgba(255,182,77,.65)}
  50%{background:#ffd591; box-shadow:0 0 0 9px rgba(255,182,77,0)}
}
.savebtn.blink{
  background:#ffb64d; color:#4a2d00; border-color:#ffb64d; font-weight:800;
  animation:savePulse 1.1s ease-in-out infinite;
}

/* ---------- 탭 ---------- */
.tabbar{
  display:flex; gap:4px; padding:8px 14px; overflow-x:auto;
  background:#fff; border-bottom:1px solid var(--line); position:sticky; top:48px; z-index:40;
}
.tab{
  border:1px solid var(--line); background:#f7f9fc; color:var(--sub);
  padding:6px 13px; border-radius:8px; cursor:pointer; font-size:13.5px; font-weight:600; white-space:nowrap;
}
.tab:hover{background:#eef3fa; color:var(--brand)}
.tab.on{background:var(--brand); border-color:var(--brand); color:#fff}

/* ---------- 공통 ---------- */
main{padding:14px}
.panel{background:var(--panel); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 1px 3px rgba(16,36,66,.05); margin-bottom:14px; overflow:hidden}
.panel.pad{padding:14px 16px}
.panel h2{font-size:15px; margin:2px 0 12px; letter-spacing:-.2px}
.panel h2 .dim{font-size:12px; font-weight:500}
.sheet-title{font-size:16px; font-weight:800; padding:12px 16px 2px; letter-spacing:-.2px}
.sub-title{font-size:13.5px; font-weight:700; padding:12px 16px 6px; color:var(--sub)}
.dim{color:var(--sub); font-weight:400}
.dim2{color:#c3ccd7}
.note{color:var(--sub); font-size:12px; padding:8px 16px 12px; margin:0}
.note p{margin:2px 0}
.hint{color:var(--sub); font-size:12px; margin-left:auto}
.sep{width:1px; height:22px; background:var(--line); display:inline-block}

.btn{
  border:1px solid var(--line); background:#fff; color:var(--ink);
  padding:6px 12px; border-radius:8px; cursor:pointer; font-size:13px; font-weight:600;
}
.btn:hover{border-color:var(--brand); color:var(--brand); background:#f4f8ff}
.btn.primary{background:var(--brand); border-color:var(--brand); color:#fff}
.btn.primary:hover{background:var(--brand-d)}
.btn.danger{color:#c02626}
.btn.danger:hover{background:#fdf0f0; border-color:#c02626}
.btn.tiny{padding:3px 9px; font-size:12px}
.btn:disabled{opacity:.45; cursor:not-allowed}

.in{
  border:1px solid var(--line); border-radius:7px; padding:5px 8px; font-size:13px;
  font-family:inherit; color:var(--ink); background:#fff;
}
/* 숫자 입력 스피너 제거 */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{-webkit-appearance:none; margin:0}
input[type="number"]{-moz-appearance:textfield; appearance:textfield}
.in:focus{outline:2px solid #bcd2f0; border-color:var(--brand)}
.in:disabled{background:#f2f4f7; color:#7c8797}
.in.wide{width:260px}
.in.num3{width:64px; text-align:center}
.in.num4{width:84px; text-align:center}
.in.num5{width:76px; text-align:center}
.in.numyn{width:56px}
.in.cellnum{width:66px; text-align:center}
.in.b{font-weight:700}
.in.holidays{width:100%; max-width:560px; font-family:Consolas,monospace; font-size:12.5px}

.toolbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:var(--panel); border:1px solid var(--line); border-radius:var(--radius);
  padding:10px 14px; margin-bottom:12px;
}
.toolbar label{display:flex; align-items:center; gap:6px; font-weight:600; font-size:13px; color:var(--sub)}
.formrow{display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:8px}
.formrow label{display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; color:var(--sub)}

/* ---------- 표 ---------- */
.table-wrap{overflow:auto; max-height:66vh; border-top:1px solid var(--line2)}
.table-wrap.tall{max-height:62vh}
table.grid{border-collapse:separate; border-spacing:0; width:max-content; min-width:100%; font-size:12.5px}
.grid th,.grid td{
  border-right:1px solid var(--line2); border-bottom:1px solid var(--line2);
  padding:3px 5px; text-align:center; background:#fff; white-space:nowrap;
}
.grid thead th{
  background:#f2f6fb; font-weight:700; color:#3c4a5d; position:sticky; z-index:5;
  top:0; height:30px;
}
.grid thead tr:nth-child(2) th{top:30px}
.grid thead th.grp{background:#e8eef7; letter-spacing:2px}
.grid thead th.sum{min-width:44px; font-size:11.5px; line-height:1.25}
.grid thead th.acc{background:#e7f0dd}
.grid td.sum{font-weight:600; min-width:44px}
.grid td.acc{background:var(--acc); font-weight:800}
.grid td.lft{text-align:left}
.grid .trow td{background:#f4f7fb; font-weight:800; border-top:2px solid var(--line)}
.grid td.empty{padding:26px 14px; color:var(--sub); background:#fbfcfe}

/* 날짜 헤더 */
.grid th.dh{min-width:34px; font-weight:700}
.grid th.dh.sat{background:var(--sat); color:#1d4ed8}
.grid th.dh.sun,.grid th.dh.hd{background:var(--sun); color:#c02626}
.grid th.dh.today{outline:2px solid var(--brand); outline-offset:-2px}
.grid th.dow{font-size:11px; font-weight:600}

/* 고정 열 */
.grid .sc{position:sticky; z-index:6; background:#f7f9fc}
.grid thead .sc{z-index:8}
.grid .sc1{left:0; min-width:46px; width:46px}
.grid .sc2{left:46px; min-width:60px; width:60px}
.grid .sc3{left:106px; min-width:118px; width:118px}
.grid .sc1w{left:0; min-width:52px}
.grid .sc2w{left:52px; min-width:96px; font-size:11.5px}
.grid td.sc{background:#fbfcfe}
.grid td.pos{font-size:12px; color:var(--sub); font-weight:600}
.rowno{font-weight:700}
.rowdel{
  border:0; background:transparent; color:#b7c0cc; cursor:pointer; font-size:13px;
  padding:0 2px; margin-left:3px; border-radius:4px; visibility:hidden;
}
tr:hover .rowdel{visibility:visible}
.rowdel:hover{color:#c02626; background:#fdeeee}
.empsel{width:110px; border:1px solid transparent; background:transparent; font-family:inherit; font-size:12.5px; font-weight:700; padding:3px 2px; border-radius:6px; cursor:pointer}
.empsel:hover,.empsel:focus{border-color:var(--line); background:#fff; outline:none}

/* 근무표 셀 */
td.cell{cursor:pointer; min-width:34px; height:27px; padding:1px 2px; font-weight:700}
td.cell:hover{outline:2px solid #9db9e4; outline-offset:-2px}
td.cell:focus{outline:2px solid var(--brand); outline-offset:-2px}
td.satc{background:var(--sat)}
td.sunc,td.hdc{background:var(--sun)}
.wkc{color:#1d4ed8}
.wkc.night{color:#6d28d9}
.chip{display:inline-block; min-width:26px; padding:1px 5px; border-radius:6px; font-size:11.5px; font-weight:800; line-height:1.5}
.k-do{background:#e8ebf0; color:#57636f}
.k-al{background:#ffedc7; color:#8f5f00}
.k-sd{background:#d8f2ea; color:#0b7a63}
.k-sde{background:#ecdffb; color:#6d28d9}
.k-ph{background:#fcdcdc; color:#c02626}
.k-warn{background:#ffe4ea; color:#bb2650}
.k-etc{background:#dfe9f8; color:#33547e}

/* 인원 집계 */
.grid.mini td.ct{min-width:34px}
.grid.mini td.zero{color:#ccd4de}

/* ---------- 코드 선택 팝오버 ---------- */
.picker{
  position:fixed; z-index:120; width:480px; max-width:calc(100vw - 16px);
  max-height:62vh; overflow:auto; background:#fff; border:1px solid var(--line);
  border-radius:12px; box-shadow:0 14px 40px rgba(15,35,70,.22); padding:10px;
}
.pk-head{display:flex; gap:10px; align-items:center; position:sticky; top:-10px; background:#fff; padding:10px 2px 8px; margin:-10px -2px 0; z-index:2}
.pk-head .in{flex:1}
.pk-paint{display:flex; gap:5px; align-items:center; font-size:12.5px; font-weight:700; color:var(--sub); white-space:nowrap; cursor:pointer}
.pk-sec{font-size:11.5px; font-weight:800; color:var(--sub); margin:10px 2px 5px; letter-spacing:.4px}
.pk-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(74px,1fr)); gap:4px}
.pchip{
  border:1px solid var(--line2); background:#fbfcfe; border-radius:8px; cursor:pointer;
  padding:4px 3px; display:flex; flex-direction:column; align-items:center; gap:1px; font-family:inherit;
}
.pchip b{font-size:12.5px}
.pchip i{font-style:normal; font-size:10px; color:var(--sub)}
.pchip:hover{border-color:var(--brand); background:#f0f6ff}
.pchip.wday b{color:#1d4ed8}
.pchip.wnight b{color:#6d28d9}
.pchip.k-do{background:#eef1f5}.pchip.k-al{background:#fff3d9}.pchip.k-sd{background:#e2f5ee}
.pchip.k-sde{background:#f1e8fc}.pchip.k-ph{background:#fde5e5}.pchip.k-warn{background:#ffeaef}.pchip.k-etc{background:#e9f0fa}
.pk-foot{display:flex; gap:8px; justify-content:flex-end; margin-top:10px; position:sticky; bottom:-10px; background:#fff; padding:8px 0 2px}

/* ---------- 브러시 바 ---------- */
.brushbar{
  position:fixed; left:50%; bottom:18px; transform:translateX(-50%); z-index:110;
  background:#243b5e; color:#fff; border-radius:24px; padding:8px 16px;
  box-shadow:0 8px 24px rgba(10,25,50,.35); font-size:13px; display:flex; align-items:center; gap:8px;
}
.brushbar .dim{color:#b9c8dd}
.brushbar .btn{background:rgba(255,255,255,.12); border-color:rgba(255,255,255,.35); color:#fff}

/* ---------- 기초정보(조회) ---------- */
.info-hero{background:linear-gradient(135deg,#f5f9ff,#eef3fb)}
.info-label{font-size:12px; font-weight:700; color:var(--sub); letter-spacing:.5px; margin-bottom:4px}
.info-org{font-size:26px; font-weight:800; letter-spacing:-.4px; color:var(--brand-d)}
.infochip{display:inline-flex; align-items:center; gap:6px; background:#f2f6fc; border:1px solid var(--line); border-radius:9px; padding:7px 14px; font-size:14px; font-weight:700}
.infochip i{font-style:normal; font-size:12px; font-weight:600; color:var(--sub)}
.statrow{display:flex; gap:12px; flex-wrap:wrap}
.stat{background:#f7f9fc; border:1px solid var(--line2); border-radius:10px; padding:10px 18px; min-width:120px; display:flex; flex-direction:column; gap:2px}
.stat b{font-size:19px; letter-spacing:-.3px}
.stat span{font-size:12px; color:var(--sub); font-weight:600}

/* ---------- 기준정보 ---------- */
.subtabbar{display:flex; gap:2px; margin:0 0 12px; border-bottom:2px solid var(--line); flex-wrap:wrap}
.subtab{
  border:0; background:transparent; padding:8px 15px; font-size:13.5px; font-weight:600;
  color:var(--sub); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-2px; font-family:inherit;
}
.subtab:hover{color:var(--brand)}
.subtab.on{color:var(--brand); border-bottom-color:var(--brand); font-weight:800}
.basehead{padding:10px 16px}
.lockmsg{font-size:13.5px}
.lockmsg.ok{color:#155724}
.deptlist{display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.deptchip{display:inline-flex; align-items:center; gap:2px; background:#f2f6fc; border:1px solid var(--line); border-radius:8px; padding:3px 6px}
.dept-in{width:110px; border:0; background:transparent; font-weight:700}
.chipdel{border:0; background:transparent; color:#93a1b3; font-size:14px; cursor:pointer; border-radius:4px; padding:0 4px}
.chipdel:hover{color:#c02626; background:#fdeeee}
.mvbtn{border:0; background:transparent; color:#9aa7b6; font-size:10px; cursor:pointer; border-radius:4px; padding:2px 3px; line-height:1}
.mvbtn:hover{color:var(--brand); background:#eef4ff}
td.rowops{white-space:nowrap}
.monthnav{display:inline-flex; align-items:center; gap:6px}
.monthlabel{min-width:96px; text-align:center; font-size:13.5px}
.pwform{display:flex; flex-direction:column; gap:10px; max-width:340px}
.pwform label{display:flex; flex-direction:column; gap:4px; font-size:13px; font-weight:600; color:var(--sub)}
.pwform .merr{margin:0}

/* 월 마감 */
.closegrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px}
.closecard{border:1px solid var(--line); border-radius:10px; padding:12px 14px; display:flex; flex-direction:column; gap:6px; background:#fbfcfe; align-items:flex-start}
.closecard.closed{background:#fdf3f3; border-color:#e9c8c8}
.cc-m{font-weight:800}
.cc-st{font-size:12.5px; color:var(--sub); font-weight:700}
.closecard.closed .cc-st{color:#c02626}
.closedbadge{display:inline-block; background:#fde3e3; color:#c02626; font-size:12px; font-weight:800; border-radius:6px; padding:2px 9px; vertical-align:2px; margin-left:8px}
.lockmn.on{background:#fdf0e4; border-color:#e2b184; color:#8a5a1d; font-weight:700}
th.chkcol{min-width:48px; background:#e8eef7 !important}
.onmark{color:#0b7a63; font-weight:800; font-size:14px}
.grid.form th,.grid.form td{padding:4px 6px}
.grid.form thead th{position:sticky; top:0}

/* 보고서 */
.grid.report td{min-width:52px; padding:5px 7px}
.grid.report td.lft{min-width:86px}

/* ---------- 모달/토스트 ---------- */
.mback{position:fixed; inset:0; background:rgba(18,30,48,.45); z-index:200; display:flex; align-items:center; justify-content:center; padding:16px}
.mbox{background:#fff; border-radius:14px; width:420px; max-width:100%; padding:18px 20px; box-shadow:0 18px 60px rgba(8,20,45,.35)}
.mtitle{font-size:15.5px; font-weight:800; margin-bottom:8px}
.mmsg{margin:4px 0 10px; color:#37424f; font-size:13.5px}
.merr{color:#c02626; font-size:12.5px; margin:6px 0 0}
.mbody .in.wide{width:100%}
.mact{display:flex; justify-content:flex-end; gap:8px; margin-top:14px}
.toast{
  position:fixed; left:50%; bottom:64px; transform:translateX(-50%); z-index:220;
  background:#1c2733; color:#fff; padding:9px 18px; border-radius:22px; font-size:13px;
  box-shadow:0 8px 24px rgba(10,25,50,.35);
}

/* ---------- 가이드 모달 ---------- */
.helpbtn{background:rgba(255,255,255,.14); color:#fff; border:1px solid rgba(255,255,255,.4); width:34px; padding:6px 0; font-weight:800}
.helpbtn:hover{background:rgba(255,255,255,.26)}
.mbox.wide{width:680px}
.guide{max-height:62vh; overflow:auto; font-size:13.5px; line-height:1.65; padding-right:6px}
.guide h3{font-size:13.5px; margin:14px 0 5px; color:var(--brand)}
.guide h3:first-child{margin-top:0}
.guide ul{margin:0; padding-left:18px}
.guide li{margin:3px 0}
.guide .k{display:inline-block; background:#eef2f8; border:1px solid var(--line); border-radius:5px; padding:0 6px; font-size:12px; font-weight:700}

/* ---------- 인쇄 ---------- */
@page{size:A4 landscape; margin:8mm}
@media print{
  .no-print{display:none !important}
  body{background:#fff; font-size:11px}
  main{padding:0; zoom:var(--print-zoom, 1)}
  .panel{border:0; box-shadow:none; margin:0}
  .table-wrap{max-height:none; overflow:visible; border:1px solid #bbb}
  .table-wrap.tall{max-height:none}
  tr{page-break-inside:avoid}
  .subtabbar{display:none !important}
  .grid th,.grid td{border-color:#c8ccd2}
  .grid thead th,.grid .sc{position:static}
  td.cell,.chip,.grid thead th,td.satc,td.sunc,td.hdc,.grid td.acc{
    -webkit-print-color-adjust:exact; print-color-adjust:exact;
  }
  .empsel{border:0; background:transparent; appearance:none}
  .rowdel{display:none}
}
