/* 공통 스타일. design/mockups/mock.css의 토큰·컴포넌트를 그대로 옮겼다(값을 바꾸면 시안과 어긋난다). */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --line: #e7e4dd;
  --line-strong: #d6d1c7;
  --text: #1d1b18;
  --text-2: #5f5a52;
  --text-3: #8f897e;
  --brand: #2f4a3a;        /* 짙은 올리브 그린 */
  --brand-soft: #e8efe9;
  --accent: #b5762a;       /* 따뜻한 금색 */
  --ok: #2f7a4b;   --ok-soft: #e4f3e9;
  --warn: #a8660d; --warn-soft: #fbf0dc;
  --bad: #b3372b;  --bad-soft: #fbe7e4;
  --info: #2c5d9c; --info-soft: #e5eef9;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(29,27,24,.05), 0 4px 16px rgba(29,27,24,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { word-break: keep-all; overflow-wrap: anywhere; /* 한국어를 낱말 단위로 줄바꿈 */ }
[data-my-count-m]:not(:empty) { margin-left: .3em; }
html, body { background: var(--bg); color: var(--text); font-family: "Pretendard Variable", Pretendard, sans-serif; /* 시안과 같은 목록(✓ 같은 기호의 대체 글꼴까지 같아진다) */ -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 공통 컴포넌트 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; letter-spacing: normal; /* 시안의 .btn은 button(자간 normal) */ }
/* 시안에서 div·span이던 것을 button으로 만든 요소는 본문 자간을 그대로 받는다 */
.tab, .toggle, .seg button, .mode, .pick, .more, .linkbtn, .nav, .menu button, .side .me button { letter-spacing: inherit; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { background: var(--surface); border-color: #e6c3be; color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 11px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.busy { opacity: .7; cursor: progress; }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.plain::before { display: none; }
.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.live { background: var(--ok-soft); color: var(--ok); }
.chip.rejected { background: var(--bad-soft); color: var(--bad); }
.chip.scheduled { background: var(--info-soft); color: var(--info); }
.chip.expired { background: #eeece8; color: var(--text-3); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; display: block; }
.input { height: 44px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; padding: 0 14px; display: flex; align-items: center; font-size: 15px; color: var(--text); width: 100%; position: relative; }
.input.placeholder { color: var(--text-3); }
.input .suffix { margin-left: auto; color: var(--text-3); pointer-events: none; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.hint.error { color: var(--bad); font-weight: 600; }
/* 실제 입력 요소를 .input 모양에 맞춘다 */
input.input, textarea.input, select.input { outline: none; appearance: none; -webkit-appearance: none; }
input.input::placeholder, textarea.input::placeholder { color: var(--text-3); opacity: 1; }
textarea.input { height: 72px; padding: 12px 14px; resize: vertical; line-height: 1.45; display: block; }
.input:focus-within, input.input:focus, textarea.input:focus, select.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,74,58,.12); }
.input.invalid { border-color: var(--bad); }
/* 선택 상자: 글자는 .input과 같고 오른쪽에 ▾ */
.select-wrap { position: relative; }
.select-wrap select.input { padding-right: 36px; cursor: pointer; }
.select-wrap .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
/* 날짜·시간: 보이는 글자는 span, 실제 input은 투명하게 위에 겹친다 */
.input.picker { cursor: pointer; }
.input.picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }

.toggle { width: 38px; height: 22px; border-radius: 999px; background: #d9d5cd; position: relative; flex: none; border: 0; padding: 0; transition: background .15s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.toggle.on, .toggle[aria-checked="true"] { background: var(--brand); }
.toggle.on::after, .toggle[aria-checked="true"]::after { left: 19px; }
.toggle:disabled { opacity: .5; cursor: default; }

/* ---------- 브랜드 ---------- */
.brandmark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; text-decoration: none; color: inherit; }
.brandmark .logo { width: 48px; height: 32px; display: grid; place-items: center; flex: none; } /* 교회 마크(가로형) */
.brandmark .logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brandmark b { font-size: 15px; display: block; }
.brandmark small { font-size: 12px; color: var(--text-3); }

/* ---------- 관리자 레이아웃 ---------- */
.admin { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #fbfaf8; border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.nav-sec { font-size: 11.5px; font-weight: 700; color: var(--text-3); padding: 14px 10px 6px; letter-spacing: .04em; }
.nav { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 8px; font-size: 14.5px; font-weight: 500; color: var(--text-2); text-decoration: none; }
.nav:hover { background: #f1efea; }
.nav svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.nav .count.muted { background: #e6e2da; color: var(--text-2); }
.side .tv-status { margin-top: auto; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px; font-size: 12.5px; color: var(--text-2); }
.tv-status .row { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--text); font-size: 13.5px; margin-bottom: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2fae5f; box-shadow: 0 0 0 3px rgba(47,174,95,.18); flex: none; }
.dot.off { background: #c9473a; box-shadow: 0 0 0 3px rgba(201,71,58,.18); }
.dot.idle { background: #b8b2a6; box-shadow: 0 0 0 3px rgba(184,178,166,.25); }
.side .me { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 4px 0; font-size: 12px; color: var(--text-3); }
.side .me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .me button { border: 0; background: none; color: var(--text-2); font-size: 12px; font-weight: 600; padding: 2px 4px; }

.main { padding: 28px 36px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.page-head h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.tab { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; border: 1px solid transparent; background: none; }
.tab.active { background: var(--surface); border-color: var(--line-strong); color: var(--text); box-shadow: var(--shadow); }
.tab .n { color: var(--text-3); font-weight: 700; }

/* ---------- 포스터 이미지 ---------- */
.poster { aspect-ratio: 1 / 1.414; position: relative; overflow: hidden; border-radius: 4px; background: #e9e6df; }
.poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.poster.fit img { object-fit: contain; }

/* ---------- 상단바(등록·내 현황) ---------- */
.topbar { height: 64px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 32px; gap: 28px; }
.topbar .brandmark { padding: 0; }
.topbar .links { display: flex; gap: 4px; margin-left: 12px; }
.topbar .links a { height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14.5px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; text-decoration: none; gap: 6px; }
.topbar .links a.on { background: var(--brand-soft); color: var(--brand); }
.topbar .links a .n { font-size: 12px; font-weight: 700; color: var(--text-3); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.topbar .right a { font-size: 13.5px; color: var(--text-3); text-decoration: none; font-weight: 600; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 32px 32px 48px; }
/* 모바일 전용 세그먼트(내비) */
.seg-nav { display: none; }

/* ---------- 토스트 · 모달 · 빈 상태 ---------- */
.toast-box { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #23261f; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.22); animation: toast-in .2s ease-out; max-width: min(520px, calc(100vw - 32px)); }
.toast.bad { background: var(--bad); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.scrim { position: fixed; inset: 0; background: rgba(24,22,18,.48); z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); /* 열을 화면 폭으로 묶어야 .modal의 max-width: 100%가 먹는다 */ place-items: center; padding: 16px; }
.modal { width: 560px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.mh { padding: 22px 24px 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.mh h2 { font-size: 20px; font-weight: 800; }
.mh p { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.close { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); font-size: 20px; border: 0; background: none; flex: none; }
.mb { padding: 18px 24px 22px; display: grid; gap: 18px; }
.mf { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: #fcfbf9; }
.mf .btn { height: 44px; padding: 0 20px; }

.empty-state { padding: 48px 24px; text-align: center; color: var(--text-2); font-size: 14.5px; display: grid; gap: 8px; justify-items: center; }
.empty-state b { color: var(--text); font-size: 16px; }
.empty-state .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; margin-bottom: 6px; }
.loading { padding: 40px; text-align: center; color: var(--text-3); font-size: 14px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
