/* SA2 v5.1.0 Adaptive multimodal learning layer */
:root{--kb-ai:#5b3cc4;--kb-ai-soft:#f4f1ff;--kb-skill:#0e6b63;--kb-skill-soft:#eefaf8}
.kb-mm-backdrop{position:fixed;inset:0;background:rgba(5,20,42,.38);z-index:150;opacity:0;pointer-events:none;transition:.18s}
.kb-mm-backdrop.open{opacity:1;pointer-events:auto}
.kb-mm-panel{position:fixed;top:0;right:0;bottom:0;width:min(650px,96vw);background:#fff;z-index:160;box-shadow:-18px 0 55px rgba(5,31,64,.22);transform:translateX(104%);transition:.22s ease;display:flex;flex-direction:column}
.kb-mm-panel.open{transform:translateX(0)}
.kb-mm-head{padding:14px 18px;background:#082b57;color:#fff;display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.kb-mm-head h2{margin:0;font-size:20px;color:#fff}.kb-mm-head p{margin:4px 0 0;color:#dbe8f5;font-size:12px}.kb-mm-close{border:1px solid rgba(255,255,255,.35);background:transparent;color:white;border-radius:8px;padding:5px 9px;font-weight:800}
.kb-mm-tabs{display:flex;gap:6px;padding:9px 12px;border-bottom:1px solid #dce4ee;overflow-x:auto}.kb-mm-tab{border:1px solid #cad7e5;background:#fff;color:#173b63;border-radius:999px;padding:6px 10px;white-space:nowrap;font-size:11px;font-weight:800}.kb-mm-tab.active{background:#0d477d;color:#fff;border-color:#0d477d}
.kb-mm-body{padding:15px 17px 92px;overflow:auto;flex:1}.kb-mm-card{border:1px solid #dbe4ef;border-radius:13px;padding:13px;margin-bottom:11px;background:#fff}.kb-mm-card.soft{background:#f7fafc}.kb-mm-card.ai{background:var(--kb-ai-soft);border-color:#d8d0ff}.kb-mm-card.skill{background:var(--kb-skill-soft);border-color:#bfe4df}.kb-mm-card h3{margin:0 0 7px;color:#082b57;font-size:16px}.kb-mm-card p{margin:6px 0;line-height:1.55}.kb-mm-note{font-size:11px;color:#64748b;line-height:1.45}.kb-mm-kicker{font-size:9.5px;text-transform:uppercase;letter-spacing:.1em;font-weight:900;color:#6b7b8e;margin-bottom:4px}
.kb-mm-actions{display:flex;gap:7px;flex-wrap:wrap;margin-top:9px}.kb-mm-actions button,.kb-mm-btn{border:1px solid #cbd7e5;background:#fff;color:#123a65;border-radius:9px;padding:7px 10px;font-weight:800;font-size:11px}.kb-mm-actions button.primary,.kb-mm-btn.primary{background:#0d477d;color:#fff;border-color:#0d477d}.kb-mm-actions button.ai,.kb-mm-btn.ai{background:var(--kb-ai);color:#fff;border-color:var(--kb-ai)}.kb-mm-actions button.skill,.kb-mm-btn.skill{background:var(--kb-skill);color:#fff;border-color:var(--kb-skill)}
.kb-skill-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.kb-skill-card{border:1px solid #d8e2ed;border-radius:12px;padding:12px;background:#fff}.kb-skill-card b{display:block;color:#082b57;margin-bottom:5px}.kb-skill-card span{font-size:11px;color:#58687a}
.kb-read-passage{border-left:4px solid #c59d2a;background:#fffdf4;padding:12px 13px;border-radius:7px;line-height:1.65;margin:8px 0}.kb-read-passage.mark-reading{box-shadow:0 0 0 3px rgba(197,157,42,.17)}
.kb-mm-textarea,.kb-mm-input,.kb-mm-select{width:100%;box-sizing:border-box;border:1px solid #c9d5e3;border-radius:9px;padding:9px 10px;font:inherit;background:#fff}.kb-mm-textarea{min-height:92px;resize:vertical}.kb-mm-row{display:grid;grid-template-columns:1fr 1fr;gap:9px}.kb-mm-meter{height:9px;border-radius:999px;background:#e7edf4;overflow:hidden;margin:5px 0 3px}.kb-mm-meter>span{display:block;height:100%;background:#0d6d62;border-radius:inherit}.kb-mm-score{font-size:25px;font-weight:900;color:#082b57}.kb-mm-chip{display:inline-block;border:1px solid #d2dce8;border-radius:999px;padding:3px 7px;margin:2px;font-size:10px;background:#fff}.kb-mm-chip.warn{border-color:#e7c15e;background:#fff8df}.kb-mm-chip.good{border-color:#89c9a2;background:#f0fbf4}
.kb-chat{display:flex;flex-direction:column;gap:8px;max-height:42vh;overflow:auto;padding:3px}.kb-chat-bubble{max-width:88%;padding:9px 11px;border-radius:12px;font-size:12px;line-height:1.55}.kb-chat-bubble.user{align-self:flex-end;background:#0d477d;color:#fff;border-bottom-right-radius:3px}.kb-chat-bubble.tutor{align-self:flex-start;background:#f1efff;color:#27214c;border:1px solid #ddd6ff;border-bottom-left-radius:3px}.kb-tutor-composer{position:sticky;bottom:0;background:#fff;padding:10px 0 2px;border-top:1px solid #e3e9f0;margin-top:10px}.kb-tutor-compose-row{display:grid;grid-template-columns:1fr auto auto;gap:6px}.kb-tutor-quick{display:flex;gap:5px;overflow-x:auto;padding-bottom:6px}.kb-tutor-quick button{white-space:nowrap;border:1px solid #d7cffd;background:#f8f6ff;color:#49358f;border-radius:999px;padding:5px 8px;font-size:10px;font-weight:800}
.kb-rec-state{display:flex;align-items:center;gap:7px;font-size:11px;margin-top:7px}.kb-rec-dot{width:9px;height:9px;border-radius:50%;background:#94a3b8}.kb-rec-dot.live{background:#dc2626;box-shadow:0 0 0 5px rgba(220,38,38,.12)}
.kb-assess-result{border-top:1px solid #dce4ed;margin-top:10px;padding-top:10px}.kb-rubric-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.kb-rubric-item{border:1px solid #dde5ef;border-radius:9px;padding:8px;background:#fff}.kb-rubric-item strong{display:block;font-size:17px;color:#082b57}.kb-rubric-item span{font-size:10px;color:#64748b}
.kb-adaptive-reason{border-left:4px solid var(--kb-ai);padding:8px 10px;background:#f8f6ff;border-radius:7px;margin:8px 0}.kb-practice-q{border:1px solid #ddd6ff;border-radius:10px;padding:10px;margin:8px 0;background:#fff}.kb-practice-q button{display:block;width:100%;text-align:left;border:1px solid #d9e0ea;background:#fff;border-radius:8px;padding:7px 8px;margin:5px 0}.kb-practice-q button.correct{border-color:#6ab883;background:#eefaf2}.kb-practice-q button.wrong{border-color:#df8d8d;background:#fff2f2}
.kb-report-guard{border:1px solid #b9dfcf;background:#f2fbf6;border-radius:10px;padding:10px;margin-top:9px;font-size:11px}.kb-report-guard.changed{border-color:#e8c86a;background:#fff9e8}.kb-report-guard strong{color:#0a4e3d}
.kb-confirm-backdrop{position:fixed;inset:0;z-index:250;background:rgba(5,20,42,.55);display:none;align-items:center;justify-content:center;padding:15px}.kb-confirm-backdrop.open{display:flex}.kb-confirm-card{width:min(520px,96vw);background:#fff;border-radius:15px;box-shadow:0 24px 80px rgba(0,0,0,.28);padding:18px}.kb-confirm-card h3{margin:0 0 8px;color:#082b57}.kb-confirm-changes{max-height:180px;overflow:auto;background:#f7fafc;border-radius:9px;padding:9px;margin:9px 0;font-size:11px}

.kb-voice-pref{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:10px;padding-top:10px;border-top:1px solid #d9d2f6}.kb-voice-pref strong{display:block;color:#2d255d;font-size:12px}.kb-voice-pref span{display:block;font-size:10.5px;color:#6c6684;margin-top:2px}.kb-voice-toggle{display:inline-flex;align-items:center;gap:6px;border:1px solid #c5bddf;background:#fff;color:#4b3e82;border-radius:999px;padding:6px 10px;font-weight:900;min-width:72px;justify-content:center;cursor:pointer}.kb-voice-toggle.on{background:#4f3bb5;color:#fff;border-color:#4f3bb5}.kb-voice-toggle span{margin:0;color:inherit;font-size:11px}.kb-speak-btn{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}

@media(max-width:760px){.kb-mm-panel{width:100vw}.kb-mm-head{padding:11px 12px}.kb-mm-body{padding:12px 12px 88px}.kb-skill-grid,.kb-mm-row,.kb-rubric-grid{grid-template-columns:1fr}.kb-mm-tabs{padding:7px 9px}.kb-tutor-compose-row{grid-template-columns:1fr auto auto}.kb-chat{max-height:36vh}}

@media(max-width:520px){.kb-tutor-compose-row{grid-template-columns:1fr auto}.kb-tutor-compose-row #kbTutorSend{grid-column:auto}.kb-speak-btn span{display:none}.kb-voice-pref{align-items:flex-start}}
.kb-ai-engine-note{margin-top:8px;padding:7px 9px;border-radius:10px;background:#f8f6ff;border:1px solid #ddd7ff;color:#5b4f88;font-size:10.5px;font-weight:750;line-height:1.35}

/* v5.5.6 Tutor readability */
.kb-chat-bubble.tutor{max-width:94%;padding:12px 13px;background:#f7f5ff;color:#252043;border-color:#ddd6ff;font-size:13px;line-height:1.5}
.kb-tutor-answer{display:grid;gap:7px}
.kb-tutor-answer p{margin:0;line-height:1.52}
.kb-tutor-heading{margin-top:5px;padding:6px 8px;border-radius:8px;background:#ebe7ff;color:#2d2363;font-weight:900;font-size:12px;letter-spacing:.01em}
.kb-tutor-answer .kb-tutor-heading:first-child{margin-top:0}
.kb-tutor-list{margin:0;padding-left:20px;display:grid;gap:4px}
.kb-tutor-list li{padding-left:1px}
@media(max-width:760px){.kb-chat-bubble.tutor{font-size:13px;max-width:96%}.kb-tutor-heading{font-size:11.5px}}

/* v6.1 final built-in Tutor: intentionally simple */
.kb-tutor-head-actions{display:flex;gap:6px;align-items:center}
.kb-tutor-simple-row{grid-template-columns:1fr auto!important}
.kb-tutor-context-card{background:#f8fafc!important;border-color:#dbe4ef!important}
#kbTutorEngineNote{background:#eef8f2;border-color:#c8e6d3;color:#17603d}
#kbTutorPanel .kb-chat{max-height:58vh;min-height:220px;padding:8px 2px 14px;gap:12px}
#kbTutorPanel .kb-chat-bubble{font-size:14px;line-height:1.58;padding:12px 14px}
#kbTutorPanel .kb-chat-bubble.user{max-width:82%;background:#0d477d}
#kbTutorPanel .kb-chat-bubble.tutor{max-width:94%;background:#fff;border:1px solid #dfe5ee;color:#1f2a3a;box-shadow:0 1px 3px rgba(15,23,42,.04)}
#kbTutorPanel .kb-tutor-heading{background:#edf3fa;color:#123a65;padding:6px 9px;font-size:12px}
#kbTutorPanel .kb-tutor-composer{padding-top:12px}
#kbTutorPanel .kb-mm-input{min-height:44px;font-size:14px}
#kbTutorPanel .kb-rec-state{color:#64748b;line-height:1.35}
@media(max-width:760px){#kbTutorPanel .kb-chat{max-height:55vh}.kb-tutor-head-actions{gap:4px}.kb-tutor-head-actions .kb-mm-close{padding:5px 7px;font-size:11px}}

/* v6.2 Tutor multi-concept comparison layout */
.kb-tutor-compare-layout{display:grid!important;gap:10px!important}
.kb-tutor-compare-intro{margin:0 0 2px!important;padding:10px 12px;background:#f3f7fb;border-left:4px solid #0d477d;border-radius:8px;line-height:1.5}
.kb-tutor-compare-card{border:1px solid #d7e0eb;background:#fff;border-radius:12px;overflow:hidden;box-shadow:0 1px 3px rgba(15,23,42,.04)}
.kb-tutor-compare-card h3{margin:0;padding:9px 12px;background:#eaf2fb;color:#103b68;font-size:14px;line-height:1.3}
.kb-tutor-card-row{display:grid;grid-template-columns:96px 1fr;gap:10px;padding:9px 12px;border-top:1px solid #edf1f5;align-items:start}
.kb-tutor-card-row b{color:#6b4d00;font-size:11.5px;line-height:1.35}
.kb-tutor-card-row span{color:#26384d;line-height:1.48}
.kb-tutor-summary-card{border:1px solid #e3cf87;background:#fffaf0;border-radius:12px;padding:10px 12px}
.kb-tutor-summary-card h3{margin:0 0 7px;color:#684d00;font-size:13px}
.kb-tutor-summary-card .kb-tutor-card-row{grid-template-columns:130px 1fr;padding:7px 0;border-top:1px solid #f1e5bd}
.kb-tutor-summary-card .kb-tutor-card-row:first-of-type{border-top:0}
@media(max-width:760px){.kb-tutor-card-row,.kb-tutor-summary-card .kb-tutor-card-row{grid-template-columns:1fr;gap:3px}.kb-tutor-compare-card h3{font-size:13px}}


/* v6.4.3 Tutor viewport-flow fix
   The composer is a real footer, not a sticky overlay. Chat/practice content scrolls
   in its own region and therefore can never continue underneath the typing field. */
#kbTutorPanel .kb-tutor-body{
  display:flex;
  flex-direction:column;
  min-height:0;
  overflow:hidden;
  padding:15px 17px 10px;
}
#kbTutorPanel .kb-tutor-context-card{flex:0 0 auto;margin-bottom:10px}
#kbTutorPanel .kb-tutor-quick{flex:0 0 auto;margin-bottom:6px}
#kbTutorPanel .kb-tutor-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
  padding:0 4px 12px 0;
}
#kbTutorPanel .kb-chat{
  max-height:none;
  min-height:0;
  overflow:visible;
  padding:8px 2px 14px;
  gap:12px;
}
#kbTutorPanel #kbTutorPractice{padding-bottom:4px}
#kbTutorPanel .kb-tutor-composer{
  position:static;
  flex:0 0 auto;
  margin-top:0;
  padding:12px 0 2px;
  background:#fff;
  border-top:1px solid #e3e9f0;
  z-index:auto;
}
#kbTutorPanel .kb-tutor-compose-row{align-items:stretch}
#kbTutorPanel .kb-mm-input{min-height:46px}
#kbTutorPanel .kb-rec-state{margin-bottom:0}
@media(max-width:760px){
  #kbTutorPanel .kb-tutor-body{padding:12px 12px 8px}
  #kbTutorPanel .kb-tutor-scroll{padding-right:2px;padding-bottom:10px}
  #kbTutorPanel .kb-chat{max-height:none;min-height:0}
}
