  :root{
    --bg: #2A251F;
    --bg-2: #332D26;
    --paper: #302A23;
    --paper-2: #3A332C;
    --paper-3: #423A30;
    --ink: #F4ECD8;
    --ink-2: #D6CBB3;
    --ink-3: #8E8470;
    --ink-4: #6A6253;
    --rule: #3A3127;
    --rule-2: #4A4034;
    --accent: #E8674A;        /* terracotta */
    --accent-rgb: 232,103,74;
    --pink: #D262B5;          /* used on brand mark + Correction nav pill */
    --sage: #6BB389;          /* teacher grade */
    --sage-2: #8FCFA9;
    --sage-bg: #1F3A2C;
    --amber: #F0B845;         /* AI grade */
    --amber-2: #F4CC78;
    --amber-bg: #3D2E12;
    --cap: #E8674A;
    --cap-bg: #4A2118;
    --shadow-1: 0 1px 0 rgba(255,236,196,.04) inset, 0 1px 2px rgba(0,0,0,.35), 0 12px 30px -18px rgba(0,0,0,.6);
    --shadow-2: 0 1px 0 rgba(255,236,196,.05) inset, 0 1px 2px rgba(0,0,0,.4), 0 30px 60px -24px rgba(0,0,0,.7);
  }
  *{box-sizing:border-box}
  html,body{margin:0;padding:0;background:var(--bg);color:var(--ink);
    font-family:"Geist", ui-sans-serif, system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing:antialiased;
  }
  body{
    background:
      radial-gradient(1200px 600px at 85% -10%, rgba(232,103,74,.18) 0%, transparent 55%),
      radial-gradient(1000px 500px at -10% 110%, rgba(107,179,137,.13) 0%, transparent 55%),
      var(--bg);
    min-height:100vh;
  }
  .serif{font-family:"Instrument Serif", "Iowan Old Style", Georgia, serif; font-weight:400; letter-spacing:-0.01em;}
  .mono{font-family:"Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;}
  button{font-family:inherit; cursor:default;}

  /* ─────── shell ─────── */
  .shell{max-width:1480px; margin:0 auto; padding:22px 36px 60px;}

  /* ─────── topbar (matches Homepage) ─────── */
  .topbar{display:flex;align-items:center;justify-content:space-between;gap:24px;}
  .brand{display:flex;align-items:center;gap:10px;}
  .brand-mark{width:30px;height:30px;border-radius:8px;
    background:linear-gradient(140deg, var(--pink), #8E2C75); color:#fff;
    display:grid;place-items:center; font-family:"Instrument Serif",serif; font-size:20px; font-style:italic;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 4px 14px -4px rgba(210,98,181,.5);}
  .brand-name{font-weight:600; font-size:15px;}
  .brand-name em{font-style:normal; color:var(--ink-3); font-weight:400;}

  .nav{display:flex;align-items:center;gap:4px;
    background:rgba(255,236,196,.04); border:1px solid var(--rule);
    border-radius:999px; padding:4px;}
  .nav a{text-decoration:none; color:var(--ink-2); padding:7px 14px; font-size:13.5px;
    border-radius:999px; display:inline-flex; align-items:center; gap:7px;}
  .nav a:hover{color:var(--ink); background:rgba(255,236,196,.07);}
  .nav a.is-active{background:var(--ink); color:#1A1410; box-shadow:var(--shadow-1);}
  .nav .pill{font-family:"Geist Mono"; font-size:10.5px; padding:1px 6px;
    border-radius:999px; background:var(--pink); color:#1A0A14; font-weight:600;}

  .top-right{display:flex;align-items:center;gap:10px;}
  .iconbtn{width:36px;height:36px;border-radius:10px; border:1px solid var(--rule);
    background:rgba(255,236,196,.04); display:grid;place-items:center; color:var(--ink-2);}
  .iconbtn:hover{background:rgba(255,236,196,.08); color:var(--ink);}
  .avatar{width:36px;height:36px;border-radius:50%;
    background:linear-gradient(135deg,#F0B845,#C68530);
    color:#3B2A18; font-weight:700; font-size:13px;
    display:grid;place-items:center; border:1.5px solid #2B2520; box-shadow:var(--shadow-1);}

  /* ─────── page header ─────── */
  .page-hd{margin:36px 0 22px; display:flex; align-items:flex-end; justify-content:space-between; gap:24px;}
  .page-hd h1{margin:0; font-family:"Instrument Serif",serif; font-weight:400;
    font-size:56px; line-height:1; letter-spacing:-0.025em;}
  .page-hd h1 i{font-style:italic; color:var(--accent);}
  .page-hd .sub{color:var(--ink-3); font-size:13.5px; margin-top:8px; max-width:54ch;
    display:flex; align-items:center; flex-wrap:wrap; gap:8px;}
  .page-hd .sub b, .page-hd .sub strong{color:var(--ink); font-weight:600;
    font-family:"Instrument Serif", serif; font-style:italic; font-size:17px;
    line-height:1;}
  .page-hd .sub-sep{color:var(--rule-2);}
  .page-hd .sub-kbd{font:600 11px/1 "Geist Mono"; padding:3px 7px; border-radius:6px;
    background:var(--paper-2); border:1px solid var(--rule); color:var(--ink-2);
    box-shadow:0 1px 0 rgba(0,0,0,.3);}
  .page-actions{display:flex; gap:8px; align-items:center;}
  .btn{appearance:none; border:1px solid var(--rule); background:var(--paper-2);
    color:var(--ink); font:500 13px/1 "Geist"; padding:9px 13px;
    border-radius:10px; display:inline-flex; align-items:center; gap:7px;}
  .btn:hover{background:var(--paper-3); border-color:var(--rule-2);}
  .btn-primary{background:var(--accent); color:#1A1410; border-color:transparent; font-weight:600;
    box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 8px 22px -8px rgba(232,103,74,.6);}
  .btn-primary:hover{transform:translateY(-1px);}
  .btn-sage{background:var(--sage); color:#0B1F14; border-color:transparent; font-weight:600;
    box-shadow: 0 1px 0 rgba(255,255,255,.22) inset, 0 8px 22px -8px rgba(107,179,137,.5);}

  /* ─────── 3-col grid ─────── */
  .grid{display:grid; grid-template-columns: 300px minmax(0,1fr) 360px; gap:18px; align-items:flex-start;}
  @media (max-width:1200px){ .grid{grid-template-columns: 280px minmax(0,1fr);} .col-right{grid-column:1/-1;} }
  /* Left column stacks the papers pane on top of the student-feedback
     panel. When the papers pane auto-collapses on grade-complete, the
     feedback panel absorbs the freed vertical space via flex. */
  .col-left{display:flex; flex-direction:column; gap:18px; min-width:0;}
  .left-stack-feedback{display:contents;}
  .left-stack-feedback:empty{display:none;}

  /* shared panel */
  .panel{background:var(--paper); border:1px solid var(--rule); border-radius:18px;
    box-shadow:var(--shadow-1); overflow:hidden;}
  .panel-hd{display:flex; align-items:center; justify-content:space-between;
    padding:14px 16px; border-bottom:1px solid var(--rule); gap:10px;}
  .panel-hd .label{display:flex; align-items:center; gap:8px;
    font:600 11px/1 "Geist"; letter-spacing:.1em; text-transform:uppercase; color:var(--ink-2);}
  .panel-hd .label svg{color:var(--ink-3);}
  .badge{font:500 10px/1 "Geist Mono"; padding:3px 7px; border-radius:999px;
    background:rgba(232,103,74,.12); color:var(--accent); border:1px solid rgba(232,103,74,.32);
    letter-spacing:.04em; text-transform:uppercase;}
  .badge.sage{background:rgba(107,179,137,.12); color:var(--sage-2); border-color:rgba(107,179,137,.32);}

  /* ─────── LEFT: papers ─────── */
  .papers .search{position:relative; padding:12px 14px; border-bottom:1px solid var(--rule);}
  .papers .search input{width:100%; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:9px 12px 9px 32px;
    color:var(--ink); font:13px "Geist"; outline:none;}
  .papers .search input::placeholder{color:var(--ink-4);}
  .papers .search input:focus{border-color:var(--rule-2);}
  .papers .search svg{position:absolute; top:50%; left:24px; transform:translateY(-50%); color:var(--ink-4);}

  .filters{display:flex; gap:6px; padding:10px 14px; border-bottom:1px solid var(--rule); flex-wrap:wrap;}
  .filter{position:relative; appearance:none; border:1px solid var(--rule); background:transparent;
    color:var(--ink-2); font:500 12px/1 "Geist"; padding:6px 10px; border-radius:999px;
    display:inline-flex; align-items:center; gap:6px;}
  .filter:hover{background:rgba(255,236,196,.05); color:var(--ink);}
  .filter.is-active{border-color:rgba(107,179,137,.5); color:var(--sage-2); background:rgba(107,179,137,.08);}
  .filter .count{font-family:"Geist Mono"; font-size:10px; opacity:.7;}

  .tabs{display:flex; gap:0; padding:8px 14px 0; border-bottom:1px solid var(--rule);}
  .tab{flex:1; appearance:none; background:transparent; border:0; padding:10px 0 12px;
    color:var(--ink-3); font:500 13px/1 "Geist"; display:inline-flex; align-items:center; justify-content:center; gap:7px;
    border-bottom:2px solid transparent; margin-bottom:-1px;}
  .tab:hover{color:var(--ink-2);}
  .tab.is-active{color:var(--sage-2); border-bottom-color:var(--sage);}
  .tab .count{font:500 10.5px/1 "Geist Mono"; padding:2px 6px; border-radius:999px;
    background:rgba(107,179,137,.14); color:var(--sage-2);}
  .tab:not(.is-active) .count{background:rgba(255,236,196,.06); color:var(--ink-3);}

  .papers-list{max-height:680px; overflow:auto;}
  .papers-list::-webkit-scrollbar{width:8px;}
  .papers-list::-webkit-scrollbar-thumb{background:rgba(255,236,196,.1); border-radius:4px;}
  .paper{display:grid; grid-template-columns:1fr auto; align-items:center; gap:10px;
    padding:11px 14px; border-bottom:1px solid var(--rule); position:relative;}
  .paper:hover{background:rgba(255,236,196,.04);}
  /* P3: stronger active state. Heavier sage tint, slightly brighter
     name colour, and a thicker rail with a subtle outer glow so the
     currently-loaded paper is unambiguous against the hover state
     (which uses the warm-ink colour family). */
  .paper.is-active{background:rgba(107,179,137,.12);
    box-shadow: inset 0 0 0 1px rgba(107,179,137,.18);}
  .paper.is-active:hover{background:rgba(107,179,137,.16);}
  .paper.is-active::before{content:""; position:absolute; left:0; top:6px; bottom:6px; width:4px;
    background:var(--sage); border-radius:0 4px 4px 0;
    box-shadow: 0 0 12px -2px rgba(107,179,137,.6);}
  .paper.is-active .paper-name{color:var(--sage-2);}
  .paper-name{font:600 13.5px/1.2 "Geist"; color:var(--ink); letter-spacing:-.005em;}
  .paper-meta{color:var(--ink-3); font-size:11.5px; margin-top:3px;}
  .paper-file{color:var(--ink-4); font-size:11.5px; margin-top:2px;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:200px;}
  /* "(attempt N)" — subtle resubmission indicator next to the filename. */
  .paper-attempt{color:#C9A36A; font-weight:600; font-size:10.5px;}
  .paper-pills{display:flex; flex-direction:column; gap:4px; align-items:flex-end;}
  .gp{font:600 11px/1 "Geist Mono"; padding:4px 7px; border-radius:6px; min-width:38px; text-align:center;
    font-variant-numeric:tabular-nums;}
  .gp.t{background:rgba(107,179,137,.14); color:var(--sage-2); border:1px solid rgba(107,179,137,.32);}
  .gp.a{background:rgba(232,103,74,.14); color:#FFB69E; border:1px solid rgba(232,103,74,.36);}
  .gp.empty{background:rgba(255,236,196,.05); color:var(--ink-4); border:1px solid var(--rule);}
  /* Accepted-but-undelivered: orange teacher pill + a "Not delivered" line. */
  .gp.t.is-undelivered{background:rgba(232,140,74,.16); color:#FFC79E; border:1px solid rgba(232,140,74,.5);}
  .paper-undelivered{display:flex; align-items:center; gap:5px; margin-top:4px;
    font:600 10px/1.2 "Geist"; color:#F0A86A;}
  .paper-undelivered-dot{width:7px; height:7px; border-radius:50%; background:#F0A86A;
    flex:0 0 auto; box-shadow:0 0 0 2px rgba(240,168,106,.2);}
  /* Batch-accept "Not delivered" segment — tabs + re-push rows. */
  .batch-seg-tabs{display:flex; gap:4px; padding:8px 12px 0;}
  .batch-seg{font:600 12px/1 "Geist"; padding:7px 12px; border-radius:7px 7px 0 0;
    background:transparent; border:1px solid transparent; border-bottom:none;
    color:var(--ink-4); cursor:pointer;}
  .batch-seg.is-active{background:rgba(255,255,255,.04); color:var(--ink-1); border-color:var(--rule);}
  .batch-seg-undel.is-active{color:#F0A86A;}
  .batch-repush-note{padding:10px 14px; font:500 12px/1.5 "Geist"; color:var(--ink-3);
    background:rgba(240,168,106,.06); border-bottom:1px solid var(--rule);}
  .batch-repush-skipnote, .batch-repush-skipreason{color:#F0A86A; font-weight:600;}
  .batch-repush-row.is-unsendable{opacity:.55;}
  .batch-repush-cb-skip{display:inline-block; width:16px; text-align:center;
    color:#F0A86A; font-weight:700;}

  /* ─────── CENTER: PDF viewer + reasoning ─────── */
  .col-center{display:flex; flex-direction:column; gap:18px; min-width:0;}
  /* Match the column gap inside #paper-review-root so the PDF viewer,
     reasoning chat, and (optional) General Observations panels read as
     distinct cards instead of touching edge-to-edge. The 18px value
     matches .col-center / .col-right / .col-left elsewhere. The
     position:absolute #hl-tip and display:none JSON island sit outside
     the flex flow so the gap doesn't leave a phantom row for them. */
  #paper-review-root{display:flex; flex-direction:column; gap:18px; min-width:0;}
  .viewer{background:var(--paper); border:1px solid var(--rule); border-radius:18px;
    box-shadow:var(--shadow-1); overflow:hidden; position:relative;}
  .viewer-hd{display:flex; align-items:center; gap:14px; padding:12px 16px;
    border-bottom:1px solid var(--rule);}
  .viewer-hd .status{display:inline-flex; align-items:center; gap:7px;
    font:600 10.5px/1 "Geist"; letter-spacing:.12em; text-transform:uppercase; color:#FFB69E;}
  .viewer-hd .status .dot{width:7px; height:7px; border-radius:999px; background:var(--accent);
    box-shadow:0 0 0 4px rgba(232,103,74,.18); animation:p 1.6s ease-in-out infinite;}
  @keyframes p{50%{box-shadow:0 0 0 7px rgba(232,103,74,.04);}}
  .viewer-hd .fname{color:var(--ink); font-size:13.5px; font-weight:500; min-width:0;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1;}
  .viewer-hd .ctrls{display:flex; gap:6px; align-items:center;}
  .vbtn{appearance:none; width:30px; height:30px; border-radius:8px; border:1px solid var(--rule);
    background:transparent; color:var(--ink-2); display:grid; place-items:center;
    text-decoration:none;}
  .vbtn:hover{background:rgba(255,236,196,.05); color:var(--ink);}
  a.vbtn{text-decoration:none;}
  a.vbtn:hover, a.vbtn:focus{text-decoration:none;}
  .vbtn.outline{width:auto; padding:0 10px; gap:6px; font:500 12px/1 "Geist"; display:inline-flex;}

  .viewer-body{position:relative; padding:24px; background:var(--bg-2); min-height:540px;}

  /* PDF page mock */
  .pdf-page{background:#F4ECD8; color:#1F1A14; border-radius:6px; padding:54px 64px;
    box-shadow:0 10px 30px -10px rgba(0,0,0,.5); font-family:"Geist", serif;
    margin:0 auto; max-width:680px; line-height:1.55;}
  .pdf-page .pdf-h{font-family:"Instrument Serif",serif; font-size:22px; margin-bottom:6px;}
  .pdf-page .pdf-sub{color:#5C5347; font-size:12px; margin-bottom:24px;
    border-bottom:1px solid #D7CCB3; padding-bottom:14px;}
  .pdf-page .pdf-sec{font-weight:700; font-size:13px; letter-spacing:.04em;
    text-transform:uppercase; margin-top:22px; margin-bottom:8px; color:#3B342B;}
  .pdf-page p{margin:0 0 12px; font-size:13.5px;}
  .pdf-page .page-no{color:#9B907B; font-size:11px; text-align:center; margin-top:30px;}

  /* highlights */
  .hl{position:relative; padding:0 1px; border-radius:2px;
    background-image: linear-gradient(transparent 92%, var(--hlc, var(--sage)) 92%);
    background-size: 100% 100%; cursor:default;}
  .hl.gain{--hlc:#3D8C5D;}
  .hl.loss{--hlc:#C99820;}
  .hl.cap{--hlc:#D1422B;}
  .hl.major{background-image: linear-gradient(transparent 84%, var(--hlc) 84%);}
  .hl.minor{background-image: linear-gradient(transparent 94%, var(--hlc) 94%, transparent 100%); opacity:.85;}

  /* Highlight tooltip — pdfviewer.js positions it via tip.style.top/left
     from getBoundingClientRect() (viewport coordinates), so the box must
     be position:fixed for the math to land correctly. Visibility is
     controlled by toggling the .hidden class (.hl-tip.hidden{display:none}
     at the bottom of this file); pointer-events stay off in hover mode
     so the cursor can travel back onto the underline without flicker,
     and flip on when the user clicks-to-pin. The design's nested-child
     positioning (.hl > .hl-tip with left:50%/transform) was dropped —
     the live DOM has .pdf-hl elements as siblings of #hl-tip, not
     parents, so those rules never matched. */
  .hl-tip{position:fixed; z-index:50;
    background:#1A1410; color:var(--ink); border:1px solid var(--rule-2);
    border-radius:10px; padding:10px 12px; min-width:260px; max-width:320px;
    box-shadow:0 16px 30px -8px rgba(0,0,0,.7);
    font:13px/1.4 "Geist"; pointer-events:none; transition:opacity .15s ease;}
  .hl-tip[data-pinned="true"]{pointer-events:auto;}
  .hl-chip{display:inline-flex; align-items:center; gap:6px; font:600 10px/1 "Geist";
    letter-spacing:.08em; text-transform:uppercase; padding:4px 7px; border-radius:5px;
    margin-bottom:7px;}
  .hl-chip.gain{background:rgba(107,179,137,.18); color:var(--sage-2);}
  .hl-chip.loss{background:rgba(240,184,69,.18); color:var(--amber-2);}
  .hl-chip.cap {background:rgba(232,103,74,.18); color:#FFB69E;}

  /* grade island */
  .island{position:absolute; top:18px; right:18px; z-index:5;
    background:rgba(28,22,18,.92); backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border:1px solid var(--rule-2); border-radius:14px; padding:10px; display:flex; gap:8px;
    box-shadow:0 24px 50px -20px rgba(0,0,0,.7);}
  .gpill{padding:8px 12px 10px; border-radius:10px; min-width:96px;
    background:var(--paper-2); border:1px solid var(--rule);}
  .gpill .glabel{font:600 9.5px/1 "Geist"; letter-spacing:.12em; text-transform:uppercase;
    color:var(--ink-3); margin-bottom:6px;}
  .gpill .gval{font:700 26px/1 "Geist Mono"; font-variant-numeric:tabular-nums;}
  .gpill.teacher{border-color:rgba(107,179,137,.4);
    background:linear-gradient(165deg, rgba(107,179,137,.14), rgba(107,179,137,.04));}
  .gpill.teacher .glabel{color:var(--sage-2);}
  .gpill.teacher .gval{color:var(--sage-2);}
  /* Pass/fail teacher toggle — two-segment Competent / Non Competent
     control that replaces the numeric stepper in pass_fail mode.
     Reuses .seg's is-active sage treatment for the selected segment.
     Sits inside .gpill-row.pf-segs so the height matches the numeric
     stepper row visually. */
  .gpill-row.pf-segs{display:flex; gap:4px; padding:4px;
    background:rgba(0,0,0,.20); border-radius:8px;}
  .pf-seg{flex:1; appearance:none; border:0; background:transparent;
    color:var(--ink-2); font:500 11.5px/1 "Geist"; padding:8px 6px;
    border-radius:6px; cursor:pointer;
    text-transform:uppercase; letter-spacing:.04em;}
  .pf-seg:hover:not(.is-active){color:var(--ink);}
  .pf-seg.is-active{background:var(--sage); color:#0B1F14; font-weight:600;
    box-shadow: 0 1px 0 rgba(255,255,255,.22) inset;}
  .pf-seg:focus-visible{outline:2px solid rgba(107,179,137,.6); outline-offset:1px;}
  .gpill.ai{border-color:rgba(232,103,74,.4);
    background:linear-gradient(165deg, rgba(232,103,74,.14), rgba(232,103,74,.04));}
  .gpill.ai .glabel{color:#FFB69E;}
  .gpill.ai .gval{color:#FFB69E;}
  .gpill .lock{font:500 9.5px/1 "Geist Mono"; color:var(--ink-4); margin-left:6px; vertical-align:middle;}
  .gpill-row{display:flex; align-items:flex-end; gap:6px; margin-top:6px;}
  /* policy_flags indicator on the AI pill. The .policy-flags-anchor wraps
     the chip + the absolutely-positioned tooltip so the tooltip
     positions relative to the chip, not the gpill or the island. The
     tooltip mirrors .hl-tip visually (warm-brown card, subtle border
     + shadow, downward chevron) so the highlight tooltip and the
     policy flag tooltip read as the same component. Pure-CSS reveal
     on :hover and :focus-within — no JS state machine — so it's
     instant (no native title delay) and keyboard accessible. */
  .policy-flags-anchor{position:relative; display:inline-flex; margin-top:7px;}
  .policy-flags-chip{display:inline-flex; align-items:center; gap:5px;
    padding:3px 7px; border-radius:7px;
    font:600 10px/1 "Geist Mono"; letter-spacing:.04em; text-transform:uppercase;
    background:rgba(232,103,74,.16); color:#FFB69E;
    border:1px solid rgba(232,103,74,.36); cursor:help;
    appearance:none; outline:none;}
  .policy-flags-chip:hover{background:rgba(232,103,74,.22);}
  .policy-flags-chip:focus-visible{box-shadow:0 0 0 2px rgba(232,103,74,.4);}
  .policy-flags-chip svg{color:#FFB69E; flex-shrink:0;}

  .policy-flags-tip{position:absolute; top:calc(100% + 8px); right:0; z-index:30;
    min-width:280px; max-width:340px;
    background:#1A1410; color:var(--ink); border:1px solid var(--rule-2);
    border-radius:10px; padding:10px 12px;
    box-shadow:0 16px 30px -8px rgba(0,0,0,.7);
    font:13px/1.4 "Geist";
    opacity:0; pointer-events:none; transform:translateY(-2px);
    transition:opacity .12s ease, transform .12s ease;}
  .policy-flags-anchor:hover > .policy-flags-tip,
  .policy-flags-anchor:focus-within > .policy-flags-tip{
    opacity:1; pointer-events:auto; transform:translateY(0);}
  /* downward chevron pointing at the chip — matches .hl-tip's pattern,
     anchored to the right edge so it points at the chip's body */
  .policy-flags-tip::before{content:""; position:absolute; top:-6px; right:14px;
    width:10px; height:10px; background:#1A1410;
    border-left:1px solid var(--rule-2); border-top:1px solid var(--rule-2);
    transform:rotate(45deg);}
  .policy-flags-tip-head{font:600 10px/1 "Geist"; letter-spacing:.1em;
    text-transform:uppercase; color:#FFB69E; margin-bottom:8px;}
  .policy-flags-tip-list{list-style:none; margin:0; padding:0;
    display:flex; flex-direction:column; gap:10px;}
  .policy-flags-tip-row{padding-bottom:8px; border-bottom:1px solid var(--rule);}
  .policy-flags-tip-row:last-child{border-bottom:0; padding-bottom:0;}
  .policy-flags-tip-type{font:600 12.5px/1.2 "Geist"; color:var(--ink);
    margin-bottom:3px;}
  .policy-flags-tip-detail{font:12.5px/1.4 "Geist"; color:var(--ink-2);}
  .policy-flags-tip-detail b{color:var(--ink); font-weight:600;
    font-variant-numeric:tabular-nums;}
  .policy-flags-tip-action{font:12px/1.4 "Geist"; color:var(--ink-3);
    margin-top:2px;}
  .policy-flags-tip-action em{font-style:normal; color:var(--ink-2);
    font-weight:500;}
  .policy-flags-tip-foot{margin-top:9px; padding-top:8px;
    border-top:1px solid var(--rule);
    font:500 11px/1.3 "Geist Mono"; letter-spacing:.02em;
    color:var(--ink-4);}
  .stp{appearance:none; width:22px; height:22px; border-radius:6px; border:1px solid var(--rule);
    background:rgba(255,236,196,.05); color:var(--ink-2); display:grid; place-items:center;
    font:600 12px/1 "Geist Mono";}
  .stp:hover{background:rgba(255,236,196,.1); color:var(--ink);}

  /* reasoning chat */
  .chat .chat-list{padding:14px 16px; max-height:340px; overflow:auto; display:flex; flex-direction:column; gap:12px;}
  .msg{display:flex; gap:10px; max-width:88%;}
  .msg .av{width:28px; height:28px; flex-shrink:0; border-radius:8px;
    display:grid; place-items:center; font:600 11px/1 "Geist Mono";}
  .msg.ai .av{background:linear-gradient(140deg, var(--accent), #B23A22); color:#fff;}
  .msg.you{margin-left:auto; flex-direction:row-reverse;}
  .msg.you .av{background:linear-gradient(140deg, var(--sage), #2F7A4E); color:#0B1F14;}
  .bubble{background:var(--paper-2); border:1px solid var(--rule); border-radius:12px;
    padding:11px 13px; font-size:13.5px; line-height:1.5; color:var(--ink);}
  .msg.ai .bubble{border-top-left-radius:4px;}
  .msg.you .bubble{border-top-right-radius:4px; background:rgba(107,179,137,.08); border-color:rgba(107,179,137,.25);}
  .bubble b{font-weight:600;}
  .bubble .closer{display:block; margin-top:8px; color:var(--ink-3); font-style:italic;}

  .chat-composer{display:flex; gap:8px; padding:12px 14px; border-top:1px solid var(--rule);
    background:linear-gradient(180deg, transparent, rgba(0,0,0,.15));}
  .chat-composer input{flex:1; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:10px 12px;
    color:var(--ink); font:13.5px "Geist"; outline:none;}
  .chat-composer input::placeholder{color:var(--ink-4);}
  .chat-composer input:focus{border-color:var(--rule-2);}
  .chat-send{appearance:none; padding:0 14px; height:38px; border-radius:10px;
    background:var(--accent); color:#1A1410; font:600 13px/1 "Geist"; border:0;
    display:inline-flex; align-items:center; gap:6px;}

  /* ─────── RIGHT: policy + feedback ─────── */
  /* P2: tighter vertical rhythm so the policy panel doesn't outscroll the
     viewport on a standard laptop screen. Reduced policy-body gap from
     16 → 12, thresh padding from 11/12 → 9/10, and thresh inner gap
     from 9 → 7. The result is ~80px shorter overall without crowding. */
  .col-right{display:flex; flex-direction:column; gap:18px;}
  .policy .policy-body{padding:12px 16px; display:flex; flex-direction:column; gap:12px;
    overflow:hidden; max-height:none;
    transition:max-height 250ms ease, padding-top 200ms ease, padding-bottom 200ms ease;}
  /* Collapsed state — bindPolicyCollapse() (assignments.js) flips
     data-collapsed on header click / mouseleave timer / focus loss.
     The .iconbtn chevron is a downward ▼ in the markup; when the
     panel collapses we rotate it 180° to point up (▲) so the icon
     reflects the body's current state. Transition matches the body
     collapse so both finish together. */
  .policy[data-collapsed="true"] .policy-body{max-height:0; padding-top:0; padding-bottom:0;}
  .policy .panel-hd .iconbtn svg{transition:transform 250ms ease;}
  .policy[data-collapsed="true"] .panel-hd .iconbtn svg{transform:rotate(180deg);}
  .field-label{font:500 11.5px/1 "Geist"; color:var(--ink-2); letter-spacing:.01em;
    display:flex; justify-content:space-between; align-items:center;}
  .field-label .hint{color:var(--ink-4); font-size:10.5px;}
  .select{position:relative; margin-top:7px;}
  .select select{width:100%; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:10px 32px 10px 12px;
    color:var(--ink); font:13.5px "Geist"; outline:none;}
  .select::after{content:""; position:absolute; right:14px; top:50%; width:7px; height:7px;
    border-right:1.5px solid var(--ink-3); border-bottom:1.5px solid var(--ink-3);
    transform:translateY(-70%) rotate(45deg); pointer-events:none;}
  .help{color:var(--ink-4); font-size:11px; margin-top:6px; line-height:1.4;}

  .segs{display:flex; gap:4px; background:rgba(0,0,0,.25); padding:4px;
    border:1px solid var(--rule); border-radius:11px; margin-top:8px;}
  .seg{flex:1; appearance:none; background:transparent; border:0; color:var(--ink-2);
    font:500 12.5px/1 "Geist"; padding:9px 0; border-radius:8px;}
  .seg.is-active{background:var(--sage); color:#0B1F14; font-weight:600;
    box-shadow: 0 1px 0 rgba(255,255,255,.2) inset;}
  .seg:not(.is-active):hover{color:var(--ink);}

  /* threshold rows */
  .thresh{border:1px solid var(--rule); border-radius:12px; padding:9px 10px;
    background:rgba(0,0,0,.18); display:flex; flex-direction:column; gap:7px;}
  .thresh.is-off{opacity:.55;}
  .thresh-hd{display:flex; align-items:center; justify-content:space-between;}
  .thresh-hd .t{font:500 12.5px/1 "Geist"; color:var(--ink);}

  /* Assignment-instructions section: shares the threshold card visual
     language but lives above the threshold group. The preview slot
     renders the first ~200 chars of the loaded paper's stripped intro
     (or an empty-state line when no paper is loaded / no intro
     exists). Toggle OFF dims the section + reveals the "excluded from
     grader" status line. */
  .assignment-intro-section{border:1px solid var(--rule); border-radius:12px;
    padding:9px 10px; background:rgba(0,0,0,.18);
    display:flex; flex-direction:column; gap:7px;}
  .assignment-intro-section.is-off{background:rgba(0,0,0,.10);}
  /* Scrollable intro preview (Fix 2). The slot now carries the FULL
     stripped intro (capped at 8000 chars by strip_intro_html) and
     scrolls when content exceeds max-height. Stays scrollable even
     when the toggle is OFF so the teacher can still read the intro;
     greyed treatment is via opacity from applyIntroToggleState(). */
  .assignment-intro-preview{font:13px/1.5 "Geist"; color:var(--ink-2);
    background:rgba(0,0,0,.22); border:1px solid var(--rule-2);
    border-radius:9px; padding:9px 10px;
    max-height:148px; overflow-y:auto;
    transition:opacity .15s ease; position:relative;}
  .assignment-intro-preview[data-intro-state="empty"]{color:var(--ink-4);
    max-height:none; overflow:hidden;}
  .assignment-intro-preview[data-intro-state="absent"]{color:var(--ink-4);
    font-style:italic; max-height:none; overflow:hidden;}
  /* Scrollbar styling: thin, dim, matches existing .papers-list rules. */
  .assignment-intro-preview::-webkit-scrollbar{width:6px;}
  .assignment-intro-preview::-webkit-scrollbar-thumb{
    background:rgba(255,236,196,.12); border-radius:3px;}
  .assignment-intro-preview::-webkit-scrollbar-thumb:hover{
    background:rgba(255,236,196,.2);}
  .assignment-intro-text{color:var(--ink-2); white-space:pre-wrap;
    word-break:break-word; display:block;}
  .assignment-intro-meta{color:var(--ink-4); font:500 11px/1.2 "Geist Mono";
    letter-spacing:.04em; margin-top:8px; padding-top:6px;
    border-top:1px solid var(--rule);}
  .assignment-intro-status{font:500 10.5px/1 "Geist Mono";
    letter-spacing:.04em; text-transform:uppercase;
    color:var(--ink-4); padding:2px 4px;}
  /* When the toggle is off OR the row has no intro, neither the
     preview nor the toggle should look interactive. */
  .assignment-intro-section.is-off .assignment-intro-preview{
    border-style:dashed; background:rgba(0,0,0,.10);}
  input[data-enable="include_assignment_intro"]:disabled + .switch,
  .assignment-intro-section:has(input:disabled) .switch{opacity:.45;}
  .switch{position:relative; width:30px; height:18px; border-radius:999px;
    background:var(--rule-2); transition: background .15s ease; cursor:default;}
  .switch::after{content:""; position:absolute; top:2px; left:2px;
    width:14px; height:14px; border-radius:50%; background:#F4ECD8;
    transition:transform .15s ease;}
  .switch.on{background:var(--sage);}
  .switch.on::after{transform:translateX(12px);}
  .stepper{display:grid; grid-template-columns:28px 1fr 28px; gap:0;
    border:1px solid var(--rule); border-radius:9px; overflow:hidden;
    background:rgba(0,0,0,.2);}
  .stepper button{appearance:none; border:0; background:transparent; color:var(--ink-2);
    font:600 14px/1 "Geist Mono"; height:30px;}
  .stepper button:hover{background:rgba(255,236,196,.06); color:var(--ink);}
  .stepper input{appearance:none; border:0; background:transparent; color:var(--ink);
    text-align:center; font:600 13px/1 "Geist Mono"; font-variant-numeric:tabular-nums; outline:none;}

  textarea.ta{width:100%; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:10px 12px;
    color:var(--ink); font:13.5px/1.5 "Geist"; outline:none; resize:vertical; min-height:64px;}
  textarea.ta:focus{border-color:var(--rule-2);}
  textarea.ta::placeholder{color:var(--ink-4);}

  /* student feedback */
  .feedback-body{padding:14px 16px;}
  .feedback-body .fb{background:rgba(0,0,0,.2); border:1px dashed var(--rule);
    border-radius:10px; padding:12px; color:var(--ink-2); font:13.5px/1.55 "Geist";
    min-height:130px; outline:none; white-space:pre-wrap;}
  .feedback-body .fb:focus{border-color:var(--rule-2); border-style:solid;
    background:rgba(0,0,0,.3);}

  /* small icons */
  .ic{width:16px;height:16px; flex-shrink:0;}

  /* ─────── Flask-app additions (NOT part of the design verbatim) ───────
     Everything below this banner styles elements the design didn't include
     (user dropdown, flash messages, dropzone empty state) or bridges the
     design's visual classes to the legacy form widgets (.num-input,
     select.action-select) that the existing assignments.js wires up. */

  /* utility */
  .visually-hidden{position:absolute; width:1px; height:1px; padding:0;
    margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;}
  .hidden{display:none !important;}

  /* user dropdown in the topbar.
     The inner items render with their own border-radius and the parent
     pads them inward so hover backgrounds inset cleanly from the
     popover's outer rounded corners (the previous full-bleed items
     showed sharp-cornered hover fills bleeding past the radius even
     with overflow:hidden, since rounded clipping doesn't antialias the
     last row of pixels at the curve). */
  .avatar{appearance:none; cursor:default;}
  .correction-user-dropdown{position:absolute; right:0; top:calc(100% + 6px); z-index:30;
    min-width:180px; background:#1A1410; border:1px solid var(--rule-2);
    border-radius:10px; box-shadow:var(--shadow-2); overflow:hidden;
    padding:4px;}
  .correction-user-dropdown.is-hidden{display:none;}
  .correction-user-name{padding:8px 10px 6px; margin:0 0 4px;
    border-bottom:1px solid var(--rule);
    font:600 12px/1.2 "Geist"; color:var(--ink-2);}
  .correction-user-link{display:block; width:100%; text-align:left;
    padding:8px 10px; border-radius:6px;
    background:transparent; border:0; color:var(--ink-2);
    font:500 12.5px/1 "Geist"; text-decoration:none; cursor:default;}
  .correction-user-link:hover{background:rgba(255,236,196,.06); color:var(--ink);}
  .correction-user-form{margin:0; padding:0;}

  /* flash messages */
  .correction-flash{margin:18px 0 0; display:flex; flex-direction:column; gap:6px;}
  .correction-flash-msg{padding:10px 14px; border-radius:10px; border:1px solid var(--rule);
    background:var(--paper-2); color:var(--ink-2); font:13px/1.4 "Geist";}
  .correction-flash-error{border-color:rgba(232,103,74,.4); background:rgba(232,103,74,.1); color:#FFB69E;}
  .correction-flash-success{border-color:rgba(107,179,137,.4); background:rgba(107,179,137,.1); color:var(--sage-2);}

  /* stacking notifications (download flow): identical messages collapse into
     one counted box (xN), each dismissible; errors persist + stay red. */
  .notify-stack{position:fixed; top:18px; right:18px; z-index:240;
    display:flex; flex-direction:column; gap:8px; max-width:380px;}
  .notify{display:flex; align-items:flex-start; gap:8px;
    padding:10px 12px 10px 14px; border-radius:10px; border:1px solid var(--rule);
    background:var(--paper-2); color:var(--ink-2); font:13px/1.4 "Geist";
    box-shadow:0 14px 32px rgba(0,0,0,.4); animation:notify-in 160ms ease-out;}
  .notify-success{border-color:rgba(107,179,137,.4); background:rgba(107,179,137,.12); color:var(--sage-2);}
  .notify-error{border-color:rgba(232,103,74,.45); background:rgba(232,103,74,.12); color:#FFB69E;}
  .notify-msg{flex:1 1 auto; min-width:0;}
  .notify-count{flex:0 0 auto; align-self:center; font-weight:600; font-size:12px;
    padding:1px 7px; border-radius:999px; background:rgba(255,255,255,.10);}
  .notify-close{flex:0 0 auto; cursor:pointer; background:transparent; border:0;
    color:inherit; opacity:.65; font-size:16px; line-height:1; padding:0 2px;}
  .notify-close:hover{opacity:1;}
  @keyframes notify-in{from{opacity:0; transform:translateY(-6px);} to{opacity:1; transform:translateY(0);}}

  /* regrade banner (sits inside the policy panel) */
  .regrade-banner{padding:12px 16px; border-bottom:1px solid var(--rule);
    background:linear-gradient(180deg, rgba(232,103,74,.10), rgba(232,103,74,.03));}
  .regrade-banner.hidden{display:none;}
  .regrade-banner-row{display:flex; align-items:center; gap:12px; justify-content:space-between;}
  .regrade-banner-text{font:500 12px/1.4 "Geist"; color:#FFB69E;}
  .regrade-banner-btn{padding:7px 11px; font-size:12px;}

  /* segmented toggle: real <input type=radio> inside <label class="seg"> */
  .segs label.seg{display:inline-flex; align-items:center; justify-content:center;
    flex:1; padding:9px 0; cursor:default;}

  /* threshold: real <input type=checkbox data-enable> inside <label class="switch"> */
  .switch{cursor:default;}
  .thresh.is-off .thresh-body{opacity:.55; pointer-events:none;}
  .thresh-body{display:flex; flex-direction:column; gap:7px;}

  /* legacy .num-input widget — styled to match the design's .stepper */
  .num-input{display:grid; grid-template-columns:28px 1fr 28px; gap:0;
    border:1px solid var(--rule); border-radius:9px; overflow:hidden;
    background:rgba(0,0,0,.2);}
  .num-input button{appearance:none; border:0; background:transparent; color:var(--ink-2);
    font:600 14px/1 "Geist Mono"; height:30px; cursor:default;}
  .num-input button:hover{background:rgba(255,236,196,.06); color:var(--ink);}
  .num-input .num-value{display:grid; place-items:center;
    color:var(--ink); text-align:center; font:600 13px/1 "Geist Mono";
    font-variant-numeric:tabular-nums; outline:none;}
  .num-input input.num-value{appearance:none; border:0; background:transparent;}
  .num-input input.num-value::-webkit-outer-spin-button,
  .num-input input.num-value::-webkit-inner-spin-button{-webkit-appearance:none; margin:0;}
  .num-input input.num-value[type=number]{-moz-appearance:textfield;}

  /* legacy select.action-select — styled to match the design's .select select */
  select.action-select{width:100%; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:10px 32px 10px 12px;
    color:var(--ink); font:13.5px "Geist"; outline:none;}

  /* dropzone empty state — single rounded card with everything nested */
  .drop-card{background:var(--paper); border:1px solid var(--rule); border-radius:18px;
    box-shadow:var(--shadow-1); overflow:hidden;}
  .drop-zone{display:flex; flex-direction:column; align-items:center; justify-content:center;
    padding:64px 30px 36px; cursor:pointer; text-align:center; transition:background .15s ease;}
  .drop-zone:hover{background:rgba(255,236,196,.03);}
  .drop-zone.is-dragover{background:rgba(107,179,137,.06); outline:1px dashed rgba(107,179,137,.4); outline-offset:-12px;}
  .drop-zone-cloud{width:64px; height:64px; border-radius:50%;
    background:rgba(255,236,196,.06); border:1px solid var(--rule);
    color:var(--ink-2); display:grid; place-items:center; margin-bottom:18px;}
  .drop-zone-title{font:600 16px/1 "Geist"; color:var(--ink); margin-bottom:6px;}
  .drop-zone-sub{font:13.5px "Geist"; color:var(--ink-3);}
  .drop-card-actions{display:flex; gap:8px; padding:14px 16px; border-top:1px solid var(--rule);
    justify-content:flex-end; align-items:center; flex-wrap:wrap;}
  .drop-card-meta{flex:1; min-width:0; display:flex; align-items:baseline; gap:10px;
    color:var(--ink-2); font:13px "Geist";}
  .drop-card-meta .drop-name{overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0;}
  .drop-card-meta .drop-size{color:var(--ink-4); font:11.5px "Geist Mono"; white-space:nowrap;}
  .htmx-indicator{display:none;}
  .htmx-request .htmx-indicator{display:flex;}
  .drop-card-indicator{display:none; align-items:center; gap:10px; padding:14px 16px;
    border-top:1px solid var(--rule); color:var(--ink-2); font:13px "Geist"; justify-content:center;}
  .htmx-request .drop-card-indicator{display:flex;}
  .drop-spinner{width:14px; height:14px; border-radius:50%;
    border:2px solid var(--accent); border-right-color:transparent;
    animation:drop-spin .8s linear infinite;}
  @keyframes drop-spin{to{transform:rotate(360deg);}}

  /* sidebar bits the design didn't include — filter dropdowns, empty
     messages, and the .papers-pill-wrap anchor for the dropdown popover. */
  .papers-panel-body{display:flex; flex-direction:column;}
  .papers-pill-wrap{position:relative; min-width:0;}
  /* Disabled state for the Assignment chip when no Module is selected.
     Visually faded so the user can tell it's gated without an extra
     hint card; the title attribute carries the explanation. */
  .papers-pill:disabled{opacity:.45; cursor:default;}
  .papers-pill:disabled:hover{background:transparent; border-color:var(--rule); color:inherit;}
  /* Chip width cap + ellipsis on the label. Without these, a long
     assignment name in "Assignment: <name>" pushes the chip beyond the
     300px sidebar width and the tail clips visually at the column
     edge ("Assignment: ASSIGNMENT ON CHAPTER…" reading as if the name
     itself were "ASSIGNMENT ON CHAPTER"). The chip is inline-flex, so
     we need min-width:0 to let the text element shrink below its
     intrinsic width. Hover tooltip on the pill (set in JS as
     pill.title) carries the full label. */
  .papers-pill{max-width:100%; min-width:0;}
  .papers-pill-text{display:inline-flex; align-items:center; min-width:0;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .papers-pill-chev{flex-shrink:0;}
  /* Dropdown uses position:fixed (not absolute) so it escapes the
     sidebar .panel{overflow:hidden} that would otherwise visually
     clip its right edge — the dropdown can grow as wide as its
     longest label needs, even when that's wider than the 300-360px
     sidebar. JS (positionPillDropdown in assignments.js) writes the
     top/left in viewport coordinates on every open; the scroll/resize
     close handlers prevent stale positions. */
  .papers-pill-dropdown{position:fixed; z-index:20;
    min-width:200px; max-height:280px; overflow:auto;
    background:#1A1410; border:1px solid var(--rule-2); border-radius:10px;
    box-shadow:var(--shadow-2); padding:6px;}
  .papers-pill-dropdown[hidden]{display:none;}
  .papers-facet-opt{display:flex; align-items:center; gap:8px;
    padding:7px 9px; border-radius:7px; cursor:default;
    color:var(--ink-2); font:500 12.5px/1.2 "Geist";}
  .papers-facet-opt:hover{background:rgba(255,236,196,.06); color:var(--ink);}
  .papers-facet-cb{appearance:none; width:14px; height:14px; border:1px solid var(--rule-2);
    border-radius:4px; background:rgba(0,0,0,.25); cursor:default; flex-shrink:0; position:relative;}
  .papers-facet-cb:checked{background:var(--sage); border-color:var(--sage);}
  .papers-facet-cb:checked::after{content:""; position:absolute; left:3px; top:0; width:5px; height:9px;
    border-right:2px solid #0B1F14; border-bottom:2px solid #0B1F14; transform:rotate(45deg);}
  .papers-facet-label{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .papers-facet-count{font:500 10.5px/1 "Geist Mono"; color:var(--ink-4);
    padding:2px 6px; border-radius:999px; background:rgba(255,236,196,.05);}
  .papers-facet-empty{padding:9px 10px; color:var(--ink-4);
    font:500 12px/1.2 "Geist"; text-align:center;}

  /* sidebar empty-state messages */
  .papers-empty{padding:24px 14px; color:var(--ink-4);
    font:13px/1.5 "Geist"; text-align:center;}
  .papers-empty-filtered{padding:18px 14px;}

  /* paper-card .hidden honoured globally via .hidden{display:none !important}
     declared earlier in this additions block. JS adds .hidden to filter cards
     out of the search/facet results; nothing else needed here. */

  /* ── sidebar tweaks: wider pane + side-by-side grade pills ───────────
     The design's .grid uses 300px for the left column and a vertical
     stack of grade pills. Both are too tight once the sidebar carries the
     full Teacher/AI pill pair side-by-side. Extending the design where
     it is silent: bump the left column to 360px and lay the pills out
     in a horizontal row. */
  .grid{grid-template-columns: 360px minmax(0,1fr) 360px;}
  .paper.paper-card{cursor:pointer;}
  .paper.paper-card:focus{outline:none; background:rgba(255,236,196,.06);}
  .paper.paper-card .paper-card-body{min-width:0;}
  .paper.paper-card .paper-name,
  .paper.paper-card .paper-meta,
  .paper.paper-card .paper-file{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .paper.paper-card .paper-pills{flex-direction:row; gap:6px; align-items:center;}
  .paper.paper-card .gp{flex-shrink:0; min-width:46px;}

  /* ── tab labels wrap cleanly when long (e.g. "AI to review") ─────────
     Wrapping the label in its own span lets it flow to two lines while
     the .count chip stays vertically centered next to it. Equal vertical
     padding gives the tab row a uniform height regardless of label rows. */
  .papers-tab{padding-top:10px; padding-bottom:10px; min-height:46px;}
  .papers-tab .papers-tab-label{flex:0 1 auto; min-width:0; text-align:center;
    line-height:1.15; white-space:normal; word-break:normal;}

  /* ── Papers pane vertical collapse — wired by assignments.js
     bindPapersPaneToggle. .is-collapsed hides the body so the panel
     shrinks to just its header; this frees vertical space in the
     left column for the sibling .feedback-panel underneath (set up
     in the layout restructure batch). The chevron icons rotate
     between down (expanded) and up (collapsed) via the same JS.
     250ms transition matches the policy / breakdown collapses. */
  #papers-pane{overflow:hidden;}
  #papers-pane > #papers-panel-mount{overflow:hidden; max-height:1400px;
    transition:max-height 250ms ease, opacity 200ms ease;}
  #papers-pane.is-collapsed > #papers-panel-mount{max-height:0; opacity:0;}
  #papers-pane.is-collapsed > .panel-hd{border-bottom-color:transparent;}

  /* ── Inline grading loading state.
     assignments.js → showGradingLoader replaces #grading-area's innerHTML
     with this card the moment a grade request leaves the page. The
     outer container reuses .drop-card so it lands on the same warm-brown
     surface as the empty-state dropzone — the loading state reads as
     a continuation of the same panel, not a popover. */
  .grading-loading{position:relative;}
  .grading-loading-body{display:flex; flex-direction:column; align-items:center;
    justify-content:center; text-align:center; padding:64px 30px 36px;}
  .grading-loading-spinner{width:48px; height:48px; border-radius:50%;
    border:3px solid var(--accent); border-right-color:transparent;
    animation:drop-spin .8s linear infinite; margin-bottom:18px;}
  .grading-loading-title{font:600 16px/1 "Geist"; color:var(--ink); margin-bottom:6px;}
  .grading-loading-sub{font:13.5px "Geist"; color:var(--ink-3);}
  .grading-loading-stage{margin-top:18px; color:var(--ink-3);
    font:500 10.5px/1 "Geist Mono"; letter-spacing:.1em; text-transform:uppercase;}

  /* ─── paper_review styling ──────────────────────────────────────────
     The partial uses the design's class names where it can (.viewer,
     .viewer-hd, .viewer-body, .vbtn, .island, .gpill, .panel-hd, .chat,
     .chat-list, .chat-composer, .chat-send, .hl-tip, .hl-chip) so the
     verbatim design rules above already drive most of the visual. The
     rules below cover (a) the live DOM elements the design's static mock
     didn't include — #pdf-viewer canvas wrapper, #pdf-viewer-loading,
     #submit-island, .feedback-panel — and (b) parallel
     selectors for class names the JS modules emit at runtime
     (.pdf-hl[-gain/loss/cap], .reasoning-chat-msg*, .reasoning-chat-bubble,
     .reasoning-chat-avatar, .reasoning-chat-textarea, .hl-tip-chip-*). */

  /* PDF.js mount: pdfviewer.js inserts .pdf-page-wrap children, each holding
     a <canvas class="pdf-page-canvas"> and a .pdf-page-overlay for highlights.
     Cap the height so a long paper doesn't push the right column off the
     viewport. Pages scroll INSIDE #pdf-viewer; the floating islands
     (.grade-island, .submit-island) sit in .viewer-body and aren't part of
     the scroll container, so they stay pinned to the panel corners. The
     320px subtraction roughly accounts for the topbar (~64px), the page
     header (~100px), .viewer-hd (~50px), .viewer-body padding (48px), and
     a small gap. .viewer-body keeps its own min-height:540px floor so
     short viewports don't crush the panel below readability. */
  #pdf-viewer{display:flex; flex-direction:column; gap:14px; align-items:center;
    width:100%;
    max-height: calc(100vh - 320px); min-height: 480px;
    overflow-y: auto;}
  .pdf-page-wrap{position:relative; background:#F4ECD8;
    border-radius:6px; box-shadow:0 10px 30px -10px rgba(0,0,0,.5);
    max-width:100%;}
  .pdf-page-canvas{display:block; border-radius:6px;}
  .pdf-page-overlay{position:absolute; inset:0; pointer-events:none;}

  /* Highlight overlays — thin coloured underlines drawn over the PDF.
     The design's .hl.gain/loss/cap colour variables (--hlc) drive the
     palette; pdf-hl elements use those values via the parallel rules
     below. The legacy .pdf-hl pattern (absolute overlay, transparent
     body, coloured bottom border) is preserved. */
  .pdf-hl{position:absolute; pointer-events:auto; cursor:pointer;
    background:transparent; border-bottom:2px solid currentColor;
    transition:filter .15s ease, border-bottom-width .15s ease;}
  .pdf-hl-gain{color:#3D8C5D;}
  .pdf-hl-loss{color:#C99820;}
  .pdf-hl-cap {color:#D1422B;}
  .pdf-hl:hover,
  .pdf-hl.is-active{border-bottom-width:3px; filter:brightness(1.15);}

  /* PDF rendering spinner inside the viewer-body. */
  #pdf-viewer-loading{display:flex; align-items:center; justify-content:center;
    gap:10px; padding:30px 0; color:var(--ink-3); font:13px "Geist";}
  #pdf-viewer-loading.hidden{display:none;}

  /* Floating submit island: mirrors the .island top-right styling but
     anchored top-left of the viewer-body. */
  .submit-island{position:absolute; top:18px; left:18px; z-index:5;
    background:rgba(28,22,18,.92); backdrop-filter:blur(14px) saturate(140%);
    -webkit-backdrop-filter:blur(14px) saturate(140%);
    border:1px solid var(--rule-2); border-radius:14px; padding:8px;
    display:flex; align-items:center; gap:8px;
    box-shadow:0 24px 50px -20px rgba(0,0,0,.7);}
  .submit-island-btn{padding:7px 12px; font:600 12.5px/1 "Geist";}
  .decision-status{color:var(--ink-3); font:11.5px "Geist Mono";}

  /* Hide/show the floating grade overlays (#overlay-toggle-btn). Both islands
     are position:absolute so fading them out shifts nothing else. The toolbar
     toggle stays visible, so there's always a way back. */
  #submit-island, #grade-island{
    transition:opacity .18s ease, transform .18s ease, visibility 0s 0s;}
  .overlays-hidden #submit-island, .overlays-hidden #grade-island{
    opacity:0; pointer-events:none; transform:translateY(-10px);
    visibility:hidden; transition:opacity .18s ease, transform .18s ease, visibility 0s .18s;}
  #overlay-toggle-btn .ic-eye-off{display:none;}
  #overlay-toggle-btn[aria-pressed="true"] .ic-eye{display:none;}
  #overlay-toggle-btn[aria-pressed="true"] .ic-eye-off{display:inline-block;}

  /* Zoom controls — sits in .viewer-hd .ctrls, left of "Next paper".
     Six steps via pdfviewer.js (50/75/100/125/150/200). The indicator
     doubles as a "reset to 100%" button. Buttons reuse .vbtn so the
     warm-brown stroke + hover styling carries through; .zoom-btn just
     centers the +/− glyph and gives a square footprint. */
  .zoom-ctrls{display:inline-flex; align-items:center; gap:4px;
    padding:2px; border-radius:10px; border:1px solid var(--rule);
    background:rgba(0,0,0,.18);}
  .zoom-ctrls .zoom-btn{min-width:30px; height:28px; padding:0;
    font:600 16px/1 "Geist Mono"; justify-content:center;
    border-radius:7px; border-color:transparent; background:transparent;}
  .zoom-ctrls .zoom-btn:hover:not(:disabled){background:var(--paper-3);}
  .zoom-ctrls .zoom-btn:disabled{opacity:.4; cursor:default;}
  .zoom-ctrls .zoom-indicator{min-width:46px; height:28px; padding:0 8px;
    font:600 11.5px/1 "Geist Mono"; letter-spacing:.04em; color:var(--ink-2);
    background:transparent; border:0; cursor:pointer;
    font-variant-numeric:tabular-nums; text-align:center;}
  .zoom-ctrls .zoom-indicator:hover{color:var(--ink);}

  /* Reasoning chat — parallel selectors for the JS-emitted classes.
     reasoning_chat.js → appendMessage builds .reasoning-chat-msg(.reasoning-chat-msg-ai|-msg-user)
     with .reasoning-chat-avatar + .reasoning-chat-bubble children. Mirror
     the design's .msg / .av / .bubble rules onto those selectors so the
     visual matches without touching the JS. */
  .reasoning-chat-msg{display:flex; gap:10px; max-width:88%;}
  .reasoning-chat-msg-ai .reasoning-chat-avatar,
  .reasoning-chat-msg-user .reasoning-chat-avatar{width:28px; height:28px;
    flex-shrink:0; border-radius:8px; display:grid; place-items:center;
    font:600 11px/1 "Geist Mono";}
  .reasoning-chat-msg-ai .reasoning-chat-avatar{
    background:linear-gradient(140deg, var(--accent), #B23A22); color:#fff;}
  .reasoning-chat-msg-user{margin-left:auto; flex-direction:row-reverse;}
  .reasoning-chat-msg-user .reasoning-chat-avatar{
    background:linear-gradient(140deg, var(--sage), #2F7A4E); color:#0B1F14;}
  .reasoning-chat-bubble{background:var(--paper-2); border:1px solid var(--rule);
    border-radius:12px; padding:11px 13px; font-size:13.5px; line-height:1.5;
    color:var(--ink); white-space:pre-wrap;}
  .reasoning-chat-msg-ai .reasoning-chat-bubble{border-top-left-radius:4px;}
  .reasoning-chat-msg-user .reasoning-chat-bubble{border-top-right-radius:4px;
    background:rgba(107,179,137,.08); border-color:rgba(107,179,137,.25);}
  .reasoning-chat-msg.is-thinking .reasoning-chat-bubble{opacity:.7;
    animation:chat-pulse 1.4s ease-in-out infinite;}
  @keyframes chat-pulse{50%{opacity:.4;}}

  /* Chat list scroll area + composer (mirror design's .chat-list /
     .chat-composer / .chat-send onto the JS-targeted IDs). */
  .reasoning-chat-messages{padding:14px 16px; max-height:340px; overflow:auto;
    display:flex; flex-direction:column; gap:12px;}
  .reasoning-chat-input{display:flex; gap:8px; padding:12px 14px;
    border-top:1px solid var(--rule);
    background:linear-gradient(180deg, transparent, rgba(0,0,0,.15));}
  .reasoning-chat-textarea{flex:1; appearance:none; background:rgba(0,0,0,.25);
    border:1px solid var(--rule); border-radius:10px; padding:10px 12px;
    color:var(--ink); font:13.5px "Geist"; outline:none;}
  .reasoning-chat-textarea::placeholder{color:var(--ink-4);}
  .reasoning-chat-textarea:focus{border-color:var(--rule-2);}
  .reasoning-chat-send{appearance:none; padding:0 14px; height:38px;
    border-radius:10px; background:var(--accent); color:#1A1410;
    font:600 13px/1 "Geist"; border:0;
    display:inline-flex; align-items:center; gap:6px;}
  .reasoning-chat-send:disabled{opacity:.45; cursor:default;}
  .chat-meta{color:var(--ink-4); font-size:11.5px;}

  /* Highlight tooltip chip parallel rules (highlights.js sets the chip
     class to "hl-tip-chip hl-tip-chip-<type>"). */
  .hl-tip-chip-gain{background:rgba(107,179,137,.18); color:var(--sage-2);}
  .hl-tip-chip-loss{background:rgba(240,184,69,.18); color:var(--amber-2);}
  .hl-tip-chip-cap {background:rgba(232,103,74,.18); color:#FFB69E;}
  /* The base .hl-chip styling is already verbatim above; the tooltip in
     paper_review.html now carries both class names so the same rules apply. */
  .hl-tip-claim{color:var(--ink-2); font:13px/1.45 "Geist";}
  /* Stacked-claim layout: when multiple highlights overlap at the
     hovered point, the tooltip shows one row per claim with hairline
     separators so each observation reads independently. */
  .hl-tip-chip-stacked{background:rgba(255,236,196,.08); color:var(--ink-2);
    border:1px solid var(--rule); margin-bottom:0;}
  .hl-tip-stacked-row{display:flex; flex-direction:column; gap:5px;
    padding:8px 0;}
  .hl-tip-stacked-row-sep{border-top:1px solid var(--rule);
    margin-top:0;}
  .hl-tip-stacked-row:first-child{padding-top:6px;}
  .hl-tip-stacked-row:last-child{padding-bottom:0;}
  .hl-tip-stacked-claim{color:var(--ink-2); font:13px/1.45 "Geist";}
  /* Approximate-match badge: shown on the tooltip only when the
     underlying placement came from Layer 2 (rapidfuzz) or Layer 3
     (semantic) AND its confidence is below 0.75. Tells the teacher
     the pin isn't exact but the reasoning is real. Pure CSS hide via
     .hidden so a layer-1 hover doesn't surface the badge. */
  .hl-tip-approx{display:inline-flex; align-items:center; gap:5px;
    margin-top:8px; padding:3px 7px; border-radius:6px;
    background:rgba(240,184,69,.16); color:var(--amber-2);
    border:1px solid rgba(240,184,69,.34);
    font:600 10px/1 "Geist Mono"; letter-spacing:.04em;
    text-transform:uppercase; cursor:help;}
  .hl-tip-approx.hidden{display:none;}
  .hl-tip-approx svg{color:var(--amber-2); flex-shrink:0;}

  /* General Observations panel — surfaces claims where the locator
     couldn't tie reasoning to a specific span on the PDF (Layer 1, 2
     and 3 all missed → locator_layer="none"). Sits below the reasoning
     chat in the centre column. The whole section is omitted from the
     template when every claim located cleanly. */
  .observations-panel{margin-top:18px;}
  /* The header doubles as a click target — give it pointer affordance,
     keep the inner .label / .chat-meta stacked, and tuck the chevron
     button at the far right. Toggle wired by bindObservationsToggle()
     in assignments.js; chevron rotates to point right when collapsed. */
  .observations-panel .panel-hd{padding:12px 16px 10px;
    cursor:pointer; user-select:none; gap:10px;
    flex-wrap:wrap;}
  .observations-panel .panel-hd .label{flex:1 1 auto;}
  .observations-panel .panel-hd .chat-meta{flex:1 1 100%; order:2;}
  .observations-panel .panel-hd .observations-collapse-btn{order:1;
    color:var(--ink-3); transition:background .12s ease;}
  .observations-panel .panel-hd .observations-collapse-btn:hover{
    background:rgba(255,236,196,.05); color:var(--ink-2);}
  .observations-panel .panel-hd .observations-collapse-btn svg{
    transition:transform 250ms ease;}
  .observations-panel[data-collapsed="true"] .panel-hd .observations-collapse-btn svg{
    transform:rotate(-90deg);}
  .observations-panel[data-collapsed="true"] .panel-hd{border-bottom-color:transparent;}
  .observations-panel[data-collapsed="true"] .observations-list{display:none;}
  .observations-badge{background:rgba(240,184,69,.14); color:var(--amber-2);
    border-color:rgba(240,184,69,.32);}
  .observations-list{list-style:none; margin:0; padding:0;
    display:flex; flex-direction:column;}
  .observations-row{padding:11px 16px; border-top:1px solid var(--rule);
    display:flex; flex-direction:column; gap:6px;
    transition:background .12s ease;}
  .observations-row:hover{background:rgba(255,236,196,.04);}
  .observations-row:first-child{border-top:0;}
  .observations-row-head{display:flex; align-items:center; gap:10px;
    justify-content:space-between;}
  .observations-chip{font:600 10px/1 "Geist Mono"; letter-spacing:.08em;
    padding:4px 7px; border-radius:5px; text-transform:uppercase;
    display:inline-flex; align-items:center; gap:4px;}
  .observations-chip-sev{font-weight:500; opacity:.85;
    text-transform:none; letter-spacing:.02em;}
  .observations-impact{font:600 11px/1 "Geist Mono"; padding:3px 7px;
    border-radius:6px; font-variant-numeric:tabular-nums;
    background:rgba(255,236,196,.06); color:var(--ink-2);
    border:1px solid var(--rule);}
  .observations-impact.is-gain{background:rgba(107,179,137,.14);
    color:var(--sage-2); border-color:rgba(107,179,137,.32);}
  .observations-impact.is-loss{background:rgba(232,103,74,.14);
    color:#FFB69E; border-color:rgba(232,103,74,.32);}
  .observations-claim{color:var(--ink-2); font:13.5px/1.5 "Geist";
    word-break:break-word;}
  .hl-tip-close{position:absolute; top:6px; right:8px; appearance:none;
    background:transparent; border:0; color:var(--ink-4); font-size:16px;
    line-height:1; cursor:pointer;}
  .hl-tip-close:hover{color:var(--ink-2);}
  .hl-tip.hidden{display:none;}

  /* Feedback bubble panel — lives in the LEFT column under #papers-pane
     (OOB-swapped into #left-stack-feedback). The design's .feedback-body
     already covers the bubble visual; add .feedback-panel anchor + click
     hint. */
  .feedback-panel{margin-top:0;}
  .feedback-bubble{background:rgba(0,0,0,.2); border:1px dashed var(--rule);
    border-radius:10px; padding:12px; color:var(--ink-2);
    font:13.5px/1.55 "Geist"; min-height:130px; outline:none; white-space:pre-wrap;}
  .feedback-bubble:focus{border-color:var(--rule-2); border-style:solid;
    background:rgba(0,0,0,.3);}
  .feedback-hint{color:var(--ink-4); font-size:11px;}

  /* Right-stack-results wrapper just gives space below the policy panel. */
  .right-stack-results{display:flex; flex-direction:column; gap:18px;}
  .right-stack-results:empty{display:none;}

  /* ─── Batch grade button (sidebar row between filter chips + tabs) ─── */
  .papers-batch-row{padding:6px 10px 0; display:block;}
  /* Batch grade — reddish (Item 3 recolor). */
  .papers-batch-btn{width:100%; justify-content:center; gap:8px;
    padding:8px 12px; border-radius:10px;
    background:rgba(202,74,60,.10); border:1px solid rgba(202,74,60,.42);
    color:var(--ink); font:600 12px/1 "Geist"; letter-spacing:.02em;}
  .papers-batch-btn:hover{background:rgba(202,74,60,.16); border-color:rgba(202,74,60,.62);}
  .papers-batch-btn .ic{color:#c8503c;}
  .papers-batch-btn.is-active{border-color:rgba(202,74,60,.6);
    background:rgba(202,74,60,.16); color:var(--ink);}
  .papers-batch-btn.is-active .ic{color:#c8503c;}

  /* Batch accept launcher — greenish sibling of the (reddish) Batch grade
     button: identical width/padding/radius/typography for matching visual
     weight. Shown only on the AI-to-review tab (assignments.js toggles
     [hidden]); the [hidden] rule beats the flex display so it actually
     hides. Sits directly under Batch grade in .papers-batch-row. */
  /* display:flex (block-level) so it fills the row like Batch grade; the
     .btn base is inline-flex, which renders narrower in this container. */
  .papers-accept-btn{display:flex; align-items:center; width:100%;
    box-sizing:border-box; justify-content:center; gap:8px;
    margin-top:10px; padding:8px 12px; border-radius:10px;
    background:rgba(63,157,86,.12); border:1px solid rgba(63,157,86,.45);
    color:var(--ink); font:600 12px/1 "Geist"; letter-spacing:.02em;}
  .papers-accept-btn:hover{background:rgba(63,157,86,.18);
    border-color:rgba(63,157,86,.62);}
  .papers-accept-btn .ic{color:#3f9d56;}
  .papers-accept-btn[hidden]{display:none;}

  /* ─── Batch accept review modal (Item 4a-v2) — CLONES the preload
     picker: reuses .drop-card .preload-picker shell, .preload-picker-hd,
     .preload-picker-subm rows, .preload-picker-subhd / -footbar. Only the
     per-row controls (expand chevron, flags spacing, disabled Submit) and
     the lazy breakdown panel are added on top. ─── */
  .batch-accept-count{flex:0 0 auto; margin-left:auto; color:var(--ink-3);
    font:500 11.5px/1 "Geist Mono";}
  /* gap = the vertical space between a row card and its expanded breakdown
     panel, so they're not flush. */
  .batch-accept-row{display:flex; flex-direction:column; gap:9px;}
  /* The row card is a div (not the picker's <label>), so don't imply the
     whole row toggles a checkbox. */
  .batch-accept-subm{cursor:default;}
  .batch-accept-subm .policy-flags-anchor{flex:0 0 auto;}
  /* Expand chevron reuses .iconbtn .breakdown-collapse-btn (the main
     review's dark-rounded collapse style); here it only needs to not
     stretch and to rotate when the row is open. Sits last → far right. */
  .batch-accept-expand{flex:0 0 auto; cursor:pointer;}
  .batch-accept-expand svg{transition:transform .15s ease;}
  .batch-accept-expand[aria-expanded="true"] svg{transform:rotate(180deg);}
  /* View paper — compact neutral button on the left of the row. */
  .batch-accept-view{flex:0 0 auto; display:inline-flex; align-items:center;
    gap:5px; padding:5px 10px; border-radius:8px; font:500 11.5px/1 "Geist";
    background:var(--paper-2); border:1px solid var(--rule); color:var(--ink-2);
    cursor:pointer;}
  .batch-accept-view:hover{background:var(--paper-3); border-color:var(--rule-2);
    color:var(--ink);}
  .batch-accept-submit{flex:0 0 auto; padding:6px 14px; border-radius:8px;
    font:600 12px/1 "Geist"; background:rgba(63,157,86,.12);
    border:1px solid rgba(63,157,86,.5); color:var(--ink);}
  .batch-accept-submit:disabled{opacity:.45; cursor:not-allowed;}
  /* Editable per-row grade — ONE pill. Red while it shows the unedited AI
     proposal; green once the teacher edits (driven by data-edited="1"). */
  .batch-accept-grade{flex:0 0 auto; display:inline-flex; align-items:center; gap:4px;}
  .batch-accept-step{display:inline-flex; align-items:center; justify-content:center;
    width:22px; height:22px; border-radius:6px; border:1px solid var(--rule);
    background:var(--paper-2); color:var(--ink-2); cursor:pointer;
    font:600 14px/1 "Geist"; padding:0;}
  .batch-accept-step:hover{background:var(--paper-3); border-color:var(--rule-2);
    color:var(--ink);}
  .batch-accept-pill{min-width:52px; text-align:center; padding:4px 8px;
    border-radius:8px; font:600 12px/1 "Geist Mono"; cursor:pointer;
    background:rgba(202,74,60,.12); border:1px solid rgba(202,74,60,.45);
    color:#e1836f;}
  .batch-accept-grade[data-edited="1"] .batch-accept-pill{
    background:rgba(63,157,86,.14); border-color:rgba(63,157,86,.55); color:#7ec99a;}
  .batch-accept-pf-note{margin-top:3px; font:10.5px/1.2 "Geist"; color:#e1836f;
    text-align:center; white-space:nowrap;}
  /* Re-grade guard dialog — shown when opening an already-graded paper whose
     stored policy differs from the live panel (prevents silent re-grade). */
  .regrade-guard-overlay{position:fixed; inset:0; z-index:1000; display:flex;
    align-items:center; justify-content:center; background:rgba(8,10,14,.55);
    backdrop-filter:blur(2px);}
  .regrade-guard-card{max-width:440px; width:calc(100% - 48px); background:var(--panel,#15171c);
    border:1px solid rgba(255,255,255,.10); border-radius:14px; padding:22px 22px 18px;
    box-shadow:0 18px 50px rgba(0,0,0,.5);}
  .regrade-guard-title{margin:0 0 8px; font:600 15px/1.3 "Geist"; color:var(--ink-1,#eef1f5);}
  .regrade-guard-body{margin:0 0 16px; font:13px/1.45 "Geist"; color:var(--ink-2,#c4cad3);}
  .regrade-guard-actions{display:flex; flex-direction:column; gap:8px;}
  .regrade-guard-actions .btn{padding:9px 14px; border-radius:9px; cursor:pointer;
    font:13px "Geist"; text-align:center; border:1px solid transparent;}
  /* Default emphasis on option 1 — cheap + non-destructive. */
  .regrade-guard-primary{background:rgba(63,157,86,.16); border-color:rgba(63,157,86,.55);
    color:#8fd6a8; font-weight:600;}
  .regrade-guard-primary:hover{background:rgba(63,157,86,.24);}
  .regrade-guard-regrade{background:rgba(232,103,74,.10); border-color:rgba(232,103,74,.45);
    color:#FFB69E;}
  .regrade-guard-regrade:hover{background:rgba(232,103,74,.18);}
  .regrade-guard-cancel{background:transparent; border-color:rgba(255,255,255,.14);
    color:var(--ink-3,#9aa3ad);}
  .regrade-guard-cancel:hover{background:rgba(255,255,255,.05);}
  .regrade-guard-note{margin-top:12px; font:11px/1.35 "Geist"; color:var(--ink-3,#9aa3ad);}
  input.batch-accept-pill-input{width:64px; min-width:0;}
  .batch-accept-pf{display:inline-flex; border:1px solid rgba(202,74,60,.40);
    border-radius:8px; overflow:hidden;}
  .batch-accept-grade[data-edited="1"] .batch-accept-pf{border-color:rgba(63,157,86,.50);}
  .batch-accept-pf-seg{padding:5px 10px; border:none; background:transparent;
    color:var(--ink-3); cursor:pointer; font:600 11px/1 "Geist";}
  .batch-accept-pf-seg.is-active{background:rgba(202,74,60,.16); color:#e1836f;}
  .batch-accept-grade[data-edited="1"] .batch-accept-pf-seg.is-active{
    background:rgba(63,157,86,.16); color:#7ec99a;}
  /* Compact P/F segments — single-letter, fixed narrow width so the row stays
     tight and the student name doesn't truncate. */
  .batch-accept-pf-compact .batch-accept-pf-seg{padding:5px 0; min-width:24px;
    text-align:center;}
  /* Header info icon (replaces the per-row mapped note). Native title tooltip. */
  .batch-accept-pf-info{margin-left:6px; cursor:help; color:var(--ink-3);
    font:13px/1 "Geist"; opacity:.85;}
  .batch-accept-pf-info:hover, .batch-accept-pf-info:focus{opacity:1; color:var(--ink-2);
    outline:none;}
  .batch-accept-breakdown{border:1px solid var(--rule); border-radius:12px;
    padding:10px 13px; background:var(--paper-2); margin-left:26px;}
  .batch-accept-breakdown-loading,.batch-accept-breakdown-empty{
    color:var(--ink-3); font:12px/1.4 "Geist"; padding:4px 0;}
  /* Per-row submit status line (pushing… / refuse / fail). */
  .batch-accept-rowstatus{font:500 11.5px/1.4 "Geist"; color:var(--ink-3);
    padding:2px 0 0 26px;}
  .batch-accept-rowstatus.is-err{color:#e8674a;}
  /* Bulk "Accept N selected" progress / summary line (left of the button). */
  .batch-accept-bulkstatus{margin-right:auto; align-self:center;
    font:500 11.5px/1.4 "Geist"; color:var(--ink-3); max-width:62%;
    overflow:hidden; text-overflow:ellipsis;}
  .batch-accept-bulkstatus.is-err{color:#e8674a;}
  /* 50-selection cap note — non-alarming amber, shown only at the cap. */
  .batch-accept-capmsg{font:500 11.5px/1.4 "Geist"; color:var(--amber-2);
    background:rgba(216,166,87,.10); border:1px solid rgba(216,166,87,.30);
    border-radius:8px; padding:6px 10px; margin-bottom:8px;}
  .batch-accept-capmsg[hidden]{display:none;}
  /* The injected breakdown reuses _breakdown_panel.html, which carries a
     "Grade breakdown" .panel-hd header. It's redundant inside the modal —
     hide it HERE ONLY (scoped to .batch-accept-breakdown), so the main
     review keeps its header. Keep the +/- content below it. */
  .batch-accept-breakdown .panel-hd{display:none;}

  /* ─── Preload picker (rendered into #grading-area) ─── */
  .preload-picker{padding:0; display:flex; flex-direction:column;
    min-height:520px; max-height:calc(100vh - 220px);}
  .preload-picker-hd{display:flex; align-items:center; gap:14px;
    padding:14px 18px; border-bottom:1px solid var(--rule);
    background:var(--paper-2);}
  .preload-picker-title{display:flex; align-items:center; gap:9px;
    font:600 12px/1 "Geist"; letter-spacing:.08em; text-transform:uppercase;
    color:var(--ink-2); flex:0 0 auto;}
  .preload-picker-title .ic{color:var(--ink-3);}
  .preload-picker-breadcrumb{display:flex; align-items:center; gap:6px;
    flex:1; min-width:0; overflow:hidden;}
  .preload-picker-breadcrumb .papers-pill{padding:5px 10px; font-size:11.5px;
    cursor:pointer;}
  .preload-picker-breadcrumb .papers-pill.is-active{
    background:rgba(232,103,74,.12); border-color:rgba(232,103,74,.32);
    color:var(--accent);}
  .preload-picker-crumb-sep{color:var(--ink-4); font-size:13px;}
  .preload-picker-body{padding:14px 16px; overflow-y:auto; flex:1; min-height:0;
    display:flex; flex-direction:column; gap:10px;}
  .preload-picker-loading{color:var(--ink-3); font-size:12.5px; padding:18px 4px;}
  .preload-picker-empty{color:var(--ink-3); font-size:12.5px; padding:24px 4px;
    text-align:center;}
  .preload-picker-hidden-note{color:var(--ink-3); font-size:11.5px; padding:4px 8px 8px;
    border-bottom:1px solid var(--rule); margin-bottom:6px;}
  .preload-picker-list{display:flex; flex-direction:column; gap:7px;
    flex:1; min-height:0; overflow-y:auto;}
  .preload-picker-card{appearance:none; width:100%; text-align:left;
    background:var(--paper); border:1px solid var(--rule); border-radius:12px;
    padding:11px 13px; display:flex; gap:10px; align-items:center;
    color:var(--ink); cursor:pointer;}
  .preload-picker-card:hover{background:rgba(255,236,196,.05);
    border-color:var(--rule-2);}
  .preload-picker-card .paper-card-body{flex:1; min-width:0;}
  .preload-picker-card .paper-name{font:600 13px/1.2 "Geist"; color:var(--ink);}
  .preload-picker-card .paper-meta{font:12px/1.4 "Geist"; color:var(--ink-3);
    margin-top:3px;}

  /* Submission rows in Level 3 — same .paper-card vibe + a leading checkbox */
  .preload-picker-subm{display:flex; gap:10px; align-items:center;
    background:var(--paper); border:1px solid var(--rule); border-radius:12px;
    padding:10px 13px; cursor:pointer;}
  .preload-picker-subm:hover{background:rgba(255,236,196,.05);
    border-color:var(--rule-2);}
  .preload-picker-cb{appearance:none; width:16px; height:16px; flex:0 0 16px;
    border-radius:5px; border:1.5px solid var(--rule-2);
    background:transparent; cursor:pointer; position:relative;
    transition: background .12s ease, border-color .12s ease;}
  .preload-picker-cb:hover{border-color:var(--ink-4);}
  .preload-picker-cb:checked{background:var(--accent); border-color:var(--accent);}
  .preload-picker-cb:checked::after{content:""; position:absolute; left:4px;
    top:1px; width:6px; height:10px; border:solid #1A1410; border-width:0 2px 2px 0;
    transform:rotate(45deg);}
  .preload-picker-subm .paper-card-body{flex:1; min-width:0;}
  .preload-picker-subm .paper-name{font:600 13px/1.2 "Geist";}
  .preload-picker-subm .paper-meta{font:11.5px/1.4 "Geist"; color:var(--ink-3);}
  .preload-picker-subm .paper-file{font:11px/1.4 "Geist Mono"; color:var(--ink-4);
    margin-top:2px;}
  .preload-picker-subm .paper-pills{display:flex; gap:6px; flex:0 0 auto;}
  .preload-picker-subm .gp{flex-shrink:0; min-width:46px;}

  .preload-picker-subtabs{display:flex; gap:4px; margin-bottom:8px;
    background:rgba(0,0,0,.22); padding:3px; border-radius:9px;}
  .preload-picker-subtab{flex:1; border:0; background:transparent; cursor:pointer;
    color:var(--ink-2); font:600 12px "Geist"; padding:6px 8px; border-radius:7px;}
  .preload-picker-subtab.is-active{background:var(--sage); color:#0B1F14;}
  .preload-picker-subtab-n{opacity:.7; font-weight:500;}
  .preload-picker-marker{font:500 10px/1 "Geist"; padding:2px 6px; border-radius:6px;
    margin-left:2px; vertical-align:middle;}
  .preload-picker-marker.changed{background:rgba(232,103,74,.14); color:#FFB69E;}
  .preload-picker-marker.same{background:rgba(255,255,255,.07); color:var(--ink-3);}
  .preload-picker-subhd{display:flex; align-items:center; gap:8px;
    padding-bottom:6px; border-bottom:1px solid var(--rule);
    margin-bottom:6px;}
  .preload-picker-selectall{font-size:11.5px; padding:6px 10px;}
  .preload-picker-selcount{margin-left:auto; color:var(--ink-3);
    font:500 11.5px/1 "Geist Mono";}
  .preload-picker-footbar{display:flex; justify-content:flex-end; gap:8px;
    padding-top:10px; border-top:1px solid var(--rule); margin-top:auto;
    position:sticky; bottom:0; background:var(--paper);}

  /* ─── Grade Breakdown panel (right column, below policy panel) ─── */
  .breakdown-panel{background:var(--paper); border:1px solid var(--rule);
    border-radius:18px; overflow:hidden;}
  .breakdown-panel[data-collapsed="true"] .breakdown-body{display:none;}
  .breakdown-panel[data-collapsed="true"] .breakdown-collapse-btn svg{
    transform:rotate(-90deg);}
  .breakdown-collapse-btn{width:26px; height:26px; border-radius:7px;
    appearance:none; border:1px solid var(--rule); background:transparent;
    color:var(--ink-3); display:grid; place-items:center;}
  .breakdown-collapse-btn:hover{background:rgba(255,236,196,.05);
    color:var(--ink-2);}

  /* Fixed-height scroll: long breakdowns (lots of strengths + deductions)
     used to push the page below the viewport. Bound the body height and
     let it scroll internally; the panel keeps its header and chevron
     visible at all times. 240px subtraction roughly accounts for the
     topbar, page-hd, policy-panel header, and the gap between right-
     stack children — the policy panel collapses on paper-load so we
     don't need to reserve room for an expanded policy body. */
  .breakdown-body{padding:6px 4px 12px;
    max-height:calc(100vh - 240px); overflow-y:auto;}
  .breakdown-section-hd{padding:14px 14px 4px; color:var(--ink-3);
    font:600 10.5px/1 "Geist"; letter-spacing:.12em; text-transform:uppercase;}
  .breakdown-row{display:flex; align-items:flex-start; gap:9px;
    padding:8px 14px; margin:0 2px; border-radius:8px;
    transition:background-color .18s ease;}
  .breakdown-row.is-clickable{cursor:pointer;}
  .breakdown-row.is-clickable:hover{background:rgba(255,236,196,.05);}
  .breakdown-row.is-active{background:rgba(107,179,137,.12);}
  .breakdown-row.is-unlocated{opacity:.55; cursor:default;}
  .breakdown-marker{flex:0 0 14px; font:600 13px/1.4 "Geist Mono";
    color:var(--ink-4); text-align:center;}
  .breakdown-deduction .breakdown-marker{color:#FFB69E;}
  .breakdown-strength .breakdown-marker{color:var(--sage-2);}
  .breakdown-marker-flag{color:#F0C97A;}
  .breakdown-label{flex:1; min-width:0; font:500 12.5px/1.4 "Geist";
    color:var(--ink-2); word-break:break-word;}
  .breakdown-sublabel{font:400 11px/1.4 "Geist"; color:var(--ink-4);
    margin-top:3px;}
  .breakdown-amount{flex:0 0 auto; font:600 12.5px/1.4 "Geist Mono";
    color:var(--ink-2); padding-left:6px;}
  .breakdown-amount-pos{color:var(--sage-2);}
  .breakdown-amount-neg{color:#FFB69E;}
  .breakdown-amount-dot{color:var(--ink-4); font-size:14px;}
  .breakdown-pin-hint{display:inline-block; margin-left:6px;
    padding:1px 6px; border-radius:999px; font:500 9.5px/1.4 "Geist Mono";
    color:var(--ink-4); background:rgba(0,0,0,.18);
    border:1px solid var(--rule-2); text-transform:uppercase;
    letter-spacing:.06em;}
  /* Start + final get a slightly heavier weight + a hairline above/below
     so they read as section anchors rather than rows. */
  .breakdown-start{border-bottom:1px solid var(--rule);
    padding-top:14px; padding-bottom:14px; margin-bottom:2px;}
  .breakdown-final{border-top:1px solid var(--rule);
    margin-top:6px; padding-top:14px; padding-bottom:14px;}
  .breakdown-final .breakdown-label{font-weight:600; color:var(--ink);}
  .breakdown-amount-final{font-size:18px; font-weight:700;
    color:var(--accent);}
  .breakdown-flag{background:rgba(240,201,122,.06);
    border:1px solid rgba(240,201,122,.18);}
  .breakdown-calibration{flex-direction:row;}
  .breakdown-calib-body{flex:1; min-width:0;
    font:500 12px/1.4 "Geist"; color:var(--ink-2);}
  .breakdown-calib-line{margin:2px 0;}
  .breakdown-calib-line b{font-weight:600; color:var(--ink);}
  .breakdown-calib-note{margin-top:6px; color:var(--ink-3);
    font:400 11.5px/1.5 "Geist"; font-style:italic;}
  .breakdown-note-toggle{appearance:none; border:none; background:transparent;
    color:var(--accent); font:500 11px/1 "Geist"; cursor:pointer;
    padding:0 0 0 4px;}
  .breakdown-note-toggle:hover{text-decoration:underline;}
  .breakdown-foot-note{padding:10px 14px 0; color:var(--ink-4);
    font:400 11px/1.5 "Geist"; font-style:italic;}
  .breakdown-note-approx{color:var(--ink-3);}

  /* ─── Login / auth page ───────────────────────────────────────────────
     Lives in correction.css so login inherits every existing warm-brown
     token (--bg, --paper, --rule, --accent, --ink) and the .panel /
     .btn / .btn-primary classes. Keeps the login feeling like the same
     app — same fonts, same card treatment, same accent on the CTA. */

  body.auth-page {
    /* Same radial-gradient backdrop the correction shell uses, so a
       browser navigating login → home → correction sees one continuous
       warm-brown surface. */
    background:
      radial-gradient(1200px 600px at 85% -10%, rgba(232,103,74,.18) 0%, transparent 55%),
      radial-gradient(1000px 500px at -10% 110%, rgba(107,179,137,.13) 0%, transparent 55%),
      var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .auth-shell {
    width: 100%;
    padding: 32px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .auth-stack {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
  }

  .auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--ink);
    font: 600 16px/1 "Geist", ui-sans-serif, system-ui, sans-serif;
    letter-spacing: -0.01em;
  }
  .auth-brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: rgba(232,103,74,.10);
    border: 1px solid rgba(232,103,74,.30);
    box-shadow: var(--shadow-1);
  }
  .auth-brand-icon svg { width: 16px; height: 16px; }
  .auth-brand-name { font-size: 16px; }

  .auth-card { width: 100%; }
  .auth-card-body {
    padding: 28px 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .auth-title {
    margin: 0;
    font-family: "Instrument Serif", "Iowan Old Style", Georgia, serif;
    font-weight: 400;
    font-size: 36px;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--ink);
  }
  .auth-title i { font-style: italic; color: var(--accent); }
  .auth-subtitle {
    margin: -6px 0 0;
    color: var(--ink-3);
    font: 400 13.5px/1.5 "Geist", ui-sans-serif, system-ui, sans-serif;
  }

  .auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 4px;
  }
  .auth-field label {
    display: block;
    font: 600 10.5px/1 "Geist";
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--ink-3);
    margin-bottom: 8px;
  }
  .auth-field input {
    width: 100%;
    appearance: none;
    background: rgba(0,0,0,.25);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 11px 13px;
    color: var(--ink);
    font: 14px/1.2 "Geist", ui-sans-serif, system-ui, sans-serif;
    outline: none;
    transition: border-color 140ms ease, background 140ms ease,
                box-shadow 140ms ease;
  }
  .auth-field input::placeholder { color: var(--ink-4); }
  .auth-field input:focus {
    border-color: var(--sage);
    background: rgba(107,179,137,.06);
    box-shadow: 0 0 0 3px rgba(107,179,137,.12);
  }

  .auth-submit {
    width: 100%;
    justify-content: center;
    padding: 11px 13px;
    font-size: 14px;
    margin-top: 2px;
  }

  .auth-foot {
    margin: 6px 0 0;
    text-align: center;
    color: var(--ink-4);
    font: 12px/1.5 "Geist", ui-sans-serif, system-ui, sans-serif;
  }

  .auth-flash-stack { display: flex; flex-direction: column; gap: 8px; }
  .auth-flash {
    padding: 10px 12px;
    border-radius: 9px;
    font: 13px/1.4 "Geist", ui-sans-serif, system-ui, sans-serif;
    border: 1px solid;
  }
  .auth-flash-error {
    background: rgba(232,103,74,.10);
    border-color: rgba(232,103,74,.32);
    color: var(--accent);
  }
  .auth-flash-info {
    background: rgba(255,236,196,.04);
    border-color: var(--rule);
    color: var(--ink-2);
  }

  /* ── Batch queue view + download gate + progress bar (PART C/D) ───────── */
  .batch-queue-pane{padding:6px 2px; max-height:680px; overflow:auto;}
  #batch-queue-view{display:flex; flex-direction:column; gap:12px;}
  .bq-empty{padding:18px 12px; color:var(--ink-3); font:13px/1.5 "Geist";}
  .bq-note{margin-top:6px; font-size:11px; color:var(--ink-4);}
  .bq-section{display:flex; flex-direction:column; gap:4px;}
  .bq-cancelbar{display:flex; justify-content:flex-end; margin-bottom:2px;}
  .bq-cancel-btn{padding:5px 12px; border-radius:8px; cursor:pointer; font:12px "Geist";
    border:1px solid rgba(232,103,74,.45); background:rgba(232,103,74,.10); color:#FFB69E;}
  .bq-cancel-btn:hover{background:rgba(232,103,74,.18);}
  .bq-h{font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-3); margin-bottom:2px;}
  .bq-sub{font-size:11.5px; color:var(--ink-3);}
  .bq-bar{position:relative; height:18px; border-radius:9px; background:var(--paper-2);
    border:1px solid var(--rule); overflow:hidden;}
  .bq-bar-fill{position:absolute; left:0; top:0; bottom:0; transition:width .4s ease;}
  .bq-bar-dl{background:linear-gradient(90deg, rgba(143,207,169,.5), rgba(107,179,137,.75));}
  .bq-bar-grade{background:linear-gradient(90deg, rgba(232,160,90,.55), rgba(232,130,74,.8));}
  .bq-bar-label{position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
    font-size:11px; font-weight:600; color:var(--ink);}
  .bq-row{display:flex; gap:8px; align-items:baseline; padding:4px 8px; border-radius:7px;
    background:var(--paper-2); border:1px solid var(--rule); font:12px/1.3 "Geist";}
  .bq-student{font-weight:600; color:var(--ink-2); flex:0 0 auto;}
  .bq-asg{color:var(--ink-3); flex:1 1 auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
  .bq-reason{color:#FFB69E; font-size:11px; flex:0 0 auto;}
  .bq-row.bq-inprogress{border-color:rgba(232,130,74,.4);}
  .bq-row.bq-downloading{border-color:rgba(143,207,169,.4);}
  .bq-row.bq-completed{opacity:.7;}
  .bq-row.bq-failed{background:rgba(232,103,74,.10); border-color:rgba(232,103,74,.4);}

  .bq-gate-overlay{position:fixed; inset:0; z-index:300; background:rgba(0,0,0,.55);
    display:flex; align-items:center; justify-content:center;}
  .bq-gate{max-width:440px; width:90%; background:var(--paper); border:1px solid var(--rule-2);
    border-radius:14px; padding:20px; box-shadow:0 24px 60px rgba(0,0,0,.5);}
  .bq-gate-msg{font:14px/1.5 "Geist"; color:var(--ink); margin-bottom:16px;}
  .bq-gate-actions{display:flex; flex-direction:column; gap:8px;}
  .bq-gate-actions .btn{width:100%; padding:9px 14px; border-radius:9px; cursor:pointer;
    border:1px solid var(--rule-2); background:var(--paper-2); color:var(--ink-2); font:13px "Geist";}
  .bq-gate-actions .btn:hover{background:var(--paper-3);}
  .bq-gate-primary{border-color:rgba(107,179,137,.5) !important; color:var(--sage-2) !important;}
  .bq-gate-cancel{color:var(--ink-3) !important;}
