@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');

:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #1c2333;
  --muted: #6b7385;
  --line: #e4e7ee;
  --primary: #4353e8;
  --primary-dark: #3241c9;
  --primary-weak: #eef0fe;
  --success: #0c8a5f;
  --success-weak: #e7f7f0;
  --warn: #b86e00;
  --warn-weak: #fff5e3;
  --danger: #d23b3b;
  --danger-weak: #fdeeee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 4px 16px rgba(20, 30, 60, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* ---------- 카드 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface);
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-weak); border-color: #f5c6c6; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 배지 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.badge-primary { background: var(--primary-weak); color: var(--primary); border-color: transparent; }
.badge-success { background: var(--success-weak); color: var(--success); border-color: transparent; }
.badge-warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }
.badge-new { background: var(--danger); color: #fff; border-color: transparent; padding: 1px 6px; font-size: 11px; }

/* ---------- 폼 ---------- */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; color: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
textarea { resize: vertical; min-height: 80px; }
input[type=file] { font: inherit; width: 100%; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ---------- 파일 ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 8px; }
.thumb { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; padding: 0; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.missing::after { content: '이미지 없음'; font-size: 12px; color: var(--muted); }
.file-chip {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 9px 12px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.file-chip:hover { border-color: var(--primary); }
.file-chip .ellipsis { flex: 1; }

.empty { text-align: center; color: var(--muted); padding: 32px 12px; font-size: 14px; }
.feedback-box { background: var(--primary-weak); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.feedback-box strong { color: var(--primary); display: block; font-size: 12px; margin-bottom: 4px; }

/* ---------- 토스트 ---------- */
#toast-box { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1c2333; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: opacity .3s, transform .3s; }
.toast-error { background: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(8px); }

/* ---------- 사진 뷰어 ---------- */
.viewer { position: fixed; inset: 0; z-index: 900; background: rgba(10, 12, 20, .92); display: flex; flex-direction: column; }
.viewer-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: #fff; }
.viewer-name { flex: 1; font-size: 14px; font-weight: 600; opacity: .9; }
.viewer-count { font-size: 13px; opacity: .7; white-space: nowrap; }
.viewer-btn { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.viewer-btn:hover { background: rgba(255,255,255,.18); }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 16px; overflow: hidden; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; border-radius: 4px; background: #fff; }
.viewer-stage.zoomed { overflow: auto; align-items: flex-start; justify-content: flex-start; }
.viewer-stage.zoomed img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font-size: 34px; line-height: 1; }
.viewer-nav:hover { background: rgba(255,255,255,.24); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
@media (max-width: 600px) {
  .viewer-nav { width: 38px; height: 52px; font-size: 26px; }
  .viewer-btn[data-act="zoom"] { display: none; }
}
