@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css");
:root {
  --ink: #24325a; --ink2: #34457a; --bg: #f1f4f9; --panel: #fff; --line: #e3e6ea; --line2: #cfd4db;
  --text: #111827; --muted: #6b7280; --accent: #3b82f6; --danger: #dc2626; --ok: #16a34a;
  --side-w: 220px; --side-w-min: 56px; --cardh:#e7ecf4;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 13px/1.5 "Pretendard", "Malgun Gothic", "Segoe UI", sans-serif; color: var(--text); background: var(--panel); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- 공통 버튼/입력 ---------- */
.btn { height: 30px; padding: 0 14px; border: 1px solid var(--line2); background: #fff; border-radius: 8px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: #f4f5f7; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink2); }
.btn.danger { color: var(--danger); border-color: #fca5a5; }
.btn.danger:hover { background: #fef2f2; }
.btn:disabled { opacity: .5; cursor: default; }
.inp { height: 26px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: #fff; min-width: 0; }
.inp:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(36,50,90,.08); }
.inp[readonly] { background: #f1f3f6; }
.inp::placeholder { color: #9ca3af; }

/* ---------- 로그인 ---------- */
.login-body { min-height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #34457a 0%, #24325a 55%, #1a2545 100%); }
.login-card { width: 380px; max-width: 92vw; background: #fff; border-radius: 16px; padding: 36px 34px 30px; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.login-card p.sub { margin: 0 0 26px; color: var(--muted); }
.login-card label { display: block; font-weight: 700; margin: 14px 0 5px; font-size: 12px; color: #374151; }
.login-card .inp { width: 100%; height: 42px; font-size: 14px; }
.login-card label.saveid { display: flex; align-items: center; gap: 6px; margin: 14px 0 0; font-weight: 500; cursor: pointer; }
.login-card label.saveid input { width: 15px; height: 15px; margin: 0; cursor: pointer; }
.login-card .btn.primary { width: 100%; height: 44px; margin-top: 22px; font-size: 14px; }
.login-err { min-height: 18px; margin-top: 12px; color: var(--danger); font-size: 12px; }

/* ---------- 셸 ---------- */
.shell { height: 100%; display: flex; flex-direction: column; }
.topbar { height: 52px; flex: none; background: var(--ink); color: #fff; display: flex; align-items: center; padding: 0 18px; gap: 16px; }
.topbar .burger, .topbar .icbtn { background: none; border: 0; color: #fff; padding: 7px; border-radius: 6px; display: flex; }
.topbar .burger:hover, .topbar .icbtn:hover { background: var(--ink2); }
.topbar .logo { font-weight: 800; letter-spacing: .18em; font-size: 15px; }
.topbar .title { font-size: 13px; font-weight: 600; color: #b6c2e2; padding-left: 16px; border-left: 1px solid #3d4f84; }
.topbar .sp { flex: 1; }
.topbar .icons { display: flex; gap: 2px; }
.topbar .greet { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-right: 4px; }
.topbar .greet b { color: var(--accent); }
.topbar .greet svg.i { width: 20px; height: 20px; }

.main { flex: 1; display: flex; min-height: 0; }

/* 사이드 메뉴 */
.side { width: var(--side-w); flex: none; background: #fff; border-right: 1px solid var(--line); transition: width .18s; overflow: hidden; }
.side .menu-head { padding: 16px 16px 10px; }
.side .menu-head span { display: block; background: var(--ink); color: #fff; text-align: center; font-weight: 700; font-size: 14px; border-radius: 24px; padding: 11px 0; white-space: nowrap; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side .items { padding: 6px 0; }
.items a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px 0 18px; margin: 2px 10px; border-radius: 8px; color: #374151; text-decoration: none; white-space: nowrap; cursor: pointer; }
.items a:hover { background: #f3f5f8; }
.items a.on { background: var(--ink); color: #fff; font-weight: 700; }
.items a.on:hover { background: var(--ink2); }
.items .dash { display: none; }
.items .ic { display: inline-flex; width: 18px; height: 18px; flex: none; }

.collapsed .side { width: var(--side-w-min); }
.collapsed .side .menu-head span { visibility: hidden; height: 0; padding: 0; }
.collapsed .items { padding: 0; }
.collapsed .items a { justify-content: center; padding: 0; margin: 4px 6px; height: 40px; }
.collapsed .items .dash, .collapsed .items .t { display: none; }
.collapsed .items .ic { display: inline-flex; }

/* 탭 + 작업 영역 */
.work { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); padding: 0 18px 18px; }
.tabs { height: 50px; flex: none; display: flex; align-items: flex-end; gap: 4px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 16px; border: 1px solid var(--line2); border-bottom: 0; border-radius: 10px 10px 0 0; background: #fff; color: #4b5563; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab .x { border: 0; background: none; color: inherit; opacity: .55; font-size: 16px; line-height: 1; padding: 0 2px; }
.tab .x:hover { opacity: 1; color: var(--danger); }
.tab.on .x:hover { color: #fca5a5; }
.frames { flex: 1; position: relative; min-height: 0; background: #fff; border: 1px solid var(--line2); border-radius: 0 12px 12px 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(36,50,90,.04), 0 4px 14px rgba(36,50,90,.04); }
.frames:empty { display: none; }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; background: #fff; }
.frames iframe.on { display: block; }

/* ---------- 프로젝트 관리 페이지 (iframe 내부) ---------- */
body.page { display: flex; flex-direction: column; height: 100%; padding: 22px 24px 0; overflow: hidden; }
.ph { display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); flex: none; }
.ph h2::before { content: ""; display: inline-block; width: 4px; height: 18px; margin-right: 10px; vertical-align: -2px; border-radius: 2px; background: var(--accent); }
.ph h2 { margin: 0; font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.ph small { color: var(--muted); }
.ph .sp { flex: 1; }
.search { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 16px 0; border-bottom: 1px solid var(--line); flex: none; }
.search .f { display: flex; align-items: center; gap: 8px; }
.search .lb { font-weight: 700; white-space: nowrap; }
.search .w { width: 160px; }
.search .s { width: 100px; }
.search .sp { flex: 1; }
.grid-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(36,50,90,.04), 0 4px 14px rgba(36,50,90,.04); }
.gh-wrap { flex: none; overflow: hidden; background: #eaeff8; }
.gb-wrap { flex: 1; min-height: 0; overflow: auto; }
table.grid { border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.grid th, .grid td { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid td.ct { text-align: center; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.chip.ing { background: #ecfdf5; color: #047857; }
.chip.done { background: #f3f4f6; color: #6b7280; }
.grid th { position: sticky; top: 0; z-index: 1; background: #eaeff8; color: var(--ink); border-bottom: 1px solid var(--line2); padding: 11px 14px; text-align: left; font-weight: 700; cursor: pointer; user-select: none; }
.grid th.nosort { cursor: default; }
.grid th { white-space: nowrap; overflow-wrap: normal; }
.grid th .ar { background: transparent; color: #2563eb; margin-left: 5px; font-size: 10px; }
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.grid td.code { font-weight: 700; color: var(--ink); }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:nth-child(even) td { background: #f8fafd; }
.grid tbody tr:hover td { background: #eaf1fe; }
.grid td.empty { text-align: center; color: var(--muted); padding: 50px; cursor: default; }
.grid td.empty:hover { background: none; }
.foot { display: flex; align-items: center; gap: 6px; height: 62px; flex: none; }
.foot .info { margin-right: auto; color: #374151; }
.foot .info b { color: var(--ink); font-size: 15px; margin-left: 4px; }
.pager { display: flex; gap: 4px; }
.pager .btn { min-width: 34px; height: 34px; padding: 0 8px; }
.pager .btn.cur { background: var(--ink); border-color: var(--ink); color: #fff; }

/* 모달 */
.mask { position: fixed; inset: 0; background: rgba(36,50,90,.5); display: none; align-items: flex-start; justify-content: center; padding: 100px 12px; overflow: auto; z-index: 10; }
.mask.on { display: flex; }
.modal { width: 720px; max-width: 100%; background: #fff; border-radius: 14px; box-shadow: 0 20px 50px rgba(0,0,0,.3); overflow: hidden; }
.modal h2 { margin: 0; padding: 15px 20px; font-size: 15px; background: var(--cardh); color: var(--ink); border-bottom: 1px solid var(--line); }
.modal h2::before { content: ""; display: inline-block; width: 4px; height: 14px; margin-right: 9px; vertical-align: -2px; border-radius: 2px; background: var(--accent); }
.modal .body { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.modal .body .f { display: flex; flex-direction: column; gap: 5px; }
.modal .body .f.full { grid-column: 1 / -1; }
.modal .body label { font-size: 12px; font-weight: 700; color: #374151; }
.modal .body .inp { width: 100%; }
.modal .row { display: flex; gap: 6px; }
.modal .req { color: var(--danger); }
.modal .inp.err { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220,38,38,.12); }
.mask.tall { padding-top: 30px; padding-bottom: 30px; }
.modal.wide { width: 1300px; }
.modal .mcols { display: flex; align-items: flex-start; }
.modal .mcols > .body { flex: 0 0 720px; max-width: 720px; box-sizing: border-box; }
.modal .mh-side { flex: 1; min-width: 0; padding: 20px 20px 20px 0; }
.modal .mh-side .f { display: flex; flex-direction: column; gap: 5px; }
.modal .mh-side label { font-size: 12px; font-weight: 700; color: #374151; }
.modal .mh-side .inp { width: 100%; }
@media (max-width: 1330px) { .modal .mcols { flex-direction: column; } .modal .mcols > .body { flex: none; max-width: none; width: 100%; } .modal .mh-side { padding: 0 20px 20px; width: 100%; box-sizing: border-box; } }
.mh-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbfd; }
.mh-box .mh-sel, .mh-box .mh-add { display: flex; gap: 6px; }
.mh-box .mh-sel { margin-bottom: 6px; }
.mh-box .mh-sel .inp { flex: 1; }
.mh-box .mh-add .inp { width: auto; }
.mh-box .mh-add #mDay { flex: 1; text-align: right; }
.mh-tbl { margin-top: 10px; max-height: 176px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.mh-tbl table.grid { width: 100%; }
.mh-tbl .grid th { padding: 8px 10px; cursor: default; text-align: center; }
.mh-tbl .grid td { padding: 7px 10px; text-align: center; cursor: default; }
.mh-tbl .grid td.num { text-align: right; }
.mh-tbl .grid td.empty { padding: 22px; }
.mh-tbl .x { border: 0; background: none; color: var(--danger); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.mh-tot { text-align: right; margin-top: 8px; font-weight: 700; color: var(--ink); }
.mh-tot b { color: var(--accent); }
.modal .foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--cardh); margin: 0; }
.modal .foot .sp { flex: 1; }
.msg { font-size: 12px; margin-top: 2px; }
.msg.ok { color: var(--ok); } .msg.err { color: var(--danger); }
.toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 6px; display: none; z-index: 20; }
@media (max-width: 640px) { .modal .body { grid-template-columns: 1fr; } .topbar .title { display: none; } }

/* 업무등록 - 프로젝트 찾기 팝업 (상위 창으로 옮겨져 공통 스타일 필요) */
table.wl { width: 100%; border-collapse: collapse; font-size: 12px; }
table.wl th { background: #eaeff8; color: var(--ink); border-bottom: 1px solid var(--line2); padding: 9px 10px; text-align: left; font-weight: 700; white-space: nowrap; }
table.wl td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.wl tbody tr { cursor: pointer; }
table.wl tbody tr:nth-child(even) td { background: #f8fafd; }
table.wl tbody tr:hover td { background: #eaf1fe; }
table.wl td.empty { text-align: center; color: var(--muted); padding: 36px; cursor: default; }
.pj-search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; padding: 14px 6px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex: none; }
.pj-search .inp { width: 140px; }
.pj-search #pjKey { text-transform: uppercase; }
.pj-search .lb { font-weight: 700; white-space: nowrap; }
.pj-search .lb + .inp { margin-right: 10px; }
.pj-search .btn { margin-left: auto; min-width: 80px; }
.pj-h { background: #eaeff8; flex: none; border-bottom: 1px solid var(--line2); }
.pj-h .grid th { border-bottom: 0; }
.pj-b { flex: 1; min-height: 0; overflow-y: auto; }
.pj-modal { height: 670px; max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.pj-modal .body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.pj-list { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
