:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1e2a26; --muted: #6c7570; --line: #e7e2d8;
  --primary: #2f5d50; --primary-ink: #ffffff; --primary-soft: #e4efe9; --accent: #d9822b;
  --danger: #b8413a; --radius: 14px; --shadow: 0 1px 2px rgba(30, 42, 38, .06), 0 4px 14px rgba(30, 42, 38, .05);
  --s-예정: #56637f; --s-예정-bg: #eef1f7; --s-출석: #2b7a4b; --s-출석-bg: #e3f3e8;
  --s-결석: #b8413a; --s-결석-bg: #fbe8e5; --s-취소: #7b7b7b; --s-취소-bg: #efefef;
  --s-이월: #a4670f; --s-이월-bg: #fcefd9; --s-보강: #6a4fb0; --s-보강-bg: #efe9fb;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5;
  font: 15px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 22px; margin: 4px 0 2px; letter-spacing: -.02em; }
h1 small { font-size: 14px; font-weight: 400; }
h2 { font-size: 16px; margin: 22px 0 8px; letter-spacing: -.01em; }
.card h2 { margin-top: 0; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small, small { font-size: 12.5px; }
.prewrap { white-space: pre-wrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 14px 14px 30px; }
section { margin-bottom: 8px; }

/* 상단 · 하단 내비 */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(246, 244, 239, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.brand-mark, .login-mark { display: inline-block; width: 32px; height: 32px; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; letter-spacing: -.02em; }
.brand-text small { font-size: 11px; color: var(--muted); font-weight: 500; }
.login-center { margin: 0 0 4px; font-weight: 600; color: var(--primary); }
.topnav { display: none; gap: 2px; flex: 1; overflow-x: auto; }
.topnav a { padding: 6px 11px; border-radius: 999px; color: var(--muted); white-space: nowrap; }
.topnav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.me { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.me form { margin: 0; }
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11.5px; color: var(--muted); }
.bottomnav a.on { color: var(--primary); font-weight: 600; }
.ico { width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--m) center / 22px no-repeat; mask: var(--m) center / 22px no-repeat; }
.ico-home { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z'/%3E%3C/svg%3E"); }
.ico-cal { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E"); }
.ico-kid { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E"); }
.ico-won { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l4 13 5-11 5 11 4-13M2 11h20'/%3E%3C/svg%3E"); }
.ico-bell { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9a6 6 0 1 1 12 0c0 6 2.5 8 2.5 8h-17S6 15 6 9M10 20a2 2 0 0 0 4 0'/%3E%3C/svg%3E"); }
.ico-note { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 3h9l4 4v14H6zM9 12h7M9 16h7M9 8h3'/%3E%3C/svg%3E"); }
.ico-gear { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M4.9 19.1 7 17M17 7l2.1-2.1'/%3E%3C/svg%3E"); }
.ico-more { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='2'/%3E%3Ccircle cx='12' cy='12' r='2'/%3E%3Ccircle cx='19' cy='12' r='2'/%3E%3C/svg%3E"); }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  body { padding-bottom: 0; }
  .wrap { padding: 22px 24px 40px; }
  h1 { font-size: 24px; }
}
@media (max-width: 899px) { .me-name { display: none; } }

/* 기본 요소 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; display: block; color: inherit; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pagehead p { margin: 0; }
.row-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-gap form { margin: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.dim { opacity: .55; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.flash.error { background: var(--s-결석-bg); color: var(--danger); }
.flash.info { background: var(--s-이월-bg); color: var(--s-이월); }
.empty-state { text-align: center; color: var(--muted); padding: 26px 16px; }
.more { display: inline-block; margin: 2px 0 10px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #cfc8ba; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { min-height: 48px; font-size: 16px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: 13px; cursor: pointer; }
.linkbtn.danger { color: var(--danger); }

input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 42px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
input[type=color] { padding: 3px; height: 42px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
label.check input { width: 18px; min-height: 18px; height: 18px; accent-color: var(--primary); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.narrow, .narrow { max-width: 420px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.grid-form.tight { margin-top: 0; }
.grid-form .full { grid-column: 1 / -1; }
.grid-form.prog { margin-top: 0; }
.inline-form { margin-top: 10px; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; float: right; color: var(--muted); }
details.card[open] > summary::after { content: "▴"; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input[type=search] { width: auto; min-width: 180px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); align-items: center; }
.legend i, .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tc); margin-right: 4px; vertical-align: 0; }

/* 상태 표시 */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; margin-left: 3px; }
.pill.soft { background: var(--primary-soft); color: var(--primary); }
.pill.warn { background: var(--s-이월-bg); color: var(--s-이월); }
.st-예정 { --c: var(--s-예정); --b: var(--s-예정-bg); } .st-출석 { --c: var(--s-출석); --b: var(--s-출석-bg); }
.st-결석 { --c: var(--s-결석); --b: var(--s-결석-bg); } .st-취소 { --c: var(--s-취소); --b: var(--s-취소-bg); }
.st-이월 { --c: var(--s-이월); --b: var(--s-이월-bg); } .st-보강 { --c: var(--s-보강); --b: var(--s-보강-bg); }
.pill[class*="st-"] { background: var(--b); color: var(--c); }

/* 요약 숫자 */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat b { font-size: 20px; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.alert b { color: var(--accent); }

/* 수업 행 */
.list { display: flex; flex-direction: column; gap: 8px; }
.srow { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--tc); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.srow-main { display: flex; gap: 12px; align-items: center; padding: 11px 14px; color: inherit; }
.srow-time { display: flex; flex-direction: column; min-width: 62px; font-weight: 700; font-variant-numeric: tabular-nums; }
.srow-time:has(b) { min-width: 92px; }
.srow-time b { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.srow-time small { color: var(--muted); font-weight: 400; }
.srow-body { flex: 1; min-width: 0; }
.srow-title { font-weight: 600; word-break: keep-all; }
.srow-sub { font-size: 13px; color: var(--muted); }
.srow-msg { margin-top: 4px; font-size: 13px; color: var(--s-이월); background: var(--s-이월-bg); padding: 3px 8px; border-radius: 8px; display: inline-block; }
.srow-st { text-align: right; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); margin: 0; }
.q { border: 0; border-right: 1px solid var(--line); background: #fff; font: inherit; font-size: 14px; font-weight: 600; padding: 10px 0; cursor: pointer; color: var(--muted); }
.q:last-child { border-right: 0; }
.q.sel { color: var(--c); background: var(--b); }
.q-출석 { --c: var(--s-출석); --b: var(--s-출석-bg); } .q-결석 { --c: var(--s-결석); --b: var(--s-결석-bg); }
.q-취소 { --c: var(--s-취소); --b: var(--s-취소-bg); } .q-이월 { --c: var(--s-이월); --b: var(--s-이월-bg); } .q-예정 { --c: var(--s-예정); --b: var(--s-예정-bg); }
.q:hover { color: var(--c); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-item { flex-direction: row; }
.seg-item input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg-item span { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.seg-item input:checked + span { background: var(--b, var(--primary-soft)); color: var(--c, var(--primary)); border-color: transparent; }
.seg.small .seg-item span { padding: 6px 12px; font-size: 13px; }

/* 시간표 */
.week { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .week { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); } }
.day { background: #fbfaf7; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; min-width: 0; }
.day.is-today { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.day-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px; font-size: 14px; flex-wrap: wrap; }
.day-head .count { margin-left: auto; font-size: 12px; color: var(--muted); }
.day-empty { color: #c7c1b5; text-align: center; padding: 6px; }
.chip {
  position: relative; display: flex; flex-direction: column; padding: 7px 9px 7px 11px; margin-bottom: 6px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--tc); color: var(--ink); font-size: 13px; line-height: 1.35;
}
.chip-time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.chip-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-name em { font-style: normal; color: var(--s-보강); font-size: 11.5px; }
.chip-sub { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-st { position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--b); color: var(--c); }
.chip.st-취소, .chip.st-이월 { opacity: .7; }
.chip.st-취소 .chip-name { text-decoration: line-through; }
.chip-msg { position: absolute; bottom: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

/* 아동 */
.child-row { display: flex; gap: 12px; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.child-name { font-weight: 600; }
.child-name small { color: var(--muted); font-weight: 400; }
.memo { background: #fffdf6; }
.note-inline { margin: -4px 0 4px 18px; padding: 6px 10px; font-size: 13px; color: var(--muted); border-left: 2px solid var(--line); }
.note-card p { margin: 6px 0 0; }
.note-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.note-head small { color: var(--muted); }
.consult p { margin: 6px 0; }
.msg-card { background: var(--s-이월-bg); border-color: transparent; }
.msg-card p { margin: 4px 0 0; }
.info-line { padding: 10px 14px; }
.pop { position: relative; }
.pop > summary { color: var(--primary); font-size: 13px; }
.pop-body { position: absolute; right: 0; top: 26px; z-index: 5; width: 280px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 14px; display: flex; flex-direction: column; gap: 16px; }

/* 표 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid #f0ece4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
table.num td { font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #faf8f3; }
tr.total td { font-weight: 700; border-top: 1px solid var(--line); }
td.neg { color: var(--accent); font-weight: 700; }
td.okc { color: var(--s-출석); }
td form { margin: 0; }

.bars { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; color: var(--muted); }
.bar-fill { width: 100%; max-width: 38px; background: var(--primary); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar:hover .bar-fill { background: var(--accent); }
.two-col { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 800px) { .two-col { grid-template-columns: 1fr 1fr; } }

.list-plain > a, .list-plain > div { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f0ece4; color: inherit; align-items: center; }
.list-plain > *:last-child { border-bottom: 0; }
.list-plain > a { justify-content: flex-start; }
.list-plain > a > small:last-child { margin-left: auto; }
.list-plain small { color: var(--muted); white-space: nowrap; }
.list-plain form { margin: 0; }

.bill-line { display: flex; justify-content: space-between; padding: 3px 0; }
.bill-line:first-child { font-weight: 700; }
.bill-line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; }

.push-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: var(--primary-soft); border-color: transparent; }
.push-banner[hidden] { display: none; }
.push-banner b { display: block; color: var(--primary); }
.push-banner span { font-size: 13px; color: var(--muted); }
.chipbtn { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.wrap-chips { flex-wrap: wrap; }
.wrap-chips select { width: auto; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.menu-item b { display: block; font-size: 16px; }
.menu-item span { font-size: 13px; color: var(--muted); }

.login { max-width: 380px; margin: 8vh auto 0; text-align: center; }
.login-mark { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 6px; }
.login form { text-align: left; margin-top: 16px; }
body.guest { padding-bottom: 0; }
