/* 선생님 화면의 공통 단계(사이트 소유 층). tokens.css는 디자인 원본 mockup_v7의 색 토큰과 글자 그대로 같아야 하므로 이 단계는 여기 둔다. 수학 카드의 글자와 지면은 카드 owner가 유지한다. */
:root{
 --text-xs:12px;--text-sm:14px;--text-md:16px;--text-lg:20px;--text-xl:28px;
 --space-1:4px;--space-2:8px;--space-3:12px;--space-4:16px;--space-5:24px;--space-6:32px;
 --radius-sm:8px;--radius-md:12px;--radius-lg:16px;--control:44px;
}
:root{--radius-pill:999px;--bottom-nav-clearance:70px}
*{box-sizing:border-box}
body{background:var(--bg);color:var(--fg);font-family:var(--font);font-size:var(--text-sm);line-height:1.55;
  padding-left:max(var(--space-4),env(safe-area-inset-left,0));padding-right:max(var(--space-4),env(safe-area-inset-right,0));padding-block:var(--space-5) var(--space-6)}
.page{max-width:1220px;margin:0 auto;display:flex;flex-direction:column;gap:var(--space-5)}
h1{font-size:var(--text-xl);line-height:1.3;margin:0;text-wrap:balance}
h2{font-size:var(--text-lg);margin:0 0 var(--space-2)}
p{margin:0 0 var(--space-2)} ul{margin:0 0 var(--space-2);padding-left:var(--space-4)} li{margin:var(--space-1) 0}
.meta{color:var(--muted);font-size:var(--text-xs)}
.label{font-family:var(--mono);font-size:var(--text-xs);letter-spacing:.06em;color:var(--accent-ink)}
.doc{max-width:800px}
.doc a{color:var(--accent-ink)}
.nw{white-space:nowrap}
.ell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
button,select,input{font:inherit;color:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid var(--accent);outline-offset:2px}

.controls{display:flex;flex-wrap:wrap;gap:var(--space-2);align-items:center;margin-bottom:var(--space-3)}
.seg{display:inline-flex;flex-wrap:nowrap;border:1px solid var(--line);border-radius:var(--radius-pill);background:var(--surface);padding:var(--space-1);max-width:100%;overflow-x:auto}
.seg button{border:0;background:none;padding:var(--space-1) var(--space-3);border-radius:var(--radius-pill);font-size:var(--text-sm);min-height:36px;white-space:nowrap}
.seg button[aria-pressed="true"]{background:var(--accent);color:var(--on-accent)}
.seg.sm button{padding:var(--space-1) var(--space-2);font-size:var(--text-xs);min-height:32px}

/* 앱 틀 */
.app{position:relative;border:1px solid var(--line);background:var(--bg);box-shadow:0 14px 32px rgba(63,104,190,.10);overflow:hidden;display:flex;flex-direction:column}
.app.ph{width:min(390px,100%);height:780px;margin:0 auto;border-radius:var(--radius-lg)}
.app.dt{border-radius:var(--radius-lg);min-height:700px}
.band{display:none;background:var(--test-bg);color:var(--test);font-size:var(--text-xs);font-weight:500;padding:var(--space-1) var(--space-2);gap:var(--space-1);align-items:center;flex-wrap:wrap}
.app.test .band{display:flex}
.band-actions{display:flex;align-items:center;gap:var(--space-1);margin-left:auto;white-space:nowrap}
.band button{border:1px solid var(--test);background:none;color:var(--test);border-radius:var(--radius-pill);padding:0 var(--space-2);min-height:26px;font-size:var(--text-xs);white-space:nowrap}
.topbar{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-3);background:var(--surface);border-bottom:1px solid var(--line)}
.brand{font-weight:700;font-size:var(--text-md);white-space:nowrap}
.academy{font-size:var(--text-xs);color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.search{flex:1;min-width:0;border:1px solid var(--line);border-radius:var(--radius-pill);padding:var(--space-2) var(--space-3);background:var(--soft);color:var(--muted);font-size:var(--text-xs);text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
button.me{border:0;padding:0;cursor:pointer}
.me{width:34px;height:34px;border-radius:50%;background:var(--accent-soft);display:grid;place-items:center;font-size:var(--text-xs);font-weight:700;color:var(--accent-ink);flex:none}
.body{flex:1;min-height:0;display:flex}
.nav{display:none}
.app.dt .nav{display:flex;flex-direction:column;gap:var(--space-1);width:184px;flex:none;background:var(--surface);border-right:1px solid var(--line);padding:var(--space-3) var(--space-2)}
.nav button{border:0;background:none;text-align:left;padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);font-size:var(--text-sm);min-height:44px;display:flex;align-items:center;gap:var(--space-2);white-space:nowrap}
.nav button[aria-current="true"]{background:var(--accent-soft);color:var(--accent-ink);font-weight:700}
.nav .later{color:var(--muted);font-size:var(--text-sm)}
.nav .sep{height:1px;background:var(--line);margin:var(--space-2) var(--space-1)}
.main{flex:1;min-width:0;overflow:auto;padding:var(--space-3) var(--space-3) var(--space-4);display:flex;flex-direction:column;gap:var(--space-3)}
.app.dt .main{padding:var(--space-4) var(--space-4)}
.tabbar{display:none}
.app.ph .tabbar{display:grid;grid-template-columns:repeat(4,1fr);border-top:1px solid var(--line);background:var(--surface);padding-bottom:env(safe-area-inset-bottom,0)}
.tabbar button{border:0;background:none;padding:var(--space-2) var(--space-1);font-size:var(--text-xs);min-height:54px;display:flex;flex-direction:column;align-items:center;gap:var(--space-1);color:var(--muted);white-space:nowrap}
.tabbar button[aria-current="true"]{color:var(--accent-ink);font-weight:700}
.tabbar .ti{font-size:var(--text-md);line-height:1}
.app.ph .tabbar:has([data-nav="problems"]){grid-template-columns:repeat(5,1fr)}
.tag{font-size:var(--text-xs);border-radius:var(--radius-pill);padding:0 var(--space-1);border:1px solid var(--test);color:var(--test);font-weight:500;white-space:nowrap}

.head{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap}
.head h3{margin:0;font-size:var(--text-lg);flex:1 0 auto;display:flex;align-items:center;gap:var(--space-1);white-space:nowrap}
.app.dt .head h3{font-size:var(--text-lg)}
.head .hr{display:flex;gap:var(--space-2);align-items:center;margin-left:auto;flex:none}
.primary{border:0;background:var(--accent);color:var(--on-accent);border-radius:var(--radius-sm);padding:var(--space-2) var(--space-3);font-weight:500;min-height:44px;white-space:nowrap}
.ghost{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-sm);padding:var(--space-2) var(--space-3);min-height:40px;font-size:var(--text-sm);white-space:nowrap}
.icon{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-sm);width:44px;height:44px;font-size:var(--text-md);flex:none}
.help{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-pill);width:38px;height:38px;font-weight:700;color:var(--accent-ink);flex:none}
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-3)}
.card h4{margin:0 0 var(--space-2);font-size:var(--text-sm)}
.empty{color:var(--muted);font-size:var(--text-sm)}
.row{display:flex;gap:var(--space-2);align-items:center;flex-wrap:wrap}
.hscroll{display:flex;gap:var(--space-1);overflow-x:auto;padding-bottom:var(--space-1);scrollbar-width:none}
.hscroll::-webkit-scrollbar{display:none}
.mk{display:inline-block;vertical-align:-2px;flex:none}

/* 오늘 */
.quick input{width:100%;border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);font-size:var(--text-sm);background:var(--surface)}
.parse{display:flex;flex-wrap:wrap;gap:var(--space-1);align-items:center;font-size:var(--text-xs);background:var(--soft);border:1px dashed var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-2)}
.pill{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-pill);padding:var(--space-1) var(--space-2);white-space:nowrap}
.lesson{display:grid;grid-template-columns:auto 1fr auto;gap:var(--space-2);align-items:center;border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);background:var(--surface);text-align:left;width:100%}
.lesson[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
.lesson .t{font-variant-numeric:tabular-nums;font-weight:700;font-size:var(--text-sm);white-space:nowrap;line-height:1.25}
.lesson .t small{display:block;font-weight:400;color:var(--muted);font-size:var(--text-xs)}
.lesson .n{font-weight:700;display:flex;gap:var(--space-1);align-items:center;min-width:0}
.lesson .s{color:var(--muted);font-size:var(--text-xs);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lesson .r{display:flex;flex-direction:column;align-items:flex-end;gap:var(--space-1)}
.chip{display:inline-block;font-size:var(--text-xs);border-radius:var(--radius-pill);padding:0 var(--space-2);border:1px solid var(--line);color:var(--muted);white-space:nowrap}
.chip.warn{border-color:var(--warn);color:var(--warn);background:var(--warn-bg)}
.count{font-variant-numeric:tabular-nums;font-size:var(--text-xs);color:var(--muted);white-space:nowrap}
.split{display:flex;flex-direction:column;gap:var(--space-2)}
.app.dt .split{display:grid;grid-template-columns:1fr 340px;gap:var(--space-3);align-items:start}
.panel-col{display:none}
.app.dt .panel-col{display:block}
.actions{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-2);margin:var(--space-2) 0}
.actions button{border:1px solid var(--line);background:var(--soft);border-radius:var(--radius-sm);padding:var(--space-2) var(--space-1);min-height:44px;font-size:var(--text-sm);white-space:nowrap}
.who{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);font-size:var(--text-sm);border-bottom:1px solid var(--line2);padding:var(--space-1) 0}
.att{display:inline-flex;border:1px solid var(--line);border-radius:var(--radius-pill);overflow:hidden;flex:none}
.att button{border:0;background:none;padding:var(--space-1) var(--space-2);font-size:var(--text-xs);min-height:34px;white-space:nowrap}
.att button[aria-pressed="true"]{background:var(--accent);color:var(--on-accent)}
.note{font-size:var(--text-xs);color:var(--muted);border-top:1px solid var(--line);padding-top:var(--space-2);margin-top:var(--space-2)}

.pager{display:flex;align-items:center;gap:var(--space-1)}
.pager .range{flex:1;text-align:center;font-variant-numeric:tabular-nums;font-weight:500;font-size:var(--text-sm);white-space:nowrap}
.weekv{display:flex;flex-direction:column;gap:var(--space-1)}
.wrow{display:grid;grid-template-columns:48px 1fr;gap:var(--space-2);align-items:start;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2)}
.wrow.today{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}
.wrow .dd{font-size:var(--text-xs);white-space:nowrap;color:var(--muted);line-height:1.2}
.wrow .dd b{display:block;font-size:var(--text-md);color:var(--fg)}
.wrow.sun .dd,.wrow.sun .dd b{color:#e5484d}
.wchips{display:flex;flex-wrap:wrap;gap:var(--space-1)}
.wc{display:inline-flex;align-items:center;gap:var(--space-1);border-radius:var(--radius-sm);padding:var(--space-1) var(--space-2);font-size:var(--text-xs);color:var(--ink);white-space:nowrap}
.wc.off{background:transparent!important;color:var(--muted);border:1px dashed var(--line);text-decoration:line-through}
.wc.extra{background:var(--soft)!important;color:var(--fg);border:1px solid var(--line)}
.weekh{display:none}
.app.dt .weekv{display:none}
.app.dt .weekh{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:var(--space-1)}
.wd{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);padding:var(--space-2);min-height:180px;display:flex;flex-direction:column;gap:var(--space-1);min-width:0}
.wd .d{font-size:var(--text-xs);color:var(--muted);display:flex;justify-content:space-between}
.wd.today{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft)}
.wd.sun .d{color:#e5484d}
.blk{border-radius:var(--radius-sm);padding:var(--space-1) var(--space-1);font-size:var(--text-xs);line-height:1.35;color:var(--ink);display:flex;gap:var(--space-1);align-items:center;text-align:left;border:1px solid transparent;width:100%;min-width:0}
.blk span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.blk.two{flex-direction:column;align-items:flex-start;gap:0}
.blk.two small{font-size:var(--text-xs);opacity:.75;font-variant-numeric:tabular-nums}
.blk.two span{max-width:100%;display:flex;gap:var(--space-1);align-items:center}
.blk.off{background:transparent!important;color:var(--muted);border:1px dashed var(--line);text-decoration:line-through}
.blk.extra{background:var(--soft)!important;color:var(--fg);border:1px solid var(--line)}
.five{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:var(--space-1)}
.fc{background:var(--surface);border:1px solid var(--line2);border-radius:var(--radius-sm);min-height:52px;padding:var(--space-1) var(--space-1);display:flex;flex-direction:column;gap:var(--space-1);min-width:0;text-align:left}
.app.dt .fc{min-height:70px}
.fc .d{font-size:var(--text-xs);color:var(--muted);white-space:nowrap}
.fc.today{border-color:var(--accent)}
.fc.sun .d{color:#e5484d}
.fc .dots{display:flex;flex-wrap:wrap;gap:var(--space-1)}
.wh{font-size:var(--text-xs);color:var(--muted);text-align:center}

/* 학생 */
.tool{display:flex;gap:var(--space-2);align-items:center}
.tool input{flex:1;min-width:0;border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);font-size:var(--text-sm);background:var(--surface)}
.tool select{border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2);font-size:var(--text-sm);background:var(--surface);min-height:42px;flex:none}
.fchip{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-pill);padding:var(--space-1) var(--space-3);font-size:var(--text-xs);min-height:34px;display:inline-flex;gap:var(--space-1);align-items:center;white-space:nowrap;flex:none}
.fchip[aria-pressed="true"]{background:var(--accent-soft);border-color:var(--accent);color:var(--accent-ink);font-weight:500}
.sv{border:1px solid var(--accent);color:var(--accent-ink);background:var(--surface);border-radius:var(--radius-pill);padding:var(--space-1) var(--space-3);font-size:var(--text-xs);min-height:34px;white-space:nowrap;flex:none}
.scard{display:grid;grid-template-columns:28px 1fr auto;gap:var(--space-2);align-items:center;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-2)}
.scard .nm{display:flex;gap:var(--space-1);align-items:center;font-weight:700;border:0;background:none;padding:0;text-align:left;min-width:0}
.scard .sub{font-size:var(--text-xs);color:var(--muted);display:flex;gap:var(--space-1);flex-wrap:wrap}
.scard .nx{font-size:var(--text-xs);color:var(--muted);text-align:right;white-space:nowrap}
.grp{font-size:var(--text-xs);font-weight:700;color:var(--accent-ink);padding:var(--space-1) var(--space-1)}
input[type=checkbox]{width:20px;height:20px}
.bulk{position:sticky;bottom:0;display:flex;flex-wrap:wrap;gap:var(--space-1);align-items:center;background:var(--accent-soft);border-radius:var(--radius-md);padding:var(--space-2) var(--space-2);font-size:var(--text-xs)}
.tbl{width:100%;border-collapse:collapse;font-size:var(--text-sm)}
.tbl th,.tbl td{text-align:left;padding:var(--space-2) var(--space-2);border-bottom:1px solid var(--line2);vertical-align:middle}
.tbl th{color:var(--muted);font-weight:500;font-size:var(--text-xs);white-space:nowrap}
.tbl tr.g td{background:var(--soft);font-weight:700;font-size:var(--text-xs);color:var(--accent-ink)}
.only-ph{display:block}.only-dt{display:none}
.only-dt-i{display:none}.app.dt .only-dt-i{display:inline}.app.dt .only-ph-i{display:none}
.app.ph .search{flex:none;width:38px;height:38px;padding:0;text-align:center;font-size:var(--text-md);color:var(--accent-ink);margin-left:auto}
.app.ph .academy{flex:1}
.app.dt .only-ph{display:none}.app.dt .only-dt{display:block}

/* 시간표 */
.slot{display:flex;flex-direction:column;gap:var(--space-1)}
.slot .sh{font-size:var(--text-xs);font-weight:700;color:var(--muted);font-variant-numeric:tabular-nums}
.tcard{display:grid;grid-template-columns:auto 1fr auto;gap:var(--space-2);align-items:center;border-radius:var(--radius-md);padding:var(--space-2) var(--space-2);color:var(--ink);border:1px solid transparent;text-align:left;width:100%}
.tcard.off{background:transparent!important;color:var(--muted);border:1px dashed var(--line)}
.tcard .tn{font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tcard .ts{font-size:var(--text-xs);white-space:nowrap}
.ttwrap{overflow-x:auto;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface);padding:var(--space-2)}
.ttgrid{display:grid;gap:var(--space-1);font-size:var(--text-xs)}
.ttgrid .gh{text-align:center;font-weight:700;border-radius:var(--radius-sm);padding:var(--space-1);color:var(--ink);white-space:nowrap}
.ttgrid .ch{text-align:center;color:var(--muted);font-weight:500;padding:var(--space-1);white-space:nowrap}
.ttgrid .r{color:var(--muted);font-variant-numeric:tabular-nums;padding-top:var(--space-1);white-space:nowrap}
.ttgrid .cell{min-height:58px;border:1px dashed var(--line2);border-radius:var(--radius-sm);padding:var(--space-1);background:none;text-align:left}
.warnline{flex-wrap:wrap;align-items:center!important;display:flex;gap:var(--space-2);align-items:flex-start;font-size:var(--text-xs);color:var(--warn);background:var(--warn-bg);border-radius:var(--radius-md);padding:var(--space-2) var(--space-2)}
.tabs{display:flex;gap:var(--space-1);border-bottom:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
.tabs button{border:0;background:none;padding:var(--space-2) var(--space-2);font-size:var(--text-sm);border-bottom:2px solid transparent;min-height:42px;white-space:nowrap}
.tabs button[aria-selected="true"]{border-color:var(--accent);color:var(--accent-ink);font-weight:700}
.field{display:flex;justify-content:space-between;gap:var(--space-2);padding:var(--space-2) 0;border-bottom:1px solid var(--line2);font-size:var(--text-sm);align-items:center}
.field .k{color:var(--muted);white-space:nowrap}
.field .v{text-align:right;display:flex;gap:var(--space-1);align-items:center;justify-content:flex-end;flex-wrap:wrap}
.lrow{display:flex;justify-content:space-between;gap:var(--space-2);padding:var(--space-2) 0;border-bottom:1px solid var(--line2);font-size:var(--text-sm);align-items:center}
.lrow-open{width:100%;min-height:44px;background:none;border:0;border-bottom:1px solid var(--line2);border-radius:0;color:inherit;font:inherit;font-size:var(--text-sm);text-align:left;cursor:pointer}.lrow-open .student-note{flex-basis:100%}
.tree{display:flex;flex-direction:column;gap:var(--space-1)}
.app.dt .tree{flex-direction:row;flex-wrap:wrap;align-items:center}
.node{border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);background:var(--surface);font-size:var(--text-xs)}
.node b{display:block;font-size:var(--text-sm);white-space:nowrap}
.node.now{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}

/* 아래에서 올라오는 칸 */
.sheet-wrap{position:absolute;inset:0;background:var(--shade);display:flex;align-items:flex-end;z-index:5}
.sheet{background:var(--bg);width:100%;max-height:82%;overflow:auto;border-radius:var(--radius-lg) var(--radius-lg) 0 0;padding:var(--space-2) var(--space-3) var(--space-4);box-shadow:0 -8px 24px rgba(0,0,0,.18)}
.app.dt .sheet-wrap{align-items:center;justify-content:center}
.app.dt .sheet{width:min(460px,90%);border-radius:var(--radius-lg);max-height:80%}
.grab{width:40px;height:4px;border-radius:var(--radius-sm);background:var(--line);margin:0 auto var(--space-2)}
.sheet h4{margin:0 0 var(--space-1);font-size:var(--text-md)}

/* 학생·학부모 */
.next{background:var(--accent-soft);border-radius:var(--radius-lg);padding:var(--space-3)}
.next .big{font-size:var(--text-lg);font-weight:700;white-space:nowrap}
.next .sub{white-space:nowrap}
.wkl .lrow span:first-child{font-variant-numeric:tabular-nums}
.btnrow{display:grid;grid-template-columns:repeat(auto-fit,minmax(90px,1fr));gap:var(--space-2)}
.btnrow button{border:1px solid var(--line);background:var(--surface);border-radius:var(--radius-md);padding:var(--space-2) var(--space-1);min-height:48px;font-size:var(--text-sm);white-space:nowrap}
.mini{display:grid;grid-template-columns:repeat(7,1fr);gap:var(--space-1);text-align:center;font-size:var(--text-xs)}
.mini span{padding:var(--space-1) 0;border-radius:var(--radius-sm);display:flex;flex-direction:column;align-items:center;gap:var(--space-1);min-height:38px}

details.gi{border-bottom:1px solid var(--line2)}
details.gi:last-child{border-bottom:0}
details.gi summary{cursor:pointer;padding:var(--space-2) 0;font-size:var(--text-sm);list-style:none;display:flex;justify-content:space-between;gap:var(--space-2);align-items:center}
details.gi summary::-webkit-details-marker{display:none}
details.gi summary::after{content:"›";color:var(--muted);transition:transform .15s}
details.gi[open] summary::after{transform:rotate(90deg)}
details.gi .steps{margin:0 0 var(--space-2)}
pre.ai{white-space:pre-wrap;font-family:var(--mono);font-size:var(--text-xs);line-height:1.6;background:var(--soft);border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2);margin:0;max-height:360px;overflow:auto}
.steps{list-style:none;padding:0;margin:0;counter-reset:s}
.steps li{counter-increment:s;padding-left:var(--space-6);position:relative;margin:var(--space-2) 0;font-size:var(--text-sm)}
.steps li::before{content:counter(s);position:absolute;left:0;top:1px;width:22px;height:22px;border-radius:50%;background:var(--accent-soft);color:var(--accent-ink);font-size:var(--text-xs);font-weight:700;display:grid;place-items:center}
.legend{display:flex;flex-wrap:wrap;gap:var(--space-2);font-size:var(--text-xs);color:var(--muted)}
.legend span{display:inline-flex;gap:var(--space-1);align-items:center;white-space:nowrap}
.toast{position:fixed;left:50%;bottom:calc(20px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);background:var(--fg);color:var(--bg);padding:var(--space-2) var(--space-4);border-radius:var(--radius-sm);font-size:var(--text-sm);opacity:0;transition:opacity .2s;pointer-events:none;max-width:90vw;z-index:20}
.toast.on{opacity:1}
@media (prefers-reduced-motion:reduce){.toast{transition:none}}
/* 시안의 앱 틀을 실제 기기의 폭에 맞춘다. 색 토큰은 원본 그대로다. */
body{margin:0;padding:0;min-width:320px}
.app,.app.ph,.app.dt{width:100%;min-height:100dvh;height:auto;border:0;border-radius:0;margin:0;box-shadow:none;overflow:visible}
.app .body{min-height:0}.main{overflow:visible;padding-bottom:var(--space-6)}
.app.ph .tabbar{position:fixed;inset:auto 0 0;z-index:3}
.app.dt .nav{min-height:calc(100dvh - 70px)}
.app.dt .main{max-width:1500px;margin-inline:auto}
.stack{display:flex;flex-direction:column;gap:var(--space-2);min-width:0}
.input-label{display:flex;flex-direction:column;gap:var(--space-1);font-size:var(--text-sm);min-width:0}
input:not([type=checkbox]),select,textarea{border:1px solid var(--line);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);background:var(--surface);max-width:100%;min-width:0;color:var(--fg);font:inherit}
input:not([type=checkbox]),textarea{width:100%}
button{font:inherit}.ghost,.fchip,.sv,.seg button,.att button{min-height:44px}
.topbar .input-label{max-width:160px;font-size:0;min-width:0}.topbar select{font-size:var(--text-xs);padding:var(--space-1);min-height:44px}
.topbar{gap:var(--space-1);flex-wrap:nowrap}.topbar .brand{font-size:var(--text-sm)}.topbar .me{min-width:44px;min-height:44px;width:auto;padding:var(--space-1) var(--space-2);border-radius:var(--radius-lg);max-width:80px;white-space:nowrap;overflow:hidden}
.lesson-middle,.min-zero{min-width:0}.end{justify-content:flex-end}.between{justify-content:space-between}
.lrow{flex-wrap:wrap}.field .v{min-width:0}.sheet-wrap{position:fixed;z-index:10}
.sheet{max-height:88dvh;overscroll-behavior:contain}.app.dt .sheet-wrap{justify-content:flex-end;align-items:stretch}.app.dt .sheet{width:460px;max-height:100dvh;border-radius:var(--radius-lg) 0 0 var(--radius-lg);padding:var(--space-5)}
.sheet .actions{grid-template-columns:repeat(auto-fit,minmax(120px,1fr))}
.check{display:flex;gap:var(--space-2);align-items:center;min-height:44px}.check input{flex:none}
fieldset{border:1px solid var(--line);border-radius:var(--radius-md);min-width:0;padding:var(--space-2)}
.login{max-width:460px!important;margin:auto!important;min-height:100dvh}.login .main{padding:var(--space-6) var(--space-4);justify-content:center}
.error{color:var(--warn)}.warn-text{flex:1 1 180px;min-width:0}.warn-text b{white-space:normal;word-break:keep-all}
.student-mark{display:inline-block;width:11px;height:11px;background:var(--grade);flex:none}.student-mark.circle{border-radius:50%}.student-mark.tri{clip-path:polygon(50% 0,100% 100%,0 100%)}.student-mark.square{border-radius:var(--radius-sm)}
.family{max-width:780px!important;margin:auto!important}.family .big{font-size:clamp(18px,5vw,22px)}.family .sub{white-space:normal;word-break:keep-all}
.family details summary{cursor:pointer;padding:var(--space-1) 0;min-height:44px}
.nm{flex-wrap:wrap}.nx{font-size:var(--text-xs)}.scard{grid-template-columns:22px minmax(0,1fr) auto;gap:var(--space-1)}
.sheet .who{flex-wrap:wrap}.sheet .att{margin-left:auto}
.who{flex-wrap:wrap}.who-name{min-width:0;flex:1 1 100px}
.nm{display:flex;align-items:center;min-height:44px;max-width:100%;text-align:left;border:0;background:none;font-weight:700;text-decoration:underline;text-decoration-color:var(--line);text-underline-offset:4px;padding:var(--space-1) 0;overflow-wrap:anywhere}
.attendance-actions{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-1);margin-left:auto}
.attendance-note{white-space:pre-wrap;overflow-wrap:anywhere;max-width:100%}
.lesson-note{display:grid;gap:var(--space-2)}.lesson-note-text{margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.lesson-note .btn,.lesson-note button{justify-self:start}.student-note{flex-basis:100%}
.sheet-handle{display:flex;align-items:center;justify-content:center;min-height:32px;margin:calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) 0;touch-action:none;cursor:grab}
.sheet-handle .grab{margin:0}.sheet > h4{touch-action:none}.sheet-handle:active{cursor:grabbing}
.sheet{will-change:transform}
.app.dt .sheet-wrap{align-items:center;justify-content:center}.app.dt .sheet{width:min(460px,90%);max-height:80dvh;border-radius:var(--radius-lg)}
.app.dt .sheet-handle{display:none}
.combinations{position:relative}.combinations [data-combination]{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:grab;max-width:100%;overflow-wrap:anywhere}
.combination-moving{opacity:.35}.combination-ghost{position:fixed;z-index:30;pointer-events:none;box-shadow:0 8px 24px var(--shade);transform:scale(1.05);background:var(--surface);color:var(--fg);border:1px solid var(--accent);border-radius:var(--radius-pill)}
.quick{display:block;min-width:0}.quick input,.quick textarea{width:100%;min-width:0}.quick textarea{resize:vertical}.quick-result+.quick-result{border-top:1px solid var(--line);padding-top:var(--space-2)}.quick-result{display:flex;flex-direction:column;gap:var(--space-1)}.quick-result .parse{width:100%}
button,input:not([type=hidden]),select,textarea,summary{min-height:44px}
.seg.sm button,.band button,.tool select,.tabs button{min-height:44px}
.app.ph .search{min-width:44px;min-height:44px}
.app.ph .bulk{bottom:calc(64px + env(safe-area-inset-bottom,0px))}
button,summary{min-width:44px}
input[type=checkbox]{-webkit-appearance:none;appearance:none;width:44px;height:44px;margin:0;flex:none;cursor:pointer;border:0;border-radius:var(--radius-sm);background:linear-gradient(var(--surface),var(--surface)) center/17px 17px no-repeat,linear-gradient(var(--muted),var(--muted)) center/21px 21px no-repeat}input[type=checkbox]:checked{background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.8' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/20px 20px no-repeat,linear-gradient(var(--accent),var(--accent)) center/21px 21px no-repeat}.scard input[type=checkbox]{margin:calc(-1 * var(--space-3))}
.scard{grid-template-columns:44px minmax(0,1fr) auto}
pre.ai{max-width:100%;overflow:auto}
.head h3{min-width:0;flex:1 1 auto;white-space:normal;flex-wrap:wrap;font-size:var(--text-lg)}.head .hr{flex-wrap:wrap}
.tool{flex-wrap:wrap}.tool input{min-width:125px}.tool select{max-width:120px}
@media(min-width:900px){.app.dt .weekv{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:var(--space-1)}.wrow{display:flex;flex-direction:column;min-height:180px}.wchips{min-width:0}.wc{display:flex;flex-direction:column;align-items:flex-start;gap:0;width:100%;min-width:0;white-space:normal;word-break:keep-all;max-width:100%;text-align:left}.wc-time{font-size:var(--text-xs);line-height:1.2;opacity:.75}.wc-label{display:flex;align-items:center;gap:var(--space-1);width:100%;min-width:0}.wc-name{display:block;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wc svg{flex:none}.split{grid-template-columns:minmax(0,1fr) minmax(290px,340px)!important}}
@media(max-width:359px){.main{padding-inline:var(--space-2)}.topbar{padding-inline:var(--space-2)}.topbar .brand{font-size:var(--text-xs)}.topbar .input-label{max-width:133px}.topbar .me{max-width:58px}.head .hr{gap:var(--space-1)}.seg.sm button{padding-inline:var(--space-2)}.scard .nx{font-size:var(--text-xs)}.lesson{padding:var(--space-2);gap:var(--space-2)}.quick{flex-wrap:wrap}.quick button{margin-left:auto}}

/* Shared visibility treatment across daily, weekly, monthly and roster views. */
.scope-other{opacity:.5}
.scope{align-self:flex-start}.row.end>.scope{align-self:center;margin-right:auto}
.scope button{min-width:44px;min-height:44px}

[data-calendar]{touch-action:pan-x pan-y pinch-zoom;overscroll-behavior:contain;scroll-snap-type:y mandatory;scrollbar-width:none;overflow-anchor:none;-webkit-overflow-scrolling:touch}
[data-calendar]::-webkit-scrollbar{display:none}
.weekv[data-calendar]{display:flex;flex-direction:column;gap:0;height:518px;overflow-y:auto;overflow-x:hidden}
.weekv .wrow{flex:0 0 74px;height:74px;min-height:0;min-width:0;scroll-snap-align:start;align-items:center}
.weekv .wchips{flex-wrap:nowrap;overflow-x:auto;min-width:0;max-height:100%;overscroll-behavior-x:contain}
.weekv .wc{flex-shrink:0;min-height:44px}
.calendar-weekdays,.calendar-week{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:var(--space-1)}
.calendar-weekdays{padding-bottom:var(--space-1)}
.five[data-calendar]{display:block;height:320px;overflow-y:auto;overflow-x:hidden}
.calendar-week{height:64px;padding-bottom:var(--space-1);scroll-snap-align:start}
.calendar-week .fc{height:61px;min-height:44px;overflow:hidden}
@media(min-width:900px){
 .app.dt .weekv[data-calendar]{display:flex;flex-direction:row;gap:0;height:220px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;touch-action:pan-x pan-y pinch-zoom}
 .weekv .wrow{flex:0 0 calc(100% / 7);height:220px;min-height:0;align-items:stretch}
 .weekv .wchips{flex-direction:column;flex:1;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;overscroll-behavior-x:auto}
 .weekv .wc{flex-shrink:0}
 .five[data-calendar]{height:460px}
 .calendar-week{height:92px}
 .calendar-week .fc{height:89px;min-height:44px}
}
@media(max-width:359px){
 .five[data-calendar],.calendar-weekdays{width:calc(100vw - 12px);position:relative;left:50%;transform:translateX(-50%)}
 .calendar-week,.calendar-weekdays{column-gap:0}
}

/* Academy management uses the same mobile sheets and common controls. */
.member-row{display:flex;width:100%;text-align:left;background:none;border:0;color:inherit;font:inherit;min-height:60px;gap:var(--space-3)}.member-row .meta{display:block}.member-stopped{opacity:.55}.member-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:var(--space-2)}.member-actions button{white-space:normal;min-height:44px}.member-link{width:100%;min-width:0}.transfer-card{border-color:var(--accent)}.danger{color:var(--warn)}.card .min-zero{min-width:0;overflow-wrap:anywhere}
/* 초대받은 사람 화면: 제목은 낱말 단위로 줄바꿈, 가입·합류 단추는 넓게(시안 2판). */
.app.login h1{word-break:keep-all}
form[data-action="$join"] .row.end .primary,form[data-action="$join-existing"] .row.end .primary{width:100%}
.chip.ok{border-color:var(--accent);color:var(--accent-ink);background:var(--accent-soft)}

/* Academy labels in the combined month remain inside each date cell. */
.five .dots>span{min-width:0;max-width:100%}.five .dots small{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--text-xs);color:var(--muted)}

.five .dots .month-academy{display:flex;align-items:center;gap:var(--space-1);width:100%;height:11px;line-height:11px}.five .dots .month-academy small{display:inline-block;min-width:0;line-height:11px}.five .dots .month-academy small:first-of-type{flex:1}.fc.has-clash{border-color:var(--warn)}.month-clash{margin-left:var(--space-1);color:var(--warn);font-size:var(--text-xs)}

.wc-academy{display:flex;align-items:center;gap:var(--space-1);min-width:0;max-width:100%;font-size:var(--text-xs);line-height:1.3}.wc-academy>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wc-clash{flex:none;color:var(--caution);background:var(--surface);font-size:var(--text-xs)}

.part-notice{border:1px solid var(--line);background:var(--warn-bg);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);display:flex;gap:var(--space-2);align-items:center;justify-content:space-between;font-size:.88rem;margin-bottom:var(--space-3)}.part-notice b{color:var(--warn)}.part-notice span{min-width:0;overflow-wrap:anywhere}.part-notice button{flex:none;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--surface);color:var(--accent-ink)}.screen-unavailable{border:1px dashed var(--line);border-radius:var(--radius-md);padding:var(--space-5) var(--space-3);display:flex;flex-direction:column;align-items:center;gap:var(--space-2);color:var(--muted)}

/* Teacher shell and five connected objects use one scale. */
body:has(.app:not(.family)){margin:0;padding:0;background:var(--bg)}
.app:not(.family){font-size:var(--text-sm);border:0;border-radius:0;box-shadow:none;min-height:100dvh;width:100%;max-width:1440px;margin:0 auto}
.app.ph:not(.family){height:100dvh}
.app:not(.family) .main{padding:var(--space-4);gap:var(--space-4);scroll-behavior:auto}
.app:not(.family) .topbar{padding:var(--space-2) var(--space-4);gap:var(--space-2);flex-wrap:wrap}
.app:not(.family) .topbar label{min-width:0;flex:1;max-width:100%}
.app:not(.family) .topbar select{max-width:100%;min-width:0}
.app:not(.family) .me{width:var(--control);height:var(--control);font-size:var(--text-xs)}
.app:not(.family) button,.app:not(.family) select,.app:not(.family) summary,.app:not(.family) input:not([type=checkbox]):not([type=radio]){min-height:var(--control)}
.app:not(.family) input[type=checkbox],.app:not(.family) input[type=radio]{min-width:var(--space-4);min-height:var(--space-4)}
.app:not(.family) .check{min-height:var(--control);align-items:center;display:flex;gap:var(--space-2)}
.app:not(.family) .tabbar{grid-template-columns:repeat(5,minmax(0,1fr));flex:none}
.app:not(.family) .band .nw{white-space:normal}
.app:not(.family) .card{border-radius:var(--radius-md);padding:var(--space-4);min-width:0}
.app:not(.family) .head{gap:var(--space-2);flex-wrap:wrap;margin:0}
.app:not(.family) h2,.app:not(.family) .head h3{font-size:var(--text-lg);margin:0;letter-spacing:-.03em}
.app:not(.family) h4{font-size:var(--text-md);margin:0 0 var(--space-3)}
.app:not(.family) .meta{font-size:var(--text-xs)}
.app:not(.family) .sheet{max-height:92dvh;overscroll-behavior:contain}
.teacher-space{display:flex;flex-direction:column;gap:var(--space-4);min-width:0}
.teacher-space .t-panel{display:flex;flex-direction:column;gap:var(--space-4);min-width:0}
.t-section{margin:0;background:var(--surface);border:1px solid var(--line)}
.t-tabs{display:flex;gap:var(--space-1);overflow-x:auto;flex:none;max-width:100%;border-bottom:1px solid var(--line);padding-bottom:var(--space-2)}
.t-tabs button{flex:none;padding:var(--space-2) var(--space-3);background:transparent;border:0;border-radius:var(--radius-sm);font-size:var(--text-sm);white-space:nowrap}
.t-tabs button[aria-selected=true]{background:var(--accent-soft);color:var(--accent-ink);font-weight:700}
.t-link{border:0;background:transparent;color:var(--accent-ink);padding:var(--space-2) var(--space-1);font:inherit;text-align:left;max-width:100%;overflow-wrap:anywhere;border-radius:var(--radius-sm);text-decoration:none;display:inline-flex;align-items:center;gap:var(--space-1)}
.t-link:hover{background:var(--accent-soft)}
.t-metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-3);padding-top:var(--space-4);margin-top:var(--space-4);border-top:1px solid var(--line)}
.t-metrics span{display:block;font-size:var(--text-xs);color:var(--muted)}
.t-metrics strong{display:block;font-size:var(--text-lg);font-weight:600;margin-top:var(--space-1)}
.t-table{max-width:100%;overflow:auto;border:1px solid var(--line);border-radius:var(--radius-sm);overscroll-behavior:contain}
.t-table table{min-width:100%;border-collapse:collapse;font-size:var(--text-sm);white-space:nowrap}
.t-table th,.t-table td{padding:var(--space-2) var(--space-3);border-bottom:1px solid var(--line2);text-align:left}
.t-table th{background:var(--soft);color:var(--muted);font-weight:500}
.t-chip{display:inline-block;font-size:var(--text-xs);color:var(--muted);background:var(--soft);border-radius:var(--radius-sm);padding:var(--space-1) var(--space-2)}
.t-note{white-space:pre-wrap;overflow-wrap:anywhere}
.t-score{font-size:var(--text-xl);font-weight:600}
.t-score small{font-size:var(--text-md);color:var(--muted)}
.t-preview{width:100%;height:70dvh;border:1px solid var(--line);border-radius:var(--radius-md);background:var(--surface)}
.t-card-image{display:block;width:auto;max-width:100%;height:auto;max-height:none;margin:0 auto;background:white}
.t-file{display:inline-flex;align-items:center;min-height:var(--control);padding:var(--space-2);color:var(--accent-ink)}
.t-lesson-status{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-2);font-size:var(--text-xs);color:var(--muted);padding:0 var(--space-3) var(--space-2)}
.teacher-space .row{flex-wrap:wrap;gap:var(--space-2)}
.teacher-space .lrow{flex-wrap:wrap;gap:var(--space-2)}
.teacher-space .ability-radar{max-width:100%;height:auto}
.teacher-space .t-section:has(.ability-radar){overflow:hidden}
.teacher-space .actions{flex-wrap:wrap}
.teacher-space button.ghost{padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);font-size:var(--text-sm)}
.sheet:has(.t-preview){width:min(920px,100%)}
.sheet:has(.t-card-image){width:min(780px,100%)}
@media(min-width:900px){.app:not(.family) .main{padding:var(--space-5) var(--space-6)}.teacher-space{max-width:1040px;width:100%;margin:0 auto}.teacher-space .t-section{padding:var(--space-5)}.app:not(.family) .nav{width:176px}.app:not(.family) .topbar{padding:var(--space-3) var(--space-5)}}
@media(max-width:374px){.app:not(.family) .main{padding:var(--space-3)}.app:not(.family) .brand{font-size:var(--text-sm)}.app:not(.family) .topbar .search{display:none}.t-metrics{gap:var(--space-2)}.t-metrics strong{font-size:var(--text-md)}}
@media(min-width:900px){.teacher-space[data-entity=student]:has([data-teacher-tab=summary][aria-selected=true]) .t-panel{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}.teacher-space[data-entity=student] .t-panel>.t-section:last-child{grid-column:1/-1}.t-ability-summary .ability-radar{display:block;width:100%;max-width:390px;margin:auto}}

.app.ph:not(.family) .main{padding-bottom:calc(var(--space-6) + var(--bottom-nav-clearance));scroll-padding-bottom:90px}
.sheet .html-math-card{overflow-x:auto;overscroll-behavior:contain}

.app.ph:not(.family){height:auto}

.app:not(.family) button{min-width:var(--control)}

.t-result-row{cursor:pointer}.t-result-row:hover{background:var(--soft)}
