:root {
  --bg: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-subtle: #f0f2f5;
  --border: #e2e4e9;
  --line: #c9cdd6;
  --text-primary: #1a1d23;
  --text-secondary: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #e8efff;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --success: #16a34a;
  --success-soft: #e7f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e2;
  --muted-soft: #eef0f3;
  --sidebar-bg: #16181d;
  --sidebar-text: #cbd0dc;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #23262e;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --bg-elevated: #1a1d23;
    --bg-subtle: #20242b;
    --border: #2a2e37;
    --line: #444a56;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0ab;
    --accent-soft: #1c2a4a;
    --danger-soft: #3a1d1d;
    --success-soft: #16301f;
    --warning-soft: #3a2b14;
    --muted-soft: #262a31;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
}

.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; white-space: nowrap; }
button:disabled { opacity: 0.5; cursor: default; }
a { color: inherit; }

/* 로그인 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  padding: 16px;
}
.login-box {
  background: var(--bg-elevated);
  padding: 40px;
  border-radius: 12px;
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.login-input { width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; box-sizing: border-box; background: var(--bg); color: var(--text); }
.login-input:focus { outline: none; border-color: var(--accent); }
.login-desc { margin: 0; text-align: center; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.error-text { color: var(--danger); font-size: 13px; min-height: 16px; margin: 0; text-align: center; }

/* 레이아웃 */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-title { color: var(--sidebar-text-active); font-weight: 700; font-size: 16px; padding: 0 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--sidebar-text);
  font-size: 14px;
}
.nav-link span:first-of-type { flex: 1; }
.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.nav-link.active { background: var(--sidebar-hover); color: var(--sidebar-text-active); font-weight: 600; }
.nav-sub { padding-left: 38px; font-size: 13.5px; }
.nav-sub.active { box-shadow: inset 2px 0 0 var(--accent); }
.nav-group { margin-top: 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
  color: #9aa0ab;
}
.badge {
  background: var(--danger);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
}
.sidebar-footer { border-top: 1px solid #2a2e37; padding: 12px 8px 0; display: flex; flex-direction: column; gap: 8px; }
.user-name { font-size: 13px; color: var(--sidebar-text-active); line-height: 1.4; }
.user-title { color: var(--sidebar-text); font-size: 12px; }
.user-name small { display: block; color: var(--sidebar-text); font-size: 12px; }

.main-content { flex: 1; min-width: 0; padding: 28px 32px; max-width: 1080px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-header h2 { margin: 0; font-size: 20px; }
.page-sub { color: var(--text-secondary); font-size: 13px; margin: 4px 0 0; }

/* 버튼 */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: none; color: var(--text-secondary); padding: 6px 10px; font-weight: 500; }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-subtle); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-ghost-light {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--sidebar-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.btn-ghost-light:hover { color: var(--sidebar-text-active); }

/* 카드 */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 14px; font-size: 15px; }
.card-header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-header-row h3 { margin: 0; }

/* 테이블 */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table th { color: var(--text-secondary); font-weight: 600; font-size: 12px; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { background: var(--bg-subtle); }
.data-table .title-cell { font-weight: 600; min-width: 160px; }
.data-table .nowrap { white-space: nowrap; }
.muted { color: var(--text-secondary); }
.empty-state { text-align: center; color: var(--text-secondary); padding: 48px 0; }

/* 상태 칩 */
.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-progress { background: var(--accent-soft); color: var(--accent); }
.chip-approved { background: var(--success-soft); color: var(--success); }
.chip-rejected { background: var(--danger-soft); color: var(--danger); }
.chip-withdrawn, .chip-muted { background: var(--muted-soft); color: var(--text-secondary); }
.chip-pending { background: var(--warning-soft); color: var(--warning); }

/* 양식 선택 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.form-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
}
.form-card:hover { border-color: var(--accent); }
.form-card .form-cat { font-size: 12px; color: var(--accent); font-weight: 600; }
.form-card .form-icon { font-size: 22px; }
.form-card .form-name { font-size: 16px; font-weight: 700; }
.form-search { width: 100%; max-width: 420px; padding: 10px 13px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; box-sizing: border-box; margin-bottom: 18px; background: var(--bg); color: var(--text); }
.form-search:focus { outline: none; border-color: var(--accent); }
.form-group { margin-bottom: 22px; }
.form-group-title { font-size: 14px; margin: 0 0 10px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.form-group-count { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--bg-subtle); border-radius: 10px; padding: 1px 8px; }
.form-card .form-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.req { color: var(--danger); margin-left: 2px; }
input[type=text], input[type=email], input[type=number], input[type=date], select, textarea {
  font: inherit;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  min-width: 0;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.input-sm { padding: 5px 8px !important; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 140px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* 결재선 */
.line { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.line-step {
  flex: 0 0 auto;
  min-width: 128px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-elevated);
}
.line-step.is-current { border-color: var(--warning); box-shadow: 0 0 0 1px var(--warning); }
.line-step.is-skipped { opacity: 0.55; }
.line-step-head {
  background: var(--bg-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.line-step-body { padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; }
.line-person { font-size: 13px; line-height: 1.4; }
.line-person .name { font-weight: 600; }
.line-person .sub { font-size: 11px; color: var(--text-secondary); }
.line-person .st-approved { color: var(--success); }
.line-person .st-rejected { color: var(--danger); }
.line-person .st-pending { color: var(--warning); }
.line-person .comment { font-size: 12px; color: var(--text-secondary); margin-top: 2px; white-space: pre-wrap; }
.line-empty { font-size: 12px; color: var(--text-secondary); }

/* 결재선 편집 */
.line-edit-step { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--bg-subtle); }
.person-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  font-size: 13px;
}
.person-chip button { background: none; border: none; color: var(--text-secondary); font-size: 14px; padding: 0 4px; line-height: 1; }
.person-chip button:hover { color: var(--danger); }

/* 문서 상세 */
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-secondary); font-size: 13px; margin-top: 6px; }
.doc-fields { display: grid; grid-template-columns: 160px 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.doc-fields > div { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.doc-fields > div:nth-last-child(-n+2) { border-bottom: none; }
.doc-fields .k { background: var(--bg-subtle); color: var(--text-secondary); font-weight: 600; font-size: 13px; }
.doc-fields .v { white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.act-box textarea { min-height: 70px; margin-bottom: 10px; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.history li { display: flex; gap: 12px; font-size: 13px; }
.history .h-time { color: var(--text-secondary); white-space: nowrap; min-width: 112px; }
.history .h-body { flex: 1; min-width: 0; }
.history .h-comment { color: var(--text-secondary); margin-top: 2px; white-space: pre-wrap; }
.diff { margin-top: 6px; font-size: 12px; background: var(--bg-subtle); border-radius: 8px; padding: 8px 10px; }
.diff del { color: var(--danger); }
.diff ins { color: var(--success); text-decoration: none; }

/* 숫자 타일 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; }
.stat-accent { border-color: var(--accent); }
.stat-accent .stat-value { color: var(--accent); }
code { background: var(--bg-subtle); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* 관리 */
.admin-row td { padding: 6px 8px; }
.admin-row input[type=text], .admin-row select { min-width: 96px; }
.editor-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--bg-subtle); }
.hint { font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin: 0 0 10px; }

/* 서식 편집기 · 본문 */
.rte { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-elevated); }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.rte-bar button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; font-size: 12.5px; color: var(--text-primary); }
.rte-bar button:hover { background: var(--bg-elevated); border-color: var(--border); }
.rte-sep { width: 1px; background: var(--border); margin: 2px 4px; }
.rte-body { min-height: 160px; padding: 12px 14px; outline: none; line-height: 1.7; font-size: 14px; }
.rich, .rte-body { word-break: break-word; overflow-x: auto; }
.rich table, .rte-body table { border-collapse: collapse; margin: 6px 0; }
.rich td, .rich th, .rte-body td, .rte-body th { border: 1px solid var(--border); padding: 6px 10px; min-width: 60px; }
.rich td:empty, .rte-body td:empty { height: 32px; }
.rich th, .rte-body th { background: var(--bg-subtle); }
.rich a, .rte-body a { color: var(--accent); }
.rich p, .rte-body p { margin: 0 0 6px; }
.doc-body { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; }
.auto-field { padding: 8px 10px; background: var(--bg-subtle); border-radius: 8px; font-size: 14px; }
.file-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.file-link { background: none; border: none; padding: 0; color: var(--accent); font-size: 13.5px; text-align: left; }
.file-link:disabled { color: var(--text-primary); }
.form-icon { font-size: 22px; margin-right: 6px; }
.policy-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 10px; background: var(--bg-elevated); }
.policy-card.is-default { border-color: var(--accent); }
.policy-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.policy-head b { font-size: 14px; }

/* 앱 안 확인창 */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { background: var(--bg-elevated); border-radius: 12px; padding: 22px; width: 420px; max-width: 100%; box-shadow: 0 12px 40px rgba(0,0,0,0.25); display: flex; flex-direction: column; gap: 14px; }
.dialog-msg { font-size: 14.5px; line-height: 1.6; white-space: normal; }
.dialog-input { min-height: 70px; }

/* 토스트 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 100;
  max-width: calc(100% - 32px);
}
.toast.error { background: var(--danger); }

/* 탭 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab {
  padding: 10px 14px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { background: var(--bg-subtle); color: var(--text-secondary); border-radius: 999px; font-size: 12px; padding: 0 8px; }
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent); }
.card-flush { padding: 4px 6px; }

/* 안내 상자 / 도구줄 */
.notice {
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.notice-warning { background: var(--warning-soft); color: var(--text-primary); border-color: var(--warning); }
.chain-list { list-style: none; margin: 8px 0 4px; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.chain-list .nohead { color: var(--text-secondary); text-decoration: line-through; text-decoration-color: var(--warning); }
.chain-count { display: inline-block; min-width: 38px; font-weight: 700; }
.notice-sub { color: var(--text-secondary); font-size: 12.5px; margin-top: 4px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 140px; padding: 7px 10px; font-size: 13px; }
.toolbar input { flex: 1; min-width: 180px; max-width: 280px; }
.toolbar-count { font-size: 13px; margin-left: auto; }
.link-more { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.link-back { font-size: 13px; color: var(--text-secondary); text-decoration: none; display: inline-block; margin-bottom: 6px; }
.link-back:hover { color: var(--text-primary); }

/* 홈 */
.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--accent); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.home-grid .card { margin-bottom: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { border-top: 1px solid var(--border); }
.mini-list li:first-child { border-top: none; }
.mini-list a, .mini-row { display: flex; flex-direction: column; gap: 2px; padding: 9px 2px; text-decoration: none; color: inherit; }
.mini-list a:hover .mini-title { color: var(--accent); }
.mini-title { font-weight: 600; font-size: 14px; }
.mini-meta { font-size: 12px; color: var(--text-secondary); }
.mini-empty { color: var(--text-secondary); font-size: 13px; margin: 6px 0 12px; }

/* 조직도 그림 (왼쪽 → 오른쪽 트리) */
.card-chart { padding: 12px 16px 16px; }
.chart-tools { display: flex; gap: 4px; justify-content: flex-end; align-items: center; margin-bottom: 4px; }
.chart-hint { font-size: 12px; margin-right: auto; }
.org-chart { overflow: auto; padding: 4px 2px 8px; }
.org-chart ul { list-style: none; margin: 0; padding: 0; }
.org-chart > ul { display: inline-flex; flex-direction: column; }
.org-chart li { display: flex; align-items: center; position: relative; }
.org-chart li > ul { display: flex; flex-direction: column; position: relative; padding-left: 28px; }
.org-chart li > ul::before { content: ''; position: absolute; left: 0; top: 50%; width: 28px; border-top: 1.5px solid var(--line); }
.org-chart li li { padding: 5px 0 5px 24px; }
.org-chart li li::before { content: ''; position: absolute; left: 0; top: 50%; width: 24px; border-top: 1.5px solid var(--line); }
.org-chart li li::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--line); }
.org-chart li li:first-child::after { top: 50%; }
.org-chart li li:last-child::after { bottom: 50%; }
.org-chart li li:only-child::after { display: none; }
.org-chart > ul > li { padding: 5px 0; }
.org-node {
  position: relative;
  width: 196px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 9px 12px 9px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .12s, box-shadow .12s;
}
.org-node:hover, .org-node:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.org-node.no-head { border-left-color: var(--warning); }
.org-node.is-hl { background: var(--accent-soft); border-color: var(--accent); }
.org-node-name { font-weight: 700; font-size: 14px; padding-right: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-head { font-size: 12.5px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-node-head span { color: var(--text-secondary); font-size: 11.5px; }
.org-node-head em { color: var(--warning); font-style: normal; }
.org-node-count { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.org-toggle {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 22px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 0 4px;
}
.org-toggle:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* 검색 */
.search-box { position: relative; width: 280px; max-width: 100%; }
.search-box input { padding: 8px 12px; }
.search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.search-results button {
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  white-space: normal;
}
.search-results button:hover { background: var(--bg-subtle); }

/* 오른쪽 상세 패널 */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.25); z-index: 40; }
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.12);
  z-index: 50;
  overflow-y: auto;
  padding: 22px 22px 32px;
}
.panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 18px;
}
.panel-crumb { font-size: 12px; color: var(--text-secondary); padding-right: 40px; }
.panel-title { font-size: 19px; margin: 4px 0 16px; }
.panel-section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.panel-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.is-focus .person-row { background: var(--accent-soft); border-radius: 8px; padding-left: 6px; }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.person-main { min-width: 0; }
.person-name { font-size: 14px; font-weight: 600; }
.person-sub { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn { cursor: pointer; padding: 4px 10px; }
.chip-btn:hover { border-color: var(--accent); }

/* 출퇴근 */
.clock-card { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.clock-main { flex: 1; min-width: 180px; }
.clock-now { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.1; }
.clock-plan { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.clock-times { display: flex; gap: 18px; align-items: center; }
.clock-times > div { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.clock-times b { font-size: 18px; }
.clock-actions { display: flex; gap: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.clock-actions { flex-wrap: wrap; justify-content: flex-end; }
.clock-rule { width: 100%; text-align: right; font-size: 11.5px; color: var(--text-secondary); }
.clock-device { font-size: 13.5px; text-align: right; line-height: 1.6; }
.week-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.week-chip { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 12.5px; }
.week-chip.over { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.att-table tr.is-rest td { background: var(--bg-subtle); }
.att-table tr.is-today td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
.danger { color: var(--danger); }
.side-panel.wide { width: 760px; }

/* 공지 */
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li + li { border-top: 1px solid var(--border); }
.notice-list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 14px; text-decoration: none; color: inherit; }
.notice-list a:hover { background: var(--bg-subtle); }
.notice-list.compact a { padding: 9px 2px; }
.notice-title { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; }
.notice-list .is-unread .notice-title { font-weight: 700; }
.notice-meta { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); flex-shrink: 0; }
.notice-body { white-space: pre-wrap; line-height: 1.75; font-size: 14.5px; word-break: break-word; }
.notice-body a { color: var(--accent); }

/* 겸직 표시 */
.concurrent { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0 6px; }

/* 프로필 */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
.profile-grid .card { margin-bottom: 0; }
.profile-grid .doc-fields { grid-template-columns: 120px 1fr; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; font-size: 13.5px; line-height: 1.5; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
a.user-name { text-decoration: none; display: block; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; }
a.user-name:hover { background: var(--sidebar-hover); }

/* 연차 조정 내역 */
.adjust-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
input[type=time] { font: inherit; color: var(--text-primary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; }

/* 입력 폼 카드 */
.edit-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 4px 24px 20px;
  margin-bottom: 16px;
  max-width: 760px;
}
.edit-card section { padding: 18px 0 6px; border-bottom: 1px solid var(--border); }
.edit-card section:last-of-type { border-bottom: none; }
.edit-card h3 { font-size: 15px; margin: 0 0 14px; }
.edit-card > .actions { padding-top: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-size: 13.5px; line-height: 1.5; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input { margin-top: 3px; }
.danger-zone { border-color: var(--danger-soft); padding-top: 16px; }
.danger-zone h3 { color: var(--danger); }
input:disabled { background: var(--bg-subtle); color: var(--text-secondary); }

/* 근무조 칩 */
.rc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--c, var(--accent));
  white-space: nowrap;
}
.rc-default { background: transparent; color: var(--c, var(--text-secondary)); border: 1px dashed currentColor; opacity: 0.7; font-weight: 600; }
.rc-off { background: var(--muted-soft); color: var(--text-secondary); }
.rc-clear { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.rc-leave { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }
.rc-leave.pending { border-style: dashed; }
.month-nav { gap: 6px; align-items: center; }
.month-nav b { font-size: 15px; min-width: 92px; text-align: center; }
.color-input { width: 44px; min-width: 44px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-elevated); }

/* 내 근무표 달력 */
.cal-card { padding: 12px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-head { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-secondary); padding: 6px 0; }
.cal-head.we { color: var(--danger); }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-elevated); min-width: 0; }
.cal-cell.is-rest { background: var(--bg-subtle); }
.cal-cell.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-blank { border: none; background: none; }
.cal-date { display: flex; justify-content: space-between; gap: 4px; font-size: 12.5px; font-weight: 700; }
.cal-hol { color: var(--danger); font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-time { font-size: 11.5px; }
.cal-leave { font-size: 11.5px; font-weight: 600; color: var(--success); text-decoration: none; background: var(--success-soft); border-radius: 5px; padding: 2px 5px; }
.cal-leave.pending { border: 1px dashed var(--success); }

/* 팀 근무표 */
.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.brush { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: 8px; padding: 4px 8px 4px 4px; font-size: 12px; color: var(--text-secondary); }
.brush:hover { background: var(--bg-subtle); }
.brush.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text-primary); }
.roster-wrap { overflow: auto; max-height: calc(100vh - 260px); }
.roster { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.roster th, .roster td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; padding: 0; }
.roster thead th { position: sticky; top: 0; z-index: 2; background: var(--bg-elevated); font-weight: 600; color: var(--text-secondary); padding: 6px 0; min-width: 38px; line-height: 1.2; }
.roster thead th small { display: block; font-size: 10.5px; font-weight: 500; }
.roster th.is-rest, .roster td.is-rest { background: var(--bg-subtle); }
.roster thead th.is-rest { color: var(--danger); }
.roster th.is-today { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.roster .rname { position: sticky; left: 0; z-index: 1; background: var(--bg-elevated); text-align: left; padding: 6px 10px; min-width: 110px; white-space: nowrap; }
.roster thead .rname { z-index: 3; }
.roster .rname small { display: block; color: var(--text-secondary); font-size: 11px; font-weight: 400; }
.roster .rcell { height: 40px; min-width: 38px; }
.roster .rcount { padding: 0 10px; white-space: nowrap; font-weight: 600; }
.roster.is-editing .rcell.editable { cursor: crosshair; user-select: none; }
.roster.is-editing .rcell.editable:hover { box-shadow: inset 0 0 0 2px var(--accent); }
.roster .rcell.is-painted { box-shadow: inset 0 0 0 2px var(--accent); }
.roster .rc { min-width: 28px; font-size: 11px; padding: 0 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* 모바일 */
@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px 16px; }
  .sidebar-title { padding: 0 0 8px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px; }
  .nav-group { flex-direction: row; margin-top: 0; gap: 4px; }
  .nav-group-title { display: none; }
  .nav-link, .nav-sub { white-space: nowrap; padding: 7px 10px; }
  .nav-link .icon { display: none; }
  .nav-sub.active { box-shadow: none; }
  .sidebar-footer { flex-direction: row; align-items: center; justify-content: space-between; margin-top: 8px; }
  .main-content { padding: 18px 16px; }
  .card { padding: 16px; }
  .doc-fields { grid-template-columns: 1fr; }
  .doc-fields .k { border-bottom: none !important; padding-bottom: 2px; }
  .history li { flex-direction: column; gap: 2px; }
  .list-table th:nth-child(1), .list-table td:nth-child(1),
  .list-table th:nth-child(2), .list-table td:nth-child(2),
  .list-table th:nth-child(6), .list-table td:nth-child(6) { display: none; }
  .list-table .title-cell { min-width: 0; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-card { padding: 4px 16px 16px; }
  .search-box { width: 100%; }
  .side-panel { width: 100%; }
  .toolbar input, .toolbar select { flex: 1 1 100%; max-width: none; }
  .cal-cell { min-height: 70px; padding: 4px; }
  .cal-time, .cal-leave { font-size: 10px; }
  .cal .rc { min-width: 0; font-size: 10px; padding: 0 3px; }
  .roster-wrap { max-height: none; }
}
