:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e7e9ee;
  --line-strong: #d5d9e0;
  --text: #191c22;
  --text-2: #4b5260;
  --text-3: #8a91a0;
  --accent: #2f6bff;
  --accent-weak: #eaf0ff;
  --accent-strong: #1f54d6;
  --green: #12a150;
  --green-weak: #e6f7ee;
  --red: #e5484d;
  --red-weak: #fdeced;
  --amber: #d68400;
  --amber-weak: #fff4e0;
  --violet: #7c5cff;
  --violet-weak: #f1edff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; letter-spacing: -0.01em;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
.ic { flex: none; vertical-align: middle; }

#app { display: flex; height: 100vh; }

/* ---------- Sidebar ---------- */
#sidebar {
  width: var(--sidebar-w); flex: none; background: var(--bg); display: flex; flex-direction: column;
  border-right: 1px solid var(--line); height: 100vh;
}
.sb-head { padding: 14px 14px 8px; }
.sb-company { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; padding: 4px 4px 10px; }
.sb-logo { width: 26px; height: 26px; border-radius: 8px; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.clock-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.clock-card .clock-status { flex: 1; min-width: 0; }
.clock-card .clock-status b { display: block; font-size: 13px; }
.clock-card .clock-status span { font-size: 12px; color: var(--text-3); }
.clock-card.on { border-color: #bfe8cf; background: #f4fcf7; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px #d6f3e2; }
.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.sb-item, .sb-group-head {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border-radius: 8px; border: 0; background: none;
  cursor: pointer; color: var(--text-2); font-size: 14px; text-align: left;
}
.sb-item:hover, .sb-group-head:hover { background: #eceef2; color: var(--text); }
.sb-item.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.sb-sub { padding-left: 18px; }
.sb-sub .sb-item { font-size: 13.5px; padding: 6px 10px; }
.sb-group-head .caret { margin-left: auto; color: var(--text-3); transition: transform .15s; }
.sb-group.closed .caret { transform: rotate(-90deg); }
.sb-group.closed .sb-sub { display: none; }
.sb-sep { height: 1px; background: var(--line); margin: 8px 6px; }
.sb-count { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
.sb-kbd { margin-left: auto; font-size: 11px; color: var(--text-3); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.sb-foot { border-top: 1px solid var(--line); padding: 10px 12px; }
.sb-user { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; cursor: pointer; padding: 6px; border-radius: 8px; text-align: left; }
.sb-user:hover { background: #eceef2; }
.sb-user .meta { flex: 1; min-width: 0; }
.sb-user .meta b { display: block; font-size: 13.5px; }
.sb-user .meta span { font-size: 12px; color: var(--text-3); }

#menu-toggle { display: none; }

/* ---------- Main ---------- */
#main { flex: 1; min-width: 0; overflow-y: auto; background: var(--surface); border-radius: 14px 0 0 0; }
.page { padding: 32px 40px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head .sub { color: var(--text-3); margin-top: 6px; font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 0 -40px 20px; padding: 0 40px; overflow-x: auto; }
.tab { padding: 10px 0 12px; border: 0; background: none; cursor: pointer; color: var(--text-3); font-weight: 600; font-size: 14.5px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .n { font-size: 12px; color: var(--text-3); margin-left: 4px; font-weight: 500; }
.seg { display: inline-flex; background: #eef0f3; border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 13px; }
.seg button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--text-3); font-size: 13px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--red); border-color: #f5c2c4; }
.btn.danger:hover { background: var(--red-weak); }
.btn.solid-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: #eef0f3; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: #eef0f3; color: var(--text); }

.input, select.input, textarea.input {
  width: 100%; height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 11px; background: var(--surface); outline: none;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 11px; line-height: 1.6; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.search { position: relative; }
.search .input { padding-left: 32px; width: 220px; height: 34px; }
.search .ic { position: absolute; left: 10px; top: 9px; color: var(--text-3); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field .req { color: var(--red); margin-left: 2px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- Cards, tables, badges ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.section-title { font-size: 17px; font-weight: 700; margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title:first-child { margin-top: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }

.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: auto; background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12.5px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line); padding: 11px 14px; white-space: nowrap; }
.tbl td.wrap { white-space: normal; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: #eef0f3; color: var(--text-2); white-space: nowrap; }
.badge.green { background: var(--green-weak); color: var(--green); }
.badge.blue { background: var(--accent-weak); color: var(--accent-strong); }
.badge.red { background: var(--red-weak); color: var(--red); }
.badge.amber { background: var(--amber-weak); color: var(--amber); }
.badge.violet { background: var(--violet-weak); color: var(--violet); }
.badge.dark { background: #3a3f4b; color: #fff; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 700; flex: none; letter-spacing: -0.04em; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .meta b { display: block; font-weight: 600; }
.person .meta span { display: block; font-size: 12px; color: var(--text-3); }

.empty { text-align: center; padding: 56px 20px; color: var(--text-3); }
.empty .ic { color: #c4c9d3; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.list-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row.click { cursor: pointer; border-radius: 8px; padding-left: 10px; padding-right: 10px; }
.list-row.click:hover { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .desc { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; font-weight: 600; color: var(--text-3); margin-left: 2px; }

.progress { height: 6px; background: #edf0f4; border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

.banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 10px; background: var(--accent-weak); color: var(--accent-strong); font-size: 13.5px; margin-bottom: 16px; }
.banner.amber { background: var(--amber-weak); color: #8a5600; }
.banner.green { background: var(--green-weak); color: #0b7a3c; }

/* ---------- Type cards (leave, templates) ---------- */
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.type-card { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: var(--surface); cursor: pointer; text-align: left; min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; transition: border-color .12s, box-shadow .12s; }
.type-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.type-card .emoji { font-size: 22px; }
.type-card .name { font-size: 13.5px; font-weight: 600; margin-top: 18px; }
.type-card .val { font-size: 16px; font-weight: 700; margin-top: 4px; }
.type-card .val.muted { font-weight: 500; font-size: 14px; }

/* ---------- Overlay: modal / drawer ---------- */
.overlay { position: fixed; inset: 0; background: rgba(17, 20, 28, .42); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .12s; }
.overlay.drawer-overlay { justify-content: flex-end; padding: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: .5; } }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
.modal-sm { max-width: 420px; } .modal-md { max-width: 560px; } .modal-lg { max-width: 820px; } .modal-xl { max-width: 1100px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; }
.modal-head h3 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 6px 22px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
.drawer { background: var(--surface); width: min(760px, 100vw); height: 100vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slide .16s; position: relative; }
.drawer-close { position: absolute; top: 14px; right: 14px; z-index: 3; background: rgba(255,255,255,.8); }

.profile-cover { height: 150px; background: linear-gradient(120deg, #c9d8ff, #e7dcff 45%, #ffe1d2); }
.profile-head { padding: 0 28px 16px; display: flex; align-items: flex-end; gap: 16px; margin-top: -44px; }
.profile-head .avatar { border: 4px solid #fff; }
.profile-head h2 { font-size: 24px; font-weight: 800; }
.profile-body { padding: 0 28px 40px; }
.profile-body .tabs { margin: 0 -28px 20px; padding: 0 28px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 0; }
.kv > div { padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv > div:nth-child(odd) { color: var(--text-3); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline .ti { position: relative; padding: 0 0 18px; }
.timeline .ti::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline .ti b { display: block; }
.timeline .ti span { color: var(--text-3); font-size: 12.5px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1f2430; color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: fade .15s; }
.toast.error { background: var(--red); }

/* ---------- Popover menu ---------- */
.menu { position: fixed; z-index: 150; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
.menu .mi { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px; border: 0; background: none; width: 100%; text-align: left; }
.menu .mi:hover { background: var(--surface-2); }
.menu .mh { font-size: 11.5px; color: var(--text-3); padding: 6px 10px 4px; font-weight: 600; }

/* ---------- Attendance timeline ---------- */
.week { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.week-axis, .week-row { display: grid; grid-template-columns: 170px 1fr; }
.week-axis { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 11.5px; color: var(--text-3); }
.week-axis .ticks { position: relative; height: 30px; }
.week-axis .ticks span { position: absolute; top: 9px; transform: translateX(-50%); }
.week-row { border-bottom: 1px solid var(--line); min-height: 62px; }
.week-row:last-child { border-bottom: 0; }
.week-row.weekend { background: #fbfbfc; }
.week-row .day { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px; border-right: 1px solid var(--line); }
.week-row .day .d { font-weight: 700; width: 22px; text-align: center; }
.week-row .day .d.today { background: var(--red); color: #fff; border-radius: 6px; }
.week-row .day .w { color: var(--text-2); }
.week-row .day.sun .d, .week-row .day.sun .w, .week-row .day.hol .d, .week-row .day.hol .w { color: var(--red); }
.week-row .day.sat .d, .week-row .day.sat .w { color: var(--accent); }
.week-row .day .tot { margin-left: auto; font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.week-row .track { position: relative; background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px calc(100% / 24)); }
.bar { position: absolute; top: 14px; height: 34px; border-radius: 7px; background: var(--accent-weak); border: 1px solid #c6d5ff; color: var(--accent-strong); font-size: 11.5px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; }
.bar.remote { background: var(--violet-weak); border-color: #d9cfff; color: var(--violet); }
.bar.outside { background: var(--amber-weak); border-color: #f3d9a4; color: var(--amber); }
.bar.open { background: var(--green-weak); border-color: #b7e6c9; color: var(--green); }
.bar.leave { background: repeating-linear-gradient(45deg, #fff4e0, #fff4e0 6px, #fdebc8 6px, #fdebc8 12px); border-color: #f3d9a4; color: #8a5600; cursor: default; }
.add-in-row { position: absolute; right: 8px; top: 18px; opacity: 0; }
.week-row:hover .add-in-row { opacity: 1; }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); opacity: .6; }

/* ---------- Calendar ---------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 12px; color: var(--text-3); font-weight: 500; padding: 6px 0; }
.cal td { text-align: center; padding: 3px 0; }
.cal td .cd { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; font-size: 13px; position: relative; }
.cal td.out .cd { color: #c4c9d3; }
.cal td.sun .cd, .cal td.hol .cd { color: var(--red); }
.cal td.today .cd { background: var(--accent-weak); color: var(--accent-strong); font-weight: 700; }
.cal td .cd i { position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); }
.mcal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.mcal > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 96px; padding: 6px 8px; font-size: 12px; }
.mcal .h { min-height: 0; text-align: center; color: var(--text-3); background: var(--surface-2); padding: 8px; }
.mcal .o { background: #fbfbfc; color: #c4c9d3; }
.mcal .dn { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.mcal .hol .dn, .mcal .sun .dn { color: var(--red); }
.mcal .ev { display: block; background: var(--amber-weak); color: #8a5600; border-radius: 5px; padding: 1px 6px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcal .ev.h { background: var(--red-weak); color: var(--red); text-align: left; min-height: 0; padding: 1px 6px; border: 0; }

/* ---------- Org chart ---------- */
.org-canvas { background: radial-gradient(circle, #dfe3ea 1px, transparent 1px) 0 0 / 18px 18px, #f7f8fa; border: 1px solid var(--line); border-radius: 14px; padding: 40px; overflow: auto; min-height: 520px; }
.org-tree, .org-tree ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.org-tree ul { padding-top: 26px; position: relative; }
.org-tree li { position: relative; padding: 26px 10px 0; display: flex; flex-direction: column; align-items: center; }
.org-tree > li { padding-top: 0; }
.org-tree ul::before { content: ""; position: absolute; top: 0; left: 50%; height: 26px; border-left: 2px solid #b9c0cc; }
.org-tree li::before, .org-tree li::after { content: ""; position: absolute; top: 0; height: 26px; width: 50%; border-top: 2px solid #b9c0cc; }
.org-tree li::before { right: 50%; } .org-tree li::after { left: 50%; border-left: 2px solid #b9c0cc; }
.org-tree li:only-child::before, .org-tree li:only-child::after { border-top: 0; }
.org-tree li:only-child::after { width: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border-top: 0; }
.org-tree li:last-child::before { border-right: 2px solid #b9c0cc; border-top: 2px solid #b9c0cc; border-radius: 0 8px 0 0; }
.org-tree li:first-child::after { border-radius: 8px 0 0 0; }
.org-tree li:first-child:last-child::before { border: 0; }
.org-tree > li::before, .org-tree > li::after { display: none; }
.org-tree ul:empty { display: none; }
.org-node { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; width: 240px; box-shadow: var(--shadow); text-align: left; }
.org-node h4 { font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.org-node .members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px 2px 3px; font-size: 12px; cursor: pointer; background: var(--surface); }
.chip:hover { border-color: var(--line-strong); }

/* ---------- Document / contract / certificate paper ---------- */
.paper { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 48px 56px; font-size: 14px; line-height: 1.85; color: #111; }
.paper h1 { text-align: center; font-size: 24px; letter-spacing: 0.3em; margin-bottom: 28px; }
.paper h2 { font-size: 16px; margin: 18px 0 8px; }
.paper .doc-body p { margin: 0 0 4px; white-space: pre-wrap; }
.paper table.cert { width: 100%; border-collapse: collapse; margin: 18px 0; }
.paper table.cert th, .paper table.cert td { border: 1px solid #333; padding: 9px 12px; text-align: left; font-size: 14px; }
.paper table.cert th { background: #f4f5f7; width: 22%; font-weight: 600; }
.paper .sign-area { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 36px; }
.paper .sign-box { border-top: 1px solid #ccc; padding-top: 12px; font-size: 13.5px; position: relative; }
.paper .sign-img { height: 56px; display: block; margin-top: 6px; }
.paper .seal { position: absolute; right: 8px; bottom: -14px; opacity: .92; }
.paper .issuer { text-align: center; margin-top: 40px; font-size: 18px; font-weight: 700; position: relative; }
.paper .issuer .seal { position: absolute; left: calc(50% + 90px); top: 6px; bottom: auto; right: auto; }
.paper .docno { font-size: 12px; color: #666; }

.sigpad { border: 1.5px dashed var(--line-strong); border-radius: 10px; background: #fcfcfd; touch-action: none; width: 100%; height: 180px; cursor: crosshair; display: block; }

.approval-line { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: max-content; max-width: 100%; }
.approval-line .ap { width: 96px; border-right: 1px solid var(--line); text-align: center; font-size: 12px; }
.approval-line .ap:last-child { border-right: 0; }
.approval-line .ap .r { background: var(--surface-2); padding: 4px; color: var(--text-3); border-bottom: 1px solid var(--line); }
.approval-line .ap .s { height: 52px; display: grid; place-items: center; font-weight: 700; }
.approval-line .ap .n { padding: 4px; border-top: 1px solid var(--line); }
.stamp { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 2px solid var(--red); color: var(--red); border-radius: 50%; font-size: 11px; transform: rotate(-8deg); }
.stamp.rej { border-color: #555; color: #555; }

.picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 6px; }
.picker .chip { cursor: default; }
.picker .chip button { border: 0; background: none; cursor: pointer; color: var(--text-3); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.picker select { border: 0; outline: none; background: none; min-width: 120px; height: 28px; color: var(--text-3); }

.var-chip { display: inline-block; border: 1px solid #c6d5ff; background: var(--accent-weak); color: var(--accent-strong); border-radius: 6px; padding: 1px 7px; margin: 2px; font-size: 12px; cursor: pointer; }

.pay-table input.input { height: 30px; font-size: 13px; width: 110px; }
.pay-table td, .pay-table th { padding: 7px 10px; }
.pay-table th.grp { text-align: center; }

.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-nav .sb-item { font-size: 13.5px; }
.settings-section { max-width: 760px; }

.notif { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: #f7f9ff; }
.notif .t { font-size: 13.5px; }
.notif .a { font-size: 12px; color: var(--text-3); margin-top: 3px; }

.palette { position: fixed; top: 14vh; left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { border: 0; border-bottom: 1px solid var(--line); width: 100%; padding: 16px 18px; font-size: 16px; outline: none; }
.palette .results { max-height: 50vh; overflow-y: auto; padding: 6px; }
.palette .res { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.palette .res.sel, .palette .res:hover { background: var(--surface-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
  #sidebar { position: fixed; z-index: 90; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open #sidebar { transform: none; }
  #menu-toggle { display: grid; position: fixed; top: 12px; left: 12px; z-index: 80; background: var(--surface); box-shadow: var(--shadow); font-size: 16px; }
  #main { border-radius: 0; }
  .page { padding: 60px 16px 40px; }
  .tabs { margin: 0 -16px 16px; padding: 0 16px; }
  .page-head { flex-direction: column; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .week-axis, .week-row { grid-template-columns: 110px 1fr; }
  .paper { padding: 28px 20px; }
  .search .input { width: 100%; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .paper { border: 0; padding: 0; }
}

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #e7eeff, transparent 45%), radial-gradient(circle at 85% 90%, #f3ecff, transparent 40%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 32px 28px; }

/* ---------- Wiki ---------- */
.wk { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100vh; }
.wk.has-panel { grid-template-columns: 240px minmax(0, 1fr) 420px; }
.wk-tree { border-right: 1px solid var(--line); padding: 18px 12px; overflow-y: auto; background: #fcfcfd; }
.wk-tree .search .input { width: 100%; }
.wk-tree-list { margin-top: 6px; }
.wk-tree-head { display: flex; align-items: center; }
.wk-tree-toggle { flex: 1; display: flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 4px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-2); text-align: left; min-width: 0; }
.wk-tree-toggle span:first-of-type { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-tree-children { padding-left: 14px; }
.wk-tree-item { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: none; padding: 5px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--text-2); text-align: left; }
.wk-tree-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-tree-item:hover { background: #eef0f3; }
.wk-tree-item.active { background: var(--surface); box-shadow: 0 0 0 1px var(--line); color: var(--text); font-weight: 600; }
.wk-mini { width: 24px; height: 24px; opacity: 0; }
.wk-tree-head:hover .wk-mini { opacity: 1; }
.wk-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.wk-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.wk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 12px; flex-wrap: wrap; }
.wk-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 24px 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.wk-chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 20px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.wk-chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.wk-graph { position: relative; flex: 1; min-height: 360px; background: radial-gradient(circle, #e3e6ec 1px, transparent 1px) 0 0 / 22px 22px, #fafbfc; overflow: hidden; }
.wk-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; user-select: none; }
.wk-svg:active { cursor: grabbing; }
.wk-edge { stroke: #c9cdd5; stroke-width: 1.3; }
.wk-edge.contain { stroke: #d9dce2; stroke-dasharray: 3 4; }
.wk-edge.note { stroke: #e2e4e8; stroke-width: 1; }
.wk-edge.on { stroke: #6b4a3f; stroke-width: 2; }
.wk-edge.dim { opacity: .25; }
.wk-elabel { font-size: 11px; fill: #6b4a3f; text-anchor: middle; paint-order: stroke; stroke: #fafbfc; stroke-width: 4px; opacity: 0; pointer-events: none; font-weight: 600; }
.wk-elabel.show { opacity: 1; }
.wk-node { cursor: pointer; transition: opacity .15s; }
.wk-node.dim { opacity: .22; }
.wk-node:hover circle { filter: brightness(1.1); }
.wk-nlabel { fill: #3a3f4b; paint-order: stroke; stroke: #fafbfc; stroke-width: 4px; font-weight: 600; }
.wk-nlabel.folder { fill: #7d8592; font-weight: 500; }
.wk-node.sel .wk-nlabel { fill: #111; font-weight: 800; }
.wk-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); }
.wk-legend { position: absolute; left: 14px; top: 12px; display: flex; flex-wrap: wrap; gap: 10px; font-size: 11.5px; color: var(--text-3); background: rgba(255,255,255,.85); padding: 6px 10px; border-radius: 8px; }
.wk-legend span { display: inline-flex; align-items: center; gap: 4px; }
.wk-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.wk-scroll { flex: 1; overflow-y: auto; padding: 18px 24px 40px; }
.wk-panel { border-left: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.wk-panel-head { position: sticky; top: 0; background: var(--surface); display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px 22px; z-index: 2; border-bottom: 1px solid var(--line); }
.wk-panel-body { padding: 18px 22px 40px; }
.wk-title { font-size: 26px; font-weight: 800; }
.wk-block-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 8px; font-size: 14px; }
.wk-summary { background: #f6f4f2; border-radius: 10px; padding: 12px 14px; line-height: 1.7; font-size: 13.5px; white-space: pre-wrap; }
.wk-body { margin-top: 10px; line-height: 1.8; font-size: 13.5px; white-space: pre-wrap; }
.wk-rels { border: 1px solid var(--line); border-radius: 10px; padding: 4px 12px; }
.wk-rel { display: flex; align-items: center; gap: 6px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.wk-rel:last-child { border-bottom: 0; }
.wk-rel .icon-btn { width: 26px; height: 26px; opacity: .4; }
.wk-rel:hover .icon-btn { opacity: 1; }
.wk-link { color: #8a3b2a; font-weight: 700; cursor: pointer; text-decoration: underline; text-decoration-color: #e7c7bd; text-underline-offset: 3px; }
.wk-link:hover { text-decoration-color: currentColor; }
.wk-note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; background: var(--surface); }
.wk-note:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.wk-note-title { font-size: 13.5px; }
.wk-excerpt { border-left: 2px solid #e7c7bd; padding: 2px 0 2px 10px; font-size: 13px; line-height: 1.7; }
.wk-excerpt mark, .wk-content mark { background: #fbe4dc; color: #8a3b2a; font-weight: 700; border-radius: 3px; padding: 0 2px; }
.wk-mention { cursor: pointer; }
.wk-content { white-space: pre-wrap; line-height: 1.8; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; max-height: 50vh; overflow-y: auto; }
.wk-file { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.wk-file .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk-comment { display: flex; gap: 10px; font-size: 13.5px; }
.wk-comment .grow { flex: 1; min-width: 0; }
.wk-sentence { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; line-height: 1.7; }
.wk-pagecheck { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 1200px) { .wk.has-panel { grid-template-columns: 200px minmax(0, 1fr) 360px; } .wk { grid-template-columns: 200px minmax(0, 1fr); } }
@media (max-width: 860px) {
  .wk, .wk.has-panel { display: block; height: auto; padding-top: 52px; }
  .wk-tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .wk-graph { height: 60vh; flex: none; }
  .wk-panel { border-left: 0; border-top: 1px solid var(--line); }
  .wk-top, .wk-bar { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 860px) { .wk-legend { display: none; } }

/* ---------- Wiki AI ---------- */
.wk-ai { background: linear-gradient(135deg, #f3efff, #eef4ff); border: 1px solid #ddd3ff; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.7; }
.wk-ai-head { font-weight: 700; color: #5b3fd6; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.wk-ai ul { margin: 6px 0 0; padding-left: 18px; }
.wk-ai-item { align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; }
.wk-ai-item input { margin-top: 3px; }
.wk-ai-loading { display: flex; align-items: center; gap: 14px; padding: 10px 0 14px; }
.wk-spin { width: 26px; height: 26px; border-radius: 50%; border: 3px solid #e4defc; border-top-color: #6b4ff0; animation: wkspin .8s linear infinite; flex: none; }
@keyframes wkspin { to { transform: rotate(360deg); } }

.google-btn { width: 100%; height: 44px; gap: 10px; font-size: 14.5px; }
.login-or { display: flex; align-items: center; gap: 10px; margin: 20px 0 14px; color: var(--text-3); font-size: 12.5px; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
