:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #fbfaf6;
  --border: #e3e0d4;
  --text: #2b2a26;
  --text-muted: #74726a;
  --text-faint: #a3a096;
  --accent: #2e5c8a;
  --accent-hover: #234a70;
  --accent-bg: #eaf1f8;

  --red: #b93c2e;
  --red-bg: #fbeae7;
  --red-border: #ecc4bc;

  --amber: #b3791b;
  --amber-bg: #fdf1de;
  --amber-border: #f0d6a6;

  --caution: #93790f;
  --caution-bg: #f8f2d6;
  --caution-border: #e6d791;

  --green: #2f7d4f;
  --green-bg: #e8f4ec;
  --green-border: #c3e0cc;

  --none-bg: #eeece5;
  --none-text: #8b887e;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(40,35,20,0.06), 0 2px 8px rgba(40,35,20,0.04);
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }

.bi {
  width: 1em;
  height: 1em;
  fill: currentColor;
  vertical-align: -0.15em;
  flex-shrink: 0;
}
.icon-lg .bi { width: 1.6em; height: 1.6em; }

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

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-text strong { display: block; font-size: 15px; }
.brand-text small { color: var(--text-muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-icon { width: 18px; text-align: center; display: inline-flex; justify-content: center; }
.nav-icon .bi { width: 16px; height: 16px; }

.sidebar-footer { color: var(--text-faint); font-size: 10.5px; padding: 10px 6px 0; border-top: 1px solid var(--border); margin-top: 12px; }

/* ---------- Main content ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#topbar-title { font-size: 16px; font-weight: 700; }
.badge-date { color: var(--text-muted); font-size: 12.5px; }

.view { padding: 24px; flex: 1; overflow-y: auto; }

/* ---------- Common components ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .08s ease;
}
.stat-card:hover { transform: translateY(-1px); }
.stat-card .stat-label { color: var(--text-muted); font-size: 12.5px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; }
.stat-card.red .stat-value { color: var(--red); }
.stat-card.amber .stat-value { color: var(--amber); }
.stat-card.caution .stat-value { color: var(--caution); }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.accent .stat-value { color: var(--accent); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-header h3 { margin: 0; font-size: 14.5px; }
.panel-body { padding: 16px 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.red { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.chip.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-border); }
.chip.caution { background: var(--caution-bg); color: var(--caution); border-color: var(--caution-border); }
.chip.green { background: var(--green-bg); color: var(--green); border-color: var(--green-border); }
.chip.none { background: var(--none-bg); color: var(--none-text); }
.chip.info { background: var(--accent-bg); color: var(--accent); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.input, select.input, textarea.input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; white-space: nowrap; }
th:hover { color: var(--accent); }
tbody tr:hover { background: var(--surface-2); }
.plate { font-family: "Consolas", "SF Mono", monospace; font-weight: 700; letter-spacing: 0.5px; }

/* 이동시간 휴무 관리대장 — 실제 엑셀 관리대장의 색상 구분(적립=파랑/사용=주황/잔여=초록)을 그대로 반영 */
.ledger-table { font-size: 12.5px; }
.ledger-table th { cursor: default; text-align: center; white-space: nowrap; }
.ledger-table thead tr:first-child th { font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--surface); }
.ledger-table thead tr:nth-child(2) th { font-size: 11.5px; padding: 7px 8px; }
.ledger-table td { padding: 7px 9px; white-space: nowrap; }
.ledger-table .grp-accent { background: var(--accent); color: #fff; }
.ledger-table .grp-amber { background: var(--amber); color: #fff; }
.ledger-table .grp-green { background: var(--green); color: #fff; }
.ledger-table .grp-neutral { background: var(--none-bg); color: var(--text-muted); }
.ledger-table td.cell-accent { background: var(--accent-bg); font-weight: 600; text-align: right; }
.ledger-table td.cell-amber { background: var(--amber-bg); font-weight: 600; text-align: right; }
.ledger-table td.cell-green { background: var(--green-bg); font-weight: 700; text-align: right; color: var(--green); }
.ledger-table tr.ledger-total-row td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--border); white-space: normal; }
.ledger-table tr.ledger-total-row td:first-child { text-align: center; }
/* "관리"(수정/삭제) 열은 가로 스크롤을 아무리 해도 항상 보이게 오른쪽에 고정 — 표가 넓어서
   맨 끝까지 스크롤해야만 수정 버튼이 보이는 게 실사용에서 "넣을 방법이 없다"는 혼란으로 이어졌음. */
.ledger-table th:last-child,
.ledger-table td:last-child {
  position: sticky;
  right: 0;
  box-shadow: -2px 0 4px rgba(40, 35, 20, 0.08);
}
.ledger-table thead th:last-child { background: var(--none-bg); z-index: 2; }
.ledger-table tbody tr td:last-child { background: var(--surface); }
.ledger-table tbody tr:hover td:last-child { background: var(--surface-2); }
.ledger-table tr.ledger-total-row td:last-child { background: var(--surface-2); box-shadow: none; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

.progress-bar { height: 8px; background: var(--none-bg); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.progress-bar-fill.green { background: var(--green); }

.checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.checklist-item:last-child { border-bottom: none; }
.checklist-item input[type="checkbox"] { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.checklist-item.checked .checklist-item-label { text-decoration: line-through; color: var(--text-muted); }
.checklist-item-body { flex: 1; min-width: 0; }
.checklist-item-label { font-weight: 600; font-size: 13.5px; }
.checklist-item-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.checklist-item-guide { font-size: 12px; color: var(--text-muted); margin-top: 4px; white-space: pre-line; }
.checklist-item-note { margin-top: 8px; }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-muted);
}
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: white; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(30,28,20,0.35);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-close { cursor: pointer; color: var(--text-muted); font-size: 18px; background: none; border: none; }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text-muted); }
.form-row .input { width: 100%; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .t-icon { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: var(--surface-2); }
.timeline .t-body { flex: 1; }
.timeline .t-type { font-weight: 700; font-size: 13px; }
.timeline .t-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.timeline .t-detail { margin-top: 4px; font-size: 13px; }

.bar-chart { display: flex; flex-direction: column; gap: 8px; }
.bar-chart-row { display: flex; align-items: center; gap: 10px; }
.bar-chart-label { width: 90px; flex-shrink: 0; font-size: 12.5px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-chart-track { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; height: 24px; position: relative; overflow: hidden; }
.bar-chart-fill { height: 100%; background: var(--accent); border-radius: 6px 0 0 6px; transition: width .3s; }
.bar-chart-value { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11.5px; font-weight: 700; color: var(--text); }

.attachment-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.attachment-chip {
  display: inline-flex; align-items: center;
  border-radius: 999px; overflow: hidden;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid transparent;
}
.attachment-chip:focus-within, .attachment-chip:hover { border-color: var(--accent); }
.attachment-open {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 6px 4px 8px; border: none; background: none; color: inherit;
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.attachment-chip .bi { width: 0.9em; height: 0.9em; }
.attachment-remove {
  border: none; background: none; cursor: pointer; color: var(--text-faint);
  display: inline-flex; align-items: center; padding: 4px 8px 4px 2px;
}
.attachment-remove:hover { color: var(--red); }
.attachment-remove .bi { width: 0.85em; height: 0.85em; }

.evidence-note {
  font-size: 11.5px; color: var(--text-faint); margin-top: 4px;
  display: flex; align-items: center; gap: 4px;
}

.alert-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alert-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer;
}
.alert-row:hover { border-color: var(--accent); }
.alert-row .alert-text { flex: 1; font-size: 13px; }
.alert-row .alert-text strong { font-family: "Consolas", "SF Mono", monospace; }

.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row .settings-label { font-weight: 600; font-size: 13.5px; }
.settings-row .settings-desc { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

.audit-log { font-size: 12px; color: var(--text-muted); }
.audit-log li { padding: 6px 0; border-bottom: 1px dashed var(--border); }

.breadcrumb { color: var(--text-muted); font-size: 12.5px; margin-bottom: 12px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.toast-container { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  background: var(--text); color: white; padding: 10px 16px; border-radius: var(--radius-sm);
  font-size: 13px; box-shadow: var(--shadow); animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 760px) {
  .sidebar { position: fixed; z-index: 40; height: 100%; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .content { width: 100%; }
}

/* ---------- 드래그앤드롭 파일 업로드 ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  background: var(--surface-2);
  transition: border-color .1s ease, background .1s ease;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.dropzone.busy { opacity: 0.6; cursor: wait; }
.dropzone.compact { padding: 10px 14px; font-size: 12.5px; text-align: left; }
.dropzone .bi { width: 1.4em; height: 1.4em; margin-bottom: 6px; }
.dropzone.compact .bi { width: 1em; height: 1em; margin-bottom: 0; vertical-align: -0.15em; }
#photo-dropzone.dragover img, #photo-dropzone.dragover > div:first-child { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 채용·면접: 면접자 정보 카드 ---------- */
.info-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--surface-2);
  max-width: 560px;
}
.info-card-title { text-align: center; font-weight: 700; font-size: 15px; margin-bottom: 16px; }
.info-card-body { display: flex; justify-content: space-between; gap: 16px; }
.info-card-fields { display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.info-card-photo { width: 84px; height: 104px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.info-card-photo-empty {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); color: var(--text-faint); font-size: 11px; text-align: center;
}
.info-card-answers {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px; font-size: 13px;
}

/* ---------- 채용·면접: 합격통지서 ---------- */
.offer-letter {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  background: var(--surface);
  max-width: 720px;
  font-size: 13px;
  line-height: 1.7;
}
.offer-header { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.offer-logo { height: 88px; width: auto; }
.offer-header h1 { font-size: 24px; margin: 0; }
.offer-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 12.5px; }
.offer-table th, .offer-table td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
.offer-table th { background: var(--surface-2); width: 110px; white-space: nowrap; }
.offer-doclist { margin: 0; padding-left: 18px; }
.offer-note { margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.offer-warn { font-size: 12px; color: var(--red); }
.offer-contact th { width: 90px; }
.offer-sign { text-align: right; margin-top: 22px; }
.offer-company { font-weight: 700; margin-top: 6px; }
.offer-ceo { margin-top: 4px; }
.offer-seal-slot { color: var(--text-faint); font-size: 11px; border: 1px dashed var(--border); padding: 2px 8px; border-radius: 4px; }
.offer-seal-img { width: 54px; height: 54px; object-fit: contain; vertical-align: middle; margin-left: -6px; }

@media print {
  @page { size: portrait; margin: 14mm; }

  body.printing-offer #app > *:not(.content),
  body.printing-offer .sidebar,
  body.printing-offer .topbar,
  body.printing-offer .breadcrumb,
  body.printing-offer .panel:not(:has(#offer-print-area)),
  body.printing-offer .view > .panel > .panel-header {
    display: none !important;
  }
  body.printing-offer .view { padding: 0; }
  body.printing-offer .panel:has(#offer-print-area) { border: none; box-shadow: none; margin: 0; }
  body.printing-offer .offer-letter { border: none; max-width: 100%; padding: 0; }

  body.printing-card #app > *:not(.content),
  body.printing-card .sidebar,
  body.printing-card .topbar,
  body.printing-card .breadcrumb,
  body.printing-card .panel:not(:has(#card-preview)),
  body.printing-card .view > .panel > .panel-header {
    display: none !important;
  }
  body.printing-card .view { padding: 0; }
  body.printing-card .panel:has(#card-preview) { border: none; box-shadow: none; margin: 0; }
  body.printing-card .info-card { border: none; max-width: 640px; margin: 0 auto; }
  body.printing-card .info-card-title { font-size: 22px; margin-bottom: 22px; }
  body.printing-card .info-card-fields { font-size: 17px; gap: 12px; }
  body.printing-card .info-card-answers { font-size: 16px; gap: 10px; margin-top: 20px; padding-top: 18px; }
  body.printing-card .info-card-photo,
  body.printing-card .info-card-photo-empty { width: 120px; height: 148px; }
}

/* ---------- 랩핑 관리대장 인쇄 (법인차량) ---------- */
#wrapping-print-area { display: none; }
#wrapping-print-area h1 { font-size: 17pt; margin: 0 0 3mm; }
#wrapping-print-area .print-meta { font-size: 9.5pt; color: #555; margin-bottom: 6mm; }
#wrapping-print-area .print-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
#wrapping-print-area .print-table thead { display: table-header-group; }
#wrapping-print-area .print-table tr { page-break-inside: avoid; }
#wrapping-print-area .print-table th,
#wrapping-print-area .print-table td { border: 0.6pt solid #333; padding: 2.4mm 2mm; text-align: center; }
#wrapping-print-area .print-table th { background: #eef1f6; font-weight: 700; }
#wrapping-print-area .print-table td.left { text-align: left; }
#wrapping-print-area .print-table td.plate { font-family: Consolas, "SF Mono", monospace; font-weight: 700; letter-spacing: 0.3pt; }

@media print {
  /* 이름 붙은 페이지로 분리 — 이름 없는 @page는 위에서 이미 세로(portrait)로 정해뒀는데,
     같은 이름 없는 @page를 여기서 또 쓰면 나중에 선언된 이 규칙이 이겨서 카드/합격통지서
     인쇄까지 전부 가로로 나가버리는 문제가 있었다. */
  @page wrapping-landscape { size: A4 landscape; margin: 12mm; }
  body.printing-wrapping #app { display: none !important; }
  body.printing-wrapping #wrapping-print-area {
    display: block !important;
    page: wrapping-landscape;
    font-family: "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", sans-serif;
    color: #1a1a1a;
  }
}


/* 서명 링크 패널 안내문 — .evidence-note는 flex라 문장 중간 <strong>·아이콘이 칸으로 쪼개져서 별도 블록 스타일 */
.sign-note { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 4px; }
.sign-note .bi { vertical-align: -2px; margin-right: 2px; }
