/* ── Variables : mode sombre (défaut) ── */
:root{
  --bg:#0d0d1f;--sb:#1a1040;--card:#161633;--card2:#1b1b3d;--bdr:#252558;
  --txt:#e2e8f0;--mut:#7c8db5;--pri:#b79d72;
  --txt-soft:#a8bbd6;--txt-soft-strong:#cdd8ea;
  --qcm-exp:#94a3b8;--ai-bg:#0a0a20;--ai-input-bg:#080818;--ai-input-bdr:#1e3a5f;
  --hint-c:#334155;
}
/* ── Variables : mode clair ── */
body.light{
  --bg:#ece4d1;--sb:#ede4d2;--card:#f6f0e3;--card2:#efe7d7;--bdr:#d5c7aa;
  --txt:#332a1f;--mut:#756754;--pri:#b2873c;
  --txt-soft:#5f5343;--txt-soft-strong:#332a1f;
  --qcm-exp:#6f624e;--ai-bg:#efe7d7;--ai-input-bg:#fffdf8;--ai-input-bdr:#cbbd9d;
  --hint-c:#9c8f7a;
}
body.light .blk.warn{background:rgba(251,191,36,.08)}
body.light .blk.demo{background:rgba(56,189,248,.06)}
body.light .tab:hover{background:rgba(0,0,0,.05)}
/* Couleurs des bulles de titre en mode clair */
body.light .blk.def  .blk-h{color:#8b6a2d;background:rgba(178,135,60,.12)}
body.light .blk.thm  .blk-h{color:#065f46;background:rgba(52,211,153,.13)}
body.light .blk.prop .blk-h{color:#0e7490;background:rgba(45,212,191,.13)}
body.light .blk.meth .blk-h{color:#9a3412;background:rgba(251,146,60,.13)}
body.light .blk.ex   .blk-h{color:#7c3aed;background:rgba(167,139,250,.14)}
body.light .blk.warn .blk-h{color:#92400e;background:rgba(251,191,36,.18)}
body.light .blk.demo .blk-h{color:#075985;background:rgba(56,189,248,.14)}
body.light .blk.def  {border-color:#b2873c}
body.light .blk.thm  {border-color:#10b981}
body.light .blk.prop {border-color:#06b6d4}
body.light .blk.meth {border-color:#f97316}
body.light .blk.ex   {border-color:#a855f7}
body.light .blk.warn {border-color:#f59e0b;background:rgba(251,191,36,.1)}
body.light .blk.demo {border-color:#38bdf8;background:rgba(56,189,248,.07)}
body.light .ch-item:hover{background:rgba(0,0,0,.04)}
body.light .ch-item.active{background:rgba(178,135,60,.09)}

/* ── Reset ── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden}
body{background:var(--bg);color:var(--txt);font-family:'Segoe UI',system-ui,-apple-system,sans-serif;display:flex;height:100vh;transition:background .2s,color .2s}
body.light{
  background:#ece4d1;
}
#root{display:flex;width:100%;height:100vh;overflow:hidden}

/* ── Sidebar ── */
.sb{width:290px;min-width:290px;background:var(--sb);border-right:1px solid var(--bdr);display:flex;flex-direction:column;overflow-y:auto;transition:width .22s ease,min-width .22s ease}
.sb.sb-closed{width:52px;min-width:52px;overflow:hidden}
.sb-h{padding:1.3rem 1.2rem 0.9rem;border-bottom:1px solid var(--bdr);display:flex;align-items:flex-start;gap:.6rem}
.sb-h-txt{flex:1;min-width:0}
.sb-logo{font-size:1.2rem;font-weight:800;color:var(--pri);letter-spacing:-.4px}
.sb-sub{font-size:.8rem;color:var(--mut);margin-top:.25rem;line-height:1.45}
.sb-lbl{font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--mut);padding:.9rem 1.2rem .35rem}
.sb-lbl-group{padding-top:1rem;color:var(--txt-soft-strong)}
/* Bouton toggle sidebar */
.sb-tog{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:28px;height:28px;margin-top:.1rem;background:rgba(183,157,114,.12);border:1px solid rgba(183,157,114,.22);border-radius:7px;color:var(--pri);font-size:1.1rem;cursor:pointer;transition:background .15s}
.sb-tog:hover{background:rgba(183,157,114,.28)}
body.light .sb-tog{background:rgba(178,135,60,.1);border-color:rgba(178,135,60,.2);color:#8b6a2d}
body.light .sb-tog:hover{background:rgba(178,135,60,.18)}
/* Toggle lone (sidebar fermée) */
.sb-tog-lone{display:flex;align-items:center;justify-content:center;width:34px;height:34px;margin:.9rem auto 0;background:rgba(183,157,114,.12);border:1px solid rgba(183,157,114,.22);border-radius:8px;color:var(--pri);font-size:1.2rem;cursor:pointer;transition:background .15s}
.sb-tog-lone:hover{background:rgba(183,157,114,.28)}
body.light .sb-tog-lone{background:rgba(178,135,60,.1);border-color:rgba(178,135,60,.2);color:#8b6a2d}

/* ── Bouton retour accueil ── */
.home-btn{
  display:flex;align-items:center;gap:.4rem;
  margin:.6rem .9rem .1rem;padding:.45rem .85rem;
  background:rgba(183,157,114,.1);border:1px solid rgba(183,157,114,.25);
  border-radius:8px;color:var(--pri);font-size:.82rem;font-weight:600;
  cursor:pointer;text-decoration:none;transition:background .15s;
}
.home-btn:hover{background:rgba(183,157,114,.2)}
body.light .home-btn{background:rgba(178,135,60,.1);border-color:rgba(178,135,60,.2);color:#8b6a2d}
body.light .home-btn:hover{background:rgba(178,135,60,.16)}

/* ── Liste chapitres ── */
.ch-item{display:flex;flex-direction:column;gap:.25rem;padding:.65rem 1.1rem;cursor:pointer;border-left:3px solid transparent;transition:background .12s}
.ch-item:hover{background:rgba(255,255,255,.04)}
.ch-item.active{background:rgba(183,157,114,.09)}
.ch-row{display:flex;align-items:center;gap:.55rem}
.ch-num{font-size:.72rem;font-weight:800;width:24px;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.ch-name{font-size:.86rem;font-weight:600;line-height:1.3;flex:1}
.pg-wrap{height:3px;background:var(--bdr);border-radius:99px;overflow:hidden}
.pg-fill{height:100%;border-radius:99px;transition:width .4s}
.pg-lbl{font-size:.67rem;color:var(--mut)}

/* ── Main area ── */
.main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0}
.topbar{background:var(--sb);border-bottom:1px solid var(--bdr);padding:.75rem 2rem;display:flex;align-items:center;gap:.7rem;flex-shrink:0}
.topbar-num{font-size:.8rem;font-weight:800;padding:.2rem .6rem;border-radius:6px}
.topbar-link{
  display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;
  min-height:34px;padding:.36rem .82rem;border-radius:10px;
  text-decoration:none;font-size:.85rem;font-weight:700;
  color:#0f172a !important;background:#ffffff !important;border:1px solid rgba(255,255,255,.76) !important;
  box-shadow:0 10px 24px rgba(2,6,23,.18);
  transition:transform .15s,background .15s,border-color .15s,color .15s,box-shadow .15s;
}
.topbar-link:hover{
  transform:translateY(-1px);
  background:#ffffff !important;
  border-color:#ffffff !important;
  color:#020617 !important;
  box-shadow:0 14px 28px rgba(2,6,23,.24);
}
body.light .topbar-link{
  color:#0f172a !important;background:#ffffff !important;border-color:rgba(203,213,225,.92) !important;
  box-shadow:0 10px 24px rgba(148,163,184,.18);
}
body.light .topbar-link:hover{
  background:#ffffff !important;
  border-color:#cbd5e1 !important;
  color:#020617 !important;
  box-shadow:0 14px 28px rgba(148,163,184,.24);
}
.topbar-title{font-size:1.16rem;font-weight:700;flex:1}
.topbar-track{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:30px;padding:.24rem .78rem;border-radius:999px;border:1px solid transparent;
  font-size:.76rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase;
  flex-shrink:0;
}
.theme-btn{background:var(--card2);border:1px solid var(--bdr);border-radius:8px;padding:.38rem .8rem;cursor:pointer;font-size:.88rem;color:var(--mut);transition:background .15s,color .15s;flex-shrink:0}
.theme-btn:hover{background:var(--bdr);color:var(--txt)}
.tabs{display:flex;gap:.2rem;padding:.55rem 2rem;border-bottom:1px solid var(--bdr);background:var(--sb);flex-shrink:0}
.tab{padding:.45rem 1.1rem;border-radius:8px;border:none;background:transparent;color:var(--mut);font-size:.94rem;font-weight:500;cursor:pointer;transition:background .12s,color .12s}
.tab:hover{background:rgba(255,255,255,.06);color:var(--txt)}
.tab.on{background:rgba(183,157,114,.15);color:var(--pri);font-weight:700}
.scroll{flex:1;overflow-y:auto;padding:1.8rem 2.2rem}

/* ── Cartes de section ── */
.card{background:var(--card);border:1px solid var(--bdr);border-radius:14px;padding:1.5rem 1.6rem;margin-bottom:1.4rem}

/* ── Titre de section §1 — GRAND ── */
.card-t{
  font-size:1.72rem;font-weight:900;margin-bottom:1rem;
  display:flex;align-items:center;gap:.5rem;
  letter-spacing:-.02em;line-height:1.2;
}

.stxt{color:var(--txt-soft);line-height:2.06;font-size:1.12rem;margin-bottom:.85rem}
.stxt strong{color:var(--txt-soft-strong)}

/* ── Blocs (def / thm / prop / meth / ex / warn / demo) ── */
.blk{
  border-left:4px solid var(--bdr);border-radius:0 10px 10px 0;
  margin:.85rem 0;background:var(--card2);overflow:hidden;
}

/* ── En-tête bulle ── */
.blk-h{
  font-size:1.14rem;font-weight:800;
  padding:.6rem 1.1rem;
  display:flex;align-items:center;gap:.45rem;
  margin-bottom:0;
  border-bottom:1px solid rgba(255,255,255,.06);
  letter-spacing:-.01em;
}
body.light .blk-h{border-bottom:1px solid rgba(0,0,0,.06)}

/* Couleurs des bulles sombre */
.blk.def  {border-color:#818cf8}.blk.def  .blk-h{color:#c7d2fe;background:rgba(129,140,248,.18)}
.blk.thm  {border-color:#34d399}.blk.thm  .blk-h{color:#6ee7b7;background:rgba(52,211,153,.15)}
.blk.prop {border-color:#2dd4bf}.blk.prop .blk-h{color:#5eead4;background:rgba(45,212,191,.14)}
.blk.meth {border-color:#fb923c}.blk.meth .blk-h{color:#fdba74;background:rgba(251,146,60,.15)}
.blk.ex   {border-color:#c084fc}.blk.ex   .blk-h{color:#e9d5ff;background:rgba(192,132,252,.15)}
.blk.warn {border-color:#fbbf24;background:rgba(251,191,36,.06)}.blk.warn .blk-h{color:#fef08a;background:rgba(251,191,36,.18)}
.blk.demo {border-color:#38bdf8;border-style:dashed;background:rgba(56,189,248,.04)}.blk.demo .blk-h{color:#bae6fd;background:rgba(56,189,248,.15)}

/* Corps du bloc */
.blk-b{font-size:1.1rem;color:var(--txt-soft);line-height:2.02;padding:.95rem 1.12rem}
.blk-b strong{color:var(--txt-soft-strong)}

.math-figure{
  width:100%;max-width:520px;
  margin:1rem auto .35rem;padding:1rem;border-radius:16px;
  border:1px solid rgba(183,157,114,.24);
  background:
    radial-gradient(circle at top right, rgba(183,157,114,.12), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}
.math-figure-top{display:flex;align-items:center;justify-content:flex-start;margin-bottom:.7rem}
.math-figure-tag{
  display:inline-flex;align-items:center;padding:.24rem .62rem;border-radius:999px;
  background:rgba(183,157,114,.14);border:1px solid rgba(183,157,114,.26);
  color:#e7d8bb;font-size:.72rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase
}
.math-figure-canvas{
  padding:.45rem;border-radius:12px;overflow:hidden;
  border:1px solid rgba(255,255,255,.06);
  background:linear-gradient(180deg, rgba(7,14,34,.82), rgba(15,23,42,.42));
}
.math-figure svg{display:block;width:100%;height:auto}
.math-figure-cap{margin-top:.72rem;color:var(--txt-soft);font-size:.95rem;line-height:1.75}

.math-figure .mf-axis{stroke:#e2e8f0;stroke-width:2.2;stroke-linecap:round;opacity:.92}
.math-figure .mf-grid{stroke:rgba(148,163,184,.22);stroke-width:1}
.math-figure .mf-curve{fill:none;stroke:#7dd3fc;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}
.math-figure .mf-curve-alt{fill:none;stroke:#a78bfa;stroke-width:4;stroke-linecap:round;stroke-linejoin:round}
.math-figure .mf-tangent{stroke:#f59e0b;stroke-width:3.2;stroke-linecap:round}
.math-figure .mf-line{stroke:#fda4af;stroke-width:3;stroke-linecap:round}
.math-figure .mf-dash{stroke:#94a3b8;stroke-width:2;stroke-dasharray:6 6;stroke-linecap:round}
.math-figure .mf-fill{fill:rgba(52,211,153,.22);stroke:rgba(52,211,153,.6);stroke-width:1.5}
.math-figure .mf-rect{fill:rgba(125,132,248,.18);stroke:#818cf8;stroke-width:1.5}
.math-figure .mf-plane{fill:rgba(45,212,191,.18);stroke:#2dd4bf;stroke-width:2}
.math-figure .mf-vector{stroke:#f59e0b;stroke-width:3;stroke-linecap:round}
.math-figure .mf-point{fill:#f8fafc;stroke:#0f172a;stroke-width:2}
.math-figure .mf-label{
  fill:#e2e8f0;font-size:15px;font-weight:700;
  paint-order:stroke;stroke:rgba(2,6,23,.78);stroke-width:3px;stroke-linejoin:round
}
.math-figure .mf-title{
  fill:#cbd5e1;font-size:16px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;
  paint-order:stroke;stroke:rgba(2,6,23,.72);stroke-width:3px;stroke-linejoin:round
}

body.light .math-figure{
  border-color:rgba(178,135,60,.16);
  background:
    radial-gradient(circle at top right, rgba(178,135,60,.07), transparent 36%),
    linear-gradient(180deg, rgba(250,246,238,.98), rgba(241,232,214,.95));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9);
}
body.light .math-figure-tag{
  background:rgba(178,135,60,.1);border-color:rgba(178,135,60,.2);color:#8b6a2d
}
body.light .math-figure-canvas{
  border-color:rgba(213,199,170,.55);
  background:linear-gradient(180deg, rgba(255,251,242,.98), rgba(243,234,216,.9));
}
body.light .math-figure .mf-axis{stroke:#1e293b}
body.light .math-figure .mf-grid{stroke:rgba(100,116,139,.18)}
body.light .math-figure .mf-point{fill:#ffffff;stroke:#cbd5e1}
body.light .math-figure .mf-label,
body.light .math-figure .mf-title{fill:#334155;stroke:rgba(255,255,255,.9)}

/* ── QCM ── */
.tab.tab-summary{
  border:1px solid rgba(183,157,114,.24);
  background:rgba(183,157,114,.08);
  color:var(--pri);
  font-weight:700;
}
.tab.tab-summary:hover{background:rgba(183,157,114,.16)}
body.light .tab.tab-summary{
  border-color:rgba(178,135,60,.2);
  background:rgba(178,135,60,.1);
  color:#8b6a2d;
}

.summary-card{
  scroll-margin-top:1rem;
  border-color:rgba(183,157,114,.22);
  background:
    radial-gradient(circle at top right, rgba(183,157,114,.08), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
}
.summary-kicker{
  display:inline-flex;align-items:center;
  padding:.26rem .68rem;margin-bottom:.8rem;
  border-radius:999px;
  background:rgba(183,157,114,.12);
  border:1px solid rgba(183,157,114,.24);
  color:#e7d8bb;font-size:.75rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;
}
.summary-intro{
  color:var(--txt-soft);
  font-size:1rem;
  line-height:1.8;
  margin:-.15rem 0 1rem;
}
.summary-panel{
  border:1px solid var(--bdr);
  border-radius:14px;
  overflow:hidden;
  background:var(--card2);
}
.summary-section{
  border-top:1px solid rgba(255,255,255,.06);
}
.summary-section:first-child{border-top:none}
.summary-section-title{
  padding:.92rem 1.05rem .8rem;
  font-size:1rem;
  font-weight:800;
  letter-spacing:.01em;
  background:rgba(255,255,255,.03);
  border-bottom:1px solid rgba(255,255,255,.04);
}
.summary-line{
  display:flex;
  align-items:flex-start;
  gap:.9rem;
  padding:1rem 1.05rem;
  border-top:1px solid rgba(255,255,255,.06);
}
.summary-line:first-child{border-top:none}
.summary-mark{
  width:.62rem;
  height:.62rem;
  flex-shrink:0;
  border-radius:999px;
  margin-top:.78rem;
  box-shadow:0 0 0 4px rgba(255,255,255,.04);
}
.summary-text{
  flex:1;
  color:var(--txt-soft);
  font-size:1.04rem;
  line-height:1.9;
  overflow-wrap:anywhere;
}
.summary-text .katex-display{
  overflow-x:auto;
  overflow-y:hidden;
  padding:.1rem 0 .25rem;
}
body.light .summary-card{
  border-color:rgba(178,135,60,.16);
  background:
    radial-gradient(circle at top right, rgba(178,135,60,.06), transparent 28%),
    linear-gradient(180deg, rgba(250,246,238,.98), rgba(242,233,217,.94));
}
body.light .summary-kicker{
  background:rgba(178,135,60,.1);
  border-color:rgba(178,135,60,.18);
  color:#8b6a2d;
}
body.light .summary-section{
  border-top:1px solid rgba(213,199,170,.42);
}
body.light .summary-section-title{
  background:rgba(178,135,60,.05);
  border-bottom:1px solid rgba(213,199,170,.34);
}
body.light .summary-line{border-top:1px solid rgba(213,199,170,.42)}
body.light .summary-mark{box-shadow:0 0 0 4px rgba(178,135,60,.08)}

.qcm-card{background:var(--card);border:1px solid var(--bdr);border-radius:12px;padding:1.4rem 1.5rem;margin-bottom:1.1rem}
.qcm-q{font-weight:600;margin-bottom:.75rem;font-size:1.12rem;line-height:1.88}
.qcm-o{display:flex;flex-direction:column;gap:.4rem}
.qcm-btn{background:var(--card2);border:1px solid var(--bdr);border-radius:8px;padding:.68rem 1rem;color:var(--txt);font-size:1.04rem;cursor:pointer;text-align:left;transition:border-color .15s,background .15s}
.qcm-btn:hover{border-color:var(--pri)}
.qcm-btn.ok{border-color:#34d399;background:rgba(52,211,153,.1)}
.qcm-btn.ko{border-color:#f87171;background:rgba(248,113,113,.1)}
.qcm-exp{margin-top:.55rem;font-size:.95rem;color:var(--qcm-exp);line-height:1.7;padding:.55rem .8rem;background:rgba(255,255,255,.03);border-radius:6px}

/* ── Exercices guidés ── */
.gu-card{background:var(--card);border:1px solid var(--bdr);border-radius:12px;padding:1.4rem 1.5rem;margin-bottom:1.1rem}
.gu-title{font-weight:800;font-size:1.16rem;margin-bottom:.55rem}
.gu-stmt{color:var(--txt-soft);font-size:1.08rem;line-height:2;margin-bottom:.75rem}
.step-box{background:var(--card2);border:1px solid var(--bdr);border-radius:8px;margin-bottom:.6rem;overflow:hidden}
.step-top{display:flex;justify-content:space-between;align-items:center;padding:.6rem .9rem;cursor:pointer}
.step-lbl{font-size:.95rem;font-weight:700;color:var(--pri)}
.step-hint{font-size:.92rem;color:var(--mut);font-style:italic}
.step-toggle{font-size:.75rem;color:var(--pri);background:rgba(183,157,114,.15);border:none;border-radius:5px;padding:.28rem .65rem;cursor:pointer}
.step-sol{padding:.7rem 1rem;font-size:1rem;color:var(--txt-soft);line-height:1.94;border-top:1px solid var(--bdr)}

/* ── KaTeX & listes ── */
.katex-display{margin:.6rem 0 !important}
ul,ol{margin-left:1.3em;margin-bottom:.55em}
li{margin-bottom:.45em;font-size:1rem}

/* ── AI Helper ── */
.ai-toggle{display:inline-flex;align-items:center;gap:.35rem;background:rgba(56,189,248,.1);border:1px solid rgba(56,189,248,.25);color:#7dd3fc;border-radius:8px;padding:.35rem .8rem;font-size:.8rem;cursor:pointer;margin-top:.6rem;transition:background .15s;font-family:inherit}
.ai-toggle:hover{background:rgba(56,189,248,.2)}
.ai-panel{background:var(--ai-bg);border:1px solid #38bdf8;border-radius:10px;margin-top:.65rem;display:flex;flex-direction:column;overflow:hidden}
.ai-panel.ai-big .ai-messages{max-height:380px !important}
.ai-header{display:flex;justify-content:space-between;align-items:center;padding:.5rem .9rem;background:rgba(56,189,248,.08);font-size:.82rem;font-weight:700;color:#7dd3fc;flex-shrink:0}
.ai-header-btns{display:flex;gap:.3rem}
.ai-header-btns button{background:rgba(56,189,248,.15);border:none;color:#7dd3fc;cursor:pointer;font-size:.78rem;border-radius:4px;padding:.18rem .5rem;transition:background .12s}
.ai-header-btns button:hover{background:rgba(56,189,248,.3)}
.ai-messages{flex:1;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y;padding:.65rem .9rem;display:flex;flex-direction:column;gap:.5rem;min-height:60px;max-height:180px;min-width:0;transition:max-height .25s ease}
.ai-msg{font-size:.9rem;line-height:1.7;padding:.5rem .8rem;border-radius:8px;white-space:pre-wrap;word-break:break-word}
.ai-msg.user{background:rgba(124,132,248,.18);color:#c7d2fe;align-self:flex-end;max-width:88%;border-bottom-right-radius:2px}
.ai-msg.assistant{background:rgba(56,189,248,.07);color:#bae6fd;align-self:flex-start;max-width:97%;border-bottom-left-radius:2px}
body.light .ai-msg.user{color:#6b21a8}
body.light .ai-msg.assistant{color:#6e5727}
.ai-hint{color:var(--hint-c);font-size:.82rem;font-style:italic;text-align:center;padding:.45rem}
.ai-loading{opacity:.7;animation:pulse 1.2s infinite}
@keyframes pulse{0%,100%{opacity:.7}50%{opacity:1}}
.ai-input-row{display:flex;gap:.4rem;padding:.55rem .9rem;border-top:1px solid rgba(56,189,248,.15);flex-shrink:0}
.ai-input{flex:1;background:var(--ai-input-bg);border:1px solid var(--ai-input-bdr);border-radius:7px;color:var(--txt);font-size:.9rem;padding:.45rem .7rem;resize:none;font-family:inherit;line-height:1.5}
.ai-input:focus{outline:none;border-color:#38bdf8}
.ai-send{background:#38bdf8;color:#020617;border:none;border-radius:7px;padding:.45rem .9rem;cursor:pointer;font-weight:800;font-size:1.05rem;flex-shrink:0;transition:opacity .15s}
.ai-send:disabled{opacity:.4;cursor:not-allowed}

/* Warm light-mode override */
body.light .sb,
body.light .topbar,
body.light .tabs{
  background:#ede4d2;
}
body.light .card,
body.light .qcm-card,
body.light .gu-card,
body.light .summary-panel,
body.light .blk,
body.light .step-box{
  background:#f4edde;
  border-color:#d5c7aa;
}
body.light .pg-wrap{
  background:#dbcdb3;
}
body.light .theme-btn:hover{
  background:#e7dcc6;
}
body.light .qcm-exp{
  background:rgba(178,135,60,.06);
}
body.light .step-toggle{
  color:#8b6a2d;
  background:rgba(178,135,60,.12);
}
body.light .ai-toggle{
  background:rgba(178,135,60,.1);
  border-color:rgba(178,135,60,.25);
  color:#8b6a2d;
}
body.light .ai-toggle:hover{
  background:rgba(178,135,60,.18);
}
body.light .ai-panel{
  background:#efe7d7;
  border-color:#c6af7d;
}
body.light .ai-header{
  background:rgba(178,135,60,.08);
  color:#8b6a2d;
}
body.light .ai-header-btns button{
  background:rgba(178,135,60,.14);
  color:#8b6a2d;
}
body.light .ai-header-btns button:hover{
  background:rgba(178,135,60,.24);
}
body.light .ai-msg.assistant{
  background:#efe3c7;
}
body.light .ai-input-row{
  border-top-color:#ddd0b5;
}
body.light .ai-input{
  background:#fffdf8;
  border-color:#cbbd9d;
}
body.light .ai-input:focus{
  border-color:#a67b32;
}
body.light .ai-send{
  background:#a67b32;
  color:#fffaf0;
}
