/* 선생님용 관리 화면 */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eff1f6;
  --border: #e3e6ee;
  --border-strong: #cfd4df;
  --text: #1c2233;
  --text-2: #4a5265;
  --muted: #858da1;
  --primary: #4b5bdc;
  --primary-600: #3e4dc6;
  --primary-50: #eef0ff;
  --primary-100: #dde1ff;
  --success: #138a52;
  --success-50: #e5f6ed;
  --warning: #c26d04;
  --warning-50: #fff2de;
  --danger: #d6363d;
  --danger-50: #fdebea;
  --info: #2a72c9;
  --info-50: #e7f1fc;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(20, 28, 51, .06);
  --shadow: 0 2px 8px rgba(20, 28, 51, .06), 0 1px 2px rgba(20, 28, 51, .04);
  --shadow-lg: 0 24px 60px rgba(20, 28, 51, .2);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
.ico { display: inline-flex; flex-shrink: 0; }
.ico svg { display: block; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ───────── 상단 메뉴 ───────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(1.4) blur(8px);
}
.topbar-inner { max-width: 1480px; height: 60px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #5b6af0, #8a5cf6);
  color: #fff;
  box-shadow: 0 2px 6px rgba(80, 90, 220, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { max-width: 220px; overflow: hidden; font-size: 15px; font-weight: 800; letter-spacing: -.01em; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 11.5px; color: var(--muted); }
.nav { flex: 1; display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px; color: var(--text-2); font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--primary-50); color: var(--primary); }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; }

/* ───────── 페이지 공통 ───────── */
.page { max-width: 1480px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; }
.page-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-desc { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .spacer { flex: 1; }
.toolbar-count { font-size: 13.5px; color: var(--text-2); white-space: nowrap; }
.toolbar-count b { color: var(--text); }
.search { position: relative; display: flex; align-items: center; }
.search .ico { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search .input { width: 300px; padding-left: 36px; text-overflow: ellipsis; }
.loading { padding: 70px 20px; text-align: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; margin: 0 auto 12px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── 입력 / 버튼 ───────── */
.input {
  height: 38px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; line-height: 1.6; resize: vertical; }
select.input { padding-right: 30px; cursor: pointer; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input::placeholder { color: #a6adbc; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.input[type='number'] { -moz-appearance: textfield; }
.input[type='number']::-webkit-inner-spin-button, .input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.btn {
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: #bcc3d1; background: var(--surface-2); }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.btn-primary { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(75, 91, 220, .3); }
.btn-primary:hover { border-color: var(--primary-600); background: var(--primary-600); }
.btn-danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-danger:hover { border-color: #bd2b32; background: #bd2b32; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { border-color: transparent; background: var(--surface-3); color: var(--text); }
.btn-soft { border-color: transparent; background: var(--primary-50); color: var(--primary); }
.btn-soft:hover { border-color: transparent; background: var(--primary-100); }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { border-color: transparent; background: var(--danger-50); }
.btn-sm { height: 32px; padding: 0 10px; border-radius: 7px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn.danger:hover { background: var(--danger-50); color: var(--danger); }

/* ───────── 표 ───────── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius-lg); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius-lg); }
.toolbar + .table-wrap .table th { border-radius: 0 !important; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.sort-ind { margin-left: 3px; color: var(--primary); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .1s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: #f9faff; }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; }
.actions-inner { display: inline-flex; gap: 4px; align-items: center; }
.cell-name { font-weight: 700; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.cell-empty { color: #c2c7d2; }

/* ───────── 칩 ───────── */
.chip { height: 24px; padding: 0 9px; display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip-gray { background: var(--surface-3); color: var(--text-2); }
.chip-green { background: var(--success-50); color: var(--success); }
.chip-red { background: var(--danger-50); color: var(--danger); }
.chip-blue { background: var(--info-50); color: var(--info); }
.chip-orange { background: var(--warning-50); color: var(--warning); }
.chip-primary { background: var(--primary-50); color: var(--primary); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* ───────── 빈 화면 ───────── */
.empty { padding: 60px 24px; text-align: center; color: var(--text-2); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--primary-50); color: var(--primary); }
.empty h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.empty p { margin: 0 0 18px; color: var(--muted); }
.empty-actions { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ───────── 모달 ───────── */
.modal-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(17, 22, 38, .45); opacity: 0; transition: opacity .15s; }
.modal-overlay.show { opacity: 1; }
.modal { width: 100%; max-height: calc(100vh - 40px); display: flex; flex-direction: column; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform .15s; }
.modal-overlay.show .modal { transform: none; }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 660px; }
.modal-lg { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.modal-body { padding: 12px 20px 20px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-foot .spacer { flex: 1; }
.confirm-message { margin: 0; color: var(--text-2); line-height: 1.65; white-space: pre-line; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .req { margin-left: 2px; color: var(--danger); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .input { width: 100%; }
.field-full { grid-column: 1 / -1; }
.form-error { margin: 14px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-50); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.info-box { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); line-height: 1.7; }
.info-box code { padding: 1px 6px; border-radius: 5px; background: var(--surface-3); font-size: 12.5px; word-break: break-all; }

/* ───────── 알림 ───────── */
#toast-root { position: fixed; left: 50%; bottom: 84px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast {
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  background: #1f2537;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast-success .ico { color: #74e3ab; }
.toast-error { background: #b4232a; }

/* ───────── 리포트 목록 ───────── */
.date-nav { display: inline-flex; align-items: center; gap: 4px; }
.date-nav .input { width: 150px; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }
.summary b { color: var(--text); }
.summary .day { font-size: 15px; font-weight: 800; color: var(--text); }
.meter { width: 120px; height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-3); }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.class-group td { padding: 8px 12px; background: var(--surface-2); font-size: 12.5px; font-weight: 700; color: var(--text-2); }

/* ───────── 리포트 작성 ───────── */
.editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin-bottom: 16px; }
.editor-title { min-width: 0; }
.editor-title h1 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 21px; font-weight: 800; }
.editor-title h1 small { font-size: 14px; font-weight: 500; color: var(--muted); }
.editor-title p { margin: 3px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.editor-head-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.notice { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; padding: 12px 14px; border-radius: 12px; background: var(--info-50); color: #1c599f; font-size: 13.5px; }
.notice ul { margin: 0; padding-left: 16px; }
.notice .ico { margin-top: 1px; }
.history-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.history-chips a { padding: 3px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.history-chips a:hover { border-color: var(--primary-100); color: var(--primary); }
.history-chips a.current { border-color: var(--primary); background: var(--primary); color: #fff; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 22px; align-items: start; }
.editor-form { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.form-section { padding: 18px 18px 16px; }
.form-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.form-section-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; }
.form-section-head h2 .ico { color: var(--primary); }
.form-section-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.form-section-actions { display: flex; gap: 6px; flex-shrink: 0; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 8px; }
.row-item > .input { flex: 1 1 0; }
.row-item > .grow-2 { flex: 2 1 0; }
.row-item > .w-round { flex: 0 0 140px; }
.row-item > .w-score { flex: 0 0 76px; text-align: right; }
.row-item .slash { color: var(--muted); }
.row-num { flex: 0 0 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }
.row-head { display: flex; gap: 8px; margin: 0 0 6px 30px; font-size: 12px; font-weight: 600; color: var(--muted); }
.add-row { margin-top: 10px; }
.rows-empty { padding: 12px; border: 1px dashed var(--border-strong); border-radius: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.seg { flex-shrink: 0; display: inline-flex; overflow: hidden; border: 1px solid var(--border-strong); border-radius: 9px; transition: box-shadow .15s, border-color .15s; }
.seg-btn { height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 700; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-strong); }
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.active.seg-done { background: var(--success); color: #fff; }
.seg-btn.active.seg-partial { background: #e08a0b; color: #fff; }
.seg-btn.active.seg-none { background: var(--danger); color: #fff; }
.row-item.needs-status .seg { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.teacher-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.teacher-row label { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.teacher-row .input { width: 180px; }
.editor-actions {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 20px -24px -24px;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
}
.editor-actions .spacer { flex: 1; }
.save-state { font-size: 12.5px; color: var(--muted); }
.save-state.dirty { color: var(--warning); font-weight: 600; }
.preview-pane { position: sticky; top: 76px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.phone { height: calc(100vh - 200px); min-height: 520px; overflow: hidden; border: 10px solid #1e2333; border-radius: 34px; background: #000; box-shadow: var(--shadow-lg); }
.phone-screen { height: 100%; overflow-y: auto; overscroll-behavior: contain; background: #f6f1ea; }
.phone-screen .rp { min-height: 100%; }

/* 학부모 피드백 (목록 + 작성 화면 공용) */
.fb-list { display: flex; flex-direction: column; }
.fb-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 14px; padding: 16px; border-bottom: 1px solid var(--border); }
.fb-item:last-child { border-bottom: 0; }
.fb-item.handled .fb-main, .fb-item.handled .fb-icon { opacity: .6; }
.fb-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; }
.fb-icon.consult { background: var(--danger-50); color: var(--danger); }
.fb-icon.message { background: var(--info-50); color: var(--info); }
.fb-icon.confirm { background: var(--success-50); color: var(--success); }
.fb-main { min-width: 0; }
.fb-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 700; }
.fb-title .cell-sub { font-weight: 500; }
.fb-message { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.fb-meta { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.fb-meta .ico { margin-right: 3px; }
.fb-meta span { display: inline-flex; align-items: center; }
.fb-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.fb-time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.fb-compact .fb-item { padding: 12px 0; }
.seg-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.seg-tabs button { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg-tabs .count { min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; }

/* 학생별 리포트 기록 */
.report-history { list-style: none; margin: 0; padding: 0; }
.report-history li { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.report-history li:last-child { border-bottom: 0; }
.report-history .date { min-width: 120px; font-weight: 700; }

/* ───────── 언어 선택 (한국어 / English) ───────── */
.lang-switch { flex-shrink: 0; display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.lang-switch button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.lang-switch button:hover { color: var(--text); }
.lang-switch button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }
.login-lang { position: fixed; top: 16px; right: 16px; background: rgba(255, 255, 255, .8); box-shadow: var(--shadow-sm); }

/* 학생 이름 + 영어 이름 */
.name-cell .cell-name { margin-right: 6px; }
.name-alt { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.table td.cell-en { font-weight: 600; color: var(--primary); }

/* ───────── 학생 리포트 안의 작은 메뉴 ───────── */
.subtabs { display: flex; gap: 2px; margin: -2px 0 14px; overflow-x: auto; border-bottom: 1px solid var(--border); }
.subtabs a { margin-bottom: -1px; padding: 10px 14px; display: inline-flex; align-items: center; gap: 6px; border-bottom: 2px solid transparent; color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap; }
.subtabs a:hover { color: var(--text); }
.subtabs a.active { border-bottom-color: var(--primary); color: var(--primary); }
.class-group-inner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ───────── 사용자 메뉴 ───────── */
.user-menu { position: relative; flex-shrink: 0; }
.user-btn { height: 40px; padding: 0 8px 0 4px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; background: transparent; color: var(--text); cursor: pointer; }
.user-btn:hover { background: var(--surface-3); }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-50); color: var(--primary); font-size: 12px; font-weight: 800; }
.user-name { max-width: 120px; overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 220px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg); }
.menu-head { margin-bottom: 4px; padding: 8px 10px 10px; display: flex; flex-direction: column; border-bottom: 1px solid var(--border); }
.menu-head strong { font-size: 14px; }
.menu-head small { font-size: 12px; color: var(--muted); }
.menu button { width: 100%; padding: 9px 10px; display: flex; align-items: center; gap: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--surface-3); }

/* ───────── 로그인 ───────── */
.login-body {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(1100px 560px at 8% -10%, #e5e8ff 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 110%, #efe6ff 0%, transparent 55%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card { padding: 32px 28px 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
.login-brand strong { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.login-brand small { font-size: 13px; color: var(--muted); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form .form-error { margin: 0; }
.login-btn { width: 100%; margin-top: 2px; }
.login-help { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--primary); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.notice-text { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; background: var(--info-50); color: #1c599f; font-size: 13.5px; line-height: 1.6; }

/* ───────── 반별 일괄 작성 ───────── */
.batch-bar { margin-bottom: 14px; }
.batch-bar .toolbar { border-bottom: 0; }
.class-picker { padding: 26px 24px; }
.class-picker-title { margin: 0 0 14px; font-weight: 700; color: var(--text-2); }
.class-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.class-card { padding: 16px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.class-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.class-card strong { font-size: 17px; }
.class-card span { font-size: 13px; color: var(--muted); }
.batch-common-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; }
.batch-block-wide { grid-column: 1 / -1; }
.batch-block h3 { margin: 0 0 4px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 800; }
.batch-block h3 .ico { color: var(--primary); }
.batch-block > .cell-sub { margin: 0 0 8px; }
.batch-block .rows { margin-top: 8px; }
.batch-students { margin-top: 14px; }
.batch-students-head { padding: 18px 18px 6px; margin-bottom: 0; }
.batch-warn { margin: 6px 18px 12px; padding: 9px 12px; display: flex; align-items: flex-start; gap: 8px; border-radius: 10px; background: var(--warning-50); color: #8a4d00; font-size: 13px; }
.batch-warn .ico { margin-top: 1px; }
.batch-table td { white-space: normal; vertical-align: top; }
.batch-table .col-check { width: 40px; text-align: center; }
.batch-table .col-check input { width: 17px; height: 17px; margin-top: 4px; accent-color: var(--primary); }
.student-cell { min-width: 110px; }
.student-cell .chip { margin-top: 6px; }
.hw-cell { min-width: 340px; }
.hw-source { margin-bottom: 4px; font-size: 11.5px; color: var(--muted); }
.hw-line { padding: 4px 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hw-line + .hw-line { border-top: 1px dashed var(--border); }
.hw-text { flex: 1; min-width: 0; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.hw-line.needs .seg { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-50); }
.seg.sm .seg-btn { height: 28px; padding: 0 8px; font-size: 12px; }
.batch-table .col-score { width: 120px; }
.score-input { display: flex; align-items: center; gap: 6px; }
.score-input .input { width: 64px; padding: 0 8px; text-align: right; }
.score-max { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.comment-cell { min-width: 210px; }
.comment-cell textarea { width: 100%; min-height: 38px; font-size: 13.5px; }
.batch-table tr.is-excluded td:not(.col-check) { opacity: .4; }
.batch-summary { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ───────── 지난 리포트 조회 ───────── */
.range-btns { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.range-btns .btn.active { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.filter-chip { height: 30px; padding: 0 6px 0 12px; display: inline-flex; align-items: center; gap: 6px; border-radius: 99px; background: var(--primary-50); color: var(--primary); font-size: 13px; font-weight: 700; }
.filter-chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.filter-chip button:hover { background: var(--primary-100); }
.history-table td { white-space: normal; vertical-align: top; }
.date-cell { font-weight: 700; white-space: nowrap !important; }
.lesson-cell { max-width: 320px; font-size: 13.5px; }
.lesson-cell .cell-sub { display: block; }
.test-chips { max-width: 230px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.modal-report { max-width: 460px; }
.phone-modal { height: min(760px, calc(100vh - 210px)); min-height: 0; border-width: 8px; border-radius: 28px; box-shadow: none; }

/* ───────── 엑셀 가져오기 ───────── */
.import-summary { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.import-summary > div { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); text-align: center; }
.import-summary b { display: block; font-size: 22px; font-weight: 800; }
.import-summary span { font-size: 12.5px; color: var(--muted); }
.import-summary .is-error b { color: var(--danger); }
.import-table-wrap { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
.import-table th { position: sticky; top: 0; z-index: 1; }
.import-table td.wrap { white-space: normal; }
.import-table tr.row-error td { background: #fff8f8; }
.import-error { font-size: 13px; font-weight: 600; color: var(--danger); }
.change-list { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.change-list li + li { margin-top: 2px; }
.change-list .from { color: var(--muted); text-decoration: line-through; }
.change-list .to { font-weight: 600; color: var(--success); }

/* ───────── 화면 폭에 맞춤 ───────── */
@media (max-width: 1280px) {
  .nav a { padding: 0 10px; }
  .user-name { display: none; }
}
@media (max-width: 1100px) {
  .brand-text small { display: none; }
  .lang-switch button { padding: 0 7px; }
}
@media (max-width: 1200px) {
  .editor-grid { grid-template-columns: 1fr; }
  .preview-pane { position: static; }
  .phone { max-width: 420px; height: 760px; margin: 0 auto; }
}
@media (max-width: 860px) {
  .topbar-inner { gap: 10px; padding: 0 12px; }
  .brand-text small { display: none; }
  .nav a { padding: 0 10px; font-size: 13.5px; }
  .nav a .ico { display: none; }
  .page { padding: 16px; }
  .editor-actions { margin: 20px -16px -16px; padding: 10px 16px; }
  .search, .search .input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .row-item { flex-wrap: wrap; }
  .row-item > .w-round { flex: 1 1 120px; }
  .row-head { display: none; }
  .fb-item { grid-template-columns: auto minmax(0, 1fr); }
  .fb-side { grid-column: 2; align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .batch-common-grid { grid-template-columns: 1fr; }
  .import-summary { grid-template-columns: repeat(2, 1fr); }
  .nav { overflow-x: auto; scrollbar-width: none; }
}
@media (max-width: 560px) {
  .brand-text { display: none; }
}
