/* ==========================================================================
   시나브로 체험단 — 기본 디자인 (v0.3.1 개편)
   색·간격·글꼴은 맨 위 :root 한 곳에서만 정한다. 화면별 모양은 app.css.
   상태 색은 기획.md §4-1 표와 같다: 회색·파랑·빨강·보라·주황·초록.
   ========================================================================== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f2f4f6;
  --ink: #191f28;
  --ink-2: #4e5968;
  --ink-3: #8b95a1;
  --line: #e5e8eb;
  --line-2: #d1d6db;

  --primary: #3062f0;          /* 버튼 · 선택 · 링크 */
  --primary-dark: #1f4bd1;
  --primary-ink: #ffffff;
  --primary-soft: #ebf1ff;
  --accent: #ff7a00;           /* 시간 · 급함 */
  --accent-soft: #fff3e6;
  --ok: #0ca678;
  --ok-soft: #e6f8f1;
  --warn: #f08c00;
  --warn-soft: #fff8e6;
  --danger: #e5484d;
  --danger-soft: #fdeded;
  --purple: #7048e8;
  --purple-soft: #f1edff;

  /* 상태 색 (기획 §4-1) */
  --st-gray: #6b7684;
  --st-blue: #3062f0;
  --st-red: #e5484d;
  --st-purple: #7048e8;
  --st-orange: #f08c00;
  --st-green: #0ca678;

  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --gap: 14px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
          "Malgun Gothic", "Noto Sans KR", sans-serif;
  --top-h: 56px;
  --tabbar-h: 64px;
  --shadow: 0 1px 2px rgba(25, 31, 40, .04), 0 6px 20px rgba(25, 31, 40, .05);
  --shadow-lg: 0 18px 50px rgba(25, 31, 40, .18);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.55; word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }   /* 교훈 32: display 가 hidden 을 이기지 않게 */
img { max-width: 100%; }
b, strong { font-weight: 700; }

/* ── 바탕 틀 ── */
.wrap { max-width: 560px; margin: 0 auto; padding: 20px 16px 28px; }
.wrap-wide { max-width: 1440px; padding-left: 24px; padding-right: 24px; }
.foot { text-align: center; color: var(--ink-3); font-size: 12px; padding: 8px 16px 28px; }
.rv .foot { padding-bottom: calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

/* ── 글자 ── */
.h1 { font-size: 24px; line-height: 1.3; margin: 4px 0 16px; letter-spacing: -.02em; font-weight: 800; }
.h2 { font-size: 17px; line-height: 1.35; margin: 0 0 12px; letter-spacing: -.01em; font-weight: 800; }
.eyebrow { margin: 0 0 6px; color: var(--primary); font-size: 13px; font-weight: 700; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }
.count { display: inline-block; min-width: 1.7em; padding: 1px .5em; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; text-align: center; vertical-align: 2px; font-weight: 700; }
.num-strong { font-variant-numeric: tabular-nums; font-weight: 800; }

/* ── 카드 ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: var(--gap); box-shadow: var(--shadow); }
.card.center { text-align: center; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-title-row .h2 { margin: 0; }
.empty { text-align: center; padding: 36px 18px; }
.empty-title { font-weight: 800; margin: 0 0 4px; }
.empty .muted { margin: 0; font-size: 14px; }
.empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M4 7h16M4 12h10M4 17h7'/%3E%3C/svg%3E") center / 22px no-repeat; }
.row-gap { margin-top: 18px; text-align: center; }

/* ── 버튼 ── */
.btn, .btn-small {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-ink);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, transform .05s;
}
.btn:hover, .btn-small:hover { background: var(--primary-dark); }
.btn:active, .btn-small:active { transform: scale(.98); }
.btn { min-height: 50px; padding: 0 20px; font-size: 16px; }
.btn-small { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-soft:hover { background: #dce6ff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c9353a; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #099268; }
.btn[disabled], .btn-small[disabled] { background: var(--line-2); color: #fff; cursor: not-allowed; }
.btn-text { background: none; border: 0; padding: 6px 2px; color: var(--ink-2); font: inherit;
  font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn:focus-visible, .btn-small:focus-visible, .btn-text:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 2px; }
.is-done { background: var(--ok) !important; color: #fff !important; }
.inline { display: inline; margin: 0; }

/* ── 입력 칸 ── */
.form label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--ink); }
.form input:not([type=checkbox]):not([type=radio]):not([type=file]), .form select, .form textarea {
  display: block; width: 100%; margin-top: 7px; min-height: 50px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: var(--radius-md); background: #fafbfc;
  font: inherit; font-size: 16px; font-weight: 500; color: var(--ink);  /* 16px: 폰에서 확대 안 되게 */
  transition: border-color .15s, background .15s;
}
.form textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--primary); background: #fff; outline: none;
  box-shadow: 0 0 0 4px var(--primary-soft); }
.form input::placeholder, .form textarea::placeholder { color: #adb5bd; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.req { font-size: 11px; font-weight: 800; color: var(--danger); margin-left: 3px; }
.opt { font-size: 12px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }

/* 칸 상태 색 (고칠것 #3) — 오류는 칸 전체를 빨갛게, 채운 칸은 초록, 비어 있는 필수 칸은 주황 */
.form label:has(.field-error) > input, .form label:has(.field-error) > select,
.form label:has(.field-error) > textarea, .form .is-error {
  border-color: var(--danger) !important; background: var(--danger-soft) !important; }
.form label:has(.field-error) { color: var(--danger); }
[data-fieldstate] .is-filled { border-color: #7ad3ae; background: #f3fcf8; }
[data-fieldstate] .is-need { border-color: #ffc078; background: #fffaf0; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-md);
  padding: 12px 14px; margin: 0 0 16px; font-size: 14px; font-weight: 700; border: 1px solid #f8c4c6; }
.field-error { display: block; color: var(--danger); font-weight: 600; font-size: 13px; margin-top: 6px; }
.check { display: flex !important; gap: 10px; align-items: center; margin: 12px 0 6px !important; font-weight: 600 !important; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.consent { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px; margin: 4px 0 16px; background: var(--surface-2); }
.consent-title { font-weight: 800; margin: 0 0 6px; font-size: 14px; }
.consent ul { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 14px; }
.tag { font-size: 11px; font-weight: 700; color: var(--warn); border: 1px solid currentColor; border-radius: 99px; padding: 0 6px; margin-left: 4px; }
fieldset.scope-box { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 12px 16px 6px; margin: 6px 0 16px; background: #fcfcfd; }
.scope-box legend { font-size: 13px; font-weight: 800; color: var(--ink-2); padding: 0 6px; }

/* ── 알림 띠 ── */
.flash { border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 14px; font-weight: 700; font-size: 14px; }
.flash-ok { background: var(--ok-soft); color: #087f5b; }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* ── 배지 · 알약 ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 800;
  background: color-mix(in srgb, var(--c, var(--st-gray)) 12%, white); color: var(--c, var(--st-gray)); white-space: nowrap; }
.badge-gray, .badge-pending { --c: var(--st-gray); }
.badge-blue { --c: var(--st-blue); }
.badge-red, .badge-blocked { --c: var(--st-red); }
.badge-purple { --c: var(--st-purple); }
.badge-orange { --c: var(--st-orange); }
.badge-green, .badge-active { --c: var(--st-green); }
.badge-canceled { --c: var(--st-gray); text-decoration: line-through; }
.badge-c-draft { --c: var(--st-gray); }
.badge-c-open { --c: var(--st-green); }
.badge-c-paused { --c: var(--st-orange); }
.badge-c-closed { --c: var(--ink-3); }
.tag-mini { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.tag-mini.warn { background: var(--danger-soft); color: var(--danger); }
.tag-mini.ok { background: var(--ok-soft); color: #087f5b; }
.pill { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 7px; background: rgba(25,31,40,.62); color: #fff; backdrop-filter: blur(4px); }
.pill-open { background: var(--primary); }
.pill-hot { background: var(--danger); }
.pill-upcoming { background: var(--purple); }
.pill-full, .pill-today_full, .pill-closed, .pill-ended, .pill-paused { background: #4e5968; }
.pill-type { background: rgba(255,255,255,.92); color: var(--purple); }
.pill-ship { background: rgba(255,255,255,.92); color: var(--ink-2); }

/* ── 표 · 목록 (관리자·진행자) ── */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--ink-3); font-weight: 700; font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.table td { white-space: nowrap; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: #fafbfc; }
.table tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table a.cnt { display: inline-block; min-width: 28px; padding: 2px 6px; border-radius: 7px; font-weight: 800; color: var(--ink); text-align: center; }
.table a.cnt:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.table a.cnt.zero { color: var(--line-2); font-weight: 500; }
.table a.cnt.alert { background: var(--danger-soft); color: var(--danger); }
.wrap-cell { white-space: normal !important; min-width: 180px; }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px 12px; margin: 0; }
.kv dt { color: var(--ink-3); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; }
.kv-tight { grid-template-columns: 84px 1fr; gap: 6px 10px; font-size: 14px; }
.kv-tight dd { font-weight: 600; }
.kv-rows { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 14px; }
.kv-rows dt, .kv-rows dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.kv-rows dt { color: var(--ink-3); padding-right: 12px; }
.kv-rows dd { text-align: right; font-weight: 700; }
.kv-rows dt:last-of-type, .kv-rows dd:last-of-type { border-bottom: 0; }

.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.head-row .h1, .head-row .h2 { margin: 4px 0; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.guide { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); }
details.confirm > summary { cursor: pointer; color: var(--ink-3); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; list-style: none; padding: 6px 0; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] { background: var(--danger-soft); border-radius: var(--radius-md); padding: 6px 12px 12px; }
.inline-details { display: inline-block; }
.copy-row { display: flex; gap: 8px; margin: 10px 0 6px; }
.copy-field { flex: 1; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); font: inherit; color: var(--ink-2); }
.sticky-save { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); z-index: 4; }

/* ── 단계 안내 팝업 (한 장씩 · 점) ── */
.modal { border: 0; border-radius: 22px; padding: 0; width: min(92vw, 440px); box-shadow: var(--shadow-lg); color: var(--ink); }
.modal::backdrop { background: rgba(25, 31, 40, .5); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.modal-head b { font-size: 16px; }
.modal-x { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 4px; }
.modal-body { padding: 22px 22px 8px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 20px 20px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.dots i.on { background: var(--primary); width: 18px; border-radius: 99px; }
