/* ── 리셋 & 기본 ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Malgun Gothic', sans-serif; font-size: 14px; background: #f4f6f8; color: #222; }
a { color: inherit; text-decoration: none; }

/* ── 레이아웃 ────────────────────────────────────────────────────────────── */
.app-layout { display: flex; flex-direction: column; height: 100vh; }
.main-area  { display: flex; flex: 1; overflow: hidden; }

/* ── 상단바 ──────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px; height: 52px;
  background: #1a3a5c; color: #fff; flex-shrink: 0;
}
.topbar-title { font-size: 16px; font-weight: 700; margin-right: auto; }
.topbar-title em { font-style: normal; font-size: 12px; opacity: .7; margin-left: 6px; }
.topbar-user  { font-size: 13px; opacity: .85; }
.badge { background: #e74c3c; color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.btn-logout {
  padding: 5px 14px; border: 1px solid rgba(255,255,255,.4);
  background: transparent; color: #fff; border-radius: 4px; cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,.15); }

/* ── 사이드바 ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 180px; flex-shrink: 0;
  background: #fff; border-right: 1px solid #dde3ea;
  overflow-y: auto; padding: 12px 0;
}
.sidebar-section { margin-bottom: 8px; }
.sidebar-label {
  padding: 6px 16px; font-size: 11px; font-weight: 700;
  color: #8a94a6; text-transform: uppercase; letter-spacing: .05em;
}
.sidebar-list { list-style: none; }
.sidebar-item {
  padding: 9px 16px; cursor: pointer; font-size: 13px; color: #444;
  border-left: 3px solid transparent;
  transition: background .15s, border-color .15s;
}
.sidebar-item:hover   { background: #f0f4f8; }
.sidebar-item.active  { background: #eef3fb; border-left-color: #1a3a5c; color: #1a3a5c; font-weight: 600; }
.sidebar-item.submitted { color: #27ae60; }
.sidebar-item.submitted::after { content: " ✓"; }

/* ── PDF 뷰어 영역 ───────────────────────────────────────────────────────── */
.viewer-area {
  flex: 1; overflow: auto; padding: 20px;
  display: flex; flex-direction: column; align-items: center;
}
.placeholder { color: #aaa; margin: auto; font-size: 15px; }
.viewer-header {
  display: flex; justify-content: space-between; align-items: center;
  width: 100%; max-width: 900px; margin-bottom: 10px;
  font-size: 15px; font-weight: 600; color: #1a3a5c;
}
.canvas-wrap { position: relative; border: 1px solid #ccd3dc; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.canvas-wrap canvas { display: block; }
#drawCanvas  { position: absolute; top: 0; left: 0; cursor: crosshair; }
.viewer-footer {
  display: flex; gap: 12px; margin-top: 14px; width: 100%; max-width: 900px; justify-content: flex-end;
}

/* ── 버튼 ────────────────────────────────────────────────────────────────── */
.btn-primary   { padding: 8px 20px; background: #1a3a5c; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-secondary { padding: 8px 20px; background: #eee; color: #333; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-danger    { padding: 8px 20px; background: #e74c3c; color: #fff; border: none; border-radius: 5px; cursor: pointer; font-size: 13px; }
.btn-primary:hover   { background: #14304f; }
.btn-secondary:hover { background: #ddd; }
.btn-danger:hover    { background: #c0392b; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-link { color: #1a3a5c; text-decoration: underline; font-size: 12px; cursor: pointer; }

/* ── 로그인 ──────────────────────────────────────────────────────────────── */
.login-wrap {
  max-width: 360px; margin: 100px auto; padding: 40px;
  background: #fff; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.1);
  text-align: center;
}
.login-wrap h1 { font-size: 22px; margin-bottom: 28px; line-height: 1.4; color: #1a3a5c; }
.login-wrap h1 span { font-size: 14px; color: #888; display: block; margin-top: 4px; }
.login-wrap input {
  display: block; width: 100%; padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid #ccd3dc; border-radius: 5px; font-size: 14px;
}
.login-wrap button { width: 100%; margin-top: 4px; }
.error-msg { color: #e74c3c; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ── 관리자 메인 ─────────────────────────────────────────────────────────── */
.admin-main { flex: 1; overflow: auto; padding: 24px; }
.admin-panel h2 { font-size: 18px; margin-bottom: 16px; color: #1a3a5c; }
.count-badge { background: #e74c3c; color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 8px; }

/* ── 테이블 ──────────────────────────────────────────────────────────────── */
.record-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.record-table th { background: #f0f4f8; padding: 10px 14px; text-align: left; font-size: 12px; color: #666; font-weight: 600; }
.record-table td { padding: 10px 14px; border-top: 1px solid #eee; font-size: 13px; vertical-align: middle; }
.record-table tr:hover td { background: #fafcff; }

/* ── 모달 ────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 999;
}
.modal { background: #fff; border-radius: 10px; padding: 28px; width: 420px; }
.modal h3 { margin-bottom: 14px; color: #1a3a5c; }
.modal textarea { width: 100%; padding: 10px; border: 1px solid #ccd3dc; border-radius: 5px; font-size: 13px; resize: vertical; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
