:root{
    --bg:#F7F8FA; --surface:#FFFFFF; --ink:#0F1115; --ink2:#3A3F4B; --soft:#6B7180; --faint:#9AA0AC;
    --line:#E6E8EC; --line2:#F0F1F4; --accent:#3D5AFE; --accentSoft:#EEF1FF;
    --done:#12965A; --doneSoft:#E7F6EE; --wait:#A16207; --waitSoft:#FEF6E4; --danger:#C62828;
    --r:10px; --shadow:0 1px 2px rgba(15,17,21,.04);
  }
  @media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#0E1013;--surface:#16191E;--ink:#F2F3F5;--ink2:#C9CDD4;--soft:#9AA0AC;--faint:#6B7180;--line:#262A31;--line2:#1E2127;--accentSoft:#1D2546;--doneSoft:#10261B;--waitSoft:#2A2111}}
  :root[data-theme="dark"]{--bg:#0E1013;--surface:#16191E;--ink:#F2F3F5;--ink2:#C9CDD4;--soft:#9AA0AC;--faint:#6B7180;--line:#262A31;--line2:#1E2127;--accentSoft:#1D2546;--doneSoft:#10261B;--waitSoft:#2A2111}
  :root{box-sizing:border-box; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px)}
  html{scroll-padding-top:env(safe-area-inset-top,0px)}
  *{box-sizing:border-box}
  html,body{margin:0}
  body{font-family:'Geist',system-ui,-apple-system,sans-serif; background:var(--bg); color:var(--ink); font-size:15px; line-height:1.45; -webkit-font-smoothing:antialiased}
  button{font:inherit; color:inherit}
  a{color:inherit; text-decoration:none}
  :focus-visible{outline:2px solid var(--accent); outline-offset:2px}

  .bar{background:var(--surface); border-bottom:1px solid var(--line); position:sticky; top:env(safe-area-inset-top,0px); z-index:5}
  .bar.dark{background:#0F1115; border-bottom-color:#0F1115}
  .bar-in{max-width:960px; margin:0 auto; height:60px; padding:0 24px; display:flex; align-items:center; gap:14px}
  .wordmark{display:flex; align-items:center; gap:8px; font-weight:700; letter-spacing:-.01em}
  .mark{width:22px; height:22px; border-radius:6px; background:var(--accent); display:grid; place-items:center; flex:none}
  .mark i{display:block; width:10px; height:12px; border-radius:2px; background:#fff}
  .bar.dark .wordmark,.bar.dark .school{color:#fff}
  .bar .logo{height:30px; width:auto; max-width:180px; display:block}
  .bar .school{font-weight:600}
  .bar .sep{width:1px; height:24px; background:var(--line)}
  .bar.dark .sep{background:rgba(255,255,255,.18)}
  .bar .spacer{flex:1}
  .tab{background:none; border:none; padding:8px 12px; border-radius:8px; color:var(--soft); font-weight:500; cursor:pointer; white-space:nowrap}
  .tab:hover{background:var(--line2); color:var(--ink)}
  .bar.dark .tab{color:#B7BCC7}
  .bar.dark .tab:hover{background:rgba(255,255,255,.08); color:#fff}

  .page{max-width:960px; margin:0 auto; padding:32px 24px 72px}
  /* Sticky footer: fill the viewport so the footer sits at the bottom on short pages (not the admin console). */
  body:not(.platform){min-height:100vh; display:flex; flex-direction:column}
  body:not(.platform) .page{flex:1 0 auto; width:100%}
  .head{display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:24px}
  h1{font-size:24px; font-weight:600; letter-spacing:-.02em; margin:0}
  .lede{color:var(--soft); margin:4px 0 0}
  h3{font-size:13px; font-weight:600; color:var(--soft); margin:0}
  .crumbs{font-size:13px; color:var(--soft); margin-bottom:6px}
  .crumbs a:hover{color:var(--ink)}

  .field{display:grid; gap:6px}
  .field > span{font-size:13px; font-weight:500; color:var(--ink2)}
  .hint{font-size:12px; color:var(--faint)}
  input,select{font:inherit; height:40px; padding:0 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); width:100%; box-shadow:var(--shadow)}
  input:focus,select:focus{border-color:var(--accent); outline:none; box-shadow:0 0 0 3px var(--accentSoft)}
  .prefix{display:flex; align-items:center; border:1px solid var(--line); border-radius:8px; background:var(--surface); box-shadow:var(--shadow); overflow:hidden}
  .prefix span{padding:0 0 0 12px; color:var(--faint); white-space:nowrap}
  .prefix input{border:none; box-shadow:none; padding-left:2px}
  .prefix:focus-within{border-color:var(--accent); box-shadow:0 0 0 3px var(--accentSoft)}
  .btn{height:40px; padding:0 16px; border-radius:8px; border:1px solid transparent; font-weight:500; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap}
  .btn.primary{background:var(--ink); color:var(--bg)}
  .btn.primary:hover{background:#262A33}
  .btn.accent{background:var(--accent); color:#fff}
  .btn.secondary{background:var(--surface); border-color:var(--line); box-shadow:var(--shadow)}
  .btn.secondary:hover{background:var(--line2)}
  .btn.ghost{background:none; color:var(--soft); padding:0 10px}
  .btn.ghost:hover{color:var(--ink); background:var(--line2)}
  .btn.danger{background:none; color:var(--danger); padding:0 10px}
  .btn.sm{height:32px; padding:0 10px; font-size:13px}
  .btn.danger.solid{background:var(--danger); color:#fff; padding:0 16px}
  summary.btn{list-style:none; width:max-content}
  summary.btn::-webkit-details-marker{display:none}
  .btn[disabled]{opacity:.4; cursor:default}

  .panel{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); box-shadow:var(--shadow)}
  .pad{padding:20px}
  .panel-head{padding:14px 20px; border-bottom:1px solid var(--line); display:flex; align-items:center; gap:10px; flex-wrap:wrap}
  .panel-head b{font-weight:600; flex:1; min-width:120px}
  .stack{display:grid; gap:16px}

  .metrics{display:grid; grid-template-columns:repeat(4,1fr); border:1px solid var(--line); border-radius:var(--r); background:var(--surface); box-shadow:var(--shadow); margin-bottom:20px; overflow:hidden}
  .metric{padding:16px 20px; border-left:1px solid var(--line)}
  .metric:first-child{border-left:none}
  .metric .v{font-size:24px; font-weight:600; letter-spacing:-.02em; font-variant-numeric:tabular-nums}
  .metric .k{font-size:13px; color:var(--soft)}
  .meter{height:6px; border-radius:99px; background:var(--line2); margin-top:10px; overflow:hidden}
  .meter i{display:block; height:100%; background:var(--accent); border-radius:99px}

  .rows > .row{padding:18px 20px; border-top:1px solid var(--line)}
  .rows > .row:first-child{border-top:none}
  .r-top{display:flex; align-items:center; gap:12px}
  .r-name{font-weight:600; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .r-count{font-variant-numeric:tabular-nums; color:var(--ink2); font-weight:500; white-space:nowrap}
  .r-count span{color:var(--faint)}
  .badge{font-size:12px; font-weight:500; padding:3px 8px; border-radius:6px; white-space:nowrap}
  .badge.wait{background:var(--waitSoft); color:var(--wait)}
  .badge.prog{background:var(--accentSoft); color:var(--accent)}
  .badge.done{background:var(--doneSoft); color:var(--done)}
  .papers{display:flex; flex-wrap:wrap; gap:3px; margin:12px 0 10px}
  .p{width:10px; height:13px; border-radius:2px; background:var(--line2); box-shadow:inset 0 0 0 1px var(--line)}
  .p.g{background:var(--accent); box-shadow:none}
  .done-set .p.g{background:var(--done)}
  .p.new{animation:pop .35s ease}
  @keyframes pop{0%{transform:scale(.5)}70%{transform:scale(1.2)}100%{transform:scale(1)}}
  .r-meta{display:flex; gap:16px; flex-wrap:wrap; font-size:13px; color:var(--soft)}
  .r-note{margin-top:10px; font-size:13px; color:var(--ink2); background:var(--bg); border:1px solid var(--line2); border-radius:8px; padding:8px 10px}
  .r-actions{display:flex; align-items:center; gap:4px; margin-left:8px}
  .edit{margin-top:14px; padding:14px; background:var(--bg); border:1px solid var(--line); border-radius:8px; display:grid; gap:12px}
  .grid2{display:grid; grid-template-columns:1fr 1fr; gap:12px}
  .end{display:flex; justify-content:space-between; gap:8px}

  /* directory lists */
  .link-row{display:flex; align-items:center; gap:14px; padding:16px 20px; border-top:1px solid var(--line)}
  .link-row:first-child{border-top:none}
  .link-row:hover{background:var(--bg)}
  .link-row .t{flex:1; min-width:0}
  .link-row .t b{display:block; font-weight:600}
  .link-row .t small{color:var(--soft); font-size:13px}
  .mini{width:120px; height:6px; border-radius:99px; background:var(--line2); overflow:hidden; flex:none}
  .mini i{display:block; height:100%; background:var(--accent)}
  .pct{width:44px; text-align:right; font-variant-numeric:tabular-nums; color:var(--ink2); font-weight:500; font-size:14px}
  .chev{color:var(--faint)}

  .url{display:flex; align-items:center; gap:6px; font-size:13px; color:var(--soft); background:var(--bg); border:1px solid var(--line); border-radius:8px; padding:0 4px 0 10px; height:32px; max-width:100%; min-width:0}
  .url code{font-family:inherit; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .size{display:flex; align-items:center; gap:6px; font-size:13px; color:var(--soft)}
  .size input{width:64px; height:32px; text-align:center}

  .split{display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:20px; align-items:start}
  .side{display:grid; gap:16px; position:sticky; top:84px}
  .muted{color:var(--soft); font-size:13px; margin:0}
  .code{font-size:20px; font-weight:600; letter-spacing:.12em; font-variant-numeric:tabular-nums; background:var(--bg); border:1px dashed var(--line); border-radius:8px; padding:10px; text-align:center}
  .logo-prev{border-radius:8px; padding:16px; display:flex; justify-content:center; background:var(--ink)}
  .logo-prev.light{background:var(--surface); border:1px solid var(--line)}
  .logo-prev img{height:32px; width:auto; max-width:100%}
  .seg{display:grid; grid-template-columns:1fr 1fr; padding:3px; background:var(--line2); border-radius:8px}
  .seg button{border:none; background:none; height:32px; border-radius:6px; font-size:13px; font-weight:500; color:var(--soft); cursor:pointer}
  .seg button[aria-pressed="true"]{background:var(--surface); color:var(--ink); box-shadow:0 1px 2px rgba(0,0,0,.08)}
  .err{color:var(--danger); font-size:13px; margin:0}
  .err:empty{display:none}

  .empty{text-align:center; padding:56px 24px}
  .empty b{display:block; font-weight:600; margin-bottom:4px}
  .empty p{color:var(--soft); margin:0}
  .narrow{max-width:420px; margin:40px auto 0}
  .narrow .panel{margin-top:20px}
  .hero{text-align:center; padding:40px 0 28px}
  .hero h1{font-size:34px}
  .hero .lede{font-size:17px}
  .between{display:flex; justify-content:space-between; align-items:center; gap:12px; margin:28px 0 12px}

  .codein{height:56px; font-size:22px; font-weight:600; letter-spacing:.2em; text-align:center; text-transform:uppercase}
  .codechip{font-weight:600; letter-spacing:.08em; color:var(--ink)}
  .modal{position:fixed; inset:0; background:rgba(15,17,21,.45); display:grid; place-items:center; z-index:20; padding:20px}
  .modal .panel{max-width:360px; width:100%}
  .modal p{margin:0 0 16px}
  .banner{max-width:960px; margin:16px auto 0; padding:12px 16px; border-radius:8px; background:var(--waitSoft); color:var(--wait); font-size:14px}
  .toast{position:fixed; left:50%; bottom:calc(24px + env(safe-area-inset-bottom,0px)); transform:translate(-50%,8px); background:var(--ink); color:var(--bg); padding:8px 14px; border-radius:8px; font-size:13px; opacity:0; transition:.2s; pointer-events:none}
  .toast.show{opacity:1; transform:translate(-50%,0)}

  @media (max-width:820px){
    .split{grid-template-columns:1fr} .side{position:static; order:-1}
    .metrics{grid-template-columns:1fr 1fr}
    .metric:nth-child(3){border-left:none} .metric:nth-child(n+3){border-top:1px solid var(--line)}
    .mini{display:none}
  }
  @media (max-width:520px){
    .page{padding:24px 16px 64px} .bar-in{padding:0 16px; gap:10px}
    .bar .school{display:none}
    .r-top{flex-wrap:wrap} .grid2{grid-template-columns:1fr}
  }
  @media (prefers-reduced-motion:reduce){.p.new{animation:none}.toast{transition:none}}
  /* ---------- Platform console (separate surface) ---------- */
  body.platform{background:var(--bg)}
  body.platform .bar{display:none}
  body.platform .page{max-width:none; padding:0}
  .pf{display:grid; grid-template-columns:232px minmax(0,1fr); min-height:100vh}
  .pf-nav{background:#111318; color:#C9CDD4; padding:20px 14px; display:flex; flex-direction:column; gap:4px; position:sticky; top:0; height:100vh}
  .pf-brand{display:flex; align-items:center; gap:8px; color:#fff; font-weight:700; padding:4px 8px 18px}
  .pf-brand small{display:block; font-weight:500; color:#8A90A0; font-size:11px; letter-spacing:.08em; text-transform:uppercase}
  .pf-nav a{display:flex; align-items:center; justify-content:space-between; padding:9px 10px; border-radius:8px; color:#C9CDD4; font-weight:500; font-size:14px}
  .pf-nav a:hover{background:rgba(255,255,255,.06); color:#fff}
  .pf-nav a.on{background:rgba(255,255,255,.1); color:#fff}
  .pf-nav .count{background:var(--accent); color:#fff; font-size:11px; font-weight:600; border-radius:99px; padding:1px 7px}
  .pf-nav .foot{margin-top:auto; font-size:12px; color:#6B7180; padding:8px 10px; background:none; border:none}
  .pf-main{padding:32px 36px 72px; min-width:0}
  .pf-main h1{margin-bottom:4px}
  .table{width:100%; border-collapse:collapse; font-size:14px}
  .table th{text-align:left; font-weight:500; color:var(--soft); font-size:12px; padding:10px 16px; border-bottom:1px solid var(--line); white-space:nowrap}
  .table td{padding:14px 16px; border-bottom:1px solid var(--line); vertical-align:middle}
  .table tr:last-child td{border-bottom:none}
  .table .acts{display:flex; gap:6px; justify-content:flex-end; flex-wrap:wrap}
  .setform label{display:block; margin-bottom:16px}
  .setform label span{display:block; font-size:13px; color:var(--soft); margin-bottom:6px}
  .setform textarea{font:inherit; width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink); box-shadow:var(--shadow); resize:vertical}
  .stats{display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; margin-bottom:16px}
  .stat{background:var(--surface); border:1px solid var(--line); border-radius:var(--r); padding:16px 18px}
  .stat .n{font-size:28px; font-weight:700; line-height:1.1}
  .stat .l{color:var(--soft); font-size:13px; margin-top:4px}
  .stat.warn .n{color:var(--wait)} .stat.danger .n{color:var(--danger)}
  .table tr.rowlink{cursor:pointer}
  .table tr.rowlink:hover td{background:var(--bg)}
  .table code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:13px; letter-spacing:.06em}
  .tbl-wrap{overflow-x:auto}
  .tag{font-size:12px; font-weight:500; padding:2px 8px; border-radius:6px; background:var(--line2); color:var(--ink2); white-space:nowrap}
  .tag.new{background:var(--waitSoft); color:var(--wait)}
  .tag.warn{background:var(--waitSoft); color:var(--wait)}
  .tag.danger{background:#FBE9E9; color:var(--danger)}
  .tag.done{background:var(--doneSoft); color:var(--done)}
  .sub{color:var(--soft); font-size:13px}
  .thumb{height:24px; width:auto; max-width:120px; display:block; border-radius:4px; padding:3px 6px; background:#0F1115}
  .thumb.light{background:#fff; border:1px solid var(--line)}
  .inline{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
  .inline select{width:auto; min-width:200px}
  .school-card{border-radius:8px; border:1px solid var(--line); padding:12px; display:flex; align-items:center; gap:10px; background:var(--bg)}
  .status-dot{width:8px; height:8px; border-radius:50%; background:var(--wait); flex:none}
  .status-dot.ok{background:var(--done)}
  @media (max-width:760px){
    .pf{grid-template-columns:1fr} .pf-nav{position:static; height:auto; flex-direction:row; flex-wrap:wrap; align-items:center}
    .pf-brand{padding:4px 8px} .pf-nav .foot{display:none} .pf-main{padding:24px 16px 64px}
  }

  /* environment ribbon (non-production only) */
  .env-ribbon{background:#B7791F; color:#fff; text-align:center; font-size:12px; font-weight:600; letter-spacing:.04em; padding:5px 12px}
  .env-ribbon span{opacity:.85; font-weight:500; margin-left:8px}
  .demo-hint{font-size:13px; background:var(--accentSoft); color:var(--accent); border-radius:8px; padding:10px 12px}
  .pf-nav .foot{display:flex; flex-direction:column; gap:6px}
  .pf-nav .foot .who{overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .pf-nav .foot a.signout{padding:6px 10px; margin:0 -10px; border-radius:8px; color:#C9CDD4; font-size:13px; font-weight:500}
  .pf-nav .foot a.signout:hover{background:rgba(255,255,255,.06); color:#fff}
  @media (max-width:760px){.pf-nav .foot{display:flex; margin-left:auto; flex-direction:row; align-items:center}.pf-nav .foot .who{display:none}}

  /* grading queue */
  .queue{list-style:none; margin:0; padding:6px}
  .q-row{display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:8px; background:var(--surface); border:1px solid transparent}
  .q-row + .q-row{margin-top:4px}
  .q-row [data-grip]{cursor:grab}
  .q-row:hover{background:var(--bg)}
  .q-row.dragging{opacity:.45}
  .q-row.drop-before{box-shadow:inset 0 3px 0 var(--accent)}
  .q-row.drop-after{box-shadow:inset 0 -3px 0 var(--accent)}
  .grip{color:var(--faint); letter-spacing:-3px; font-size:14px; user-select:none}
  .q-pos{width:24px; height:24px; border-radius:50%; background:var(--line2); color:var(--ink2); font-size:12px; font-weight:600; display:grid; place-items:center; flex:none}
  .q-row:first-child .q-pos{background:var(--accent); color:#fff}
  .q-main{flex:1; min-width:0; display:flex; flex-direction:column}
  .q-main b{font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .q-move{display:flex; gap:2px}
  .q-move .btn{width:32px; padding:0}
  .badge.next{background:#F1ECFE; color:#6D3FD8}
  @media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .badge.next{background:#261C40; color:#B9A2F5}}

  /* ---- navigation: always fits on a phone (Bug #2) ---- */
  .bar-in{min-width:0}
  .wordmark{min-width:0; flex-shrink:1}
  .wm-text{white-space:nowrap}
  .tabs{display:flex; align-items:center; gap:2px; flex-shrink:0}
  .bar .logo, .bar .school{min-width:0; flex-shrink:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  @media (max-width:520px){
    .bar-in{gap:8px}
    .bar.has-school .wm-text{display:none}          /* the mark alone identifies Graded Yet next to a school logo */
    .bar .logo{max-width:120px; height:26px}
    .bar .school{display:block; max-width:120px; font-size:14px}
    .tab{padding:8px 8px; font-size:14px}
  }

  /* ---- − / + stepper ---- */
  .stepper{display:inline-flex; gap:6px}
  .btn.icon{width:40px; height:40px; padding:0; font-size:20px; font-weight:600; line-height:1; border-radius:10px}
  .btn.icon.secondary{color:var(--ink)}
  .r-actions{gap:8px}
  @media (max-width:520px){ .btn.icon{width:44px; height:44px} .r-actions{margin-left:auto} }

  /* ---- class hierarchy ---- */
  .class-panel{overflow:hidden}
  .class-head{padding:18px 20px 14px; border-bottom:1px solid var(--line); background:var(--surface)}
  .class-title-row{display:flex; align-items:center; gap:10px}
  .class-title{font-size:19px; font-weight:700; letter-spacing:-.01em; margin:0; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .class-meta{display:flex; flex-wrap:wrap; align-items:center; gap:10px 14px; margin-top:10px; font-size:13px; color:var(--soft)}
  .class-meta .url{max-width:100%}
  .rows.nested{background:var(--bg); padding:8px 8px 8px 20px; border-left:4px solid var(--accentSoft)}
  .rows.nested > .row{background:var(--surface); border:1px solid var(--line); border-radius:8px; margin:0 0 8px; padding:14px 16px}
  .rows.nested > .row:last-child{margin-bottom:0}
  .rows.nested > .row + .row{border-top:1px solid var(--line)}
  @media (max-width:520px){ .rows.nested{padding:8px 8px 8px 10px} .class-head{padding:16px} }

  /* ---- sortable class panels ---- */
  .sortable.dragging{opacity:.45}
  .class-panel.drop-before{box-shadow:0 -3px 0 var(--accent)}
  .class-panel.drop-after{box-shadow:0 3px 0 var(--accent)}
  [data-grip]{cursor:grab}

  /* elements toggled with the hidden attribute stay hidden even when a class sets display */
  [hidden]{display:none !important}

  /* ---- keep the dashboard within a phone's width ---- */
  .split{grid-template-columns:minmax(0,1fr) 300px}
  .split > *, .stack > *{min-width:0}
  @media (max-width:820px){ .split{grid-template-columns:minmax(0,1fr)} }
  .papers{max-width:100%}

  /* ---- class groups (B3: quiet header band, accordion, overflow menu) ---- */
  .list-tools{display:flex; justify-content:space-between; align-items:center; margin:6px 2px -6px}
  .list-tools h2{font-size:15px; font-weight:600; margin:0}
  .list-tools span{display:flex; gap:4px}
  .list-tools .btn{height:32px}
  .cg{overflow:visible}
  .cg-head{display:flex; align-items:center; gap:10px; padding:12px 12px 12px 16px; background:#F5F6F8; border-radius:var(--r) var(--r) 0 0; border-bottom:1px solid var(--line)}
  .cg.closed .cg-head{border-bottom:none; border-radius:var(--r)}
  .cg-toggle{display:flex; align-items:center; gap:8px; flex:1 1 auto; min-width:0; background:none; border:none; padding:4px 0; margin:0; text-align:left; cursor:pointer; color:inherit; font:inherit}
  .chev{width:20px; height:20px; display:grid; place-items:center; color:var(--soft); flex:none; transition:transform .15s ease}
  .cg.closed .chev{transform:rotate(-90deg)}
  .cg-title{font-size:17px; font-weight:700; letter-spacing:-.01em; margin:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
  .cg-sum{font-size:13px; color:var(--soft); white-space:nowrap}
  .cg.closed .cg-body{display:none}
  .cg-menu-wrap{position:relative; flex:none}
  .cg-more{width:36px; height:36px; padding:0; font-size:20px; line-height:1; color:var(--soft)}
  .cg-menu{position:absolute; right:0; top:calc(100% + 4px); z-index:10; min-width:220px; background:var(--surface); border:1px solid var(--line); border-radius:10px; box-shadow:0 8px 24px rgba(15,17,21,.12), 0 2px 6px rgba(15,17,21,.08); padding:6px; display:grid}
  .cg-menu-code{font-size:12px; color:var(--soft); padding:8px 10px 6px}
  .cg-menu-code b{color:var(--ink); margin-left:4px}
  .cg-item{display:flex; align-items:center; justify-content:space-between; gap:10px; width:100%; min-height:38px; padding:0 10px; border:none; background:none; border-radius:6px; font:inherit; font-size:14px; color:var(--ink); text-align:left; cursor:pointer}
  .cg-item:hover{background:var(--line2)}
  .cg-item.danger{color:var(--danger)}
  .cg-size input{width:68px; height:30px; text-align:center}
  .cg .grip{cursor:grab; padding:6px 4px; touch-action:none}
  .reordering .cg{outline:1px dashed var(--line)}
  .cg.dragging, .q-row.dragging{opacity:.6; box-shadow:0 8px 24px rgba(15,17,21,.15)}
  .grip{touch-action:none; user-select:none; -webkit-user-select:none}
  .grip:focus-visible{outline:2px solid var(--accent); border-radius:4px}

  /* teacher assignment rows: one quiet list */
  .cg-body .t-row{padding:14px 16px; border-top:1px solid var(--line2)}
  .cg-body .t-row:first-child{border-top:none}
  .t-row .r-top{gap:8px}
  .t-row .p{width:8px; height:11px}
  .t-row .papers{gap:2px; margin:10px 0 2px}
  .done-check{width:20px; height:20px; border-radius:50%; background:var(--doneSoft); color:var(--done); display:inline-grid; place-items:center; font-size:12px; font-weight:700; flex:none}
  .t-note{margin-top:6px; color:var(--soft); font-size:13px}
  .btn.icon-sm{width:36px; height:36px; padding:0; color:var(--faint)}
  .btn.icon-sm:hover{color:var(--ink)}

  @media (max-width:520px){
    .cg-head{flex-wrap:wrap; row-gap:2px; padding:10px 8px 10px 12px}
    .cg-toggle{flex:1 1 0}
    .cg-title{font-size:16px; white-space:normal}
    .cg-sum{order:3; flex-basis:100%; padding-left:28px}
    .cg-body .t-row{padding:12px}
    .t-row .r-top{flex-wrap:wrap}
    .t-row .r-actions{margin-left:auto}
  }
  @media (prefers-color-scheme:dark){ .cg-head{background:#1A1D23} .cg-menu{box-shadow:0 8px 24px rgba(0,0,0,.5)} }

  /* ---- drag to reorder (queue and classes) ---- */
  .s-list{position:relative; list-style:none; margin:0; padding:0}
  .s-item{position:relative; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; transition:transform .18s cubic-bezier(.2,.8,.2,1)}
  .s-item.lifted{z-index:5; transition:none; box-shadow:0 10px 28px rgba(15,17,21,.18)}
  .s-item.lifted .s-inner{transform:scale(1.02)}
  .s-item.pressing{background:var(--accentSoft)}
  .s-item.settling{transition:transform .16s ease-out}
  .s-inner{transition:transform .12s ease}
  .handle{width:44px; height:44px; margin:-6px -4px -6px -10px; display:grid; place-items:center; color:#8A91A0; border:none; background:none; cursor:grab; touch-action:none; border-radius:10px; flex:none; padding:0}
  .handle:hover{color:var(--ink); background:var(--line2)}
  .handle:focus-visible{outline:2px solid var(--accent); outline-offset:-2px}
  .handle svg{width:20px; height:20px}
  body.dragging, body.dragging *{cursor:grabbing !important}
  .queue .s-item{background:var(--surface); border-radius:10px}
  .queue .q-row{padding:10px 12px}
  .queue .q-row .q-pos{background:var(--line2); color:var(--ink2)}
  .queue .s-item:first-child .q-pos{background:var(--accent); color:#fff}
  .queue .s-item + .s-item{margin-top:4px}
  /* compact classes while reordering */
  .cg-list.reordering .cg-body{display:none}
  .cg-list.reordering .cg-head{border-bottom:none; border-radius:var(--r)}
  .cg-list.reordering .cg-sum, .cg-list.reordering .cg-menu-wrap, .cg-list.reordering .chev{display:none}
  .cg-list.reordering .cg-toggle{cursor:grab}
  .hint{font-size:13px; color:var(--soft); margin:0 2px -6px}

  /* footer (teacher-facing pages) + privacy page */
  .foot{border-top:1px solid var(--line); background:var(--surface)}
  .foot-in{max-width:960px; margin:0 auto; padding:18px 24px; display:flex; align-items:center; justify-content:space-between; gap:12px 18px; flex-wrap:wrap; font-size:13px; color:var(--faint)}
  .foot-in nav{display:flex; gap:18px}
  .foot-in a{color:var(--soft)}
  .foot-in a:hover{color:var(--ink)}
  .prose{max-width:720px}
  .prose h2{font-size:16px; font-weight:600; letter-spacing:-.01em; margin:28px 0 6px}
  .prose p{margin:0 0 12px; color:var(--ink2)}
  .prose ul{margin:0 0 12px; padding-left:20px; color:var(--ink2)}
  .prose li{margin:4px 0}
  .prose strong{color:var(--ink); font-weight:600}
  .prose a{color:var(--accent)}
  .prose a:hover{text-decoration:underline}
