/* The launcher is the tutor, and nothing else.
 *
 * It used to be a pill carrying the tutor's name and persona line ("Socrates ·
 * Questioning and reflection"). At rest, on every page, that is a lot of
 * furniture for a control the teacher already recognises — and the face IS the
 * identity, so the words only repeated it. Now the button is exactly the
 * portrait: one circle, no chrome, no copy.
 *
 * It is also draggable, because a fixed corner eventually covers something.
 * Position is written as left/top by the drag handler and persisted per
 * teacher; the right/bottom defaults below only apply until then.
 */
.k-socrates-fab{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:9996;
  display:block;
  width:52px;
  height:52px;
  padding:0;
  border:0;
  border-radius:50%;
  background:none;
  color:#fff;
  /* The glow sits under the disc rather than around a pill. */
  filter:drop-shadow(0 10px 22px rgba(0,0,0,.42));
  cursor:grab;
  touch-action:none;              /* let the drag handler own the gesture */
  transition:transform .16s ease, filter .16s ease;
}
.k-socrates-fab:hover{
  transform:scale(1.06);
  filter:drop-shadow(0 14px 28px rgba(0,0,0,.5));
}
.k-socrates-fab:focus-visible{
  outline:2px solid #fff;
  outline-offset:3px;
}
/* While dragging: no hover lift (it fights the pointer) and no transition
   (it would lag the cursor). */
.k-socrates-fab.is-dragging{
  cursor:grabbing;
  transition:none;
  transform:scale(1.10);
}
.k-socrates-fab.is-dragging:hover{transform:scale(1.10);}

/* The copy is gone; keep the rule so any cached page that still renders the
   spans collapses cleanly instead of showing a half-pill. */
.k-socrates-fab-copy{display:none !important;}

.k-socrates-fab-icon{
  width:100%;
  height:100%;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:rgba(255,255,255,.14);
  font-size:22px;
  flex:0 0 auto;
}

/* KX-DEF.A2 — animated guide face (shared kairos-guides rig) in the FAB and
   modal head. Ring + breath + blink; namespaced sf- keyframes so this sheet
   stays standalone. --sf-accent is set inline per guide. */
.k-socrates-fab-icon.has-guide{
  position:relative;
  background:none;
  width:100%;
  height:100%;
}
.k-socrates-fab-icon.has-guide::before{
  content:'';
  position:absolute;
  inset:-2px;
  border-radius:50%;
  background:conic-gradient(from 0deg, var(--sf-accent,#7b6cf6), transparent 30%, transparent 70%, var(--sf-accent,#7b6cf6));
  animation:sf-ring 7s linear infinite;
}
.k-socrates-guide-face{
  position:relative;
  display:block;
  width:44px;
  height:44px;
  flex:0 0 auto;
  margin-right:12px;
  float:left;
}
.k-socrates-guide-face::before{
  content:'';
  position:absolute;
  inset:-2px;
  border-radius:50%;
  background:conic-gradient(from 0deg, var(--sf-accent,#7b6cf6), transparent 30%, transparent 70%, var(--sf-accent,#7b6cf6));
  animation:sf-ring 7s linear infinite;
}
.k-socrates-fab-icon.has-guide .guide-avatar,
.k-socrates-guide-face .guide-avatar{position:relative;display:block;width:100%;height:100%;border-radius:50%;}
.k-socrates-fab-icon.has-guide .gf-disc,
.k-socrates-guide-face .gf-disc{position:absolute;inset:1px;border-radius:50%;overflow:hidden;display:block;background:#0b0918;}
.k-socrates-fab-icon.has-guide .gf-disc svg,
.k-socrates-guide-face .gf-disc svg{width:100%;height:100%;display:block;}
.k-socrates-fab-icon.has-guide .gf-bg,
.k-socrates-guide-face .gf-bg{fill:#241d4d;}
.k-socrates-fab-icon.has-guide .gf-breath,
.k-socrates-guide-face .gf-breath{transform-box:fill-box;transform-origin:50% 100%;animation:sf-breath 4.4s ease-in-out infinite;}
.k-socrates-fab-icon.has-guide .gf-eye,
.k-socrates-guide-face .gf-eye{transform-box:fill-box;transform-origin:center;animation:sf-blink 5.6s infinite;}
.k-socrates-fab-icon.has-guide .gf-mouth,
.k-socrates-guide-face .gf-mouth{transform-box:fill-box;transform-origin:center;transform:scaleY(.16);}
.k-socrates-fab:hover .gf-mouth{animation:sf-talk .9s ease-in-out infinite;}
@keyframes sf-ring{to{transform:rotate(360deg);}}
@keyframes sf-breath{0%,100%{transform:scaleY(1);}50%{transform:translateY(-.7px) scaleY(1.012);}}
@keyframes sf-blink{0%,93%,100%{transform:scaleY(1);}96%{transform:scaleY(.08);}}
@keyframes sf-talk{0%,100%{transform:scaleY(.18);}15%{transform:scaleY(1);}30%{transform:scaleY(.4);}45%{transform:scaleY(.95);}60%{transform:scaleY(.28);}78%{transform:scaleY(.8);}}
@media (prefers-reduced-motion:reduce){
  .k-socrates-fab-icon.has-guide::before,
  .k-socrates-guide-face::before,
  .k-socrates-fab-icon.has-guide .gf-breath,
  .k-socrates-guide-face .gf-breath,
  .k-socrates-fab-icon.has-guide .gf-eye,
  .k-socrates-guide-face .gf-eye{animation:none;}
}

.k-socrates-fab-copy{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.k-socrates-fab-title{
  font-size:11px;
  font-weight:800;
  line-height:1.1;
}
.k-socrates-fab-subtitle{
  font-size:10px;
  opacity:.86;
  line-height:1.1;
  white-space:nowrap;
}

.k-socrates-overlay{
  position:fixed;
  inset:0;
  z-index:9997;
  background:rgba(15,23,42,.46);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}
.k-socrates-overlay.open{
  opacity:1;
  pointer-events:auto;
}

.k-socrates-modal{
  position:fixed;
  right:18px;
  bottom:72px;
  width:min(1120px, calc(100vw - 28px));
  height:min(780px, calc(100vh - 96px));
  z-index:9998;
  border:1px solid rgba(231,234,243,.95);
  border-radius:30px;
  overflow:hidden;
  display:none;
  grid-template-rows:auto 1fr;
  background:
    radial-gradient(circle at top right, rgba(123,97,255,.14), transparent 22%),
    linear-gradient(180deg,#f9f7ff 0%, #ffffff 28%, #fcfcff 100%);
  box-shadow:0 36px 90px rgba(15,23,42,.22);
}
.k-socrates-modal.open{display:grid}

.k-socrates-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  padding:20px 22px 16px;
  border-bottom:1px solid #eceff7;
  background:linear-gradient(180deg,rgba(255,255,255,.84),rgba(251,250,255,.78));
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.k-socrates-head-main{min-width:0}
.k-socrates-eyebrow{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:#efe9ff;
  color:#4b2aad;
  font-size:11px;
  font-weight:800;
  letter-spacing:.04em;
  margin-bottom:12px;
}
.k-socrates-title{
  margin:0;
  font-size:27px;
  line-height:1.02;
  letter-spacing:-.03em;
  color:#182033;
}
.k-socrates-subtitle{
  margin:8px 0 0;
  color:#69707d;
  font-size:13px;
  line-height:1.5;
  max-width:720px;
}
.k-socrates-close{
  border:none;
  background:rgba(244,245,248,.95);
  color:#475467;
  width:40px;
  height:40px;
  border-radius:14px;
  font-size:16px;
  cursor:pointer;
  flex:0 0 auto;
  transition:.16s ease;
}
.k-socrates-close:hover{
  background:#eceff7;
  transform:translateY(-1px);
}

.k-socrates-layout{
  min-height:0;
  display:grid;
  grid-template-columns:320px 1fr;
}

.k-socrates-sidebar{
  border-right:1px solid #eceff7;
  background:linear-gradient(180deg,rgba(245,240,255,.82),rgba(250,249,255,.72));
  padding:18px;
  display:grid;
  grid-template-rows:auto auto 1fr;
  gap:14px;
  min-height:0;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.k-socrates-banner{
  position:relative;
  overflow:hidden;
  background:linear-gradient(135deg,#2f1688 0%, #4b2aad 55%, #7b61ff 100%);
  color:#fff;
  border-radius:22px;
  padding:16px;
  box-shadow:0 16px 34px rgba(75,42,173,.22);
}
.k-socrates-banner::after{
  content:"";
  position:absolute;
  inset:auto -36px -36px auto;
  width:120px;
  height:120px;
  border-radius:999px;
  background:radial-gradient(circle, rgba(255,255,255,.28) 0%, rgba(255,255,255,0) 70%);
  pointer-events:none;
}
.k-socrates-banner h3{
  margin:0 0 6px;
  font-size:18px;
  line-height:1.08;
  letter-spacing:-.02em;
}
.k-socrates-banner p{
  margin:0;
  font-size:12px;
  line-height:1.45;
  color:rgba(255,255,255,.92);
}
.k-socrates-panel{
  background:rgba(255,255,255,.64);
  border:1px solid rgba(255,255,255,.5);
  border-radius:18px;
  padding:12px;
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.k-socrates-panel-title{
  margin:0 0 8px;
  font-size:12px;
  font-weight:800;
  color:#1f2430;
  letter-spacing:.05em;
  text-transform:uppercase;
}
.k-socrates-context{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.k-socrates-chip{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  background:#f3efff;
  color:#6a35d8;
  font-size:11px;
  font-weight:800;
}

.k-socrates-flow{
  display:grid;
  gap:8px;
}
.k-socrates-flow-step{
  display:flex;
  gap:10px;
  align-items:flex-start;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(255,255,255,.56);
  border-radius:14px;
  padding:9px 10px;
}
.k-socrates-flow-dot{
  width:24px;
  height:24px;
  border-radius:999px;
  display:grid;
  place-items:center;
  font-size:11px;
  font-weight:800;
  background:#efe9ff;
  color:#4b2aad;
  flex:0 0 auto;
}
.k-socrates-flow-copy{
  font-size:12px;
  color:#475467;
  line-height:1.4;
}

.k-socrates-prompts-wrap{
  min-height:0;
  display:grid;
  grid-template-rows:auto 1fr;
  gap:8px;
}
.k-socrates-prompts{
  display:grid;
  gap:8px;
  overflow:auto;
  min-height:0;
  padding-right:2px;
}
.k-socrates-prompt{
  text-align:left;
  border:1px solid rgba(255,255,255,.52);
  background:rgba(255,255,255,.78);
  color:#4b2aad;
  border-radius:14px;
  padding:11px 12px;
  font-size:12px;
  line-height:1.42;
  font-weight:700;
  cursor:pointer;
  transition:.16s ease;
  box-shadow:0 4px 14px rgba(31,36,48,.04);
}
.k-socrates-prompt:hover{
  background:rgba(236,229,255,.94);
  border-color:#cfc2ff;
  transform:translateY(-1px);
}

.k-socrates-main{
  min-width:0;
  min-height:0;
  display:grid;
  grid-template-rows:auto 1fr auto;
  background:linear-gradient(180deg,rgba(255,255,255,.7),rgba(252,252,255,.82));
}
.k-socrates-main-head{
  padding:18px 20px 14px;
  border-bottom:1px solid #edf0f7;
  background:rgba(255,255,255,.58);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.k-socrates-main-head h3{
  margin:0 0 5px;
  font-size:18px;
  color:#1f2430;
  letter-spacing:-.01em;
}
.k-socrates-main-head p{
  margin:0;
  font-size:12px;
  color:#69707d;
  line-height:1.45;
}

.k-socrates-history{
  padding:16px 18px 18px;
  overflow:auto;
  display:grid;
  gap:12px;
  align-content:start;
}
.k-socrates-empty{
  border:1px dashed #d8dfee;
  border-radius:18px;
  padding:14px;
  background:#fafbff;
  color:#6d7688;
  font-size:13px;
  line-height:1.5;
}
.k-socrates-msg{
  display:flex;
}
.k-socrates-msg.user{justify-content:flex-end}
.k-socrates-msg.ai{justify-content:flex-start}
.k-socrates-bubble{
  max-width:74%;
  border-radius:18px;
  padding:13px 15px;
  font-size:13px;
  line-height:1.58;
  white-space:pre-wrap;
  word-break:break-word;
  box-shadow:0 8px 18px rgba(26,30,52,.05);
}
.k-socrates-msg.ai .k-socrates-bubble{
  background:rgba(255,255,255,.78);
  color:#1f2430;
  border:1px solid rgba(255,255,255,.64);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
}
.k-socrates-msg.user .k-socrates-bubble{
  background:linear-gradient(135deg,rgba(236,229,255,.96),rgba(216,203,255,.92));
  color:#4b2aad;
  border:1px solid rgba(207,194,255,.72);
}

.k-socrates-thinking{
  display:none;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:linear-gradient(135deg,#2f1688,#4b2aad);
  color:#fff;
  font-size:12px;
  font-weight:800;
  width:max-content;
  box-shadow:0 10px 24px rgba(75,42,173,.18);
}
.k-socrates-thinking.open{display:inline-flex}
.k-socrates-thinking-dot{
  width:8px;
  height:8px;
  border-radius:999px;
  background:#fff;
  opacity:.9;
  animation:kSocratesPulse 1.2s infinite ease-in-out;
}
@keyframes kSocratesPulse{
  0%,100%{transform:scale(.8);opacity:.45}
  50%{transform:scale(1.1);opacity:1}
}

.k-socrates-footer{
  border-top:1px solid #edf0f7;
  background:rgba(255,255,255,.58);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  padding:14px 16px;
}
.k-socrates-input-shell{
  display:grid;
  grid-template-columns:1fr auto;
  gap:10px;
  align-items:center;
}
.k-socrates-input{
  width:100%;
  min-height:48px;
  max-height:130px;
  resize:vertical;
  border:1px solid rgba(230,232,242,.95);
  background:rgba(255,255,255,.82);
  border-radius:16px;
  padding:12px 14px;
  font:inherit;
  font-size:13px;
  color:#1f2430;
  outline:none;
}
.k-socrates-input:focus{
  border-color:#cfc2ff;
  box-shadow:0 0 0 4px rgba(107,79,230,.08);
}
.k-socrates-send{
  border:none;
  border-radius:16px;
  padding:12px 16px;
  background:linear-gradient(135deg,#2f1688,#4b2aad);
  color:#fff;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 10px 20px rgba(75,42,173,.18);
}
.k-socrates-send:hover{
  transform:translateY(-1px);
}
.k-socrates-note{
  margin-top:8px;
  font-size:11px;
  color:#69707d;
  line-height:1.4;
}

@media (max-width: 980px){
  .k-socrates-modal{
    right:12px;
    bottom:12px;
    width:calc(100vw - 24px);
    height:min(90vh, 820px);
  }
  .k-socrates-layout{
    grid-template-columns:1fr;
  }
  .k-socrates-sidebar{
    border-right:none;
    border-bottom:1px solid #eceff7;
  }
}
@media (max-width: 640px){
  .k-socrates-fab{
    right:14px;
    /* Clear the mobile nav bar (SHELL.A1, ~68px + safe-area). At the old 14px
       the launcher sat on top of the last nav item and swallowed its tap. A
       teacher who drags it sets left/top inline, which overrides this. */
    bottom:calc(78px + env(safe-area-inset-bottom, 0px));
  }
  .k-socrates-fab-subtitle{display:none}
  .k-socrates-modal{
    border-radius:22px;
  }
  .k-socrates-title{
    font-size:22px;
  }
  .k-socrates-bubble{
    max-width:88%;
  }
  .k-socrates-input-shell{
    grid-template-columns:1fr;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
 * FAB.A2 — hover label + the rebuilt panel.
 *
 * The panel used to be a two-column desktop layout (sidebar of prompts + a fake
 * conversation column) sized for a screen it rarely got. It is now a single
 * column that reads top-to-bottom: who is speaking → what this module is for →
 * what you can ask → the composer, matching the AI module's own card language.
 * ════════════════════════════════════════════════════════════════════════════ */

/* ── Hover label ─────────────────────────────────────────────────────────── */
/* A bare portrait tells a first-time teacher nothing to act on. The pill names
   the action, and only on hover/focus so the resting state stays just the face. */
.k-socrates-fab-hint{
  position:absolute;
  right:calc(100% + 10px);
  top:50%;
  transform:translateY(-50%) translateX(6px);
  padding:7px 12px;
  border:1px solid rgba(255,255,255,.16);
  border-radius:999px;
  background:#241d4d;
  color:#f4f1ff;
  font-size:12.5px;
  font-weight:650;
  white-space:nowrap;
  pointer-events:none;
  opacity:0;
  transition:opacity .15s ease, transform .15s ease;
  box-shadow:0 10px 26px rgba(0,0,0,.45);
}
.k-socrates-fab:hover .k-socrates-fab-hint,
.k-socrates-fab:focus-visible .k-socrates-fab-hint{
  opacity:1;
  transform:translateY(-50%) translateX(0);
}
/* While dragging the pill is noise, and it would be dragged along with it. */
.k-socrates-fab.is-dragging .k-socrates-fab-hint{opacity:0 !important;}

/* ── Panel ───────────────────────────────────────────────────────────────── */
/* Visibility is owned by the BASE rule above: `.k-socrates-modal{display:none}`
 * with `.k-socrates-modal.open{display:grid}`. This block restyles the panel and
 * must NOT set `display` unconditionally — doing so overrode the base `none`
 * (same specificity, later in the file), so the panel was permanently on screen
 * and removing `.open` did nothing. That is the "the ✕ doesn't close it" report.
 *
 * The lesson for the test that missed it: asserting `classList.contains('open')`
 * proves the class flipped, not that anything moved. Assert on computed display. */
.k-socrates-modal{
  width:min(94vw, 420px);
  min-width:min(360px, calc(100vw - 28px));
  min-height:420px;
  max-height:min(78vh, 660px);
  overflow:hidden;
  resize:both;
  background:#1a1440;
  border:1px solid rgba(255,255,255,.14);
  border-radius:20px;
  box-shadow:0 26px 60px rgba(0,0,0,.6);
}
/* Overrides the base `.open{display:grid}` only while open — never the `none`. */
.k-socrates-modal.open{
  display:flex;
  flex-direction:column;
}
.k-socrates-modal.is-expanded{
  width:min(720px, calc(100vw - 36px));
  max-height:calc(100vh - 112px);
  height:min(760px, calc(100vh - 112px));
}
.k-socrates-modal.is-course-workflow{
  left:50%;
  top:50%;
  right:auto;
  bottom:auto;
  transform:translate(-50%,-50%);
  width:min(720px,calc(100vw - 36px));
  height:min(760px,calc(100vh - 72px));
  max-height:calc(100vh - 72px);
  resize:none;
  animation:kCourseWorkflowExpand .28s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes kCourseWorkflowExpand{
  from{opacity:.86;transform:translate(-50%,-47%) scale(.965);}
  to{opacity:1;transform:translate(-50%,-50%) scale(1);}
}

.k-socrates-head{
  display:flex;
  align-items:center;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid rgba(255,255,255,.12);
  background:linear-gradient(180deg, rgba(255,255,255,.06), transparent);
  flex:0 0 auto;
}
.k-socrates-head .k-socrates-guide-face{
  width:42px; height:42px; margin:0; float:none; flex:0 0 auto;
}
.k-socrates-head-main{min-width:0; flex:1 1 auto;}
.k-socrates-title{
  margin:0; font-size:16px; font-weight:700; color:#f4f1ff;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.k-socrates-subtitle{
  margin:2px 0 0; font-size:12px; color:#a9a3c4;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.k-socrates-close{
  flex:0 0 auto; width:32px; height:32px; border-radius:10px;
  border:1px solid rgba(255,255,255,.14); background:rgba(255,255,255,.06);
  color:#f4f1ff; cursor:pointer; font-size:13px; line-height:1;
}
.k-socrates-close:hover{background:rgba(255,255,255,.12);}
.k-socrates-expand{
  flex:0 0 auto;width:32px;height:32px;border-radius:10px;
  border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.06);
  color:#f4f1ff;cursor:pointer;font-size:15px;line-height:1;
}
.k-socrates-expand:hover{background:rgba(255,255,255,.12);}

.k-socrates-body{
  padding:14px 16px 16px;
  overflow-y:auto;
  display:grid;
  gap:14px;
  min-height:0;
}

/* ── "What you can do here" ──────────────────────────────────────────────── */
.k-socrates-does{
  border:1px solid rgba(255,255,255,.14);
  border-radius:14px;
  background:rgba(255,255,255,.04);
  padding:11px 13px;
}
.k-socrates-does > summary{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  cursor:pointer; list-style:none;
  font-size:13px; font-weight:650; color:#f4f1ff;
}
.k-socrates-does > summary::-webkit-details-marker{display:none;}
.k-socrates-does[open] > summary{margin-bottom:9px;}
.k-socrates-new{
  flex:0 0 auto; padding:2px 8px; border-radius:999px;
  background:rgba(115,221,176,.18); border:1px solid rgba(115,221,176,.4);
  color:#6ee7b7; font-size:10px; font-weight:700; letter-spacing:.03em;
}
.k-socrates-does ul{margin:0; padding-left:17px; display:grid; gap:5px;}
.k-socrates-does li{font-size:12.5px; line-height:1.5; color:#c9c4e0;}

.k-socrates-context{display:flex; flex-wrap:wrap; gap:5px; margin-top:10px;}
.k-socrates-chip{
  padding:3px 9px; border-radius:999px;
  background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.12);
  color:#a9a3c4; font-size:10.5px; font-weight:600;
}

/* ── Prompts ─────────────────────────────────────────────────────────────── */
.k-socrates-section-title{
  margin:0 0 9px; font-size:11px; font-weight:700;
  letter-spacing:.07em; text-transform:uppercase; color:#a9a3c4;
}
.k-socrates-prompts{display:grid; gap:6px;}
.k-socrates-prompt{
  appearance:none; text-align:left;
  padding:10px 12px; border-radius:11px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  color:#e7e3f7; font:inherit; font-size:12.5px; font-weight:600;
  cursor:pointer; transition:border-color .15s ease, background .15s ease;
}
.k-socrates-prompt:hover{
  border-color:var(--sf-accent,#7b6cf6);
  background:rgba(255,255,255,.09);
  color:#fff;
}

/* ── Composer ────────────────────────────────────────────────────────────── */
.k-socrates-composer{display:flex; gap:8px; align-items:flex-end;}
.k-socrates-input{
  flex:1 1 auto; min-height:42px; max-height:120px; resize:vertical;
  padding:11px 12px; border-radius:11px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.22); color:#f4f1ff;
  font:inherit; font-size:13px;
}
.k-socrates-input:focus{
  outline:2px solid var(--sf-accent,#7b6cf6); outline-offset:1px;
  border-color:var(--sf-accent,#7b6cf6);
}
.k-socrates-send{
  flex:0 0 auto; padding:11px 16px; border-radius:11px; border:0;
  background:var(--sf-accent,#7b6cf6); color:#14101f;
  font:inherit; font-size:12.5px; font-weight:700; cursor:pointer;
}
.k-socrates-send:hover{filter:brightness(1.1);}

.k-socrates-note{
  margin:0; font-size:11.5px; line-height:1.5; color:#a9a3c4;
  padding-top:11px; border-top:1px solid rgba(255,255,255,.10);
}
.k-socrates-note b{color:#e7e3f7;}
.k-socrates-answers{display:grid;gap:8px;}
.k-socrates-chat-line{
  width:max-content;
  max-width:88%;
  padding:10px 13px;
  border-radius:15px;
  font-size:13px;
  line-height:1.5;
  letter-spacing:-.006em;
}
.k-socrates-chat-line.is-guide{
  justify-self:start;
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);
  color:#e7e3f7;
  border-bottom-left-radius:4px;
}
.k-socrates-chat-line.is-user{
  justify-self:end;
  background:linear-gradient(135deg,var(--sf-accent,#7b6cf6),color-mix(in srgb,var(--sf-accent,#7b6cf6) 76%,#4634cf));
  color:#fff;
  border:1px solid color-mix(in srgb,var(--sf-accent,#7b6cf6) 72%,#fff);
  border-bottom-right-radius:5px;
  box-shadow:0 7px 18px color-mix(in srgb,var(--sf-accent,#7b6cf6) 20%,transparent);
  font-weight:720;
}
.k-course-copilot-reply{
  max-width:92%;
  font-weight:560;
  text-wrap:pretty;
}
.k-course-copilot{width:min(94vw,480px);}
.k-course-copilot .k-socrates-cards{grid-template-columns:repeat(2,minmax(0,1fr));}
.k-course-copilot .k-socrates-body{
  background:linear-gradient(180deg,rgba(255,255,255,.025),transparent 32%);
}
.k-course-copilot .k-socrates-section{display:grid;gap:8px;}
.k-course-copilot .k-socrates-card{
  min-height:60px;
  padding:12px 13px;
  border-radius:15px;
  font-size:12px;
  font-weight:750;
}
.k-course-copilot .k-socrates-card-ico{
  display:grid;
  place-items:center;
  width:30px;
  height:30px;
  border-radius:10px;
  background:rgba(123,108,246,.12);
  font-size:14px;
}
.k-course-copilot-hello{
  width:92%;
  max-width:none;
  padding:12px 14px;
  font-size:13px;
}
.k-course-copilot-hello span{color:inherit;}
.k-socrates-thinking{
  display:flex;
  align-items:center;
  min-width:142px;
  gap:9px;
  font-style:normal;
}
.k-socrates-thinking em{
  color:inherit;
  font-size:11.5px;
  font-style:normal;
  font-weight:650;
  letter-spacing:.02em;
  opacity:.72;
}
.k-socrates-thinking > span{
  width:8px;height:8px;border-radius:50%;background:var(--sf-accent,#7b6cf6);
  box-shadow:14px 0 0 color-mix(in srgb,var(--sf-accent,#7b6cf6) 65%,transparent),
             28px 0 0 color-mix(in srgb,var(--sf-accent,#7b6cf6) 35%,transparent);
  margin-right:28px;
  animation:kSocratesThoughtDots 1.15s ease-in-out infinite alternate;
}
@keyframes kSocratesThoughtDots{to{opacity:.4;transform:translateY(-2px);}}
.k-socrates-followups{display:grid;gap:7px;}
.k-socrates-followups button{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-height:40px;
  padding:9px 11px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:11px;
  background:rgba(255,255,255,.05);
  color:#e7e3f7;
  font:inherit;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
}
.k-socrates-followups button:hover{border-color:var(--sf-accent,#7b6cf6);}
.k-course-library-suggestions{
  display:grid;
  gap:9px;
  padding:13px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:18px;
  background:linear-gradient(145deg,rgba(123,108,246,.12),rgba(255,255,255,.025));
}
.k-course-library-heading{display:flex;align-items:center;gap:10px;padding:2px 3px 6px;}
.k-course-library-heading>span{
  display:grid;place-items:center;width:30px;height:30px;border-radius:10px;
  background:rgba(123,108,246,.18);color:#c9c0ff;font-size:15px;
}
.k-course-library-heading>div{display:grid;gap:1px;}
.k-course-library-heading strong{color:#f2efff;font-size:12.5px;}
.k-course-library-heading small{color:#a9a3c4;font-size:10.5px;}
.k-course-library-suggestion,
.k-course-library-more{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:48px;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:12px;
  background:rgba(255,255,255,.05);
  color:#e7e3f7;
  text-decoration:none;
  transition:border-color .16s ease,background .16s ease,transform .16s ease;
}
.k-course-library-suggestion{
  display:grid;
  grid-template-columns:38px minmax(0,1fr) auto;
  min-height:76px;
  padding:11px 13px 11px 10px;
  overflow:hidden;
}
.k-course-library-suggestion:hover,
.k-course-library-more:hover{
  border-color:var(--sf-accent,#7b6cf6);
  background:rgba(255,255,255,.08);
  transform:translateY(-1px);
}
.k-course-library-rank{
  display:grid;place-items:center;width:34px;height:34px;border-radius:11px;
  background:linear-gradient(145deg,rgba(123,108,246,.28),rgba(123,108,246,.10));
  color:#d8d1ff;font-size:10px;font-weight:850;letter-spacing:.08em;
}
.k-course-library-copy{display:grid;gap:3px;min-width:0;}
.k-course-library-signal{
  color:#9b8cff;font-size:9px;font-weight:850;letter-spacing:.11em;text-transform:uppercase;
}
.k-course-library-suggestion strong{
  overflow:hidden;
  font-size:12.5px;
  line-height:1.3;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.k-course-library-suggestion small{color:#a9a3c4;font-size:10.5px;}
.k-course-library-open{display:flex;align-items:center;gap:7px;color:#c9c0ff;font-size:10.5px;font-weight:750;}
.k-course-library-open b{
  display:grid;place-items:center;width:28px;height:28px;border-radius:9px;
  background:rgba(123,108,246,.14);font-size:14px;
}
.k-course-library-suggestion b,
.k-course-library-more span{font-size:15px;}
.k-course-library-more{
  min-height:40px;
  color:var(--sf-accent,#9b8cff);
  font-size:12px;
  font-weight:750;
}
.k-course-upload-form{
  display:grid;
  gap:13px;
  padding:15px;
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  background:linear-gradient(145deg,rgba(255,255,255,.08),rgba(255,255,255,.035));
  box-shadow:0 16px 34px rgba(10,8,32,.18);
}
.k-course-upload-heading{display:flex;align-items:center;gap:11px;}
.k-course-upload-heading > span{
  display:grid;place-items:center;width:38px;height:38px;border-radius:12px;
  background:color-mix(in srgb,var(--sf-accent,#7b6cf6) 18%,transparent);
  font-size:17px;
}
.k-course-upload-heading div{display:grid;gap:2px;}
.k-course-upload-heading strong{font-size:13.5px;color:#f4f1ff;}
.k-course-upload-heading small{font-size:10.5px;color:#aaa3c7;}
.k-course-upload-form label{display:grid;gap:6px;}
.k-course-upload-form label > span{
  color:#b9b3d0;font-size:10px;font-weight:800;letter-spacing:.09em;text-transform:uppercase;
}
.k-course-upload-form input,
.k-course-upload-form textarea{
  width:100%;
  box-sizing:border-box;
  padding:10px 11px;
  border:1px solid rgba(255,255,255,.15);
  border-radius:10px;
  background:rgba(9,7,30,.32);
  color:#f4f1ff;
  font:inherit;
  font-size:12.5px;
  outline:none;
}
.k-course-upload-form input:focus,
.k-course-upload-form textarea:focus{
  border-color:var(--sf-accent,#7b6cf6);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--sf-accent,#7b6cf6) 18%,transparent);
}
.k-course-upload-form input[type="file"]{padding:8px;font-size:11.5px;}
.k-course-upload-grid{display:grid;grid-template-columns:.8fr 1.2fr;gap:11px;}
.k-course-upload-actions{display:flex;justify-content:flex-end;gap:8px;padding-top:2px;}
.k-course-upload-actions button{
  display:inline-flex;align-items:center;justify-content:center;gap:10px;
  min-height:40px;padding:9px 14px;border-radius:11px;font:inherit;
  font-size:12px;font-weight:780;cursor:pointer;
}
.k-course-upload-actions .is-secondary{
  border:1px solid rgba(255,255,255,.15);background:transparent;color:#d7d2e7;
}
.k-course-upload-actions .is-primary{
  border:0;background:var(--sf-accent,#7b6cf6);color:#fff;
  box-shadow:0 9px 20px color-mix(in srgb,var(--sf-accent,#7b6cf6) 24%,transparent);
}
.k-course-upload-actions button:disabled{opacity:.52;cursor:wait;}
.k-course-upload-status{
  margin:0;padding:10px 11px;border-radius:10px;font-size:11.5px;line-height:1.45;
}
.k-course-upload-status.is-working{background:rgba(123,108,246,.12);color:#dcd7ff;}
.k-course-upload-status.is-error{background:rgba(239,68,68,.12);color:#fecaca;}
.k-course-upload-status.is-success{background:rgba(16,185,129,.13);color:#bbf7d0;}
.k-course-upload-spinner{
  display:inline-block;width:10px;height:10px;margin-right:8px;border:2px solid currentColor;
  border-right-color:transparent;border-radius:50%;vertical-align:-1px;animation:kCourseUploadSpin .7s linear infinite;
}
@keyframes kCourseUploadSpin{to{transform:rotate(360deg);}}

/* Light teacher workspace: the launcher and guided chat belong to the same
   surface system as the page instead of looking like a dark legacy widget. */
:root[data-tetra-theme="light"] .k-socrates-fab{
  background:transparent;
  box-shadow:none;
  filter:none;
}
:root[data-tetra-theme="light"] .k-socrates-fab:hover{
  box-shadow:0 16px 34px rgba(35,48,73,.2);
  filter:none;
}
:root[data-tetra-theme="light"] .k-socrates-fab-hint{
  background:#fff;
  border-color:#d9e1ec;
  color:#20304a;
  box-shadow:0 12px 30px rgba(35,48,73,.16);
}
:root[data-tetra-theme="light"] .k-socrates-modal{
  background:#f8fbff;
  border-color:#d9e1ec;
  box-shadow:0 26px 60px rgba(35,48,73,.22);
}
:root[data-tetra-theme="light"] .k-socrates-head{
  background:#fff;
  border-color:#e3e8f0;
}
:root[data-tetra-theme="light"] .k-socrates-title,
:root[data-tetra-theme="light"] .k-socrates-does > summary,
:root[data-tetra-theme="light"] .k-socrates-hello{
  color:#182033;
}
:root[data-tetra-theme="light"] .k-socrates-subtitle,
:root[data-tetra-theme="light"] .k-socrates-voice,
:root[data-tetra-theme="light"] .k-socrates-does li,
:root[data-tetra-theme="light"] .k-socrates-section-title,
:root[data-tetra-theme="light"] .k-socrates-note{
  color:#687386;
}
:root[data-tetra-theme="light"] .k-socrates-close,
:root[data-tetra-theme="light"] .k-socrates-does,
:root[data-tetra-theme="light"] .k-socrates-prompt{
  background:#fff;
  border-color:#dfe6ef;
  color:#25344d;
}
:root[data-tetra-theme="light"] .k-socrates-prompt:hover{
  background:#eef7ff;
  color:#182033;
}
:root[data-tetra-theme="light"] .k-socrates-chip{
  background:#edf3f9;
  border-color:#d9e1ec;
  color:#52627a;
}
:root[data-tetra-theme="light"] .k-socrates-input{
  background:#fff;
  border-color:#ccd7e5;
  color:#182033;
}
:root[data-tetra-theme="light"] .k-socrates-note,
:root[data-tetra-theme="light"] .k-socrates-welcome{
  border-color:#e3e8f0;
}
:root[data-tetra-theme="light"] .k-socrates-note b{color:#25344d;}
:root[data-tetra-theme="light"] .k-socrates-chat-line.is-guide,
:root[data-tetra-theme="light"] .k-socrates-followups button{
  background:#fff;
  border-color:#dfe6ef;
  color:#25344d;
}
:root[data-tetra-theme="light"] .k-course-library-suggestion,
:root[data-tetra-theme="light"] .k-course-library-more{
  background:#fff;
  border-color:#dfe6ef;
  color:#25344d;
}
:root[data-tetra-theme="light"] .k-course-library-suggestions{
  background:linear-gradient(145deg,#faf8ff,#f5f8ff);
  border-color:#e1e5f0;
}
:root[data-tetra-theme="light"] .k-course-library-heading strong{color:#25344d;}
:root[data-tetra-theme="light"] .k-course-library-heading small{color:#6d7890;}
:root[data-tetra-theme="light"] .k-course-library-rank{background:#eeeaff;color:#553bc5;}
:root[data-tetra-theme="light"] .k-course-library-signal{color:#6247d3;}
:root[data-tetra-theme="light"] .k-course-library-open{color:#553bc5;}
:root[data-tetra-theme="light"] .k-course-library-open b{background:#eeeaff;}
:root[data-tetra-theme="light"] .k-course-library-suggestion:hover,
:root[data-tetra-theme="light"] .k-course-library-more:hover{
  background:#f6f3ff;
  border-color:#9f8cf7;
}
:root[data-tetra-theme="light"] .k-course-library-suggestion small{color:#6d7890;}
:root[data-tetra-theme="light"] .k-course-library-more{color:#4f35c7;}
:root[data-tetra-theme="light"] .k-course-upload-form{
  background:linear-gradient(145deg,#fff,#f8f7ff);
  border-color:#dfe6ef;
  box-shadow:0 16px 34px rgba(35,48,73,.10);
}
:root[data-tetra-theme="light"] .k-course-upload-heading strong{color:#182033;}
:root[data-tetra-theme="light"] .k-course-upload-heading small,
:root[data-tetra-theme="light"] .k-course-upload-form label > span{color:#687386;}
:root[data-tetra-theme="light"] .k-course-upload-form input,
:root[data-tetra-theme="light"] .k-course-upload-form textarea{
  background:#fff;border-color:#ccd7e5;color:#182033;
}
:root[data-tetra-theme="light"] .k-course-upload-actions .is-secondary{
  background:#fff;border-color:#d8e0eb;color:#34425a;
}
:root[data-tetra-theme="light"] .k-course-upload-status.is-working{background:#f0edff;color:#4f35c7;}
:root[data-tetra-theme="light"] .k-course-upload-status.is-error{background:#fff0f0;color:#b42318;}
:root[data-tetra-theme="light"] .k-course-upload-status.is-success{background:#eafaf2;color:#18794e;}
@media (max-width:640px){
  .k-socrates-modal.is-course-workflow{
    width:calc(100vw - 20px);
    height:calc(100vh - 28px);
    max-height:calc(100vh - 28px);
  }
  .k-course-upload-grid{grid-template-columns:1fr;}
}

@media (max-width:640px){
  .k-socrates-modal{
    width:auto; left:10px; right:10px;
    max-height:74vh;
  }
  /* Clear the mobile nav bar so the panel is never half-hidden behind it. */
  .k-socrates-modal.open{bottom:calc(78px + env(safe-area-inset-bottom, 0px));}
}

/* ════════════════════════════════════════════════════════════════════════════
 * FAB.A3 — the panel answers in place.
 *
 * It used to hand every question to /tetrahedron/ai/ and navigate. Honest, but
 * it made the assistant a signpost: you asked, you got a page load. The answer
 * now lands in the panel, computed by the same engine over the same governed
 * reads. The full module is still one click away for work that needs its tabs.
 * ════════════════════════════════════════════════════════════════════════════ */

/* ── One-time invitation ─────────────────────────────────────────────────── */
/* Only for a teacher who has never opened it (see SEEN_FAB_KEY). A loop would
   be a distraction on ~55 pages, so this runs a few times and stops. */
@keyframes sf-invite{
  0%,70%,100%{transform:translateY(0)}
  80%{transform:translateY(-9px)}
  90%{transform:translateY(-4px)}
}
.k-socrates-fab.is-inviting{
  animation:sf-invite 2.4s ease-in-out 3;
}
@media (prefers-reduced-motion:reduce){
  .k-socrates-fab.is-inviting{animation:none;}
}

/* ── The tutor speaks first ──────────────────────────────────────────────── */
.k-socrates-welcome{
  padding-bottom:12px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.k-socrates-hello{
  margin:0; font-size:15px; font-weight:700; color:#f4f1ff;
}
.k-socrates-voice{
  margin:5px 0 0; font-size:13px; line-height:1.55;
  color:#c9c4e0; font-style:italic;
}

/* ── First-run Tetrahedron orientation ───────────────────────────────────── */
.k-tetra-onboarding-head{align-items:flex-start;}
.k-tetra-onboarding-eyebrow{
  display:block;
  margin:0 0 4px;
  color:var(--sf-accent,#a991ff);
  font-size:9.5px;
  font-weight:800;
  letter-spacing:.09em;
  text-transform:uppercase;
}
.k-tetra-onboarding{gap:12px;}
.k-tetra-onboarding-chat{display:grid;gap:8px;}
.k-tetra-onboarding-msg{
  width:fit-content;
  max-width:94%;
  padding:10px 12px;
  border:1px solid rgba(255,255,255,.13);
  border-radius:14px 14px 14px 4px;
  background:rgba(255,255,255,.055);
  color:#e7e3f7;
  font-size:12.5px;
  line-height:1.58;
  white-space:pre-wrap;
}
.k-tetra-onboarding-msg.prompt{
  border-color:color-mix(in srgb, var(--sf-accent,#a991ff) 58%, transparent);
  background:color-mix(in srgb, var(--sf-accent,#a991ff) 12%, transparent);
}
.k-tetra-onboarding-msg[hidden],
.k-tetra-onboarding-features[hidden]{display:none;}
.k-tetra-onboarding-msg.is-generating::after{
  content:'';
  display:inline-block;
  width:6px;
  height:1em;
  margin-left:3px;
  vertical-align:-2px;
  border-radius:2px;
  background:var(--sf-accent,#a991ff);
  animation:sf-onboarding-caret .72s steps(1) infinite;
}
@keyframes sf-onboarding-caret{50%{opacity:0;}}
.k-tetra-onboarding-features{
  padding:12px;
  border:1px solid rgba(255,255,255,.13);
  border-radius:15px;
  background:rgba(0,0,0,.16);
  animation:sf-answer-in .22s ease-out;
}
.k-tetra-onboarding-features h3{
  margin:0 0 9px;
  color:#f4f1ff;
  font-size:12px;
  font-weight:750;
}
.k-tetra-onboarding-features ol{display:grid;gap:7px;margin:0;padding:0;list-style:none;}
.k-tetra-onboarding-features li{display:grid;grid-template-columns:22px 1fr;gap:8px;align-items:start;}
.k-tetra-onboarding-features li > span{
  display:grid;
  place-items:center;
  width:22px;
  height:22px;
  border-radius:50%;
  background:color-mix(in srgb, var(--sf-accent,#a991ff) 18%, transparent);
  color:var(--sf-accent,#a991ff);
  font-size:10px;
  font-weight:800;
}
.k-tetra-onboarding-features li p{margin:1px 0 0;color:#c9c4e0;font-size:11.7px;line-height:1.45;}
.k-tetra-onboarding-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding-top:11px;
  border-top:1px solid rgba(255,255,255,.10);
}
.k-tetra-onboarding-actions p{margin:0;color:#8f88ad;font-size:10.5px;line-height:1.4;}
.k-tetra-onboarding-actions button{
  flex:0 0 auto;
  padding:10px 14px;
  border:0;
  border-radius:11px;
  background:var(--sf-accent,#a991ff);
  color:#14101f;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
.k-tetra-onboarding-actions button:disabled{opacity:.42;cursor:wait;}
@media (prefers-reduced-motion:reduce){
  .k-tetra-onboarding-msg.is-generating::after,
  .k-tetra-onboarding-features{animation:none;}
}

/* ── Actionable cards ────────────────────────────────────────────────────── */
.k-socrates-cards{display:grid; gap:7px;}
.k-socrates-card{
  appearance:none;
  display:flex; align-items:center; gap:10px;
  width:100%; text-align:left;
  padding:11px 12px; border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.05);
  color:#e7e3f7; font:inherit; font-size:12.5px; font-weight:600;
  cursor:pointer;
  transition:border-color .15s ease, background .15s ease, transform .1s ease;
}
.k-socrates-card:hover{
  border-color:var(--sf-accent,#7b6cf6);
  background:rgba(255,255,255,.09);
  color:#fff;
  transform:translateX(2px);
}
.k-socrates-card:active{transform:translateX(0);}
.k-socrates-card-ico{flex:0 0 auto; font-size:15px; line-height:1;}
.k-socrates-section-note{
  margin:-2px 0 9px;
  color:#aaa4c5;
  font-size:11.5px;
  line-height:1.45;
}
.k-socrates-card-copy{display:grid;gap:2px;min-width:0;}
.k-socrates-card-label{display:block;color:inherit;}
.k-socrates-card-scope{
  display:block;
  color:var(--sf-accent,#a991ff);
  font-size:9.5px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.k-socrates-card-description{
  display:block;
  color:#aaa4c5;
  font-size:10.5px;
  font-weight:500;
  line-height:1.35;
}
.k-socrates-card.is-report{align-items:flex-start;padding:12px;}
.k-socrates-card.is-report .k-socrates-card-ico{margin-top:3px;}

@media (min-width:980px){
  .k-socrates-cards:has(.k-socrates-card.is-report){grid-template-columns:1fr 1fr;}
}

/* ── Answers ─────────────────────────────────────────────────────────────── */
.k-socrates-answers:empty{display:none;}

.k-socrates-answer{
  border:1px solid var(--sf-accent,#7b6cf6);
  border-radius:14px;
  background:rgba(0,0,0,.22);
  padding:12px 14px;
  animation:sf-answer-in .18s ease-out;
}
@keyframes sf-answer-in{
  from{opacity:0; transform:translateY(4px)}
  to{opacity:1; transform:translateY(0)}
}
@media (prefers-reduced-motion:reduce){
  .k-socrates-answer{animation:none;}
}

.k-socrates-answer.is-loading{
  color:#a9a3c4; font-size:12.5px; font-style:italic;
  border-style:dashed;
}

/* A limit is not a result. Dashed and amber so "I cannot answer that" never
   reads like a measured zero. */
.k-socrates-answer.is-limit{
  border-color:rgba(251,191,36,.5);
  border-style:dashed;
  background:rgba(251,191,36,.08);
}

.k-socrates-answer-q{
  font-size:11px; font-weight:700; letter-spacing:.03em;
  color:var(--sf-accent,#7b6cf6);
  margin-bottom:7px;
}
.k-socrates-answer-line{
  margin:0 0 5px; font-size:13px; line-height:1.55;
  color:#f4f1ff; white-space:pre-wrap;
}
.k-socrates-answer-line:last-of-type{margin-bottom:0;}

/* The evidence trail, same commitment the module makes. */
.k-socrates-answer-src{
  margin-top:9px; padding-top:8px;
  border-top:1px dashed rgba(255,255,255,.14);
  font-size:10.5px; color:#a9a3c4;
}

/* ── Go deeper ───────────────────────────────────────────────────────────── */
.k-socrates-deeper{
  display:block; text-align:center;
  padding:9px; border-radius:10px;
  border:1px solid rgba(255,255,255,.14);
  color:#c9c4e0; text-decoration:none;
  font-size:12px; font-weight:600;
}
.k-socrates-deeper:hover{
  border-color:var(--sf-accent,#7b6cf6);
  color:#fff;
}

/* ── The assistant is desktop-only ───────────────────────────────────────────
 *
 * On a phone the launcher was a floating face competing with the content for a
 * 390px-wide screen, sitting above a nav bar that already fills the bottom edge,
 * and its panel covered most of the viewport. It also did not reliably open
 * there. The teacher still reaches the assistant on mobile — it is a nav
 * destination like any other module — so nothing is lost by removing the
 * floating shortcut from the surface where it does not fit.
 *
 * 37 pages already hid it with their own `display:none !important`; this makes
 * that portal-wide instead of per-page. Kept as a single breakpoint so the
 * decision lives in one place.
 */
@media (max-width:720px){
  .k-socrates-fab,
  .k-socrates-modal,
  .k-socrates-overlay{
    display:none !important;
  }
}

/* Calendar gets a deterministic scheduling copilot instead of the generic
   analytics assistant. Its tokens are intentionally local so light mode cannot
   inherit the legacy dark panel, while Obsidian remains native. */
.k-socrates-modal.k-calendar-copilot{
  --kc-bg:#fff;
  --kc-surface:#f6f8fc;
  --kc-surface-strong:#eef2ff;
  --kc-line:#d9dfeb;
  --kc-text:#17233b;
  --kc-muted:#596985;
  --kc-accent:#5533c2;
  --kc-accent-soft:#eee9ff;
  width:min(94vw,520px);
  max-height:min(88vh,760px);
  background:var(--kc-bg);
  border-color:var(--kc-line);
  color:var(--kc-text);
  box-shadow:0 24px 70px rgba(23,35,59,.22);
}
.k-calendar-copilot .k-socrates-head{
  background:linear-gradient(135deg,#f5f2ff,#eef6ff);
  border-bottom-color:var(--kc-line);
}
.k-calendar-copilot :is(.k-socrates-title,.k-calendar-types h3,.k-calendar-form h3,.k-calendar-review-card h3){color:var(--kc-text);}
.k-calendar-copilot :is(.k-socrates-subtitle,.k-calendar-note){color:var(--kc-muted);}
.k-calendar-copilot .k-socrates-close{background:#fff;border-color:var(--kc-line);color:var(--kc-text);}
.k-calendar-copilot-body{gap:14px;background:var(--kc-bg);}
.k-calendar-chat{display:grid;gap:8px;}
.k-calendar-bubble{
  display:grid;gap:4px;padding:12px 14px;border:1px solid var(--kc-line);
  border-radius:16px 16px 16px 5px;background:var(--kc-surface-strong);color:var(--kc-text);
}
.k-calendar-bubble strong{font-size:14px}.k-calendar-bubble span{color:var(--kc-muted);font-size:12px;line-height:1.45}
.k-calendar-types h3,.k-calendar-form h3{margin:0 0 9px;font-size:12px;}
.k-calendar-choice-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.k-calendar-choice{
  display:flex;align-items:center;gap:8px;min-height:44px;padding:10px 11px;
  border:1px solid var(--kc-line);border-radius:12px;background:var(--kc-surface);
  color:var(--kc-text);font:inherit;font-size:12px;font-weight:700;text-align:left;cursor:pointer;
}
.k-calendar-choice:last-child{grid-column:1/-1}
.k-calendar-choice:hover,.k-calendar-choice.is-selected{
  border-color:var(--kc-accent);background:var(--kc-accent-soft);color:var(--kc-accent);
}
.k-calendar-form,.k-calendar-review-card{
  display:grid;gap:11px;padding:14px;border:1px solid var(--kc-line);
  border-radius:16px;background:var(--kc-surface);
}
.k-calendar-form label{display:grid;gap:5px;color:var(--kc-text);font-size:11px;font-weight:750;}
.k-calendar-form input{
  width:100%;min-height:42px;padding:9px 10px;border:1px solid var(--kc-line);
  border-radius:10px;background:var(--kc-bg);color:var(--kc-text);font:inherit;font-size:12px;
}
.k-calendar-form input::placeholder{color:color-mix(in srgb,var(--kc-muted) 72%,transparent);}
.k-calendar-form fieldset{margin:0;padding:0;border:0}
.k-calendar-form legend{margin-bottom:6px;color:var(--kc-text);font-size:11px;font-weight:750}
.k-calendar-segments{display:flex;flex-wrap:wrap;gap:6px}
.k-calendar-segment{
  padding:8px 10px;border:1px solid var(--kc-line);border-radius:999px;
  background:var(--kc-bg);color:var(--kc-muted);font:inherit;font-size:11px;font-weight:700;cursor:pointer;
}
.k-calendar-segment.is-selected{border-color:var(--kc-accent);background:var(--kc-accent-soft);color:var(--kc-accent)}
.k-calendar-date-row{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.k-calendar-actions{display:flex;gap:8px;flex-wrap:wrap}
.k-calendar-actions button{
  min-height:40px;padding:9px 13px;border:1px solid var(--kc-line);border-radius:10px;
  background:var(--kc-bg);color:var(--kc-text);font:inherit;font-size:12px;font-weight:800;cursor:pointer;
}
.k-calendar-actions :is(.k-calendar-review,.k-calendar-save){border-color:var(--kc-accent);background:var(--kc-accent);color:#fff}
.k-calendar-error{margin:0;color:#b42318;font-size:11px;font-weight:700}
.k-calendar-review-kicker{color:var(--kc-accent);font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}
.k-calendar-review-card h3{margin:0;font-size:17px}
.k-calendar-review-card dl{display:grid;gap:7px;margin:0}
.k-calendar-review-card dl div{display:grid;grid-template-columns:82px 1fr;gap:8px;padding-top:7px;border-top:1px solid var(--kc-line)}
.k-calendar-review-card dt{color:var(--kc-muted);font-size:10px;font-weight:800;text-transform:uppercase}
.k-calendar-review-card dd{margin:0;color:var(--kc-text);font-size:12px;font-weight:650}
.k-calendar-saved{margin:0;padding:9px 10px;border-radius:10px;background:#e6f7ef;color:#0f6b4f;font-size:11px;font-weight:750}
.k-calendar-note{margin:0;text-align:center;font-size:10px;font-weight:650}

:root:not([data-tetra-theme="light"]) .k-socrates-modal.k-calendar-copilot{
  --kc-bg:#17122f;--kc-surface:#211a42;--kc-surface-strong:#282052;
  --kc-line:#41366b;--kc-text:#f5f3ff;--kc-muted:#bbb5d0;
  --kc-accent:#ad98ff;--kc-accent-soft:#332861;box-shadow:0 28px 90px rgba(0,0,0,.52);
}
:root:not([data-tetra-theme="light"]) .k-calendar-copilot .k-socrates-head{
  background:linear-gradient(135deg,#211844,#151f45);
}
:root:not([data-tetra-theme="light"]) .k-calendar-copilot .k-socrates-close{background:#2a2348}
@media (max-width:720px){.k-calendar-choice-grid,.k-calendar-date-row{grid-template-columns:1fr}.k-calendar-choice:last-child{grid-column:auto}}
@media (max-width:560px){
  .k-socrates-modal{min-width:0;resize:none;}
  .k-course-copilot .k-socrates-cards{grid-template-columns:1fr;}
}

/* Course actions stay inside one Socrates conversation. Existing governed
   engines are mounted here instead of producing a second modal layer. */
.k-course-workflow-shell{display:flex;flex-direction:column;min-height:100%;gap:12px}
.k-course-workflow-bar{display:flex;align-items:center;gap:12px;padding:2px 0 10px;border-bottom:1px solid #e5e7eb}
.k-course-workflow-bar>button{width:38px;height:38px;border:1px solid #ddd6fe;border-radius:12px;background:#f5f3ff;color:#4c1d95;font-size:20px;cursor:pointer}
.k-course-workflow-bar>div{display:flex;flex-direction:column;gap:2px}
.k-course-workflow-bar strong{font-size:16px;color:#182238}
.k-course-workflow-bar span{font-size:12px;color:#667085}
.k-course-workflow-mount{min-height:280px;display:flex;flex:1;align-items:stretch}
.k-course-workflow-error{margin:auto;color:#b42318}
.k-course-philosopher-thinking{display:flex;align-items:center;gap:12px;max-width:86%;padding:12px 14px;border:1px solid #e2e7f0;border-radius:16px 16px 16px 5px;background:#fff;box-shadow:0 8px 24px rgba(31,35,62,.08)}
.k-course-philosopher-thinking .k-socrates-guide-face{width:42px;height:42px;flex:0 0 42px}
.k-course-philosopher-thinking>div{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:2px 9px}
.k-course-philosopher-thinking strong{font-size:13px;color:#182238}
.k-course-philosopher-thinking em{grid-column:1/-1;color:#667085;font-size:12px}
.k-thinking-dots{display:inline-flex;gap:3px}
.k-thinking-dots i{width:5px;height:5px;border-radius:50%;background:#7457e8;animation:kThinkingDot 1s ease-in-out infinite}
.k-thinking-dots i:nth-child(2){animation-delay:.14s}.k-thinking-dots i:nth-child(3){animation-delay:.28s}
.k-course-thinking-fallback{display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:#f3efff}
@keyframes kThinkingDot{0%,60%,100%{opacity:.25;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
.k-native-course-studio{display:flex;flex-direction:column;gap:16px}
.k-native-studio-intro{display:flex;align-items:center;gap:13px;padding:16px;border:1px solid #e3e7f0;border-radius:16px;background:linear-gradient(135deg,#faf9ff,#f5f8ff)}
.k-native-studio-orb{display:grid;place-items:center;width:46px;height:46px;flex:0 0 46px;border-radius:15px;background:#ede9fe;font-size:22px}
.k-native-studio-intro strong{color:#172238;font-size:15px}
.k-native-studio-intro p{margin:4px 0 0;color:#667085;font-size:12.5px}
.k-native-studio-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.k-native-studio-grid :is(a,button){display:flex;align-items:center;gap:12px;min-height:72px;padding:14px 16px;border:1px solid #dfe4ee;border-radius:15px;background:#fff;color:#172238;text-decoration:none;text-align:left;font:inherit;cursor:pointer;transition:.16s ease}
.k-native-studio-grid :is(a,button):hover{border-color:#8b5cf6;box-shadow:0 8px 22px rgba(83,56,180,.1);transform:translateY(-1px)}
.k-native-studio-grid :is(a,button)>span{display:grid;place-items:center;width:36px;height:36px;border-radius:11px;background:#f2efff;font-size:18px}
.k-native-studio-grid strong{font-size:13.5px}
body .k-socrates-modal.has-embedded-engine .k-socrates-body{overflow:auto}
body .k-socrates-modal.has-embedded-engine .k-socrates-composer,
body .k-socrates-modal.has-embedded-engine .k-socrates-deeper{display:none!important}
body #kSocratesAnswers #kCawOverlay.k-socrates-embedded-engine,
body #kSocratesAnswers #kClwOverlay.k-socrates-embedded-engine,
body #kSocratesAnswers #kAttendanceModal.k-socrates-embedded-engine{
  position:static!important;inset:auto!important;display:flex!important;flex:1!important;
  width:100%!important;min-height:0!important;padding:0!important;background:transparent!important;
  backdrop-filter:none!important;-webkit-backdrop-filter:none!important;animation:none!important;z-index:auto!important;
}
body #kSocratesAnswers #kCawOverlay.k-socrates-embedded-engine .caw-card,
body #kSocratesAnswers #kClwOverlay.k-socrates-embedded-engine .clw-card,
body #kSocratesAnswers #kAttendanceModal.k-socrates-embedded-engine .att-box{
  width:100%!important;max-width:none!important;max-height:none!important;min-height:0!important;
  border:1px solid #e3e7f0!important;border-radius:18px!important;box-shadow:none!important;
}
body #kSocratesAnswers #kCawOverlay.k-socrates-embedded-engine .caw-card{height:auto!important}
body #kSocratesAnswers #kClwOverlay.k-socrates-embedded-engine .clw-card{height:auto!important}
body #kSocratesAnswers #kCawOverlay.k-socrates-embedded-engine #kCawClose,
body #kSocratesAnswers #kClwOverlay.k-socrates-embedded-engine #kClwClose,
body #kSocratesAnswers #kAttendanceModal.k-socrates-embedded-engine #kAttendanceClose{display:none!important}
body #kSocratesAnswers #kCawOverlay.k-socrates-embedded-engine .caw-head{position:static!important}
body #kSocratesAnswers #kClwOverlay.k-socrates-embedded-engine .clw-head{position:static!important}
body #kSocratesAnswers #kAttendanceModal.k-socrates-embedded-engine .att-roster{max-height:340px}
@media (max-width:640px){
  .k-course-workflow-bar{position:sticky;top:0;z-index:3;background:#fff}
  .k-native-studio-grid{grid-template-columns:1fr}
  body #kSocratesAnswers #kAttendanceModal.k-socrates-embedded-engine .att-roster{max-height:none}
}
