:root {
  --primary: #2f5d50;
  --primary-ink: #fff;
  --bg: #f6f5f1;
  --card: #ffffff;
  --ink: #1d2320;
  --muted: #6b726e;
  --line: #e4e2db;
  --soft: #eef2ef;
  --danger: #b4412f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.55; font-size: 15px;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* 상단 바 */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar .in { max-width: 1100px; margin: 0 auto; padding: 12px 18px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 34px; width: auto; border-radius: 6px; }
.brand .name { font-weight: 800; font-size: 17px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; white-space: nowrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 18px 60px; }
h1 { font-size: 24px; letter-spacing: -.03em; margin: 0 0 4px; }
h2 { font-size: 19px; letter-spacing: -.02em; margin: 0; }
.sub { color: var(--muted); margin: 0 0 18px; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #cfccc3; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

/* 입력 */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* 카드 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 20px; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 30px 26px; }
.login .logo { text-align: center; margin-bottom: 8px; }
.login .logo img { max-height: 64px; max-width: 200px; }
.login h1 { text-align: center; }
.login .sub { text-align: center; }
.msg { font-size: 14px; margin-top: 10px; min-height: 20px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--primary); }

/* 공지 */
.notice { background: color-mix(in srgb, var(--primary) 9%, #fff); border: 1px solid color-mix(in srgb, var(--primary) 25%, #fff);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; white-space: pre-wrap; }

/* 반 탭 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 14px; white-space: nowrap; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .cnt { font-weight: 600; opacity: .6; margin-left: 4px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 260px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); cursor: pointer; user-select: none; }

/* 영상 카드 목록 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.vcard { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: transform .12s, box-shadow .12s; }
.vcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 85%, #000), color-mix(in srgb, var(--primary) 55%, #fff));
  display: grid; place-items: center; position: relative; color: #fff; }
.thumb .play { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.thumb .play::after { content: ""; border-left: 16px solid #fff; border-top: 10px solid transparent; border-bottom: 10px solid transparent; margin-left: 4px; }
.badge { position: absolute; top: 10px; left: 10px; background: #e8553f; color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; letter-spacing: .04em; }
.badge.done { left: auto; right: 10px; background: rgba(0,0,0,.55); }
.vcard .bar { height: 4px; background: rgba(0,0,0,.08); }
.vcard .bar > i { display: block; height: 100%; background: var(--primary); }
.vcard .meta { padding: 12px 14px 14px; }
.vcard .t { font-weight: 700; letter-spacing: -.01em; line-height: 1.4; }
.vcard .g { font-size: 12.5px; color: var(--primary); font-weight: 700; margin-bottom: 2px; }
.vcard .d { font-size: 13px; color: var(--muted); margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }

/* 시청 페이지 */
.player { background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; display: block; max-height: 75vh; background: #000; }
.watch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 16px 0 6px; }
.desc { white-space: pre-wrap; color: #3b423e; }
.resume { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--soft); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }
.list { margin-top: 26px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: inherit; }
.row:hover { background: var(--soft); }
.row.on { background: color-mix(in srgb, var(--primary) 10%, #fff); }
.row .mini { width: 40px; height: 40px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 800; }
.row .x { min-width: 0; flex: 1; }
.row .x .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .x .d { font-size: 12.5px; color: var(--muted); }

/* 관리자 */
.adm-nav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.adm-nav button { border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.adm-nav button.on { color: var(--ink); border-bottom-color: var(--primary); }
.split { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.side { padding: 8px; }
.side .it { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; }
.side .it:hover { background: var(--soft); }
.side .it.on { background: var(--ink); color: #fff; }
.side .it small { opacity: .6; font-weight: 600; }
.sec-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: .15s; }
.drop.over { border-color: var(--primary); background: var(--soft); color: var(--ink); }
.uploads { margin-top: 10px; display: grid; gap: 8px; }
.up { font-size: 13px; }
.up .pb { height: 6px; background: var(--soft); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.up .pb i { display: block; height: 100%; background: var(--primary); width: 0; transition: width .2s; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { font-size: 12.5px; color: var(--muted); font-weight: 700; background: #faf9f6; position: sticky; top: 0; }
.scroll { overflow: auto; max-height: 70vh; }
.chip { display: inline-block; background: var(--soft); color: var(--ink); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 700; margin: 2px 3px 2px 0; }
.chip.off { background: #f1e3e0; color: var(--danger); }
.vitem { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 8px; }
.vitem + .vitem { margin-top: 10px; }
.vitem .top { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.vitem .file { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.vitem.is-hidden { opacity: .6; }
.cell { text-align: center !important; font-weight: 700; font-size: 13px; }
.cell.c0 { color: #b9b6ad; }
.cell.c1 { background: #fbf1d9; }
.cell.c2 { background: color-mix(in srgb, var(--primary) 18%, #fff); color: var(--primary); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.swatch { width: 44px; height: 40px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.logo-prev { max-height: 60px; max-width: 220px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.cls-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; z-index: 99; box-shadow: var(--shadow); }
footer.ft { text-align: center; color: var(--muted); font-size: 12.5px; padding: 30px 0 10px; }

/* 소셜 로그인 */
.social { display: grid; gap: 8px; margin-bottom: 16px; }
.sbtn { display: block; text-align: center; padding: 12px; border-radius: 10px; font-weight: 700; text-decoration: none; }
.sbtn.kakao { background: #FEE500; color: #191919; }
.sbtn.naver { background: #03C75A; color: #fff; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #e8553f; color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-left: 4px; }
.pcard { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 10px; }
.pcard + .pcard { margin-top: 10px; }
.pcard .kv { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; font-size: 14px; }
.pcard .kv b { color: var(--muted); font-weight: 700; font-size: 13px; }
.warn { background: #fbf1d9; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.policy { white-space: pre-wrap; line-height: 1.7; }
.subs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.sub-chip { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 12px; font-weight: 700; font-size: 13.5px; cursor: pointer; }
.sub-chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.docs { padding: 6px 8px; margin-bottom: 16px; }
.docs-head { font-weight: 800; padding: 10px 10px 6px; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; }
.doc-row + .doc-row { border-top: 1px solid var(--line); }
.doc-row .ext { flex: none; width: 44px; height: 44px; border-radius: 9px; background: var(--soft); color: var(--primary); font-weight: 800; font-size: 11.5px; display: grid; place-items: center; }
.doc-row .x { flex: 1; min-width: 0; }
.doc-row .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row .d { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-s { background: #e8553f; color: #fff; font-size: 10px; font-weight: 800; padding: 1px 5px; border-radius: 4px; vertical-align: 2px; }

/* 게시판 */
.board { overflow: hidden; }
.post-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--soft); }
.post-row.pinned { background: color-mix(in srgb, var(--primary) 5%, #fff); }
.post-row .x { flex: 1; min-width: 0; }
.post-row .t { font-weight: 700; font-size: 15.5px; line-height: 1.45; }
.post-row .d { font-size: 13px; color: var(--muted); margin-top: 3px; }
.post-row .st { flex: none; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--soft); padding: 4px 10px; border-radius: 999px; }
.post-row .st.done { color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, #fff); }
.pin { display: inline-block; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 5px; margin-right: 6px; vertical-align: 2px; }
.cls { display: inline-block; color: var(--primary); font-size: 12.5px; font-weight: 800; margin-right: 6px; }
.board .empty { padding: 40px 10px; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
a.file-row:hover { background: var(--soft); }
.file-row .ico { flex: none; width: 44px; height: 44px; border-radius: 10px; background: var(--soft); color: var(--primary); font-weight: 800; font-size: 11.5px; display: grid; place-items: center; }
.file-row .ico.vid { background: var(--primary); color: #fff; font-size: 15px; }
.file-row .x { flex: 1; min-width: 0; }
.file-row .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .d { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar { height: 4px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-top: 6px; max-width: 220px; }
.pbar i { display: block; height: 100%; background: var(--primary); }
.post-head { margin-bottom: 18px; }
.post-body { white-space: pre-wrap; line-height: 1.75; font-size: 15.5px; margin-bottom: 22px; }
.sec-h { font-size: 15px; font-weight: 800; margin: 0 0 8px; }
.boards { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 16px; max-width: 460px; }
.board-tab { border: 0; background: none; padding: 10px 8px; border-radius: 9px; font-weight: 800; font-size: 14.5px; cursor: pointer; color: var(--muted); }
.board-tab.on { background: var(--primary); color: #fff; }
.board-tab .cnt { font-weight: 700; opacity: .75; margin-left: 2px; }
