/* PSEP 4 — 한 파일, 가벼운 스타일. 글꼴: 페이퍼로지(Paperlogy). /fonts 에 파일이 없으면 시스템 글꼴로 보인다. */
@font-face { font-family: "Paperlogy"; font-weight: 400; font-display: swap; src: local("Paperlogy 4 Regular"), local("Paperlogy"), url("/fonts/Paperlogy-4Regular.woff2") format("woff2"); }
@font-face { font-family: "Paperlogy"; font-weight: 600; font-display: swap; src: local("Paperlogy 6 SemiBold"), url("/fonts/Paperlogy-6SemiBold.woff2") format("woff2"); }

:root {
  --bg: #f4f5f7; --surface: #fff; --line: #dfe3e8; --text: #1b2330; --mute: #5f6b7a;
  --brand: #17456b; --brand-ink: #fff; --accent: #0f766e; --danger: #a8322a;
  --ok-bg: #e2f3ec; --ok: #14633f; --warn-bg: #fdf0d5; --warn: #7a5200; --bad-bg: #fbe6e3; --bad: #94281f;
  --info-bg: #e4eef8; --info: #17456b; --radius: 10px; --focus: 0 0 0 3px rgba(23, 69, 107, .35);
  font-family: "Paperlogy", "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.35rem; font-weight: 600; }
h2 { font-size: 1rem; font-weight: 600; }
h3 { font-size: .95rem; margin-top: 8px; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.boot, .mute { color: var(--mute); }
.boot { padding: 40px; text-align: center; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
#app { height: 100%; }

/* 틀 */
.layout { display: grid; grid-template-columns: 216px 1fr; height: 100%; }
.side { background: var(--brand); color: var(--brand-ink); display: flex; flex-direction: column; padding: 16px 10px; gap: 14px; }
.brand { font-size: 1.3rem; font-weight: 600; letter-spacing: .06em; text-decoration: none; padding: 4px 10px; display: flex; flex-direction: column; }
.brand small { font-size: .72rem; font-weight: 400; opacity: .75; letter-spacing: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: inherit; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.nav-item.on { background: rgba(255, 255, 255, .18); opacity: 1; font-weight: 600; }
.nav-icon { width: 20px; text-align: center; }
.nav-label { flex: 1; }
.badge { background: #ffd166; color: #3b2a00; border-radius: 99px; font-size: .72rem; font-weight: 600; padding: 1px 7px; min-width: 20px; text-align: center; }
.who { border-top: 1px solid rgba(255, 255, 255, .2); padding: 12px 8px 0; font-size: .85rem; }
.who-name { font-weight: 600; }
.who-sub { opacity: .75; font-size: .78rem; }
.who-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.main { overflow: auto; padding: 22px 26px 40px; min-width: 0; outline: none; }
.main.fill { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 14px; }
.main.fill > .tab-body { flex: 1; display: flex; flex-direction: column; min-height: 0; }
body.win .main { max-width: 980px; margin: 0 auto; height: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .actions, .card-actions, .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions { margin-top: 12px; }
.section { margin: 20px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.tab-body { padding-top: 12px; }

/* 단추·입력 */
.btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; min-height: 38px; white-space: nowrap; }
.btn:hover { border-color: #b9c1cc; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: inherit; text-decoration: underline; padding: 4px 6px; min-height: 0; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .86rem; }
.btn.block { width: 100%; }
.btn.hidden { visibility: hidden; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { font: inherit; border: 0; background: transparent; color: inherit; cursor: pointer; width: 32px; height: 32px; border-radius: 6px; }
.icon-btn:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }
.icon-btn:disabled { opacity: .3; }
.input { font: inherit; width: 100%; border: 1px solid #b9c1cc; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text); min-height: 38px; }
.input.area { resize: vertical; line-height: 1.6; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: .86rem; font-weight: 600; }
.hint { font-size: .8rem; color: var(--mute); }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-msg { color: var(--bad); min-height: 1.3em; font-size: .9rem; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filters { display: flex; gap: 8px; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.filters .input { width: auto; flex: 0 1 190px; }
.filters .input[type=search] { flex: 1 1 220px; }
.list-info { margin-left: auto; color: var(--mute); font-size: .86rem; }

/* 탭·칩 */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--mute); white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.chip { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: .78rem; background: #eceff3; color: var(--mute); margin-right: 4px; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }

/* 카드 */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card, .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card h2 { color: var(--mute); font-weight: 400; font-size: .9rem; }
.card .big { font-size: 1.7rem; font-weight: 600; margin: 4px 0; }
.card.small .big { font-size: 1.3rem; }
.cards .wide { grid-column: 1 / -1; }
.sheet { max-width: 900px; margin-bottom: 14px; }

/* 가상 스크롤 목록 */
.list-wrap { flex: 1; min-height: 240px; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.vlist { height: 100%; overflow: auto; position: relative; }
.vlist-spacer { position: relative; }
.vrow { position: absolute; top: 0; left: 0; right: 0; }
.list-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.list-overlay > * { pointer-events: auto; }
.row { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid #eef0f3; cursor: pointer; }
.row:hover, .row:focus-visible { background: #f3f7fb; }
.row-main { flex: 1; min-width: 0; }
.row-title, .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--mute); font-size: .82rem; }
.row.unread .row-title { font-weight: 600; }
.row.unread::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--info-bg); color: var(--info); display: grid; place-items: center; font-weight: 600; flex: none; }
.grid-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1.5fr; cursor: default; }
.grid-row.mute { color: var(--mute); }

/* 표 */
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table caption { text-align: left; padding: 8px 2px; color: var(--mute); font-size: .86rem; }
.table th, .table td { padding: 8px 12px; border-bottom: 1px solid #eef0f3; text-align: left; vertical-align: middle; }
.table thead th { font-size: .82rem; color: var(--mute); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table tbody th { font-weight: 400; white-space: nowrap; }
.table tr.off th, .table tr.off td { background: #fbf6f4; }
.table tr.off th { color: #9a4a2f; }
.table tr.today th { font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.pager, .month-nav { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 12px 0; }
.today-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; flex-wrap: wrap; }

/* 문서 */
.meta { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 12px 0 0; }
.meta dt { color: var(--mute); font-size: .86rem; } .meta dd { margin: 0; overflow-wrap: anywhere; }
.doc-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.steps, .lines, .files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step, .line, .files li, .sens-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; }
.step-main, .line-name, .files li > div:first-child, .sens-row > div:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.step-side { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.step.pending { border-color: #e2b84d; background: #fffaf0; }
.kind { font: inherit; font-size: .8rem; font-weight: 600; border: 1px solid var(--line); background: var(--info-bg); color: var(--info); border-radius: 6px; padding: 2px 8px; min-width: 44px; text-align: center; }
button.kind { cursor: pointer; }
.line.agree .kind { background: var(--warn-bg); color: var(--warn); } .line.ref .kind { background: #eceff3; color: var(--mute); }
.comment { color: var(--mute); font-size: .88rem; white-space: pre-wrap; }
.line-editor { display: flex; flex-direction: column; gap: 8px; }
.picker { position: relative; }
.picker-menu { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); max-height: 280px; overflow: auto; }
.picker-menu li { padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.picker-menu li[data-i]:hover, .picker-menu li:focus { background: var(--info-bg); outline: none; }
.preview { font-weight: 600; color: var(--accent); min-height: 1.5em; } .preview.bad { color: var(--bad); }
.notice { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 8px 12px; font-size: .88rem; margin-bottom: 10px; }
.masked { font-variant-numeric: tabular-nums; color: var(--mute); } .masked.revealed { color: var(--text); font-weight: 600; background: #fff7d6; padding: 0 4px; border-radius: 4px; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; background: #f3f5f8; border-radius: 8px; padding: 12px; text-align: center; margin: 10px 0; user-select: all; }
.upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; } .upload .input { width: auto; flex: 1 1 160px; }
.consent details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; } .consent summary { cursor: pointer; font-weight: 600; }

/* 대화창·옆 패널·알림·상태 */
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); color: var(--text); }
.dialog.wide { width: min(640px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(20, 28, 40, .45); }
.dialog-head, .panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dialog-body { padding: 18px; max-height: 70vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0, 0, 0, .12); z-index: 30; display: flex; flex-direction: column; }
.panel-body { padding: 16px 18px; overflow: auto; flex: 1; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(440px, calc(100vw - 24px)); }
.toast { background: #1b2330; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast.error { background: var(--bad); } .toast.ok { background: var(--ok); }
.state { padding: 36px 16px; text-align: center; color: var(--mute); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.state.error { color: var(--bad); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* 로그인 */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #17456b, #0f2d47); }
.login-card { background: #fff; border-radius: 14px; padding: 30px 28px; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.login-title { font-size: 1.9rem; letter-spacing: .08em; color: var(--brand); text-align: center; } .login-title.small { font-size: 1.3rem; letter-spacing: 0; }
.login-sub { text-align: center; color: var(--mute); font-size: .84rem; margin: 4px 0 20px; }

/* 좁은 화면(폰): 메뉴는 아래 띠 */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .side { order: 2; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); gap: 0; }
  .brand, .who { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-item { flex-direction: column; gap: 0; padding: 6px 8px; font-size: .72rem; position: relative; }
  .nav-item .badge { position: absolute; top: 2px; right: 0; }
  .main { padding: 14px 12px 24px; }
  .grid2 { grid-template-columns: 1fr; }
  .filters .input { flex: 1 1 30%; min-width: 0; } .filters .input[type=search] { flex: 1 1 100%; }
  .grid-row { grid-template-columns: 2fr 1fr 1fr 1fr; } .grid-row > :last-child { display: none; }
  .row-sub { font-size: .78rem; }
}
@media print { .side, .page-head .actions, #toasts { display: none; } .layout { display: block; } .main { overflow: visible; } }

/* 4.1 — 덧붙임(참조·첨부·이력) */
.extra { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.extra .files, .extra .upload { width: 100%; }
.files li.seen { background: #f3f7fb; border-color: #b9cfe6; }
.ref-results { min-height: 180px; max-height: 50vh; overflow: auto; }
.history { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.history summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }

/* 4.3 — 인사기록 */
.rec-head { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.rec-head h3 { margin: 0; }
.rec-top { display: flex; gap: 14px; align-items: flex-start; }
.photo { width: 84px; height: 108px; flex: none; border: 1px solid var(--line); border-radius: 6px; background: #f3f5f8; color: var(--mute); font-size: .74rem; display: grid; place-items: center; text-align: center; overflow: hidden; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.table.compact th, .table.compact td { padding: 5px 8px; font-size: .88rem; }
.table.compact td .input { min-height: 32px; padding: 4px 6px; min-width: 90px; }
