:root {
  --cobalt: #0047AB;
  --cobalt-dark: #00357F;
  --cobalt-soft: #E8EFFA;
  --ink: #1B2433;
  --ink-2: #33404F;
  --muted: #5A6577;
  --line: #D9DFE8;
  --line-2: #C5CDD9;
  --ground: #F4F6F9;
  --warn-bg: #FDF0E3;
  --warn: #7A3A05;
  --ok-bg: #E6F4EC;
  --ok: #12703F;
  --bad-bg: #FBE9E7;
  --bad: #9C2A17;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: 'Malgun Gothic', 'Noto Sans KR', sans-serif; font-size: 15px; line-height: 1.5; }
input, select { width: 100%; height: 40px; padding: 0 10px; font: inherit; font-size: 14.5px; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 6px; min-width: 0; }
input::placeholder { color: var(--muted); }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 1px; }
input[type=checkbox] { width: 18px; height: 18px; padding: 0; accent-color: var(--cobalt); flex: none; }
button { font: inherit; cursor: pointer; }
h2, h3, p { margin: 0; }
h3 { font-size: 15px; }

/* 머리 */
.top { background: var(--cobalt); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 20px; }
.top strong { font-size: 17px; }
.top input[type=date] { width: 150px; height: 34px; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top .link { background: none; border: 0; color: #fff; text-decoration: underline; padding: 4px; }
.save { font-size: 13.5px; min-width: 70px; text-align: right; }
.save.bad { background: var(--bad-bg); color: var(--bad); border-radius: 4px; padding: 2px 8px; font-weight: 700; }
.notice { padding: 7px 20px; background: var(--warn-bg); color: var(--warn); font-size: 13.5px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 0; }
.steps button { height: 42px; padding: 0 16px; border-radius: 6px; border: 1px solid var(--cobalt); background: #fff; color: var(--cobalt); font-weight: 700; }
.steps button.on { background: var(--cobalt); color: #fff; }

/* 공통 판 */
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.muted { color: var(--muted); font-size: 13px; }
.btn { height: 42px; padding: 0 20px; border-radius: 6px; border: 1px solid var(--cobalt); background: #fff; color: var(--cobalt); font-weight: 700; }
.btn.fill { background: var(--cobalt); color: #fff; }
.btn.soft { height: 34px; padding: 0 12px; background: var(--cobalt-soft); color: var(--cobalt-dark); border: 0; font-weight: 500; }
.btn.small { height: 34px; padding: 0 12px; font-weight: 400; color: var(--muted); border-color: var(--line-2); }
.btn.wide { width: 100%; }
.x { height: 40px; background: #fff; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; }
.warnbar { padding: 8px 12px; background: var(--warn-bg); color: var(--warn); border-radius: 6px; font-size: 13.5px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* 1. 숙제카톡방 */
.kakao { margin: 14px 20px 24px; max-width: 860px; }
.kgrid { display: grid; grid-template-columns: 150px 1fr 60px 100px; gap: 8px; align-items: center; }
.krow { min-height: 44px; border-top: 1px solid #EEF0F4; }
.kbtns { display: flex; gap: 4px; align-items: center; }
.kbtns button { width: 44px; height: 36px; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 500; }
.kbtns button.on { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }

/* 2. 등원 학생 출력 */
.printwrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 14px 20px 24px; }
.attend { flex: 1 1 280px; max-width: 340px; }
.attend label.row { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.paperside { flex: 999 1 480px; min-width: 0; max-width: 760px; display: flex; flex-direction: column; gap: 8px; }
.paper { background: #fff; border: 1px solid var(--line-2); border-radius: 2px; padding: 28px 32px; }
.pblock { border: 1px solid var(--ink); margin-top: -1px; padding: 6px 10px; font-size: 14px; line-height: 1.6; break-inside: avoid; }
.pblock .c { font-weight: 700; color: var(--cobalt-dark); background: var(--cobalt-soft); margin: -6px -10px 4px; padding: 3px 10px; }
.pblock .h { white-space: pre-wrap; }
.pblock .s { font-weight: 500; }
.pblock .g { font-weight: 700; color: var(--warn); background: var(--warn-bg); margin: 4px -10px -6px; padding: 3px 10px; }

/* 선물 */
.giftpanel { border-color: var(--warn); background: var(--warn-bg); }
.giftrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--line-2); }
.giftrow:first-of-type { margin-top: 6px; }
.giftrow.away .giftname { opacity: .7; }
.giftname { min-width: 150px; }
.giftlist { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.giftitem { display: inline-flex; align-items: center; gap: 8px; }
/* 랭크업 선물은 대단한 일이라 황금색 띠 + 검정 테두리 + 금빛 바깥 테로 튀게(원장님 2026-11-07, 도안 3번) */
.giftitem.rank b, .rankmark, .pblock .g .rank { background: linear-gradient(135deg, #FFE27A 0%, #F2B705 45%, #C98A00 100%); color: #3D2600; border: 2px solid #1B2433; border-radius: 999px; padding: 1px 10px; box-shadow: 0 0 0 2px #FFE27A; text-shadow: 0 1px 0 rgba(255, 255, 255, .45); }
.rankmark { padding: 0 6px; margin-left: 4px; font-size: 13px; }
.pblock .g .rank { padding: 0 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.giftdone { margin-top: 8px; }
.giftbar { display: flex; flex-wrap: wrap; gap: 6px 14px; border-color: var(--warn); background: var(--warn-bg); }

/* 3. 오늘 수업 */
.write { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; padding: 14px 20px 24px; }
.who { flex: 1 1 200px; max-width: 220px; min-width: 190px; }
.who .list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.who button.st { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 10px; color: var(--ink); width: 100%; }
.who button.st.on { background: var(--cobalt-soft); border-color: var(--cobalt); }
.who .n { display: block; font-weight: 700; }
.who .m { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; color: var(--muted); }
.who .m b { font-weight: 500; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.head h2 { font-size: 20px; }
.head .examscope { flex-basis: 100%; margin: 0; font-size: 14px; }
.chip { background: var(--cobalt-soft); color: var(--cobalt-dark); border-radius: 12px; padding: 2px 10px; font-size: 13px; font-weight: 500; }
.chip.warm { background: var(--warn-bg); color: var(--warn); }
.ml { margin-left: auto; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kinds button { height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); }
.kinds button.on { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.hwrow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin-top: 8px; }
.hwrow label.num { width: 76px; font-size: 13px; color: var(--muted); }
.hwrow label.chk { height: 40px; display: flex; align-items: center; gap: 6px; }
.result { height: 40px; display: flex; align-items: center; border-radius: 6px; padding: 0 12px; font-weight: 700; background: #EEF0F4; color: var(--muted); }
.result.good { background: var(--ok-bg); color: var(--ok); }
.result.mid { background: var(--warn-bg); color: var(--warn); }
.result.bad { background: var(--bad-bg); color: var(--bad); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 36px; height: 40px; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; }
.stepper span { width: 28px; text-align: center; font-weight: 700; }
.scrollx { overflow-x: auto; margin-top: 6px; }
.rows { min-width: 680px; display: flex; flex-direction: column; gap: 6px; }
.g-study { display: grid; grid-template-columns: 1.1fr 1.2fr 1fr 84px 1fr 36px; gap: 6px; }
.g-hw { display: grid; grid-template-columns: 1fr 92px 1.4fr 36px; gap: 6px; }
.g-test { display: grid; grid-template-columns: 1fr 110px 36px; gap: 6px; }
.colhead { font-size: 13px; color: var(--muted); }
.g-past { display: grid; grid-template-columns: minmax(260px, 1fr) 76px 76px 76px; gap: 6px; align-items: center; }
.past-t { white-space: pre-wrap; color: var(--ink-2); min-width: 0; }
.hwrow input[readonly] { background: #EEF0F4; color: var(--muted); }
input[data-combo] { padding-right: 24px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%235A6577'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; }
.combo { position: fixed; z-index: 50; max-height: 380px; overflow-y: auto; background: #fff; border: 1px solid var(--line-2); border-radius: 6px; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); padding: 4px; }
.combo button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 4px; padding: 7px 9px; font-size: 14px; color: var(--ink); }
.combo button:hover { background: var(--cobalt-soft); }
.combo button.on { font-weight: 700; color: var(--cobalt-dark); }
.acts { display: flex; gap: 6px; margin-top: 8px; }
.algrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.algrid label { font-size: 13px; color: var(--muted); }
.nav { display: flex; justify-content: space-between; gap: 8px; }
.side { flex: 1 1 330px; max-width: 370px; min-width: 280px; display: flex; flex-direction: column; gap: 10px; }
.chead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.chead span { font-weight: 700; font-size: 14px; }
.chead button { height: 30px; min-width: 76px; padding: 0 10px; background: var(--cobalt); color: #fff; border: 1px solid var(--cobalt); border-radius: 6px; font-size: 13px; font-weight: 500; }
.chead button.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.ctext { display: block; width: 100%; box-sizing: border-box; white-space: pre-wrap; font: inherit; font-size: 13px; line-height: 1.55; color: var(--ink); background: var(--ground); border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; resize: vertical; }
.ctext:focus { background: #fff; outline: 2px solid var(--cobalt); outline-offset: 1px; }
.ctext.edited { background: var(--warn-bg); }
.chead button.back { margin-left: auto; margin-right: 6px; min-width: 0; background: #fff; color: var(--warn); border-color: var(--line-2); font-weight: 400; }
.btn.sent { background: var(--ok-bg); color: var(--ok); }

/* 로그인 */
.login { max-width: 360px; margin: 80px auto; display: flex; flex-direction: column; gap: 12px; }
.login h2 { font-size: 20px; color: var(--cobalt); }
.login label { font-size: 13px; color: var(--muted); }
.login .err { color: var(--bad); font-size: 13.5px; }

/* 인쇄: 종이만 */
@media print {
  body { background: #fff; }
  body > #app > :not(.printwrap), .attend, .warnbar, .giftpanel { display: none !important; }
  .printwrap { padding: 0; display: block; }
  .paperside { max-width: none; }
  .paper { border: 0; padding: 0; }
  .pblock .c, .pblock .g { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@page { size: A4; margin: 12mm; }

/* 달 넘기기 확인 */
.mtable { width: 100%; min-width: 520px; border-collapse: collapse; }
.mtable th, .mtable td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; font-weight: 400; font-variant-numeric: tabular-nums; }
.mtable th:first-child { text-align: left; font-weight: 700; }
.mtable thead th { font-weight: 700; font-size: 13.5px; vertical-align: bottom; }
.mtable thead .muted { font-weight: 400; font-size: 12px; }

/* 학생 관리 */
.stuwrap { max-width: 1180px; margin: 0 auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.stuhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.stuhead .small2 { height: 36px; padding: 0 14px; }
.stable { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 14px; }
.stable th, .stable td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; }
.stable tbody th { font-weight: 700; white-space: nowrap; }
.stable thead th { font-weight: 700; font-size: 13.5px; }
.stuform { display: flex; flex-direction: column; gap: 8px; border-color: var(--cobalt); }
.stuform h3 { margin-top: 6px; }
.stugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 12px; align-items: end; }
.stugrid label { font-size: 13px; color: var(--muted); }
.stugrid label.wide { grid-column: span 2; }
.stugrid label.stuchk { display: flex; align-items: center; gap: 6px; height: 40px; color: var(--ink); font-size: 14.5px; }
.stuform .err { color: var(--bad); font-size: 13.5px; }
.stuform .retire { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--bad); }
.btn.dangerbtn { height: 34px; padding: 0 12px; border-color: var(--bad); color: var(--bad); }
.combo .chead2 { padding: 4px 10px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--ground); }

/* 학생별 기록·설정 */
.stable .nowrap { white-space: nowrap; }
.stable.rec th, .stable.rec td { text-align: center; }
.stable.rec .left, .stable.rec th.left { text-align: left; }
.stable.rec .pre { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }
.stable.rec.small { min-width: 420px; }
.stable .dim { color: var(--muted); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--cobalt); text-decoration: underline; font-weight: 700; white-space: nowrap; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { display: flex; flex-direction: column; min-width: 110px; padding: 8px 12px; background: var(--cobalt-soft); border-radius: 6px; font-size: 13px; }
.stat b { font-size: 17px; color: var(--cobalt-dark); }
select.inl { width: auto; height: 34px; }
input.inl { height: 34px; margin: 0 4px; }
.pay-ok { color: var(--ok); }
.pay-wait { color: var(--warn); }
.pay-no { color: var(--muted); }
.stuwrap.rp-page { max-width: none; }
.stable.reptable { font-size: 13px; }
.reptable td, .reptable th { white-space: nowrap; }
.reptable .rp-in { width: 62px; height: 28px; padding: 2px 4px; text-align: right; font-size: 13px; }
.reptable .rp-sum td { background: var(--warn-bg); white-space: nowrap; }
.reptable td.rp-best { background: #f9cb9c; }
.stable .dp-o { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.stable .dp-x { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.stable.chultable { min-width: 1080px; font-size: 13px; }
.chultable .chul { min-width: 26px; padding: 3px 1px; text-align: center; }
.chultable .chul-name { position: sticky; left: 0; background: #fff; white-space: nowrap; }
.chultable .chul-o { background: var(--ok-bg); color: var(--ok); font-weight: 700; }
.chultable .chul-b { background: var(--cobalt-soft); color: var(--cobalt-dark); font-weight: 700; }
.chultable .chul-x { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.chultable .chul-y { color: var(--muted); font-size: 11px; }
.chultable th.chul-sun { color: var(--bad); }
.chultable th.chul-today { outline: 2px solid var(--cobalt-dark); outline-offset: -2px; }
.stable.scoldtable { min-width: 640px; }
.stable .scold1 { background: var(--warn-bg); }
.stable .scold2 { background: var(--bad-bg); }
.scoldplus { color: var(--ok); font-weight: 700; }
.scoldtag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 700; background: var(--bad-bg); color: var(--bad); }
.kmarks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kmarks span { display: flex; flex-direction: column; align-items: center; min-width: 40px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; font-weight: 700; }
.kmarks small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.stuform.plain { padding: 10px 12px; margin-bottom: 10px; background: var(--ground); border-radius: 6px; }
.stuform.plain .err, .card > .err { color: var(--bad); font-size: 13.5px; }
.listgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.listbox { display: flex; flex-direction: column; gap: 3px; }
.listbox textarea { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 6px; resize: vertical; line-height: 1.6; }
.hwrow label.num.wide { width: 90px; }

/* 학생 현황(첫 화면) */
.homelink { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; }
.stable.hometable { min-width: 900px; }
.stable.hometable td { vertical-align: middle; }
.stable.hometable tr.dim td { color: var(--muted); }
.homeexam { display: inline-block; margin-left: 6px; white-space: nowrap; }
.hometable .giftitem { margin-right: 8px; }

/* 학생앱 주소·QR 카드(2026-11-13) */
.spqr { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.spqr svg { border: 1px solid var(--line); border-radius: 8px; }
.spcards { gap: 0; padding: 14px 20px 24px; }
.spcard { width: 90mm; height: 55mm; border: 1px dashed #999; display: flex; align-items: center; gap: 4mm; padding: 4mm; background: #fff; break-inside: avoid; }
.spcard svg { width: 44mm; height: 44mm; flex: none; }
.spcard div { display: flex; flex-direction: column; gap: 1.5mm; min-width: 0; }
.spcard b { font-size: 17pt; }
.spcard span { font-size: 10.5pt; font-weight: 700; color: #2f7fd1; }
.spcard small { font-size: 7.5pt; color: #555; line-height: 1.45; }
@media print {
  .noprint { display: none !important; }
  .printwrap.spcards { display: flex; flex-wrap: wrap; }
}

/* 수업 쓰기: 학생이 적은 플래너 칸 */
.planner { border: 2px solid var(--cobalt); }
.plrows { display: flex; flex-direction: column; margin-top: 10px; }
.plrow { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; padding: 5px 0; border-top: 1px solid var(--line); }
.plrow .pln { color: var(--muted); }
.plrow .plv { white-space: pre-wrap; }
.plbtn.done { background: #E6F4EC; color: var(--ok); }
@media (max-width: 700px) { .plrow { grid-template-columns: 1fr; gap: 2px; } }
.plrow.more { border-top: 0; padding-top: 0; }
