:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#17243a;background:#f3f5f9;font-size:16px;font-synthesis:none;--navy:#10223b;--blue:#2855d9;--line:#dce3ee;--muted:#58677c;--cyan:#8ee3e0}
*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button,a,input,select,textarea{outline-offset:4px}button{cursor:pointer;border:1px solid var(--line);background:white;color:inherit;padding:.65rem .9rem;border-radius:7px;font-size:.875rem;font-weight:600}button:hover{background:#edf2fc;border-color:#9caecb}button:disabled{opacity:.5;cursor:wait}.primary{background:var(--blue);border-color:var(--blue);color:white}.primary:hover{background:#1e43b3;color:white}.quiet{background:transparent}.danger{color:#a12836}a{color:#2855d9;text-underline-offset:3px}input,select,textarea{width:100%;border:1px solid #bdc9d9;border-radius:7px;padding:.7rem;background:white;color:inherit}textarea{resize:vertical;min-height:100px;line-height:1.55}label{display:block;font-size:.875rem;font-weight:600;margin-bottom:.5rem}small,.muted{color:var(--muted);font-size:.875rem;line-height:1.6}h1,h2,h3,p{margin-top:0}h1{font-size:1.65rem;letter-spacing:-.045em;line-height:1.25}h2{font-size:1.2rem;letter-spacing:-.025em}h3{font-size:1.05rem}pre,code{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:.85em}pre{background:#132238;color:#e2ecfa;padding:1rem;border-radius:8px;overflow:auto;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere}code{background:#eaf0f7;padding:.1rem .25rem;border-radius:3px}pre code{background:none;padding:0;color:inherit}.brand{display:flex;gap:.65rem;align-items:center;font-weight:700;letter-spacing:-.03em}.brandmark{display:grid;place-items:center;width:35px;height:35px;border-radius:8px;background:var(--cyan);color:#0a2635;font-family:monospace;font-size:1.25rem}.eyebrow{font-size:.75rem;letter-spacing:.13em;font-weight:700;text-transform:uppercase}.topbar{height:70px;display:flex;justify-content:space-between;align-items:center;padding:0 1.5rem;background:white;border-bottom:1px solid var(--line);gap:1rem}.topbar .right{display:flex;gap:.8rem;align-items:center}.tag{font-size:.75rem;padding:.25rem .5rem;background:#eaf0fb;color:#244bae;border-radius:4px;font-weight:600;display:inline-block}.shell{display:grid;grid-template-columns:245px minmax(320px,1fr) minmax(330px,390px);min-height:calc(100vh - 70px)}.sidebar{background:var(--navy);color:#e2ebfa;padding:1.5rem 1rem;max-height:calc(100vh - 70px);overflow:auto;position:sticky;top:0}.sidebar .eyebrow{color:#91a5c3;margin:0 .5rem 1rem}.sidebar input{background:#20334e;border:1px solid #3e506b;color:white;margin-bottom:1.1rem;font-size:.875rem}.sidebar input::placeholder{color:#aabbd0}.lab-link{display:flex;align-items:baseline;gap:.65rem;width:100%;text-align:left;border:0;background:none;color:#bdcbe0;border-radius:6px;margin:.2rem 0;padding:.7rem .6rem;font-weight:400;line-height:1.4}.lab-link span:first-child{font-family:monospace;color:#8ca0bf;font-size:.75rem}.lab-link:hover{background:#203b5c;color:white}.lab-link.active{background:#304a73;color:white;box-shadow:inset 3px 0 var(--cyan)}.lab-link.active span:first-child{color:var(--cyan)}.workspace{min-width:0;padding:1.7rem 2rem 4rem;background:white}.breadcrumb{display:flex;gap:.6rem;align-items:center;margin-bottom:1.2rem;font-size:.8rem;color:var(--muted)}.lab-heading{border-bottom:1px solid var(--line);padding-bottom:1.3rem;margin-bottom:1.5rem}.lab-heading h1{margin:.7rem 0 1rem}.section-control{max-width:100%;margin-top:1rem}.source-link{font-size:.875rem}.prose{line-height:1.8;overflow-wrap:anywhere}.prose h1{font-size:1.5rem}.prose h2{margin-top:2rem;padding-top:1rem;border-top:1px solid var(--line)}.prose h3{margin-top:1.8rem}.prose h4{margin:1.2rem 0 .6rem}.prose li{margin:.3rem 0}.prose blockquote{border-left:3px solid #a4bbec;margin-left:0;padding-left:1rem;color:var(--muted)}.prose table{display:block;max-width:100%;overflow:auto;border-collapse:collapse;font-size:.875rem}.prose th,.prose td{border:1px solid var(--line);padding:.6rem;text-align:left}.assistant-panel{border-left:1px solid var(--line);padding:1.3rem;display:flex;flex-direction:column;gap:1rem;max-height:calc(100vh - 70px);position:sticky;top:0;background:#f8faff;min-width:0}.assistant-head{display:flex;justify-content:space-between;align-items:center}.assistant-head h2{margin:0}.machine{border:1px solid #cbd8ef;border-radius:9px;padding:1rem;background:white}.machine .eyebrow{color:var(--muted);margin-bottom:.5rem}.machine-row{display:flex;justify-content:space-between;align-items:center;gap:.5rem}.machine strong{font-family:monospace;font-size:.9rem}.machine small{display:block;margin-top:.5rem}.machine button{font-size:.75rem;padding:.3rem .5rem}.mode-grid{display:grid;grid-template-columns:1fr 1fr;gap:.4rem}.mode-grid button[aria-pressed=true]{color:var(--blue);background:#e9efff;border-color:#a9bdef}.conversation{flex:1 1 0;overflow:auto;min-height:0;display:flex;flex-direction:column;gap:1rem;padding:.2rem}.empty-chat{margin:auto 0;padding:1rem .2rem}.empty-chat .icon{font-family:monospace;font-size:1.7rem;color:var(--blue);margin-bottom:1rem}.message{font-size:.925rem;line-height:1.65;overflow-wrap:anywhere}.message .role{font-size:.7rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;color:var(--muted);margin-bottom:.4rem}.message.user{background:#e9effc;border-radius:8px;padding:.8rem}.message.diagnostic{background:#eff4f5;border-radius:8px;padding:.8rem}.message p:last-child{margin:0}.message pre{font-size:.8rem}.chat-actions{display:flex;justify-content:space-between;align-items:center;margin-top:.6rem;gap:.5rem}.chat-actions small{font-size:.75rem}.assistant-footer{display:flex;gap:.5rem;border-top:1px solid var(--line);padding-top:.8rem;flex-wrap:wrap}.assistant-footer button{flex:1;font-size:.8rem}.banner{background:#fff4d7;border:1px solid #e5d297;padding:.7rem;border-radius:6px;font-size:.8rem;line-height:1.5}.login-page{min-height:100vh;display:grid;grid-template-columns:1fr 1fr}.login-context{background:var(--navy);color:white;padding:3rem;display:flex;flex-direction:column;justify-content:space-between}.login-context h1{font-size:3.2rem;max-width:500px;line-height:1.1;letter-spacing:-.06em}.login-context p{color:#bccce3;max-width:430px;line-height:1.8}.login-context .eyebrow{color:var(--cyan);margin-bottom:1.5rem}.login-panel{display:flex;align-items:center;justify-content:center;padding:2rem}.login-form{width:100%;max-width:380px}.login-form h2{font-size:1.7rem}.login-form input{margin:.3rem 0 1rem}.login-form button{width:100%;margin-bottom:1rem}.field-error{color:#a12836;min-height:1.5rem;font-size:.875rem}.admin{max-width:1300px;margin:auto;padding:2rem}.admin-heading{display:flex;justify-content:space-between;gap:1rem;align-items:center;margin-bottom:1.5rem}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:1rem;margin-bottom:1.5rem}.stat{background:white;border:1px solid var(--line);padding:1.2rem;border-radius:10px}.stat strong{font-size:2rem;display:block;margin-top:.4rem;letter-spacing:-.05em}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:1.5rem}.panel{background:white;border:1px solid var(--line);border-radius:10px;padding:1.5rem;min-width:0}.panel.full{grid-column:1/-1}.panel-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;gap:.5rem}.panel-title h2{margin:0}.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse}th{text-align:left;color:var(--muted);font-size:.75rem;letter-spacing:.06em;text-transform:uppercase;font-weight:600}td,th{padding:.85rem .5rem;border-bottom:1px solid var(--line);font-size:.875rem}td button{font-size:.75rem;padding:.3rem .5rem}.ticket{border:1px solid var(--line);padding:1rem;border-radius:8px;margin:.7rem 0}.ticket-header{display:flex;justify-content:space-between;gap:1rem;margin-bottom:.7rem}.ticket p{font-size:.9rem;line-height:1.6;margin-bottom:.7rem}.ticket summary{cursor:pointer;font-size:.85rem;color:var(--blue)}.ticket .transcript{max-height:300px;overflow:auto;margin-top:1rem}.ticket.resolved{opacity:.7}.empty{padding:1.5rem 0;color:var(--muted);line-height:1.7}.form-row{margin-bottom:1rem}.row{display:flex;gap:.6rem;align-items:center}.row>*{flex:1}.dialog-actions{display:flex;justify-content:flex-end;gap:.5rem;margin-top:1.5rem}dialog{border:1px solid var(--line);border-radius:12px;padding:1.8rem;width:min(540px,calc(100vw - 2rem));box-shadow:0 25px 100px #10223b44;color:#17243a}dialog::backdrop{background:#10223b88}dialog p{line-height:1.7}#notice{position:fixed;bottom:1rem;left:50%;transform:translateX(-50%);background:#10223b;color:white;box-shadow:0 5px 30px #0003;padding:1rem 1.4rem;border-radius:9px;z-index:100;max-width:90vw;font-size:.875rem}.loading{padding:3rem;text-align:center;color:var(--muted)}.pulse{color:var(--muted);font-size:.875rem}.hidden{display:none!important}button:focus-visible,a:focus-visible{outline:3px solid #61c6d6}.student-code{user-select:all;overflow-wrap:anywhere;background:#eaf0fb;padding:1rem;border-radius:7px;font-family:monospace}.notice-text{font-size:.85rem;line-height:1.6}.source-files{margin-top:1rem}.source-files a{display:block;font-size:.85rem;margin:.5rem 0}.refresh{white-space:nowrap}
@media(min-width:1600px){.shell{grid-template-columns:270px minmax(400px,1fr) 460px}.workspace{padding-left:3.5rem;padding-right:3.5rem}}
@media(max-width:1100px){.shell{grid-template-columns:195px minmax(280px,1fr) 330px}.workspace{padding:1.3rem}.sidebar{padding:1.2rem .6rem}.assistant-panel{padding:1rem}.topbar{padding:0 1rem}}
@media(max-width:900px){.shell{grid-template-columns:190px 1fr}.assistant-panel{grid-column:2;position:static;max-height:none;border-top:1px solid var(--line);min-height:600px}.workspace{grid-column:2}.sidebar{grid-row:1/3}.admin-grid{grid-template-columns:1fr}.login-context{padding:2rem}.login-context h1{font-size:2.5rem}}
@media(max-width:600px){.topbar{height:auto;min-height:65px;padding:.8rem;flex-wrap:wrap}.topbar .right{font-size:.8rem}.shell{display:block}.sidebar{position:static;max-height:230px;padding:1rem}.sidebar nav{display:flex;gap:.4rem;overflow:auto}.lab-link{min-width:175px;max-width:210px}.sidebar input{margin-bottom:.5rem}.sidebar .eyebrow{margin-bottom:.5rem}.workspace{padding:1.3rem}.assistant-panel{padding:1.3rem}.login-page{display:block}.login-context{padding:1.7rem;gap:2rem}.login-context h1{font-size:2rem;margin-bottom:.7rem}.login-context p{margin:0}.login-context>small{display:none}.login-panel{padding:2rem 1.5rem}.admin{padding:1rem}.admin-heading{align-items:flex-start}.stats{gap:.5rem}.stat{padding:.8rem}.stat small{font-size:.75rem}.stat strong{font-size:1.6rem}.panel{padding:1rem}.brand{font-size:.95rem}}

/* Keep the three desktop panes inside the viewport, with independent scrolling. */
.sidebar { min-width: 0; }
.lab-link { min-width: 0; }
.lab-link span:first-child { flex: 0 0 2rem; }
.lab-link span:last-child { min-width: 0; overflow-wrap: anywhere; }
.empty-chat { margin: 0; padding: .6rem .2rem; }
.empty-chat h3 { margin-bottom: .5rem; }
@media (min-width: 901px) {
  .shell { height: calc(100dvh - 70px); min-height: 0; overflow: hidden; }
  .sidebar, .workspace, .assistant-panel {
    position: static; height: 100%; max-height: none; min-height: 0;
    overflow-y: auto; overscroll-behavior-y: contain;
  }
  .sidebar { align-self: start; scrollbar-gutter: stable; }
  .assistant-panel { overflow: hidden; }
  .assistant-panel > :not(.conversation) { flex-shrink: 0; }
  .assistant-panel textarea { max-height: 180px; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .shell { grid-template-columns: 180px minmax(0, 1fr) 310px; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .sidebar { align-self: start; }
}

/* Panel layout is separate from message roles; only the thread scrolls. */
.conversation > * { flex: 0 0 auto; min-width: 0; }
.conversation-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .85rem; }
.conversation-heading button { padding: .3rem .5rem; font-size: .75rem; }
@media (min-width: 901px) {
  .assistant-panel { gap: .65rem; padding: 1rem; }
  .assistant-panel .machine { padding: .6rem .75rem; }
  .assistant-panel .machine .eyebrow { margin-bottom: .25rem; font-size: .65rem; }
  .assistant-panel .machine small { margin-top: .2rem; font-size: .75rem; }
  .assistant-panel .mode-grid button { padding: .45rem .5rem; }
  .assistant-panel textarea { height: 70px; min-height: 70px; max-height: 120px; }
  .assistant-footer { padding-top: .5rem; }
}
@media (max-width: 900px) {
  .assistant-panel { height: max(620px, calc(100dvh - 70px)); min-height: 0; overflow: hidden; }
}

.registration-panel { margin-bottom: 1.5rem; }
.registration-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.signup-label { margin-top: 1rem; }
.signup-saved { display: flex; align-items: center; gap: .6rem; margin: 1rem 0; }
.signup-saved input { width: auto; margin: 0; }

.assistant-panel > :not(.conversation) { flex-shrink: 0; }
.conversation { overscroll-behavior-y: contain; scrollbar-gutter: stable; }

.ssh-command { position: relative; margin: 1rem 0; }
.ssh-command pre { margin: 0; padding-top: 3rem; }
.ssh-command .code-copy { position: absolute; top: .4rem; right: .4rem; display: grid; place-items: center; padding: .4rem; color: #e2ecfa; background: #20334e; border-color: #58677c; }
.ssh-command .code-copy:hover { background: #304a73; }
