:root {
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --line: #e2e5ea;
    --primary: #1f5fbf;
    --primary-ink: #ffffff;
    --ok: #13795b;
    --ok-bg: #e5f4ee;
    --warn: #9a5b00;
    --warn-bg: #fff4e0;
    --err: #b42318;
    --err-bg: #fdecea;
    --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--primary); }

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
button:hover, .btn:hover { border-color: #c4c9d2; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { border-color: var(--primary); filter: brightness(1.07); }
.btn-danger { color: var(--err); }
.btn-block { width: 100%; padding: 14px; font-size: 16px; font-weight: 600; }

input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
}
textarea { width: 100%; resize: vertical; }

.alert { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.alert-err { background: var(--err-bg); color: var(--err); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-ok { background: var(--ok-bg); color: var(--ok); }

/* ---------- 직원 서명 화면 (모바일 우선) ---------- */
.m-wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 40px; }
.m-head { padding: 20px 4px 8px; }
.m-head .org { color: var(--muted); font-size: 13px; }
.m-head h1 { margin: 4px 0 0; font-size: 21px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-top: 14px; }
.card h2 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.step { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff;
        font-size: 13px; align-items: center; justify-content: center; flex: none; }
.subjects { width: 100%; border-collapse: collapse; font-size: 14px; }
.subjects th, .subjects td { border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: left; vertical-align: top; }
.subjects th { color: var(--muted); font-weight: 500; font-size: 13px; }
.subjects .law { display: block; color: var(--muted); font-size: 12px; }
.subjects .h { text-align: right; white-space: nowrap; }
.edu-links { display: grid; gap: 8px; margin: 4px 0 12px; }
.edu-links .btn { justify-content: space-between; padding: 12px 14px; background: #f1f5fc; border-color: #d6e0f2;
                  color: var(--primary); font-weight: 600; white-space: normal; text-align: left; }
.pledge { white-space: pre-wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 14px;
          max-height: 320px; overflow-y: auto; font-size: 14px; }
.agree { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px; border-radius: 8px;
         background: #f1f5fc; cursor: pointer; font-weight: 600; }
.agree input { width: 22px; height: 22px; margin: 0; flex: none; }
.sign-box { position: relative; border: 2px dashed #b9c0cc; border-radius: 8px; background: #fff; touch-action: none; }
.sign-box canvas { display: block; width: 100%; height: 200px; }
.sign-box .hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
                  color: #b0b6c0; pointer-events: none; font-size: 15px; }
.sign-tools { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 13px; }
.verify-input { width: 100%; font-size: 22px; letter-spacing: 6px; text-align: center; padding: 12px; margin: 8px 0 14px; }
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: flex;
             align-items: center; justify-content: center; font-size: 30px; margin: 6px auto 10px; }
.doc-links { display: grid; gap: 10px; margin-top: 16px; }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0;
           border-top: 1px solid var(--line); text-align: left; }
.doc-row:first-of-type { margin-top: 12px; }
.doc-title { font-weight: 700; }
.doc-title .small { display: block; font-weight: 400; }
.doc-btns { display: flex; gap: 8px; }
.doc-btns .btn { padding: 10px 14px; }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- 관리자 ---------- */
.a-top { background: #182234; color: #fff; padding: 0 20px; height: 54px; display: flex; align-items: center; gap: 16px; }
.a-top .brand { font-weight: 700; font-size: 16px; }
.a-top .sp { flex: 1; }
.a-top .who { font-size: 13px; opacity: .8; }
.a-top button { background: transparent; color: #fff; border-color: #3a475e; padding: 5px 10px; font-size: 13px; }
.a-wrap { padding: 18px 20px 40px; max-width: 1400px; margin: 0 auto; }
.a-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.a-bar h1 { font-size: 20px; margin: 0 12px 0 0; }
.a-bar .sp { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; }
.stat.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.stat .l { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progress { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 16px;
               font-size: 15px; color: var(--muted); }
.tabs button.on { color: var(--text); border-bottom-color: var(--primary); font-weight: 700; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; border-bottom: 1px solid var(--line); }
.tools .sp { flex: 1; }
.tbl-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grid th { background: #f8f9fb; color: var(--muted); font-weight: 600; font-size: 13px; position: sticky; top: 0; }
table.grid tr:hover td { background: #fafbfd; }
table.grid td.wrap { white-space: normal; min-width: 180px; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-READY { background: #eef0f3; color: var(--muted); }
.b-SENT { background: var(--warn-bg); color: var(--warn); }
.b-SIGNED { background: var(--ok-bg); color: var(--ok); }
.b-EXCLUDED { background: #ececf4; color: #5b5f86; }
tr.excluded td { color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.link-btn { background: none; border: none; padding: 0; color: var(--primary); font-size: 14px; cursor: pointer; text-decoration: underline; }
.link-btn.small { font-size: 12px; margin-left: 4px; }
dialog { border: none; border-radius: var(--radius); padding: 0; width: min(720px, 94vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 20, 30, .45); }
dialog .d-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
dialog .d-body { padding: 14px 18px; max-height: 60vh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #182234; color: #fff; padding: 10px 18px;
         border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 10; max-width: 90vw; }
.toast.show { opacity: 1; }

.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 12px 16px; align-items: start; }
.form-grid label { padding-top: 8px; color: var(--muted); font-size: 14px; }
.form-grid input[type=text] { width: 100%; }
.sub-tbl input { width: 100%; }
.sub-tbl td { padding: 6px; }

.login { max-width: 380px; margin: 10vh auto; }
.login form { display: grid; gap: 10px; }
.login input { width: 100%; padding: 11px 12px; }

@media (max-width: 760px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid label { padding-top: 0; }
    .a-wrap { padding: 14px 16px 40px; }
}
