
:root{font-family:Inter,ui-sans-serif,system-ui,sans-serif;color:#1b2943;background:#f3f6fb}*{box-sizing:border-box}body{margin:0}button,input,textarea,select{font:inherit}button{cursor:pointer}button:disabled{opacity:.5;cursor:wait}.layout{display:grid;grid-template-columns:244px minmax(0,1fr);min-height:100vh}.side{background:#11213d;color:#d6e4f5;padding:26px 17px;display:flex;flex-direction:column;gap:9px}.logo{font-size:23px;font-weight:850;letter-spacing:-.7px;margin:0 12px 24px;color:#fff}.logo b{color:#70dcc7}.nav{border:0;text-align:left;color:#bfcde4;padding:13px;border-radius:12px;background:none}.nav.active,.nav:hover{color:white;background:#263c5f}.tag{background:#225b57;color:#c6fcef;padding:5px 9px;border-radius:50px;font-size:11px;font-weight:700;margin-left:8px}.grow{flex:1}.aside-note{color:#98aec9;font-size:12px;line-height:1.5;padding:12px}.main{padding:32px;max-width:1200px;width:100%;margin:auto}.top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:21px}h1{font-size:29px;letter-spacing:-.8px;margin:0 0 8px}h2{font-size:18px;margin:0 0 14px}p{line-height:1.6}.muted{color:#63738c}.eyebrow{font-size:12px;font-weight:800;letter-spacing:1.1px;color:#299684;text-transform:uppercase}.panel{background:#fff;border:1px solid #e0e7f1;border-radius:18px;padding:23px;box-shadow:0 4px 18px #233d6810}.grid{display:grid;grid-template-columns:1.5fr 1fr;gap:18px}.stack{display:grid;gap:18px}.btn{background:#167c70;border:1px solid #167c70;border-radius:10px;color:#fff;padding:11px 16px;font-weight:700}.btn.secondary{background:white;border-color:#d7dfeb;color:#263958}.btn:hover{filter:brightness(.96)}.field{border:1px solid #cbd6e5;background:#fff;border-radius:10px;padding:11px;width:100%;color:#1b2943}.label{font-size:13px;font-weight:700;color:#435570;margin:9px 0 6px;display:block}.hidden{display:none!important}.session-list{display:grid;gap:7px;max-height:410px;overflow:auto}.session{background:#f5f8fc;border:1px solid #e7ecf3;border-radius:10px;padding:11px;text-align:left;color:#263958}.session.selected{border-color:#167c70;background:#e9f7f3}.chat{height:min(57vh,530px);min-height:340px;overflow-y:auto;padding:16px;background:#f8fafd;border:1px solid #e7ecf4;border-radius:12px;display:flex;flex-direction:column;gap:14px}.bubble{max-width:88%;padding:13px 15px;border-radius:14px;white-space:pre-wrap;line-height:1.6;overflow-wrap:anywhere}.bubble.user{background:#dbf3ed;align-self:flex-end}.bubble.assistant{background:white;border:1px solid #dfe7ef;align-self:flex-start}.bubble.system{align-self:center;color:#65748b;background:#eaf0f7;font-size:13px}.tools{display:flex;gap:8px;flex-wrap:wrap;margin:14px 0}.compose{display:flex;gap:10px;align-items:flex-end}.compose textarea{min-height:74px;resize:vertical;flex:1}.small{font-size:12px;color:#62738e}.pill{display:inline-block;padding:5px 9px;background:#e6f5f1;color:#11675c;border-radius:999px;font-size:12px;font-weight:700}.record{border-left:3px solid #8fc5b7;padding:9px 14px;margin:9px 0;background:#f7fafc}.status{font-size:12px;font-weight:700}.ok{color:#168269}.bad{color:#b34b4b}.empty{padding:40px 20px;text-align:center;color:#64758c}.source{padding:11px 0;border-bottom:1px solid #e7ecf3}.bar{height:8px;border-radius:99px;background:#e9eff5;overflow:hidden}.bar span{height:100%;display:block;background:#168777}footer{font-size:12px;color:#8290a3;margin-top:18px}.link{color:#178576;text-decoration:underline}@media(max-width:880px){.layout{grid-template-columns:1fr}.side{padding:12px;flex-direction:row;flex-wrap:wrap;align-items:center}.logo{margin:3px 16px 3px 3px}.aside-note,.grow{display:none}.nav{padding:9px}.main{padding:20px}.grid{grid-template-columns:1fr}.chat{height:46vh}}

/* v2.1 responsive refinements */
html{scroll-behavior:smooth} .layout,.main,.panel,.grid,.stack{min-width:0}
.main{max-width:1440px}.grid{grid-template-columns:minmax(0,1.55fr) minmax(280px,1fr)}
.bubble{min-width:0}.bubble.assistant{white-space:pre-wrap}.bubble mjx-container[display="true"]{max-width:100%;overflow-x:auto;overflow-y:hidden;padding:4px 0}
.tools button{min-height:44px}.nav:focus-visible,.btn:focus-visible,.field:focus-visible,.session:focus-visible{outline:3px solid #59bfae;outline-offset:2px}
.error-card{align-self:stretch;padding:13px 15px;background:#fff4f2;border:1px solid #efc8c1;border-radius:12px;color:#7f3530;font-size:13px;line-height:1.5}
.error-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:8px}
.error-actions .btn{min-height:38px}.chat[aria-busy="true"]{cursor:progress}
#chatNotice{min-height:20px;margin:7px 0;color:#536780;font-size:13px}
@media(max-width:1080px){.layout{grid-template-columns:210px minmax(0,1fr)}.side{padding:20px 10px}.main{padding:20px}.grid{grid-template-columns:minmax(0,1fr)}.stack{grid-template-columns:repeat(2,minmax(0,1fr));align-items:start}.chat{height:min(54vh,560px)}}
@media(max-width:700px){.layout{display:block}.side{position:sticky;top:0;z-index:10;display:flex;flex-direction:row;flex-wrap:wrap;gap:4px;align-items:center;padding:9px 12px;box-shadow:0 4px 14px #11213d22}.logo{font-size:18px;width:100%;margin:0 0 3px}.tag{font-size:9px}.nav{font-size:12px;padding:9px 10px;flex:1;text-align:center;white-space:nowrap}.main{padding:14px 12px;max-width:100%}.top{align-items:flex-start;flex-wrap:wrap;margin-bottom:12px}h1{font-size:23px}.panel{padding:15px;border-radius:14px}.grid,.stack{display:grid;grid-template-columns:minmax(0,1fr);gap:12px}.chat{min-height:280px;height:clamp(300px,47dvh,520px);padding:10px;gap:10px}.bubble{max-width:96%;padding:11px 12px;font-size:14px}.tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin:10px 0}.tools button{padding:9px 6px;font-size:12px;line-height:1.3}.compose{gap:7px;align-items:stretch}.compose textarea{min-height:66px;font-size:16px}.compose .btn{align-self:flex-end;min-height:46px;padding:10px 12px}.session-list{max-height:260px}#status{font-size:11px;overflow-wrap:anywhere}}
@media(max-width:360px){.nav{font-size:11px;padding:7px 5px}.tools{grid-template-columns:1fr 1fr}.bubble{max-width:100%}}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
/* Rendered Markdown inside tutor bubbles */
.bubble.assistant{white-space:normal}
.bubble.assistant p{margin:0 0 .85em;line-height:1.65}
.bubble.assistant p:last-child{margin-bottom:0}
.bubble.assistant ul,.bubble.assistant ol{padding-left:1.55em;margin:.5em 0 1em}
.bubble.assistant li{margin:.3em 0;line-height:1.6}
.bubble.assistant li>p{margin:.2em 0}
.bubble.assistant strong{font-weight:750}
.bubble.assistant code{background:#f0f4f8;padding:.1em .35em;border-radius:4px;font-size:.91em;overflow-wrap:anywhere}
.bubble.assistant pre{background:#14243e;color:#eef5ff;border-radius:10px;padding:12px;overflow-x:auto;max-width:100%;white-space:pre}
.bubble.assistant pre code{background:transparent;padding:0;color:inherit;white-space:pre;overflow-wrap:normal}
.bubble.assistant blockquote{margin:.8em 0;padding:.2em .8em;border-left:3px solid #168777;background:#f6faf9}
.bubble.assistant blockquote p{margin:.2em 0}
.bubble.assistant a{color:#106d83;text-decoration:underline}
.bubble.assistant table{border-collapse:collapse;display:block;overflow-x:auto;max-width:100%;margin:.75em 0}
.bubble.assistant th,.bubble.assistant td{border:1px solid #d8e2ec;padding:6px 9px;text-align:left}
.bubble.assistant th{background:#edf5f4}
.bubble.assistant h1,.bubble.assistant h2,.bubble.assistant h3{font-size:1.05em;margin:1em 0 .4em}
.bubble.assistant mjx-container{max-width:100%;overflow-x:auto;overflow-y:hidden}
.evaluation-control{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin:12px 0}.evaluation-control button{flex-shrink:0}@media(max-width:600px){.evaluation-control{align-items:stretch;flex-direction:column}.evaluation-control button{width:100%}}

/* v2.3 adaptive assessment */
.diag-actions{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0}.diag-question{margin-top:15px;border:1px solid #d6e2ee;border-radius:14px;padding:18px;background:#f8fafc}.diag-question .pill{margin-bottom:10px}.diag-rich{line-height:1.7;overflow-wrap:anywhere}.diag-rich p{margin:.35em 0 1em}.diag-rich mjx-container{max-width:100%;overflow-x:auto}.diag-question textarea{margin:5px 0 12px}.diag-question #diagHint{margin-top:12px}.diag-feedback{margin-top:15px;line-height:1.65}.diag-feedback .record{border-color:#137d73}.diag-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.diag-metric{background:#f4f8fb;border-radius:10px;padding:14px;min-width:0}.diag-metric strong{font-size:23px;display:block}.diag-metric span{font-size:12px;color:#52657b}.diag-main{min-width:0}#diagNotice{margin:8px 0;min-height:16px}#diagHistory .record{font-size:13px}
@media(max-width:700px){.diag-actions{display:grid;grid-template-columns:1fr 1fr}.diag-actions .btn{padding:9px 7px;font-size:12px}.diag-question{padding:12px}.diag-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:370px){.diag-actions{grid-template-columns:1fr}}

.reference-toolbar{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin-top:10px}.reference-toolbar .field{width:min(390px,100%)}.reference-toolbar .label{margin:0}.reference-toolbar .small{flex-basis:100%}.reference-box{border:1px solid #dde8ee;border-radius:13px;margin:14px 0;padding:12px;background:#f7fafc;min-width:0}.message-references{margin-top:10px;border-top:1px solid #ddd;padding-top:8px;font-size:12px}.message-references summary{cursor:pointer;color:#137b70;font-weight:700}.reference-item{padding:10px;border-bottom:1px solid #dfe7ed;overflow-wrap:anywhere}.reference-item:last-child{border:0}.reference-item summary{cursor:pointer;font-weight:700}.reference-item .excerpt{white-space:pre-wrap;margin-top:6px;font-size:13px;line-height:1.5}.source-check{display:flex;align-items:center;gap:8px;padding:8px 2px;overflow-wrap:anywhere}.source-check input{width:18px;height:18px;flex-shrink:0}.source .small{overflow-wrap:anywhere}.source-tools{display:flex;gap:8px;flex-wrap:wrap}#uploadForm input[type=file]{max-width:100%}@media(max-width:700px){.reference-toolbar{align-items:stretch;flex-direction:column}.reference-toolbar .field{width:100%}.reference-toolbar .small{flex-basis:auto}.source-tools .btn{min-height:40px}}
.priority-select{width:auto;max-width:125px;margin-left:6px;padding:7px}.source-tools label{display:flex;align-items:center;gap:5px}@media(max-width:600px){.source-tools{flex-direction:column;align-items:flex-start}.source-tools .btn{width:100%}}
/* v2.5 browser voice interaction */
.voice-panel{border:1px solid #d6e6e2;background:linear-gradient(135deg,#f3fbf8,#f7faff);padding:12px 14px;border-radius:13px;margin:12px 0}
.voice-bar{display:flex;align-items:center;flex-wrap:wrap;gap:9px}
.voice-bar .btn{padding:9px 11px;min-height:42px}
.voice-bar label{display:flex;align-items:center;gap:7px;margin:0;font-size:13px;color:#354b61}
.voice-bar input[type=checkbox]{width:17px;height:17px;accent-color:#167c70}
.voice-settings{display:grid;grid-template-columns:minmax(100px,.8fr) minmax(135px,1.4fr) minmax(120px,.8fr);gap:10px;margin-top:10px}
.voice-settings .label{margin:0 0 4px}.voice-settings .field{padding:8px;min-width:0}
.voice-status{font-size:12px;color:#425971;margin:8px 0 0;min-height:18px;overflow-wrap:anywhere}
.voice-status.listening{color:#a33832;font-weight:700}
.voice-interim{font-size:13px;color:#566c85;font-style:italic;margin-top:6px;overflow-wrap:anywhere}
.voice-bubble-controls{display:flex;gap:7px;align-items:center;justify-content:flex-end;margin-top:8px;border-top:1px solid #e5ebf1;padding-top:7px}
.voice-bubble-controls button{font-size:12px;border:1px solid #cadbd7;border-radius:8px;background:#f8fcfa;color:#236b61;padding:5px 9px;min-height:32px}
.voice-bubble-controls button:hover{background:#e8f6f1}
.voice-diagnostic{display:flex;gap:9px;align-items:center;flex-wrap:wrap;margin:8px 0 12px}
.voice-diagnostic button{min-height:40px}
@media(max-width:700px){.voice-panel{padding:10px}.voice-bar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.voice-bar .btn{width:100%;min-width:0}.voice-bar label{grid-column:1/-1}.voice-settings{grid-template-columns:1fr 1fr}.voice-settings>div:nth-child(2){grid-column:1/-1;grid-row:2}.voice-bar label{font-size:12px}}
@media(max-width:390px){.voice-settings{grid-template-columns:1fr}.voice-settings>div:nth-child(2){grid-column:auto;grid-row:auto}}
.language-settings{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:10px}.language-settings .field{padding:9px}.language-settings .label{margin:0 0 4px}@media(max-width:540px){.language-settings{grid-template-columns:minmax(0,1fr)}}

/* v2.6 account gate: narrow-screen friendly */
#accountGate{position:fixed;inset:0;background:#f1f6fa;z-index:9999;display:flex;align-items:center;justify-content:center;padding:22px;overflow-y:auto}
#accountGate[hidden],#accountInfo[hidden],.account-field[hidden]{display:none!important}
.account-card{width:min(450px,100%);border:1px solid #d6e4eb;background:white;border-radius:20px;box-shadow:0 18px 65px #152f4522;padding:clamp(20px,5vw,32px)}
.account-card h2{font-size:24px;margin:7px 0 9px}.account-card .field{font-size:16px}
.account-card button{min-height:44px}.account-toggle{background:none;border:none;color:#156d70;text-decoration:underline;padding:8px 0;font-weight:700}
.account-toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:0 0 16px;padding:10px 13px;background:#eff8f6;border-radius:12px}
.account-toolbar button{margin-left:auto}.account-toolbar strong{overflow-wrap:anywhere}
@media(max-width:600px){.account-card{border-radius:14px}.account-toolbar{font-size:13px}}


/* v2.6.1 mobile-first navigation and native-safe surfaces */
html{font-size:16px}body{overflow-x:hidden}button,.nav,.home-tile{touch-action:manipulation}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid #12a99c;outline-offset:2px}
.main{padding-bottom:calc(28px + env(safe-area-inset-bottom,0px))}.side{z-index:12}.nav{display:flex;align-items:center;gap:12px;min-height:48px;font-weight:650}.nav-icon{font-size:20px;min-width:24px;text-align:center}.home-hero{display:flex;justify-content:space-between;align-items:center;gap:18px;background:linear-gradient(125deg,#153753,#11786d);border-radius:22px;padding:clamp(22px,4vw,44px);color:white;margin-bottom:20px}.home-hero h2{font-size:clamp(23px,3.5vw,36px);max-width:650px;line-height:1.2}.home-hero p{max-width:630px;color:#daeee9}.home-hero .eyebrow{color:#9de6d6}.home-hero .btn{background:#f5fffd;color:#124d48;border-color:#f5fffd}.hero-symbol{font-size:110px;opacity:.45}.home-tiles{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:20px}.home-tile{background:#fff;border:1px solid #dfebef;border-radius:17px;padding:19px;text-align:left;display:flex;flex-direction:column;gap:9px;color:#1b2943;min-height:150px}.home-tile:hover{border-color:#167c70;background:#f8fdfc}.home-tile span{font-size:27px;color:#167c70}.home-tile strong{font-size:16px}.home-tile small{color:#65748b;font-size:12px;line-height:1.45}.profile-card{max-width:680px}.profile-summary{display:flex;align-items:center;gap:14px;background:#f1f7f5;padding:16px;border-radius:13px;margin:18px 0 26px}.profile-avatar{width:48px;height:48px;border-radius:50%;background:#14796f;color:#fff;display:grid;place-items:center;font-size:22px}
@media(max-width:1050px){.home-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){
 body{padding:0}.layout{display:block}.side{position:fixed!important;top:auto!important;bottom:0;left:0;right:0;width:100%;height:calc(68px + env(safe-area-inset-bottom,0px));padding:4px 5px env(safe-area-inset-bottom,0px)!important;display:flex!important;flex-wrap:nowrap!important;justify-content:space-between;gap:1px;background:#fff;color:#45556d;border-top:1px solid #dce5ec;box-shadow:0 -4px 18px #142b411a}.side .logo,.side .grow,.side .aside-note{display:none!important}.side .nav{min-width:0;flex:1;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:2px;min-height:54px;padding:5px 1px;border-radius:10px;color:#52657b;font-size:10px;white-space:normal}.side .nav span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.side .nav-icon{font-size:21px;min-width:auto}.side .nav.active{background:#e3f4ef;color:#0d7267}.main{padding:16px 12px calc(90px + env(safe-area-inset-bottom,0px));max-width:100%;margin:0}.account-toolbar{margin-bottom:12px}.top{margin-bottom:13px}.top h1{font-size:23px}.home-hero{padding:20px;border-radius:16px}.home-hero h2{font-size:25px}.home-hero .hero-symbol{display:none}.home-tiles{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.home-tile{padding:13px;min-height:128px}.home-tile strong{font-size:14px}.home-tile small{font-size:11px}.chat{height:clamp(270px,45dvh,600px)}input,textarea,select{font-size:16px!important} .panel{padding:14px}#tutor .grid{display:flex;flex-direction:column}#tutor .grid>.panel{width:100%}#tutor .stack{width:100%}.compose{position:relative} .compose textarea{max-height:32dvh}.voice-panel{max-width:100%}
}
@media(max-width:360px){.side .nav{font-size:9px}.nav-icon{font-size:19px!important}.home-tiles{gap:7px}.home-tile{padding:10px}}
@media(min-width:701px) and (max-width:900px){.layout{grid-template-columns:180px minmax(0,1fr)}.side{flex-direction:column;flex-wrap:nowrap}.nav{font-size:13px}.logo{font-size:20px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important;animation:none!important}}


/* v2.6.2 - focused mobile tutoring experience.
   Keeps the desktop layout and all existing control IDs/handlers intact. */
:root{--cb-teal:#087f7b;--cb-ink:#12243d;--cb-tint:#ecfaf8}
@media(max-width:700px){
  body:has(#tutor:not(.hidden)){background:#f6fafc}
  body:has(#tutor:not(.hidden)) .top,
  body:has(#tutor:not(.hidden)) .account-toolbar,
  body:has(#tutor:not(.hidden)) footer{display:none!important}
  body:has(#tutor:not(.hidden)) .main{padding:0!important;max-width:none!important}
  #tutor>.grid{display:block!important;gap:0!important}
  #tutor>.grid>.panel:first-child{
    height:calc(var(--cb-viewport-height,100dvh) - 68px - env(safe-area-inset-bottom,0px));
    min-height:0;display:flex;flex-direction:column;overflow:hidden;
    background:#f8fbfe;border:0;box-shadow:none;border-radius:0;padding:0!important;
  }
  #tutor>.grid>.stack{display:none!important}
  #tutor #sessionHeader{padding:10px 18px 8px;background:#fff;border-bottom:1px solid #e7eef4;flex:none}
  #tutor #topicTitle{font-size:19px!important;line-height:1.28;margin:0;color:var(--cb-ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #tutor #topicDesc{display:none!important}
  #mobileTutorBar{display:flex;align-items:center;gap:8px;padding:12px 14px 4px;background:#fff;flex:none}
  #mobileTutorBar .cb-brand{font-size:15px;font-weight:850;color:#0e7772;letter-spacing:-.35px;flex:1}
  #mobileTutorBar .cb-brand strong{color:#162c4d}
  .cb-icon-btn{background:#edf8f7;border:1px solid #d8eeeb;border-radius:12px;color:#0a756d;min-width:42px;height:42px;display:grid;place-items:center;font-size:20px}
  .cb-icon-btn:focus-visible{outline:3px solid #12a99c;outline-offset:2px}
  .cb-progress{display:flex;align-items:center;gap:6px;margin:0 14px 2px;padding:7px 0;background:#fff;flex:none}
  .cb-progress span{flex:1;border-radius:100px;height:4px;background:#dbe9ed}
  .cb-progress span:first-child{background:linear-gradient(90deg,#19b8a1,#078c88)}
  .cb-progress small{font-size:11px;font-weight:750;color:#607788;margin-left:5px}
  #tutor #chat{flex:1;min-height:0!important;height:auto!important;max-height:none!important;overflow:auto;overscroll-behavior:contain;padding:17px 12px 18px;gap:14px;border:0;border-radius:0;background:#f8fbfe;scroll-padding-bottom:12px}
  #tutor .bubble{font-size:18px!important;line-height:1.6!important;max-width:94%;padding:14px 16px;border-radius:18px;box-shadow:0 2px 9px #2c587909}
  #tutor .bubble.user{background:#dff6ef;border-radius:18px 18px 4px 18px;max-width:89%;color:#143c3b}
  #tutor .bubble.assistant{background:#fff;border:1px solid #e1eaf2;border-radius:18px 18px 18px 4px}
  #tutor .bubble.system{font-size:14px!important;border-radius:12px;max-width:95%}
  #tutor .bubble.assistant p{line-height:1.65}
  #tutor .bubble mjx-container{font-size:1.04em!important;max-width:100%;overflow-x:auto;overflow-y:hidden}
  #tutor .tools{display:flex!important;gap:8px;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0!important;padding:9px 12px 5px;background:#fff;flex:none;border-top:1px solid #edf0f4;grid-template-columns:none!important}
  #tutor .tools::-webkit-scrollbar{display:none}
  #tutor .tools [data-mode]{flex:0 0 auto;min-height:36px!important;border:1px solid #d9e8e8!important;border-radius:999px!important;padding:7px 12px!important;background:#f4f9f9;color:#226b68;font-size:13px!important;white-space:nowrap;line-height:1.3!important}
  #tutor .tools [data-mode][aria-pressed="true"]{background:#ddf6f0!important;border-color:#0b8e82!important;color:#075e56!important}
  #tutor #chatForm{display:flex;align-items:flex-end;gap:8px;background:#fff;padding:7px 12px 5px;margin:0;flex:none;position:static}
  #tutor #message{height:49px;min-height:49px!important;max-height:min(130px,23dvh)!important;resize:none;line-height:1.4;border-radius:16px;background:#f6fafc;padding:11px 12px;font-size:16px!important;flex:1;min-width:0}
  #tutor #send{height:48px;min-height:48px;border-radius:14px;padding:0 16px;background:linear-gradient(135deg,#08a7a0,#087c78);border:0;color:white;flex:none}
  #tutor #chatNotice{margin:0!important;padding:0 14px;font-size:12px;min-height:0!important;max-height:36px;overflow:auto;background:#fff;flex:none}
  #tutor .compose~.small, #tutor #insight, #tutor #chatSources{display:none!important}
  #tutor .reference-toolbar,#tutor .evaluation-control,#tutor .voice-panel{display:none!important}
  #tutor .cb-mobile-slot .reference-toolbar{display:flex!important}
  #tutor .cb-mobile-slot .evaluation-control{display:flex!important}
  #tutor .cb-mobile-slot .voice-panel{display:block!important}
  .cb-mobile-sheet[hidden]{display:none!important}
  .cb-mobile-sheet{position:fixed;inset:0;z-index:1000;display:flex;align-items:flex-end;justify-content:center}
  .cb-sheet-backdrop{position:absolute;inset:0;background:#0a233b88;border:0;width:100%;height:100%}
  .cb-sheet-panel{position:relative;width:100%;max-height:min(78dvh,730px);overflow:auto;overscroll-behavior:contain;border-radius:24px 24px 0 0;background:#fff;padding:16px 16px calc(24px + env(safe-area-inset-bottom,0px));box-shadow:0 -10px 40px #0c30413b}
  .cb-sheet-head{display:flex;align-items:center;justify-content:space-between;gap:10px;border-bottom:1px solid #e7eef4;padding-bottom:10px;margin-bottom:12px}
  .cb-sheet-head h2{margin:0;font-size:20px}
  .cb-sheet-panel .panel{padding:12px;margin-bottom:10px;box-shadow:none}
  .cb-sheet-panel .stack{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
  .cb-sheet-panel .reference-toolbar,.cb-sheet-panel .evaluation-control{display:flex!important}
  .cb-sheet-panel .voice-panel{display:block!important}
  .cb-sheet-panel .voice-settings{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .cb-sheet-panel input,.cb-sheet-panel select,.cb-sheet-panel textarea{font-size:16px!important}
  body.cb-sheet-open{overflow:hidden}
  body.cb-keyboard-open #tutor>.grid>.panel:first-child{height:var(--cb-viewport-height,100dvh)}
  body.cb-keyboard-open .side{display:none!important}
  body.cb-keyboard-open #tutor .tools{padding-top:4px}
}
@media(max-width:375px){#tutor .bubble{font-size:17px!important}#tutor .tools [data-mode]{font-size:12px!important;padding:7px 10px!important}}
@media(min-width:701px){#mobileTutorBar,.cb-progress,.cb-mobile-sheet{display:none!important}}

/* v2.6.3: conversation and input stay together on desktop too.
   Settings are disclosed on demand; all original controls/IDs remain intact. */
@media (min-width:701px) {
  #tutor > .grid { align-items:stretch; }
  #tutor > .grid > .panel:first-child {
    display:flex;flex-direction:column;position:relative;min-width:0;
    height:clamp(520px,calc(100dvh - 205px),980px);
    overflow:visible;
  }
  #tutor #sessionHeader {order:0;flex:none;}
  #tutor #chat {
    order:1; flex:1 1 auto; min-height:0;max-height:none;height:auto;
    overflow-y:auto;overscroll-behavior:contain;
    scroll-padding-bottom:16px;
  }
  #tutor .tools {order:2;flex:none;margin:10px 0 7px;}
  #tutor #chatForm {order:3;flex:none;align-items:flex-end;margin:0;}
  #tutor #message {min-height:68px;max-height:160px;resize:vertical;}
  #tutor #chatNotice {order:4;flex:none;}
  #tutor .cb-desktop-settings {
    order:5;flex:none;align-self:flex-start;margin-top:5px;
    max-width:100%;
  }
  #tutor .cb-desktop-settings > summary {
    list-style:none;cursor:pointer;color:#126e69;font-weight:700;
    border-radius:9px;padding:9px 11px;font-size:13px;
    border:1px solid #d7e8e4;background:#f2faf8;
  }
  #tutor .cb-desktop-settings > summary::-webkit-details-marker {display:none;}
  #tutor .cb-desktop-settings > summary:focus-visible {outline:3px solid #12a99c;outline-offset:2px;}
  #tutor .cb-desktop-settings-body {
    position:absolute;bottom:55px;left:clamp(14px,3vw,24px);
    width:min(615px,calc(100% - 28px));
    max-height:min(65dvh,580px);overflow:auto;overscroll-behavior:contain;
    background:white;border:1px solid #cadfdb;box-shadow:0 16px 48px #15384c35;
    border-radius:15px;padding:16px;z-index:20;
  }
  #tutor .cb-desktop-settings-body .reference-toolbar,
  #tutor .cb-desktop-settings-body .evaluation-control,
  #tutor .cb-desktop-settings-body .voice-panel {margin:0 0 12px;}
  #tutor .compose ~ .small {order:6;flex:none;margin-top:8px;}
  #tutor #insight {order:7;flex:none;}
  #tutor #chatSources {order:8;flex:none;max-height:100px;overflow:auto;}
  #tutor .stack {min-height:0;}
}
@media (max-width:700px) {
  #tutor .cb-desktop-settings > summary {display:none!important;}
  #tutor .cb-desktop-settings {display:contents;}
  #tutor .cb-desktop-settings-body {display:contents;}
}


/* v2.6.4: unified voice composer on desktop and mobile */
.cb-visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
#tutor #chatForm.cb-composer{width:100%;display:block;min-width:0;padding:9px 0 0;background:transparent;flex:none}
#tutor .cb-composer-shell{display:flex;flex-direction:column;width:100%;min-width:0;background:#fff;border:1.5px solid #c9dadf;border-radius:22px;padding:12px 13px 9px;box-shadow:0 3px 14px #17465810;transition:border-color .15s,box-shadow .15s}
#tutor .cb-composer-shell:focus-within{border-color:#108b81;box-shadow:0 0 0 3px #16a79920}
#tutor #message{width:100%;height:auto;min-height:51px!important;max-height:min(180px,32dvh)!important;padding:2px 3px 8px!important;background:transparent!important;border:0!important;outline:none!important;box-shadow:none!important;border-radius:0!important;resize:vertical;font-size:16px!important;line-height:1.55;flex:auto}
#tutor .cb-composer-bottom{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:43px}
#tutor .cb-composer-actions{display:flex;align-items:center;gap:8px;margin-left:auto;flex:none}
#tutor .cb-composer-icon,#tutor .cb-composer-send{display:grid;place-items:center;width:43px;height:43px;min-width:43px;min-height:43px!important;border-radius:14px;padding:0!important;line-height:1;font-size:20px}
#tutor .cb-composer-icon{background:#ecf7f5;border:1px solid #cde4df;color:#08756d;cursor:pointer}
#tutor .cb-composer-icon:hover{background:#dff3ee}
#tutor .cb-composer-icon.is-listening{background:#fff0ed;border-color:#dd968b;color:#ac302e;animation:cb-mic-pulse 1.6s infinite}
#tutor .cb-composer-icon:disabled{opacity:.4;cursor:not-allowed;animation:none}
#tutor .cb-composer-send{border:0;color:#fff;background:linear-gradient(135deg,#079e96,#087770);font-size:21px}
#tutor .cb-dictation-state{min-width:0;flex:1;color:#5a7085;font-size:12px;line-height:1.35;overflow-wrap:anywhere}
#tutor .cb-dictation-state.listening{color:#ae3632;font-weight:700}
@keyframes cb-mic-pulse{50%{box-shadow:0 0 0 7px #e6705825}}
@media(prefers-reduced-motion:reduce){#tutor .cb-composer-icon.is-listening{animation:none}}
@media(max-width:700px){
 #tutor #chatForm.cb-composer{padding:6px 11px 8px!important;background:#fff!important}
 #tutor .cb-composer-shell{border-radius:19px;padding:9px 10px 7px}
 #tutor #message{min-height:44px!important;max-height:min(135px,24dvh)!important;font-size:18px!important;resize:none}
 #tutor .cb-composer-bottom{min-height:41px}
 #tutor .cb-composer-icon,#tutor .cb-composer-send{width:42px;height:42px;min-width:42px;min-height:42px!important;border-radius:13px}
 #tutor .cb-dictation-state{font-size:11px}
}

/* v2.6.4.1: microphone is strictly icon-only, including on narrow phones.
   The accessible name and tooltip remain in voice.js / index.html. */
#tutor #voiceMic.cb-composer-icon {
  display:grid!important;place-items:center!important;flex:0 0 42px!important;
  width:42px!important;max-width:42px!important;min-width:42px!important;
  height:42px!important;min-height:42px!important;max-height:42px!important;
  padding:0!important;overflow:hidden!important;white-space:nowrap!important;
  font-size:0!important;line-height:0!important;text-indent:0!important;
}
#tutor #voiceMic.cb-composer-icon::before {
  content:"🎙";display:block;font-size:22px;line-height:1;text-align:center;
}
#tutor #voiceMic.cb-composer-icon.is-listening::before {content:"■";font-size:20px;}
#tutor .cb-composer-actions {flex-shrink:0;min-width:max-content;}
#tutor .cb-dictation-state {font-size:12px;line-height:1.35;}
@media(max-width:700px){
 #tutor #voiceMic.cb-composer-icon{flex-basis:42px!important;}
 #tutor .cb-composer-shell{min-width:0;}
}


/* v2.7.1 — Desktop conversation-first layout.
   Deliberately scoped to wide screens; Android/mobile layout stays untouched.
   Chat remains scrollable and the composer remains immediately below the chat. */
@media (min-width: 1081px) {
  .main { max-width: 1800px; padding: 22px clamp(18px, 2.2vw, 34px); }
  #tutor > .grid {
    grid-template-columns: minmax(0, 1fr) clamp(245px, 19vw, 310px);
    gap: 16px;
    align-items: start;
  }
  #tutor > .grid > .panel:first-child {
    height: max(735px, calc(100dvh - 170px));
    padding: 19px;
    min-width: 0;
  }
  #tutor #chat {
    min-height: 385px;
    flex: 1 1 auto;
    padding: 18px;
    font-size: 16px;
  }
  #tutor .bubble { max-width: 92%; }
  #tutor .stack { align-content: start; gap: 12px; }
  #tutor .stack > .panel { padding: 17px; }
  #tutor .stack .session-list {
    max-height: min(48dvh, 520px);
    overflow-y: auto;
  }
  #tutor #chatSources { max-height: 58px; }
  #tutor #sessionHeader h2 { margin-bottom: 4px; }
  #tutor .tools { margin: 8px 0 3px; }
  #tutor #chatNotice { min-height: 0; margin: 3px 0; }
}
/* Keep a comfortably sized chat on narrower desktop/laptop windows too. */
@media (min-width: 701px) and (max-width: 1080px) {
  #tutor > .grid > .panel:first-child {
    height: max(730px, calc(100dvh - 155px));
  }
  #tutor #chat { min-height: 380px; }
}


/* v2.7.2 — desktop account dock, a compact alternative to the former top toolbar.
   Existing mobile bottom navigation and Account screen are intentionally untouched. */
.side-account[hidden], .side-account-menu[hidden] { display: none !important; }
@media (min-width: 701px) {
  .side { position: sticky; top: 0; height: 100dvh; min-height: 560px; overflow: visible; }
  .side-account { position: relative; flex-shrink: 0; margin-top: 6px; }
  .side-account-trigger {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 9px; background: transparent; border: 1px solid transparent;
    border-radius: 13px; color: #f3fbff; text-align: left;
  }
  .side-account-trigger:hover, .side-account-trigger[aria-expanded="true"] {
    background: #263c5f; border-color: #38506d;
  }
  .side-account-trigger:focus-visible, .side-account-menu button:focus-visible {
    outline: 3px solid #70dcc7; outline-offset: 2px;
  }
  .side-account-avatar {
    display: grid; place-items: center; width: 37px; height: 37px;
    flex: 0 0 37px; border-radius: 50%; background: #118c79;
    color: #fff; font-weight: 800; font-size: 13px;
  }
  .side-account-copy { display: flex; flex: 1; flex-direction: column; gap: 2px; min-width: 0; }
  .side-account-copy strong { font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-account-copy small { font-size: 10px; color: #a7bad1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-account-chevron { width: 17px; height: 17px; flex: 0 0 17px; color: #9cb1cc; }
  .side-account-menu {
    position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 40;
    width: max(100%, 225px); max-width: min(280px, calc(100vw - 24px));
    padding: 8px; background: #fff; color: #1b2943; border: 1px solid #d9e4ee;
    border-radius: 14px; box-shadow: 0 14px 35px #0816274d;
  }
  .side-account-menu-heading {
    padding: 9px 12px; margin-bottom: 4px; color: #63738c;
    font-size: 11px; overflow-wrap: anywhere; border-bottom: 1px solid #edf0f5;
  }
  .side-account-menu button {
    width: 100%; display: flex; align-items: center; gap: 11px;
    padding: 12px 11px; border-radius: 9px; border: 0;
    background: transparent; color: #233651; text-align: left; font-size: 13px;
  }
  .side-account-menu button:hover { background: #eef6f4; }
  .side-account-menu button svg { width: 18px; height: 18px; flex-shrink: 0; }
  .side-account-menu #accountLogout { color: #a13a42; }
  /* The Account screen remains accessible from the dock; avoid duplicate desktop navigation. */
  .side > .nav[data-tab="profile"] { display: none; }
  .aside-note { padding-top: 4px; }
}
@media (max-width: 700px) {
  .side-account { display: none !important; }
}

/* v2.7.4.1 - dismissible desktop settings popover */
@media (min-width:701px) {
  #tutor .cb-settings-popover-header {
    position:sticky;top:-16px;z-index:2;display:flex;align-items:center;
    justify-content:space-between;gap:12px;min-height:52px;
    padding:8px 0 10px;margin:0 0 12px;
    background:#fff;border-bottom:1px solid #e2ebef;
    font-weight:700;color:#11213d;
  }
  #tutor .cb-settings-close {
    appearance:none;border:1px solid #cde5e0;background:#eff9f7;color:#07685f;
    display:grid;place-items:center;flex:none;cursor:pointer;
    width:40px;height:40px;border-radius:12px;font-size:27px;line-height:1;
  }
  #tutor .cb-settings-close:hover {background:#dff3ef;}
  #tutor .cb-settings-close:focus-visible {outline:3px solid #0f9d90;outline-offset:2px;}
}
@media (max-width:700px) {#tutor .cb-settings-popover-header {display:none!important;}}

/* v2.7.4.2 — shared brand, anchored tutor settings, no chat obstruction */
.cb-brand-icon{display:block;flex:none;width:36px;height:36px;border-radius:10px}
.cb-brand-wordmark{min-width:0;white-space:nowrap}
.cb-signin-brand{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.cb-signin-brand img{display:block;flex:none;border-radius:12px}
@media(min-width:701px){
 .side .logo{display:flex;align-items:center;gap:9px;margin-left:7px;margin-right:0;flex-wrap:wrap}
 .side .logo .tag{margin-left:0}
 #tutor .cb-desktop-settings-body{
    position:fixed;top:var(--cb-settings-top,100px);left:var(--cb-settings-left,auto);
    bottom:auto;right:auto;width:var(--cb-settings-width,365px);max-width:calc(100vw - 24px);
    max-height:var(--cb-settings-max-height, min(66dvh,580px));
    overflow:auto;border-radius:15px;padding:14px;z-index:90;
    box-shadow:0 14px 42px rgba(17,33,61,.20);
 }
 #tutor .cb-desktop-settings:not([open])>.cb-desktop-settings-body{display:none}
 #tutor .cb-desktop-settings-body .voice-settings{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 #tutor .cb-desktop-settings-body .language-settings{grid-template-columns:minmax(0,1fr)}
 #tutor .cb-desktop-settings-body .reference-toolbar .field{max-width:100%}
 #tutor .cb-desktop-settings-body .voice-bar{display:flex;flex-wrap:wrap}
 #tutor .cb-desktop-settings-body .voice-bar .btn{max-width:100%}
 #tutor .cb-desktop-settings-body .voice-settings>*{min-width:0}
 #tutor .cb-desktop-settings-body select{min-width:0;max-width:100%}
 #tutor .cb-desktop-settings > summary[aria-expanded="true"]{background:#e1f3ee;border-color:#9ad7c9}
}
@media(min-width:701px) and (max-width:940px){.side .logo{gap:5px}.cb-brand-icon{width:30px;height:30px}.side .logo .tag{font-size:9px}}

/* Visible logo in the mobile tutor bar, including Capacitor Android. */
#mobileTutorBar .cb-brand{display:flex;align-items:center;gap:6px;min-width:0}
#mobileTutorBar .cb-brand img{flex:none;width:30px;height:30px;border-radius:9px}
@media(max-width:390px){#mobileTutorBar .cb-brand img{width:26px;height:26px}}

/* v2.7.5 image attachments, compact on Android and desktop */
.cb-composer-shell{position:relative}
.cb-image-preview[hidden]{display:none!important}
.cb-image-preview{display:flex;align-items:center;gap:10px;padding:9px 12px;margin:7px 0;border:1px solid #cbe3dd;border-radius:12px;background:#f5fcfa;font-size:13px;color:#25465b}
.cb-image-preview img{width:68px;height:58px;object-fit:contain;background:#fff;border-radius:8px;border:1px solid #dae6e4}
.cb-image-preview span{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cb-image-preview button{border:0;background:#e4f2ef;color:#14655c;border-radius:8px;width:36px;height:36px;font-size:24px;cursor:pointer}
.cb-chat-image{display:block;max-width:min(320px,100%);max-height:240px;object-fit:contain;border-radius:10px;margin:0 0 9px;background:#f7fafb}
#cbImageUpload,#cbImageCamera{font-size:21px;flex:0 0 auto}
@media(max-width:700px){.cb-image-preview img{width:56px;height:52px}.cb-chat-image{max-width:100%;max-height:230px}#cbImageUpload,#cbImageCamera{font-size:19px}}


/* v2.7.7 — compact, auto-expanding tutor composer */
.cb-progress { display: none !important; }
#tutor #chatForm.cb-composer { min-width:0; flex:0 0 auto; }
#tutor .cb-composer-shell { min-width:0; width:100%; }
#tutor #message.field {
  box-sizing:border-box; width:100%; min-width:0; height:50px !important;
  min-height:50px !important; max-height:min(230px,34dvh) !important;
  resize:none !important; overflow-y:hidden; overflow-x:hidden;
  padding:6px 3px !important; line-height:1.5;
  flex:0 0 auto; display:block;
}
#tutor #message.field.cb-overflow { overflow-y:auto !important; overscroll-behavior:contain; }
#tutor .cb-composer-bottom { min-width:0; }
#tutor .cb-composer-actions { min-width:0; }
@media(max-width:700px) {
  #tutor #chatForm.cb-composer { padding:6px 10px 7px !important; }
  #tutor .cb-composer-shell { padding:8px 10px 6px; }
  #tutor #message.field { min-height:50px !important; max-height:min(200px,34dvh) !important; font-size:16px !important; }
}
