* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Malgun Gothic", "맑은 고딕", -apple-system, sans-serif;
  background: #f4f5f7;
  color: #222;
}

.hidden { display: none !important; }

/* ---------- 로그인 ---------- */
.login-gate {
  position: fixed;
  inset: 0;
  background: #1F4E78;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-box {
  background: #fff;
  border-radius: 14px;
  padding: 32px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
}
.login-box h1 { font-size: 18px; margin: 0 0 6px; }
.login-box p { font-size: 13px; color: #666; margin: 0 0 16px; }
.login-box input {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  text-align: center;
  letter-spacing: 4px;
  border: 1px solid #ccc;
  border-radius: 8px;
  margin-bottom: 10px;
}
.login-box button.primary {
  width: 100%;
  padding: 12px;
  background: #1F4E78;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 15px;
}

/* ---------- 레이아웃 ---------- */
header {
  background: #1F4E78;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
}
header h1 { font-size: 16px; margin: 0; }
header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
}

.sidebar {
  display: none;
  flex-direction: column;
  width: 170px;
  flex-shrink: 0;
  padding: 16px 8px;
  gap: 4px;
}
.sidebar button {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  color: #333;
}
.sidebar button.active { background: #1F4E78; color: #fff; }

.pills {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
}
.pills button {
  flex-shrink: 0;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e0;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.pills button.active { background: #1a202c; color: #fff; border-color: #1a202c; }

main {
  flex: 1;
  min-width: 0;
  padding: 8px 12px 60px;
}

/* ---------- 공통 카드/테이블 ---------- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.panel-header h2 { font-size: 16px; margin: 0; }
.btn {
  padding: 8px 14px;
  background: #1F4E78;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn.secondary { background: #eee; color: #333; }
.btn.danger { background: #fff; color: #b91c1c; border: 1px solid #f0c0c0; }

.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}
.card .card-title { font-size: 15px; font-weight: bold; margin-bottom: 4px; }
.card .card-sub { font-size: 12px; color: #718096; margin-bottom: 8px; }
.card .card-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.card .card-row .label { color: #718096; }
.card .card-actions { display: flex; gap: 8px; margin-top: 10px; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid #edf2f7; text-align: left; }
.data-table th { background: #f7fafc; color: #4a5568; font-size: 12px; }
.data-table td.num { text-align: right; }
.data-table tr.needs-attention { background: #fff5f5; }

.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-tile {
  flex: 1;
  min-width: 130px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}
.stat-tile .stat-label { font-size: 12px; color: #718096; }
.stat-tile .stat-value { font-size: 20px; font-weight: bold; margin-top: 4px; }

.empty-msg { text-align: center; color: #a0aec0; padding: 30px 0; }

/* ---------- 모달 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  overflow-y: auto;
}
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 16px; margin: 0 0 14px; }
.modal label { display: block; font-size: 13px; color: #555; margin: 10px 0 4px; }
.modal input[type=text], .modal input[type=number], .modal input[type=date],
.modal select, .modal textarea {
  width: 100%; padding: 10px; font-size: 14px; border: 1px solid #ccc; border-radius: 8px;
}
.modal .row { display: flex; gap: 16px; margin-top: 16px; }
.modal .row-2 { display: flex; gap: 10px; }
.modal .row-2 > div { flex: 1; }
.modal button.primary { flex: 1; padding: 12px; background: #1F4E78; color: #fff; border: none; border-radius: 8px; font-weight: bold; }
.modal button.secondary { padding: 12px 16px; background: #eee; border: none; border-radius: 8px; }
.error { color: #b91c1c; font-size: 13px; margin-top: 8px; }

.item-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.item-row input { flex: 1; padding: 8px; font-size: 13px; border: 1px solid #ccc; border-radius: 6px; }
.item-row .rm-btn { background: none; border: none; color: #b91c1c; font-size: 16px; cursor: pointer; padding: 0 4px; }

@media (min-width: 860px) {
  .sidebar { display: flex; }
  .pills { display: none; }
  main { padding: 16px 20px 20px; }
}
