/* ==========================================================================
   수강생 관리 — 디자인 시스템 (딥네이비 · Wanted Sans)
   ========================================================================== */
:root {
  color-scheme: light;
  --navy-950: #070F24; --navy-900: #0B1A3A; --navy-800: #112650; --navy-700: #17325F;
  --navy-600: #1F4280; --navy-500: #2A56A3; --navy-400: #4F79C2; --navy-300: #8FA8D8;
  --navy-200: #C3D1EC; --navy-100: #E4EAF6; --navy-50: #F3F6FB;
  --gold: #D9A441; --gold-soft: #FBF1DC; --gold-ink: #8A5E0A;
  --navy-ink: #17325F; /* 네이비 글자·아이콘색: 라이트 navy-700, 다크 navy-500 — 채움은 navy-700 그대로 */
  --ink: #141C2E; --ink-2: #3B4660; --ink-3: #6C7891; --ink-4: #98A2B8;
  --line: #E3E8F0; --line-2: #CBD3E1; --bg: #F4F6FA; --card: #FFFFFF;
  --ok: #1B7B50; --ok-bg: #E3F4EB; --warn: #97641A; --warn-bg: #FDF3DF;
  --bad: #C4372D; --bad-bg: #FCE9E7; --info: #2A56A3; --info-bg: #E4EAF6;
  --vid: #5B4FA8; --vid-bg: #ECE9F8;
  --sup: #23767F; --sup-bg: #E0F0F2;
  --chip-on: #FFFFFF;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 8px 30px rgba(11, 26, 58, .14);
  --sidebar-w: 236px; --tabbar-h: 62px; --topbar-h: 54px;
  --font: "Wanted Sans Variable", "Wanted Sans", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui,
          Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  /* ---- 파운데이션 토큰 (디자인 방향서 v1, 2026-09-04) — Figma 변수와 이름 1:1, 정본은 design/tokens.json ---- */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-10: 40px; --space-12: 48px;
  --fs-xs: 12.5px; --fs-sm: 13.5px; --fs-md: 14.5px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 23px; --fs-3xl: 30px; --fs-4xl: 40px;
  --lh-body: 1.5; --lh-head: 1.25; --lh-display: 1;
  --r-xs: 6px; --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-pill: 999px;
  --el-0: none; --el-1: var(--shadow); --el-2: var(--shadow-lg);
  --dur-1: 120ms; --dur-2: 200ms; --dur-3: 320ms;
  --ease-standard: cubic-bezier(.2, 0, 0, 1); --ease-decel: cubic-bezier(0, 0, 0, 1); --ease-exit: cubic-bezier(.4, 0, 1, 1);
  --ease-spring: linear(0, .25 8%, .68 16%, 1.02 27%, 1.06 35%, 1.01 47%, .985 58%, 1);
  /* 브레이크포인트(미디어 쿼리는 변수 불가, 문서용): phone 600px · tablet 900px(내비 전환) · wide 1280px */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--ink); font-size: var(--fs-md);
  line-height: 1.5; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
  /* Wanted Sans는 화면용 자간이 내장되어 별도 보정 불필요 */
  letter-spacing: 0;
  word-break: keep-all; overflow-wrap: break-word; /* 한국어는 어절 단위로 줄바꿈, 긴 URL은 잘라서 */
}
a { color: var(--navy-500); text-decoration: none; }
@media (hover: hover) { a:hover { text-decoration: underline; } }
b, strong { font-weight: 700; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }

/* ---------- 앱(PWA) 터치 규칙: 회색 탭 하이라이트 제거, 더블탭 확대 지연 제거, 길게 눌러도 글자 선택 안 됨 ---------- */
a, button, .chip, .seg label, .tabbar a, .tabs a, .item, .swatch { -webkit-tap-highlight-color: transparent; }
.chip, .seg label, .tabbar a, .tabs a, .swatch, .icon-btn, .hwslide input[type=range] { touch-action: manipulation; user-select: none; -webkit-user-select: none; }
@media (prefers-reduced-motion: reduce) {
  .btn:active, .class-card:hover { transform: none; }
  .class-card, .btn, .chip, .seg label > span { transition: none; }
  .toast { animation: toastfade .2s ease-out; }
  .seg input:checked + span, .stats .num, .badge.gold, .st-gold { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
@keyframes toastfade { from { opacity: 0; } to { opacity: 1; } }
/* 모션 카탈로그(방향서 v2): 도장 · 숫자 등장 · 골드 순간 · 페이지 전환. 행동에 답하고, 화면당 자동 재생 1개 */
@keyframes stamp { 0% { transform: scale(.92); } 55% { transform: scale(1.045); } 100% { transform: scale(1); } }
@keyframes numin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes goldin { 0% { transform: scale(.9); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: none; opacity: 1; } }
.stats .num { animation: numin 600ms var(--ease-decel) both; }
.badge.gold, .st-gold { animation: goldin 700ms var(--ease-decel) both; }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: var(--dur-2); animation-timing-function: var(--ease-standard); }
::selection { background: var(--navy-200); }


/* ---------- 아이콘 기본 크기 ---------- */
svg.i { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -4px; }
.banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
h1 svg, h2 svg, h3 svg { width: 18px; height: 18px; vertical-align: -3px; }
.hint svg, .small svg { width: 14px; height: 14px; vertical-align: -2px; }
.topbar .tacts svg { width: 20px; height: 20px; vertical-align: -5px; }
.tabs svg { width: 16px; height: 16px; vertical-align: -3px; }
.sidebar .foot svg { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- 레이아웃 ---------- */
.layout { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: var(--navy-900); color: #fff;
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column; padding: 18px 12px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--navy-500), var(--navy-700));
  display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand .t { font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.02em; line-height: 1.15; }
.brand .s { font-size: 11.5px; color: var(--navy-300); font-weight: 500; }
.nav-group { font-size: 11px; font-weight: 700; color: var(--navy-400); letter-spacing: .06em;
  padding: 14px 12px 6px; text-transform: uppercase; }
.nav a {
  display: flex; align-items: center; gap: 10px; color: #CFD9EE; padding: 9px 12px;
  border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 500; margin-bottom: 2px;
}
.nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
@media (hover: hover) { .nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; } }
.nav a.on { background: var(--navy-600); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.nav a.on svg { opacity: 1; }
.nav .cnt { margin-left: auto; background: var(--navy-100); color: var(--navy-800); font-size: 11px;
  font-weight: 800; border-radius: 10px; padding: 1px 7px; }
.sidebar .foot { margin-top: auto; padding: 14px 12px 0; font-size: 12px; color: var(--navy-300);
  border-top: 1px solid rgba(255,255,255,.08); display: flex; justify-content: space-between; align-items: center; }
.sidebar .foot a { color: var(--navy-200); }

main { flex: 1; min-width: 0; padding: 26px 32px 60px; max-width: 1180px; }
.topbar { display: none; }
.tabbar { display: none; }

/* ---------- 페이지 헤더 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.page-head .sub { color: var(--ink-3); font-size: var(--fs-sm); margin-top: 4px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumb a { color: var(--ink-3); }
.crumb .sep { color: var(--ink-4); }
h2.sec { font-size: var(--fs-lg); font-weight: 700; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
h2.sec:first-child { margin-top: 0; }
h2.sec .hint { font-weight: 500; }
h3 { font-size: var(--fs-md); font-weight: 700; margin-bottom: 10px; }

/* ---------- 카드 · 그리드 ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; border: 1px solid var(--line); } /* elevation/0: 카드는 테두리만 */
.card.tight { padding: 12px 14px; }
.card.narrow { max-width: 620px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); }
.stat .num { font-size: var(--fs-3xl); font-weight: 800; color: var(--navy-ink); letter-spacing: -0.03em; line-height: var(--lh-display); }
.stat .lbl { color: var(--ink-3); font-size: var(--fs-xs); margin-top: 4px; }
/* 홈 벤토: 오늘 큰 타일 1 + 작은 통계 3 (방향서 Q3) */
.bento { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; margin-bottom: 16px; }
.bento .today-card, .bento .stats { margin-bottom: 0; }
.bento .stats { grid-template-columns: 1fr; }
.stat.accent { background: var(--navy-800); border-color: var(--navy-800); }
.stat.accent .num { color: #fff; } .stat.accent .lbl { color: var(--navy-300); }

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--navy-700); color: #fff;
  border: 1px solid var(--navy-700); border-radius: var(--r-sm); padding: 9px 16px; font-size: var(--fs-md); font-weight: 600;
  cursor: pointer; line-height: 1.2; white-space: nowrap; transition: background .12s, box-shadow .12s, transform .08s; min-height: 38px;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 16px; height: 16px; }
@media (hover: hover) { .btn:hover { background: var(--navy-800); text-decoration: none; } }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--card); color: var(--navy-ink); border-color: var(--line-2); }
@media (hover: hover) { .btn.ghost:hover { background: var(--navy-50); border-color: var(--navy-300); } }
.btn.soft { background: var(--navy-100); color: var(--navy-ink); border-color: transparent; }
@media (hover: hover) { .btn.soft:hover { background: var(--navy-200); } }
.btn.gold { background: var(--gold); color: var(--navy-950); border-color: var(--gold); }
@media (hover: hover) { .btn.gold:hover { background: #C9953A; } }
.btn.danger { background: var(--card); color: var(--bad); border-color: #EFC4BF; }
@media (hover: hover) { .btn.danger:hover { background: var(--bad-bg); } }
.btn.sm { padding: 5px 10px; font-size: var(--fs-xs); min-height: 30px; border-radius: var(--r-xs); }
.btn.lg { padding: 12px 22px; font-size: var(--fs-lg); min-height: 46px; border-radius: var(--r-sm); }
.btn.block { width: 100%; }
.btn.icon { padding: 6px; min-height: 32px; width: 32px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.acts, .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.sticky-actions {
  position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 75%, rgba(244,246,250,0));
  padding: 14px 0 8px; display: flex; gap: 8px; flex-wrap: wrap; z-index: 5;
}
form.inline { display: inline; }

/* ---------- 폼 ---------- */
.vform label, .field { display: block; margin-bottom: 14px; font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); }
.vform input:not([type=checkbox]):not([type=radio]), .vform select, .vform textarea,
.input, select.input, textarea.input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); font-size: var(--fs-md); font-weight: 400; background: var(--card); color: var(--ink); min-height: 42px;
  transition: border-color .12s, box-shadow .12s;
}
.vform input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=range]):not([type=color]), .vform textarea, .input:not(select), textarea.input { appearance: none; -webkit-appearance: none; }
.vform input:focus, .vform select:focus, .vform textarea:focus, .input:focus {
  outline: none; border-color: var(--navy-400); box-shadow: 0 0 0 3px var(--navy-100);
}
.vform textarea { resize: vertical; line-height: 1.5; }
.vform .checkline, .checkline { font-weight: 600; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkline input { width: 18px; height: 18px; accent-color: var(--navy-600); margin: 0; }
.hint { font-weight: 400; font-size: var(--fs-xs); color: var(--ink-3); }
.req { color: var(--bad); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { margin-top: 0; flex: 1; }
.search { position: relative; }
.search .input { padding-left: 36px; margin-top: 0; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-4); }

/* 체크 칩 (요일 선택 · 수업 선택) */
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 6px 13px; color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; line-height: 1.2; min-height: 34px; }
@media (hover: hover) { .chip:hover { border-color: var(--navy-400); text-decoration: none; } }
.chip.on, .chip:has(input:checked) { background: var(--navy-700); border-color: var(--navy-700); color: #fff; font-weight: 700; }
.chip input { display: none; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.on .dot, .chip:has(input:checked) .dot { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; border: 2px solid transparent; }
.swatch input { display: none; }
.swatch:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 2px var(--bg) inset; }

/* 세그먼트(출결·과제 선택 — 탭 한 번으로 저장) */
.seg { display: inline-flex; background: var(--navy-50); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg label { position: relative; cursor: pointer; display: flex; }   /* flex: 인라인 베이스라인 여백 제거 → 줄 높이 최소화 */
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label > span { display: inline-flex; align-items: center; justify-content: center; padding: 0 11px; height: 36px; border-radius: var(--r-xs); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-3); white-space: nowrap; transition: all .1s; min-width: 44px; }
@media (hover: hover) { .seg label:hover > span { color: var(--ink); } }
.seg input:checked + span { background: var(--chip-on); color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.12); animation: stamp 220ms var(--ease-decel); } /* 도장: 0.92 → 1.045 → 1 */
.seg input[value="출석"]:checked + span { background: var(--ok); color: #fff; }
.seg input[value="지각"]:checked + span, .seg input[value="조퇴"]:checked + span { background: var(--warn); color: #fff; }
.seg input[value="결석"]:checked + span { background: var(--bad); color: #fff; }
/* 과제 완료율 6칸 (0·20·40·60·80·100) — 80 이상 초록 · 40~60 노랑 · 20 이하 빨강 */
.seg.hw label > span { min-width: 40px; padding: 0 7px; }
.seg > .seg-lab { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; width: auto; font-size: 11px; font-weight: 700; color: var(--ink-4); padding: 0 5px 0 4px; white-space: nowrap; }
.seg.hw input[value="100"]:checked + span, .seg.hw input[value="80"]:checked + span { background: var(--ok); color: #fff; }
.seg.hw input[value="60"]:checked + span, .seg.hw input[value="40"]:checked + span { background: var(--warn); color: #fff; }
.seg.hw input[value="20"]:checked + span, .seg.hw input[value="0"]:checked + span { background: var(--bad); color: #fff; }
.seg.hw .hwcur { color: var(--ink-2); }
/* 과제 입력 방식 전환: 탭 6칸(기본) ↔ 10% 슬라이드 — .check-list.hw-slider 클래스로 표시 전환 */
.hw-cell { display: flex; align-items: center; min-width: 0; justify-content: flex-start; }
.hwslide { display: none; align-items: center; gap: 8px; width: 100%; max-width: 520px; min-width: 250px; }
.check-list.hw-slider .seg.hw { display: none; }
.check-list.hw-slider .hwslide { display: flex; }
.hwslide .seg-lab { font-size: 11px; font-weight: 700; color: var(--ink-4); white-space: nowrap; }
.hwslide input[type=range] { flex: 1; min-width: 0; height: 34px; margin: 0; cursor: pointer; accent-color: var(--c, var(--navy-400)); }
.hwslide input[type=range].unset { opacity: .45; }
.hwslide .val { min-width: 50px; text-align: center; font-weight: 800; font-size: 13px; border-radius: 8px; padding: 5px 6px; background: var(--navy-50); color: var(--ink-3); border: 1px solid var(--line); white-space: nowrap; }
.hwslide .val.good { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.hwslide .val.mid { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.hwslide .val.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.seg.mode label > span { min-width: 0; padding: 0 9px; height: 28px; font-size: 12px; }
.seg.mode input:checked + span { background: var(--navy-700); color: #fff; }

/* ---------- 테이블 · 리스트 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--navy-50); font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; font-weight: 700; }
th:first-child { border-top-left-radius: 8px; } th:last-child { border-top-right-radius: 8px; }
tr:last-child td { border-bottom: 0; }
tr.dim { opacity: .5; }
td.num, th.num { text-align: right; }
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); color: inherit; }
.list .item:last-child { border-bottom: 0; }
@media (hover: hover) { .list a.item:hover { background: var(--navy-50); text-decoration: none; border-radius: 8px; } }
.item .main { flex: 1; min-width: 0; }
.item .selbox { display: flex; align-items: center; padding: 6px; margin: -6px 0 -6px -4px; cursor: pointer; }
.item .selbox input { width: 17px; height: 17px; accent-color: var(--navy-500); cursor: pointer; }
.item-link { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: inherit; }
.item-link:hover { text-decoration: none; }
.item .title { font-weight: 700; font-size: var(--fs-md); }
.item .meta { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }
.item .right { text-align: right; font-size: var(--fs-sm); color: var(--ink-2); white-space: nowrap; }
.item .chev { color: var(--ink-4); width: 18px; height: 18px; flex-shrink: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--navy-100); color: var(--navy-ink); display: grid; place-items: center; font-weight: 800; font-size: var(--fs-md); flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: var(--fs-xs); }
.empty { text-align: center; padding: 36px 14px; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 8px; }
.empty p { margin-bottom: 12px; }

/* ---------- 배지 · 필 ---------- */
.badge { display: inline-block; background: var(--navy-100); color: var(--navy-ink); border-radius: var(--r-xs); padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700; line-height: 1.5; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.err, .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.grade { background: var(--navy-700); color: #fff; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill { display: inline-block; border-radius: var(--r-pill); padding: 2px 9px; font-size: var(--fs-xs); margin: 1px 3px 1px 0; font-weight: 600; }
.pill.good { background: var(--ok-bg); color: var(--ok); }
.pill.mid { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.pill.vid { background: var(--vid-bg); color: var(--vid); }
.pill.plain { background: var(--navy-50); color: var(--ink-2); }
.cls-tag { display: inline-flex; align-items: center; gap: 5px; color: #fff; border-radius: var(--r-xs); padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.cls-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.st { display: inline-block; border-radius: var(--r-xs); padding: 2px 8px; font-size: var(--fs-xs); font-weight: 700; }
.st-출석, .st-good { background: var(--ok-bg); color: var(--ok); }
.st-mid { background: var(--warn-bg); color: var(--warn); }
.st-bad { background: var(--bad-bg); color: var(--bad); }
.st-지각, .st-조퇴 { background: var(--warn-bg); color: var(--warn); }
.st-결석 { background: var(--bad-bg); color: var(--bad); }
.st-none { background: var(--navy-50); color: var(--ink-4); font-weight: 500; }
.st-gold { background: var(--gold-soft); color: var(--gold-ink); }
.warn { color: var(--bad); font-weight: 700; }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-xs); }
.mono { font-family: "JetBrains Mono", Consolas, "SF Mono", monospace; letter-spacing: 1.5px; }
.up { color: var(--ok); font-weight: 800; font-size: 12px; margin-left: 3px; }
.down { color: var(--bad); font-weight: 800; font-size: 12px; margin-left: 3px; }
.kbd { font-family: inherit; background: var(--navy-50); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--navy-ink); }

/* ---------- 알림 · 배너 ---------- */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy-900); color: #fff; border-radius: var(--r-sm); padding: 12px 16px; font-weight: 600; font-size: var(--fs-md); box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: toastin var(--dur-2) var(--ease-decel); border-left: 4px solid var(--navy-400); }
.toast.err { border-left-color: #F09084; } /* 네이비 면 위라 다크 모드 값(--bad dark) 고정 */
.toast.ok { border-left-color: #63C08F; }
.toast .x { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: 0; color: #fff; font-size: 16px; line-height: 1; }
@keyframes toastin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.banner { padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: var(--fs-sm); display: flex; gap: 10px; align-items: flex-start; }
.banner.test { background: var(--warn-bg); border: 1px solid var(--line-2); color: var(--warn); }
.banner.live { background: var(--bad-bg); border: 1px solid var(--line-2); color: var(--bad); }
.banner.info { background: var(--info-bg); border: 1px solid var(--line-2); color: var(--info); }
.banner.ok { background: var(--ok-bg); border: 1px solid var(--line-2); color: var(--ok); }

/* ---------- 탭 ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; font-size: var(--fs-md); transition: color var(--dur-2) var(--ease-standard), border-color var(--dur-2) var(--ease-standard); }
@media (hover: hover) { .tabs a:hover { color: var(--ink); text-decoration: none; } }
.tabs a.on { color: var(--navy-ink); border-bottom-color: var(--navy-ink); }
.tabs .cnt { font-size: var(--fs-xs); color: var(--ink-4); margin-left: 4px; font-weight: 600; }

/* ---------- 그래프류 ---------- */
.bar { position: relative; background: var(--navy-50); border-radius: 6px; height: 20px; min-width: 110px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--navy-400); border-radius: 6px; }
.bar .fill.bad { background: #E69A90; }
.bar .fill.ok { background: #6FC7A0; }
.bar span { position: absolute; left: 8px; top: 1px; font-size: 12px; font-weight: 700; color: var(--ink); }
.spark { width: 90px; height: 26px; }
.spark polyline { fill: none; stroke: var(--navy-500); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.spark.big { width: 130px; height: 30px; vertical-align: middle; margin-left: 8px; }
.dist { display: flex; align-items: flex-end; gap: 10px; margin: 6px 0 14px; }
.dist-col { text-align: center; width: 46px; }
.dist-bar { background: var(--navy-400); border-radius: 5px 5px 0 0; margin: 0 6px; }
.dist-cnt { font-size: 12px; font-weight: 700; color: var(--ink-2); height: 16px; }
.dist-lbl { font-size: 11px; color: var(--ink-3); border-top: 2px solid var(--line-2); padding-top: 3px; }
.choice { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--ink-3); margin-right: 6px; }
.choice b { color: var(--ink); }
.choice.ans b { color: var(--ok); }
.choice .cb { display: inline-block; height: 8px; background: var(--navy-200); border-radius: 2px; vertical-align: middle; }
.choice.ans .cb { background: var(--ok); }

/* ---------- 홈 ---------- */
.today-card { background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); color: #fff; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.today-card h2 { font-size: var(--fs-xs); font-weight: 600; color: var(--navy-300); letter-spacing: .04em; margin-bottom: 4px; }
.today-card .date { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.02em; }
.today-list { display: grid; gap: 10px; margin-top: 14px; }
.today-item { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: var(--r-sm); padding: 12px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.today-item .bar-c { width: 5px; align-self: stretch; border-radius: 3px; }
.today-item .t { font-weight: 700; font-size: var(--fs-md); }
.today-item .m { font-size: var(--fs-xs); color: #C3D1EC; }
.today-item .acts { margin-left: auto; }
.today-item .btn.ghost { background: var(--card); color: var(--navy-800); border-color: #fff; }
.today-item .btn.soft { background: rgba(255,255,255,.14); color: #fff; border-color: transparent; }
.today-empty { color: #C3D1EC; font-size: var(--fs-md); margin-top: 12px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week .day { background: var(--navy-50); border-radius: 10px; padding: 8px 6px; min-height: 74px; font-size: 12px; border: 1px solid transparent; }
.week .day.today { border-color: var(--navy-400); background: var(--card); }
.week .day .d { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; display: flex; justify-content: space-between; }
.week .day.today .d { color: var(--navy-500); }
.week .day .n { color: var(--ink-4); font-weight: 500; }
.week .cl { display: block; color: #fff; border-radius: 5px; padding: 2px 6px; font-size: 11px; font-weight: 700; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .week .cl:hover { text-decoration: none; opacity: .9; } }

/* ---------- 수업 카드 ---------- */
.class-card { position: relative; background: var(--card); border-radius: var(--radius); border: 1px solid var(--line); padding: 0; overflow: hidden; display: flex; flex-direction: column; color: inherit; transition: transform .12s, box-shadow .12s; }
.class-card .drag-h { position: absolute; top: 11px; right: 8px; padding: 2px 7px; border-radius: 7px; color: var(--ink-4); font-size: 15px; line-height: 1; cursor: grab; user-select: none; background: var(--card); border: 1px solid var(--line); opacity: 0; transition: opacity .12s; }
.class-card:hover .drag-h { opacity: 1; }
.class-card .drag-h:active { cursor: grabbing; }
.class-card.dragging { opacity: .45; outline: 2px dashed var(--navy-400); outline-offset: 2px; }
.class-card .card-cover { position: absolute; inset: 0; z-index: 1; border-radius: var(--radius); }
.class-card .drag-h, .class-card .edit-h { z-index: 2; }
.class-card .edit-h { position: absolute; top: 11px; right: 42px; padding: 3px 7px; border-radius: 7px; color: var(--ink-4); background: var(--card); border: 1px solid var(--line); opacity: .55; transition: opacity .12s; line-height: 1; }
.class-card .edit-h svg { width: 14px; height: 14px; vertical-align: -2px; }
.class-card:hover .edit-h, .class-card .edit-h:active { opacity: 1; color: var(--navy-500); }
@media (hover: none) { .class-card .drag-h { display: none; } .class-card .edit-h { right: 8px; opacity: .8; } }
@media (hover: hover) { .class-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); } }
.class-card .top { height: 7px; }
.class-card .body { padding: 14px 16px 14px; flex: 1; }
.class-card .name { font-size: var(--fs-lg); font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.class-card .meta { color: var(--ink-3); font-size: var(--fs-sm); margin-top: 3px; }
.class-card .foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.class-card .foot b { color: var(--ink); }
.class-card .live { color: var(--ok); font-weight: 700; }

/* ---------- 출결 체크 화면 (한 학생 = 한 줄: 이름 | 출결 4칸 | 과제 6칸) ---------- */
.check-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.check-sum { display: flex; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); align-items: center; }
.check-sum span:not(.st) { background: var(--navy-50); border-radius: 8px; padding: 4px 9px; font-weight: 600; color: var(--ink-2); }
.check-sum .st { font-size: 13px; padding: 4px 9px; }
/* 출결 칸은 내용 크기만큼(max-content), 남는 폭은 과제 칸(1fr)이 차지 → 조퇴 옆에 빈 여백이 생기지 않음 */
.check-row { display: grid; grid-template-columns: minmax(120px, 190px) max-content minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.check-row .who .nm { font-weight: 700; font-size: var(--fs-md); line-height: 1.25; min-width: 0; }
.check-row .who .nm a { color: inherit; }
.check-row .who .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.saved-ind { font-size: var(--fs-xs); color: var(--ok); font-weight: 600; opacity: 0; transition: opacity .2s; }
.saved-ind.show { opacity: 1; }

/* ---------- 성적 추이 선그래프 (학생 상세 · 학생 페이지와 같은 마크업) ---------- */
.chart-box { background: var(--navy-50); border-radius: 12px; padding: 8px 8px 6px; margin-bottom: 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart .g { stroke: var(--line-2); stroke-width: 1; }
.chart .yl { font-size: 9px; fill: var(--ink-3); text-anchor: end; }
.chart .xl { font-size: 9px; fill: var(--ink-3); text-anchor: middle; }
.chart .v { font-size: 9.5px; font-weight: 800; fill: var(--navy-ink); text-anchor: middle; }
.chart .me { fill: none; stroke: var(--navy-500); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart .avg { fill: none; stroke: var(--ink-4); stroke-width: 1.6; stroke-dasharray: 4 3; stroke-linejoin: round; }
.chart .dot { fill: var(--card); stroke: var(--navy-500); stroke-width: 2.2; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-3); padding: 4px 4px 0; align-items: center; }
.legend i { display: inline-block; width: 16px; height: 0; border-top: 2.4px solid var(--navy-500); vertical-align: middle; margin-right: 5px; }
.legend i.avg { border-top: 2px dashed var(--ink-4); }
.legend .muted { margin-left: auto; }

/* ---------- 주차 시험 화면: 시험지·정답본 파일 행 ---------- */
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.file-row:last-of-type { border-bottom: 0; }
.file-row .ttl { flex: 1 1 200px; min-width: 0; font-weight: 700; font-size: 14px; }
.file-row .ttl .hint { display: block; font-weight: 400; }
.file-row form.up { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; min-width: 0; }
.file-row form.up input[type=file] { flex: 1 1 120px; min-width: 0; max-width: 100%; font-size: 12px; }

/* ---------- 시험지 형식 빌더 ---------- */
.fmt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.fmt-box { display: flex; flex-direction: column; align-items: center; gap: 4px; background: var(--navy-50); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px; margin: 0 !important; text-align: center; }
.fmt-box .t { font-weight: 800; font-size: var(--fs-md); color: var(--navy-ink); }
.fmt-box input { text-align: center; font-size: 20px !important; font-weight: 800; margin-top: 2px !important; padding: 6px !important; }

/* ---------- 클리닉 · 보강 ---------- */
.slot { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot-head { display: flex; align-items: flex-start; gap: 10px; }
.slot-head .main { flex: 1; min-width: 0; }
.slot-head .title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slot-head .meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.slot-head .acts { display: flex; gap: 6px; flex-shrink: 0; }
.slot-books { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; background: var(--navy-50); }
.book-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.book-row:last-child { border-bottom: 0; }
.book-row .nm { font-weight: 700; color: var(--ink); }
.book-add { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.book-add select, .book-add input { border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; font-size: 13.5px; background: var(--card); color: var(--ink); }
.book-add select { flex: 0 1 160px; }
.book-add input { flex: 1 1 160px; }
select.mini { padding: 4px 8px; font-size: 12.5px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--ink-4); padding: 4px; border-radius: 6px; display: inline-flex; }
@media (hover: hover) { .icon-btn:hover { background: var(--bad-bg); color: var(--bad); } }
.danger-text { color: var(--bad); }
.follow-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.follow-acts form { display: flex; gap: 6px; align-items: center; }
.follow-acts select { padding: 6px 8px; font-size: 13px; border-radius: 8px; border: 1px solid var(--line-2); max-width: 210px; background: var(--card); color: var(--ink); }
@media (max-width: 900px) {
  .follow-acts { justify-content: flex-start; width: 100%; }
  .slot-head { flex-wrap: wrap; }
}

/* ---------- 성적표 · 인쇄 ---------- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .tabbar, .toasts, .no-print, .sticky-actions { display: none !important; }
  main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .print-only { display: block; }
  .page-break { page-break-after: always; break-after: page; }
}

/* ---------- 더보기 ---------- */
.menu-list .item svg { width: 22px; height: 22px; color: var(--navy-600); }

/* ---------- 코드 블록 · 기타 ---------- */
.msgbody { font-family: inherit; white-space: pre-wrap; background: var(--navy-50); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; max-width: 520px; line-height: 1.55; }
.tpl { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.tpl:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.tpl-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
.stars { color: var(--gold); font-size: 16px; letter-spacing: 1px; }
details summary { cursor: pointer; color: var(--navy-ink); font-weight: 600; }
details { border-top: 1px solid var(--line); padding: 9px 0; }
details:first-of-type { border-top: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.code-box { display: inline-flex; align-items: center; gap: 8px; background: var(--navy-50); border: 1px dashed var(--navy-300); border-radius: 10px; padding: 8px 12px; }
.code-box .mono { font-size: var(--fs-xl); font-weight: 700; color: var(--navy-ink); }
.qr svg { width: 180px; height: 180px; }
.steps { counter-reset: s; list-style: none; }
.steps li { position: relative; padding-left: 36px; margin-bottom: 12px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--navy-700); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 20% 0%, var(--navy-700), var(--navy-950)); padding: 20px; }
.login-card { width: 100%; max-width: 360px; background: var(--card); border-radius: 18px; padding: 30px 26px; box-shadow: var(--shadow-lg); text-align: center; }
.login-card .mark { width: 52px; height: 52px; border-radius: 14px; background: var(--navy-800); color: #fff; font-weight: 800; font-size: 22px; display: grid; place-items: center; margin: 0 auto 14px; }

/* ---------- 모바일 ---------- */
@media (max-width: 900px) {
  :root { --radius: 12px; }
  body { font-size: 15px; }
  .layout { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    background: var(--navy-900); color: #fff;
    /* 노치·다이나믹 아일랜드 여백은 높이에 '더해야' 함 (안 그러면 제목·아이콘이 잘림) */
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) calc(10px + env(safe-area-inset-right)) 0 calc(10px + env(safe-area-inset-left));
  }
  .topbar .back { width: 40px; height: 40px; display: grid; place-items: center; color: #fff; border-radius: 10px; background: none; border: 0; }
  .topbar .back svg { width: 22px; height: 22px; }
  .topbar .ttl { font-weight: 800; font-size: var(--fs-lg); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
  .topbar .tacts { display: flex; gap: 4px; flex: 0 0 auto; align-items: center; }
  .topbar .tacts a, .topbar .tacts button {
    color: #fff; background: rgba(255,255,255,.12); border: 0; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 36px; padding: 0 11px; font-weight: 700; font-size: 13.5px; white-space: nowrap;
  }
  main { padding: 14px max(14px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); max-width: none; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card);
    border-top: 1px solid var(--line); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-4); font-size: 11px; font-weight: 600; position: relative; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.on { color: var(--navy-700); }
  .tabbar a.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--navy-700); }
  .tabbar .cnt { position: absolute; top: 6px; right: calc(50% - 20px); background: var(--navy-700); color: #fff; font-size: 10px; font-weight: 800; border-radius: 9px; padding: 0 5px; }
  .card { padding: 14px 14px; margin-bottom: 12px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .bento { grid-template-columns: 1fr; }
  .bento .stats { grid-template-columns: repeat(3, 1fr); }
  .stat .num { font-size: var(--fs-2xl); }
  .form-row { grid-template-columns: 1fr; }
  .btn { min-height: 42px; }
  .btn.sm { min-height: 36px; }
  .icon-btn { padding: 8px; }
  .chip { min-height: 38px; }
  .tabs a { padding: 11px 14px; }
  /* iOS는 16px 미만 입력창에 포커스하면 화면을 확대한다 → 앱에서는 16px 고정 */
  .vform input:not([type=checkbox]):not([type=radio]), .vform select, .vform textarea, .input, select.input, textarea.input, select.mini { font-size: 16px; }
  .btn.sm { min-height: 32px; }
  .sticky-actions { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 10px 0 6px; }
  /* 키보드가 올라온 동안(app.js .kb-open): 탭바 숨김, 고정 바는 흐름에 */
  body.kb-open .tabbar { display: none; }
  body.kb-open .sticky-actions { position: static; background: none; padding-bottom: 0; }
  body.kb-open main { padding-bottom: 24px; }
  .toasts { top: auto; bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); max-width: none; }
  .today-card { padding: 16px; }
  .today-card .date { font-size: 19px; }
  .today-item .acts { width: 100%; margin-left: 0; }
  .today-item .acts .btn { flex: 1; }
  .week { gap: 4px; }
  .week .day { padding: 6px 4px; min-height: 60px; font-size: 11px; }
  .week .cl { font-size: 10px; padding: 2px 4px; }
  /* 모바일: 1줄째 이름+출결 4칸, 2줄째 과제 6칸 → 한 학생 약 80px (한 화면에 7~8명) */
  .check-row { grid-template-columns: minmax(54px, max-content) 1fr; gap: 4px 8px; padding: 6px 0; }
  .check-row .who .nm { font-size: 14.5px; }
  .check-row .who .sub { max-width: 90px; }
  .check-row .hw-cell { grid-column: 1 / -1; }
  .seg { width: 100%; padding: 2px; }
  .seg label { flex: 1; min-width: 0; }
  .seg label > span { width: 100%; height: 36px; font-size: 13.5px; min-width: 0; padding: 0 2px; }
  .seg.hw label > span { font-size: 13px; }
  .seg > .seg-lab { padding: 0 4px 0 3px; }
  .seg.mode { width: auto; }
  .seg.mode label { flex: 0 0 auto; }
  .seg.mode label > span { width: auto; height: 30px; padding: 0 9px; font-size: 12px; }
  .hwslide { min-width: 0; }
  .hwslide input[type=range] { height: 40px; }
  th, td { padding: 9px 8px; font-size: 13.5px; }
  .tabs a { padding: 9px 11px; font-size: 13.5px; }
  .dist-col { width: 38px; }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .only-m { display: none !important; } }

/* ---------- 기기별 호환 (2026-09-04): 아이폰·갤럭시·아이패드·갤럭시탭·폴더블 ---------- */
/* 태블릿 세로·폴더블 펼침(600–900px): 탭바 레이아웃은 유지하되 넓이를 활용 */
@media (min-width: 600px) and (max-width: 900px) {
  main { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
  .grid2, .grid3 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .bento .stats { grid-template-columns: repeat(3, 1fr); }
  .form-row { grid-template-columns: 1fr 1fr; }
  .check-row { grid-template-columns: minmax(120px, 190px) max-content minmax(0, 1fr); gap: 6px 14px; padding: 6px 4px; }
  .check-row .hw-cell { grid-column: auto; }
  .card.narrow { max-width: 620px; }
  /* 출결 4칸은 폰처럼 늘리지 않고 PC처럼 고정 폭(44px+) */
  .seg { width: auto; padding: 3px; }
  .seg label { flex: 0 0 auto; }
  .seg label > span { width: auto; min-width: 44px; padding: 0 11px; font-size: 13px; }
  .seg.hw label > span { min-width: 40px; padding: 0 7px; }
}
/* 작은 폰(≤360px: 갤럭시 S·iPhone SE 계열): 과제 6칸이 한 줄에 들어가도록 */
@media (max-width: 360px) {
  .seg label > span { padding: 0 9px; min-width: 40px; }
  .seg.hw label > span { min-width: 36px; padding: 0 5px; }
  .hw-cell { max-width: 100%; overflow-x: auto; }
  .stats { gap: 8px; }
  .page-head h1 { font-size: 19px; }
  .topbar .ttl { font-size: 15.5px; }
  /* 하단 고정 버튼이 두 줄로 꺾이지 않게 */
  .sticky-actions { gap: 6px; }
  .sticky-actions .btn { padding-left: 12px; padding-right: 12px; }
  .sticky-actions .btn.lg { padding: 10px 14px; min-height: 42px; font-size: 14.5px; }
}
/* 폰 가로 모드(높이 500 이하): 상단바·탭바를 낮춰 본문 공간 확보 */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
  :root { --topbar-h: 46px; --tabbar-h: 50px; }
  .tabbar a { font-size: 10px; gap: 1px; }
  .tabbar a svg { width: 20px; height: 20px; }
}

/* ---- 문항 편집 카드 · 채점 화면 · 문제 가져오기 (2026-09-05, 과목 불문 문항 체계: mc/ox/short/blank/essay) ---- */
.fmt-grid.four { grid-template-columns: repeat(4, 1fr); }
.qedit .card { min-width: 0; }
.qcard { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--card); }
.qcard.deleting { opacity: .45; }
.qcard .qtop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.qcard .qno { background: var(--navy-700); color: #fff; font-weight: 800; border-radius: 8px; min-width: 30px; height: 30px; display: grid; place-items: center; font-size: var(--fs-sm); padding: 0 7px; }
.qcard .qtop select.input { width: auto; margin: 0; min-height: 34px; padding: 4px 8px; font-size: var(--fs-sm); }
.qcard .pts { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-sm); font-weight: 600; }
.qcard .pts input { width: 64px; margin: 0; min-height: 34px; padding: 4px 8px; text-align: center; }
.qcard .del { margin: 0 0 0 auto; font-size: var(--fs-sm); color: var(--ink-3); }
.qcard textarea.body { margin: 0 0 8px; font-size: var(--fs-md); }
.qcard .choices { display: grid; gap: 6px; margin-bottom: 8px; }
.qcard .choices[hidden] { display: none; }
.qcard .ch { display: flex; align-items: center; gap: 8px; margin: 0; }
.qcard .ch .ci { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--navy-ink); color: var(--navy-ink); display: inline-grid; place-items: center; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.qcard .ch input { margin: 0; min-height: 34px; padding: 5px 8px; font-size: var(--fs-sm); }
.qcard .ans { display: block; margin: 0 0 6px; }
.qcard .ans input { margin-top: 4px; }
.qcard details.more { border: 0; padding: 0; margin: 0; }
.qcard details.more summary { padding: 2px 0; }
.qcard details.more label { margin: 8px 0 0; }
.qrules li { margin: 4px 0 4px 16px; }
.qno-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 7px; background: var(--navy-700); color: #fff; font-size: var(--fs-xs); font-weight: 800; padding: 0 6px; vertical-align: middle; }
.card-head h3 .qbody { font-weight: 500; color: var(--ink-2); }
.grade-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 280px; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.grade-row:last-child { border-bottom: 0; }
.grade-row .who { display: flex; align-items: center; gap: 8px; }
.grade-row .ans { white-space: pre-wrap; font-size: var(--fs-md); background: var(--navy-50); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 36px; word-break: break-word; }
.grade-row.pending .ans { border-left: 3px solid var(--warn); }
.grade-row.ok .ans { border-left: 3px solid var(--ok); }
.grade-row .score { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.grade-row .score input.pts { width: 72px; margin: 0; text-align: center; min-height: 34px; padding: 4px; }
.grade-row .score input.note { flex: 1 1 100%; margin: 0; min-height: 34px; padding: 5px 8px; font-size: var(--fs-sm); }
.src-tabs .chip { flex: 1; justify-content: center; }
@media (max-width: 900px) {
  .fmt-grid.four { grid-template-columns: repeat(2, 1fr); }
  .grade-row { grid-template-columns: 1fr; gap: 6px; }
  .qcard .del { margin-left: 0; }
}
