:root{
  --blue:#00AEEF;
  --ink:#202124;
  --muted:#6f7377;
  --line:#dfe3eb;
  --page:#eef1fb;
  --paper:#fff;
  --soft:#f6f8fc;
  --shadow:0 10px 30px rgba(31,35,41,.08);
  --radius:22px;
}
*{box-sizing:border-box}
body{margin:0;font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--ink);background:var(--page);height:100vh;overflow:hidden}
button,input,textarea,select{font:inherit}
button{border:0;cursor:pointer;background:#edf3ff;color:#16427d;border-radius:999px;padding:.6rem .85rem;font-weight:750}
button:hover{filter:brightness(.97)}
button.primary{background:var(--blue);color:#fff}
button.ghost{background:#fff;border:1px solid var(--line);color:#2d3135}
#app.shell,.shell{width:100%;height:100vh;margin:0;padding:0}
.workspace{height:100vh;display:grid;grid-template-columns:minmax(280px,25vw) minmax(420px,1fr) minmax(300px,25vw);gap:12px;padding:0 16px 14px 16px}
.pane{background:var(--paper);border:1px solid var(--line);border-radius:0 0 var(--radius) var(--radius);display:flex;flex-direction:column;min-height:0;box-shadow:var(--shadow);overflow:hidden}.pane.center{border-radius:0 0 24px 24px}.pane-head{height:60px;display:flex;align-items:center;justify-content:space-between;padding:0 20px;border-bottom:1px solid var(--line)}.pane-head h2{font-size:1.15rem;margin:0}.pane-tools{display:flex;gap:.4rem;align-items:center}.icon-btn{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:#f1f3f7;color:#444;padding:0}.pane-body{padding:18px;overflow:auto;min-height:0;flex:1}.source-search{border:1px solid var(--line);border-radius:18px;background:#fbfcff;padding:12px;margin-bottom:14px}.source-search input{width:100%;border:0;outline:0;background:transparent;font-size:.95rem}.source-actions{display:flex;gap:.5rem;margin-top:12px}.source-actions button{background:#fff;border:1px solid var(--line);color:#2d3135}.source-card{display:flex;gap:.75rem;align-items:flex-start;border:1px solid var(--line);border-radius:16px;background:#fff;padding:12px;margin-bottom:10px}.source-card:hover{border-color:#b8ddef;box-shadow:0 6px 18px rgba(0,174,239,.08)}.source-icon{width:32px;height:32px;border-radius:10px;background:#edf8fd;color:#067aa3;display:grid;place-items:center;font-weight:900;flex:0 0 auto}.source-card strong{display:block;font-size:.94rem}.source-card small{display:block;color:var(--muted);margin-top:3px}.empty-state{height:50%;display:grid;place-items:center;text-align:center;color:var(--muted);padding:1rem}.empty-state .big{font-size:2rem;color:#777}.chat-body{display:flex;flex-direction:column;gap:16px;height:100%}.messages{flex:1;overflow:auto;padding:4px 8px 0 0}.message{max-width:82%;border-radius:22px;padding:12px 14px;line-height:1.45;margin:0 0 12px 0;white-space:pre-wrap}.message.assistant{background:#fff;border:1px solid #edf0f4}.message.user{background:#f1f3f4;margin-left:auto}.suggestions{display:flex;flex-direction:column;gap:10px;align-items:flex-start}.suggestions button{background:#f7f7f8;color:#303236;border-radius:14px;padding:.75rem 1rem;font-weight:500}.composer{display:flex;align-items:center;gap:10px;border:1px solid #d6deeb;border-radius:18px;background:#fff;padding:12px 14px;margin-top:auto}.composer textarea{min-height:38px;max-height:110px;resize:none;flex:1;border:0;outline:0;padding:0;font-size:1rem}.composer-meta{font-size:.84rem;color:var(--muted);white-space:nowrap}.send-btn{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;font-size:1.4rem;padding:0;background:#e7e9ed;color:#4a4d51}.studio-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}.studio-tile{min-height:70px;border-radius:14px;display:flex;align-items:center;justify-content:space-between;gap:.6rem;padding:14px;font-weight:850;text-align:left}.studio-tile span{display:block;font-size:.9rem}.studio-tile small{display:block;font-size:1.15rem}.tile-audio{background:#e9eefc;color:#163c8c}.tile-deck{background:#f3f1df;color:#655610}.tile-video{background:#dff2e4;color:#0d6531}.tile-map{background:#f2e7f0;color:#873175}.tile-report{background:#f1f1e4;color:#6b5c17}.tile-flash{background:#f7e9e9;color:#9d2828}.tile-quiz{background:#def3f9;color:#00739c}.tile-info{background:#f0e7f0;color:#7d317d}.tile-data{background:#e9eefc;color:#173d88}.studio-output{margin-top:18px;border-top:1px solid var(--line);padding-top:18px;min-height:220px;display:grid;place-items:center;text-align:center;color:#3b3e42}.studio-output .spark{font-size:2rem}.card{background:#fff;border:1px solid var(--line);border-radius:22px;padding:1.15rem;box-shadow:var(--shadow)}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:1rem}.list{display:grid;gap:.75rem}.row{display:flex;justify-content:space-between;gap:1rem;align-items:center;border:1px solid var(--line);border-radius:16px;background:#fff;padding:.85rem}.muted{color:var(--muted)}.eyebrow{font-size:.72rem;text-transform:uppercase;letter-spacing:.08em;font-weight:900;color:#007da9}.stat{font-size:2.2rem;font-weight:950}.progress{height:12px;border-radius:999px;background:#e3eef4;overflow:hidden}.bar{height:100%;background:var(--blue);width:0}.toolbar{display:flex;gap:.5rem;flex-wrap:wrap;margin:1rem 0}.term,.pill{display:inline-block;border-radius:999px;background:#eef8fc;color:#07506b;padding:.35rem .65rem;margin:.2rem;font-weight:850}.choices{display:grid;gap:.65rem}.choice{border:1px solid var(--line);border-radius:16px;background:#fff;padding:.9rem;cursor:pointer}.choice.selected{border-color:var(--blue);box-shadow:0 0 0 3px rgba(0,174,239,.18)}.choice.correct{border-color:#138a45;background:#ecfdf5}.choice.wrong{border-color:#c52828;background:#fef2f2}textarea{width:100%;min-height:120px;border:1px solid var(--line);border-radius:18px;padding:.85rem}.login-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#edf6fb 0%,#f8f9ff 100%);padding:1rem}.login-card{background:#fff;border:1px solid var(--line);border-radius:24px;padding:2.5rem 2rem;box-shadow:0 8px 32px rgba(0,0,0,.08);max-width:420px;width:100%;text-align:center}.login-logo{font-size:2.5rem;color:var(--blue);margin-bottom:.5rem}.login-title{font-size:1.6rem;font-weight:800;margin:0 0 .4rem}.login-sub{color:var(--muted);font-size:.95rem;margin:0 0 1.8rem}.login-btns{display:flex;flex-direction:column;gap:.75rem}.oauth-btn{display:flex;align-items:center;justify-content:center;gap:.65rem;width:100%;padding:.85rem 1.2rem;border-radius:12px;border:1.5px solid var(--line);background:#fff;font-size:1rem;font-weight:600;color:#202124;text-decoration:none;cursor:pointer;transition:box-shadow .15s,border-color .15s}.oauth-btn:hover{box-shadow:0 4px 14px rgba(0,0,0,.1);border-color:#bbb}.oauth-btn-google:hover{border-color:#4285F4}.oauth-btn-microsoft:hover{border-color:#00a4ef}.oauth-btn-dev{color:var(--muted);font-weight:500;font-size:.9rem;border-style:dashed}.oauth-divider{display:flex;align-items:center;gap:.75rem;margin:.25rem 0;color:var(--muted);font-size:.85rem}.oauth-divider::before,.oauth-divider::after{content:'';flex:1;height:1px;background:var(--line)}.login-fine{font-size:.78rem;color:var(--muted);margin:1.4rem 0 0}.login-fine a{color:var(--blue)}.signout-btn{font-size:.85rem;padding:.35rem .85rem}.course-switch-link{background:none;border:none;color:var(--blue);font-size:.75rem;font-weight:600;cursor:pointer;padding:.1rem .4rem;border-radius:6px;text-decoration:underline;margin-left:.4rem}.course-switch-link:hover{background:rgba(0,174,239,.08)}.course-sel-page{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#edf6fb 0%,#f8f9ff 100%);padding:1rem}.course-sel-card{background:#fff;border:1px solid var(--line);border-radius:24px;padding:2.5rem 2rem;box-shadow:0 8px 32px rgba(0,0,0,.08);max-width:560px;width:100%;text-align:center}.course-sel-title{font-size:1.6rem;font-weight:800;margin:0 0 .4rem}.course-sel-sub{color:var(--muted);font-size:.95rem;margin:0 0 1.8rem}.course-sel-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.course-opt{display:flex;flex-direction:column;align-items:flex-start;gap:.3rem;padding:1.2rem 1.1rem;border:2px solid var(--line);border-radius:16px;background:#fff;cursor:pointer;text-align:left;transition:box-shadow .15s,border-color .15s;min-height:120px}.course-opt:hover:not(:disabled){box-shadow:0 4px 16px rgba(0,0,0,.1);border-color:var(--blue)}.course-opt-active{border-color:var(--blue);box-shadow:0 0 0 3px rgba(0,174,239,.18)}.course-opt-disabled{opacity:.5;cursor:not-allowed}.course-opt-icon{font-size:1.8rem}.course-opt-title{font-size:1rem;font-weight:700;color:var(--ink)}.course-opt-sub{font-size:.82rem;color:var(--muted)}.course-opt-detail{font-size:.78rem;color:var(--muted);margin-top:.2rem}@media(max-width:500px){.course-sel-grid{grid-template-columns:1fr}}.toast{position:fixed;bottom:1rem;right:1rem;background:#071421;color:white;border-radius:16px;padding:.9rem 1rem;opacity:0;transform:translateY(10px);transition:.2s;box-shadow:var(--shadow);z-index:30}.toast.show{opacity:1;transform:translateY(0)}.page-wrap{height:100%;overflow:auto;padding:18px}.lesson{max-width:900px;margin:auto}
@media(max-width:1100px){body{overflow:auto}.workspace{height:auto;min-height:100vh;grid-template-columns:1fr}.pane{border-radius:20px}.studio-grid{grid-template-columns:1fr 1fr}.shell,#app.shell{height:auto}}
@media(max-width:700px){.workspace{padding:10px}.studio-grid{grid-template-columns:1fr}.message{max-width:94%}}
/* ── Mobile workspace tab nav ──────────────────────────────────── */
.ws-mob-nav{display:none}
@media(max-width:768px){
  .workspace{display:flex;flex-direction:column;height:100vh;padding:0!important;gap:0}
  .ws-topbar{flex-shrink:0}
  .ws-panels{flex:1;overflow:hidden;position:relative;display:block}
  .ws-panels>.pane{position:absolute;inset:0;border-radius:0!important;height:100%!important;transition:opacity .15s}
  .ws-pane-hidden{display:none!important}
  .ws-mob-nav{display:flex;flex-shrink:0;background:#fff;border-top:1px solid var(--line);padding:0;height:56px}
  .ws-mob-tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;font-size:.7rem;font-weight:600;color:var(--muted);background:none;border:none;gap:2px;padding:4px 0;cursor:pointer;border-top:2px solid transparent;transition:color .15s,border-color .15s}
  .ws-mob-tab-active{color:var(--blue);border-top-color:var(--blue)}
}

/* ── State banner ───────────────────────────────────────────────── */
.state-banner{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem .75rem;background:#edf8fd;border-bottom:1px solid #b8e0ef;padding:.55rem 20px;font-size:.82rem;color:#0b4f6c;position:relative}
.state-banner-empty{background:#f6f8fc;border-bottom:1px solid var(--line);color:var(--muted)}
.state-banner-vendor{font-weight:400;color:#3a7fa3}
.state-banner-sep{color:#aaa}
.state-banner-btn{background:none;border:none;color:var(--blue);font-size:.82rem;font-weight:600;cursor:pointer;padding:0;text-decoration:underline}
.state-topics{display:none;width:100%;padding:.5rem 0 .25rem;border-top:1px solid #b8e0ef;margin-top:.3rem}
.state-topics.state-topics-open{display:block}
.state-topics ul{margin:0 0 .5rem 1.1rem;padding:0;font-size:.8rem;color:#0b4f6c;line-height:1.7;columns:2}
.state-outline-link{font-size:.78rem;color:var(--blue)}
.state-dropdown{width:100%;padding:.8rem 1rem;border:1.5px solid var(--line);border-radius:12px;font-size:1rem;background:#fff;margin-top:.5rem;cursor:pointer}
.state-dropdown:focus{outline:none;border-color:var(--blue)}

/* ── Workspace top bar ──────────────────────────────────────────── */
.workspace{display:flex;flex-direction:column;height:100vh}
.ws-topbar{display:flex;align-items:center;gap:12px;padding:6px 14px;
  background:var(--bg);border-bottom:1px solid var(--border);flex-shrink:0;min-height:36px}
.ws-back-btn{font-size:.75rem;color:var(--text-muted);background:none;border:none;
  cursor:pointer;padding:3px 6px;border-radius:5px}
.ws-back-btn:hover{background:var(--border);color:var(--text)}
.ws-topbar-title{font-size:.78rem;font-weight:600;color:var(--text-muted)}
.ws-panels{display:flex;flex:1;overflow:hidden}

/* ── Dashboard page ─────────────────────────────────────────────── */
.dash-page{min-height:100vh;background:var(--bg)}
.dash-topbar-home{display:flex;align-items:center;justify-content:space-between;
  padding:10px 20px;border-bottom:1px solid var(--border);background:var(--bg-card)}
.dash-brand{font-size:.88rem;font-weight:700;color:var(--text)}
.dash-ws-btn{font-size:.78rem;padding:6px 14px}
.dash-wrap{max-width:820px;margin:0 auto;padding:20px 16px 40px}
.dash-welcome{font-size:1.3rem;font-weight:700;margin:0 0 16px;color:var(--text)}

/* Hero row: ring + stats + chart */
.dash-hero{display:flex;align-items:flex-start;gap:16px;flex-wrap:wrap;
  background:var(--bg-card);border:1px solid var(--border);border-radius:12px;
  padding:18px;margin-bottom:20px}
.dash-hero-ring{display:flex;flex-direction:column;align-items:center;gap:6px;flex-shrink:0}
.dash-ring-svg{width:90px;height:90px}
.dash-ring-label{font-size:.72rem;font-weight:700;text-align:center;letter-spacing:.02em}

.dash-hero-stats{display:flex;gap:10px;flex-wrap:wrap;flex:1}
.dash-stat-card{min-width:70px;background:var(--bg);border:1px solid var(--border);
  border-radius:8px;padding:10px 12px;text-align:center}
.dash-stat-num{font-size:1.3rem;font-weight:800;line-height:1;color:var(--text)}
.dash-stat-lbl{font-size:.65rem;color:var(--text-muted);margin-top:4px;line-height:1.3}
.stat-pass .dash-stat-num{color:#10b981}
.stat-warn .dash-stat-num{color:#f59e0b}

.dash-quiz-chart{display:flex;flex-direction:column;gap:4px;flex-shrink:0}
.dash-chart-lbl{font-size:.68rem;color:var(--text-muted);font-weight:600;letter-spacing:.04em;text-transform:uppercase}
.dash-bars{display:flex;align-items:flex-end;gap:4px;height:60px}
.dash-bar-wrap{display:flex;flex-direction:column;align-items:center;gap:2px}
.dash-bar{width:16px;border-radius:3px 3px 0 0;min-height:4px}
.dash-bar-lbl{font-size:.58rem;color:var(--text-muted)}

/* Sections */
.dash-section{margin-bottom:20px}
.dash-section-title{font-size:.78rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;
  color:var(--text-muted);margin:0 0 10px}
.dash-pill{display:inline-block;background:var(--border);color:var(--text-muted);
  border-radius:99px;padding:1px 8px;font-size:.7rem;font-weight:600;margin-left:6px}

/* Module progress grid */
.dash-mod-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
.dash-mod-card{background:var(--bg-card);border:1px solid var(--border);border-radius:10px;
  padding:12px 14px;text-align:left;cursor:pointer;transition:border-color .15s}
.dash-mod-card:hover{border-color:var(--accent,#6366f1)}
.dash-mod-hdr{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:8px;gap:6px}
.dash-mod-name{font-size:.78rem;font-weight:600;color:var(--text);line-height:1.3}
.dash-mod-pct{font-size:.78rem;font-weight:700;flex-shrink:0}
.dash-progbar{height:5px;background:var(--border);border-radius:3px;overflow:hidden;margin-bottom:6px}
.dash-progfill{height:100%;background:var(--accent,#6366f1);border-radius:3px;transition:width .5s}
.dash-progfull{background:#10b981}
.dash-mod-meta{font-size:.65rem;color:var(--text-muted)}

/* Bottom row */
.dash-bottom{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px}
.dash-card{background:var(--bg-card);border:1px solid var(--border);border-radius:10px;padding:16px}
.dash-half{}

/* Mistake list */
.dash-mistake-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.dash-mistake-item{display:flex;gap:8px;align-items:flex-start;font-size:.78rem}
.dash-miss-badge{flex-shrink:0;background:#fee2e2;color:#991b1b;border-radius:4px;
  padding:1px 6px;font-size:.68rem;font-weight:700}
.dash-miss-q{color:var(--text);line-height:1.4}
.dash-no-data{color:var(--text-muted);font-size:.78rem;list-style:none;font-style:italic}

/* Recommendations */
.dash-recs{display:flex;flex-direction:column;gap:8px}
.dash-rec-card{background:var(--bg);border:1px solid var(--border);border-radius:8px;
  padding:10px 12px;text-align:left;cursor:pointer;transition:border-color .12s}
.dash-rec-card:hover{border-color:var(--accent,#6366f1);background:var(--bg-card)}
.dash-rec-mod{font-size:.65rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.04em;font-weight:600}
.dash-rec-title{font-size:.82rem;font-weight:600;color:var(--text);margin:2px 0}
.dash-rec-eta{font-size:.68rem;color:var(--accent,#6366f1);font-weight:600}

.dash-empty{color:var(--text-muted);font-size:.82rem;font-style:italic}
.dash-empty-sm{color:var(--text-muted);font-size:.72rem;margin:0}

/* ── Lesson view ──────────────────────────────────────────────── */
.lesson-nav-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;font-size:.85rem}
.lesson-progress{color:var(--text-muted);font-weight:600}
.lesson-summary{font-size:1.05rem;margin:0 0 18px;line-height:1.5}
.lesson-body{font-size:1rem;line-height:1.7;margin-bottom:20px}
.lesson-body p{margin:0 0 12px}

.term-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:10px;margin:8px 0 20px}
.term-card{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:10px 12px}
.term-card strong{display:block;color:var(--accent,#6366f1);font-size:.88rem;margin-bottom:4px}
.term-card p{margin:0 0 4px;font-size:.82rem;line-height:1.5}
.term-card small{font-size:.72rem;color:var(--text-muted);font-style:italic}

.lesson-notes-details{background:var(--bg);border:1px solid var(--border);border-radius:8px;padding:8px 14px;margin:16px 0}
.lesson-notes-details summary{cursor:pointer;font-size:.85rem;font-weight:600;color:var(--text-muted)}
.lesson-notes-details label{display:block;font-size:.78rem;font-weight:600;margin:10px 0 4px;color:var(--text-muted)}
.lesson-notes-details select,.lesson-notes-details textarea{width:100%;padding:6px 8px;border:1px solid var(--border);border-radius:6px;font-size:.85rem;background:var(--bg-card);color:var(--text)}
.lesson-notes-details textarea{min-height:80px;resize:vertical}

.lesson-nav-bottom{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:24px;padding-top:18px;border-top:1px solid var(--border)}
.lesson-nav-bottom button{font-size:.9rem;padding:10px 16px}
.lesson-nav-bottom button:disabled{opacity:.4;cursor:not-allowed}
.lesson-coach{margin-top:14px;text-align:center}
.lesson-coach button{font-size:.8rem;color:var(--text-muted)}
/* Course badge */
.course-badge:hover{opacity:.8}
