/* Kenobi, carnet de progression : bleu nuit, crème, orange et bleu ; Sora, Inter et JetBrains Mono. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/inter-latin.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+0304, U+0308, U+0329, U+1E00-1E9F; }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/sora-latin.woff2") format("woff2"); }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/sora-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+0304, U+0308, U+0329, U+1E00-1E9F; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("assets/fonts/jetbrains-mono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("assets/fonts/jetbrains-mono-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  color-scheme: light;
  --bg: #fff7f0;
  --panel: #fffdfa;
  --surface: #ffffff;
  --surface-soft: #f7ede4;
  --surface-hover: #efe4da;
  --rail: #171c2e;
  --rail-raised: #1f2740;
  /* The side rail sits one step lighter than the terminal (#171c2e) so that the two dark areas read apart. */
  --sidebar: #242c46;
  --sidebar-raised: #2f3858;
  --rail-line: rgba(255, 247, 240, 0.14);
  --rail-text: #fff7f0;
  --rail-muted: rgba(255, 247, 240, 0.78);
  --ink: #171c2e;
  --ink-soft: #333a4c;
  --muted: #545b6c;
  --line: rgba(23, 28, 46, 0.10);
  --line-strong: rgba(23, 28, 46, 0.18);
  --accent: #ffa959;
  --accent-light: #fff0dc;
  --accent-ink: #171c2e;
  --blue: #376ab7;
  --blue-dark: #2a5ca6;
  --blue-soft: #dfeafe;
  --success: #78ba87;
  --danger: #a13a2b;
  --danger-soft: #f7e5da;
  --code-bg: #171c2e;
  --code-surface: #232b42;
  --code-text: #fff7f0;
  --code-muted: #b8c0d4;
  --code-keyword: #ffa959;
  --code-string: #a8d9b2;
  --code-number: #f2b0a3;
  --code-comment: #a7b0c3;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --heading: "Sora", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", "DejaVu Sans Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  /* Rôles de texte : du plus discret au titre de page. Rien sous 12 px. */
  --text-2xs: 0.75rem;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --text-code: 0.84375rem;
  --topbar-height: 50px;
  --sidebar-width: 226px;
  --context-width: 284px;
  --radius-sm: 8px;
  --radius: 13px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --z-dropdown: 20;
  --z-sticky: 30;
  --z-backdrop: 40;
  --z-panel: 50;
  --z-modal: 60;
  --z-toast: 70;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: 1.5;
  font-feature-settings: "cv05", "cv08", "ss03";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, [popovertarget] { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button, a, input, textarea, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible, [popovertarget]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
button { border: 0; }
a { color: inherit; text-underline-offset: 4px; }
p, h1, h2, h3, h4 { margin: 0; }
h1, h2, h3 { font-family: var(--heading); text-wrap: balance; }
.brand-name, .button, .call-button { font-family: var(--heading); }
p { text-wrap: pretty; }
svg { display: block; }
::selection { background: var(--accent); color: var(--accent-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }
textarea { caret-color: var(--blue); }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100dvh; }
.sidebar {
  position: relative;
  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 12px 12px;
  overflow-y: auto;
  --rail-raised: var(--sidebar-raised);
  border-right: 1px solid rgba(8, 11, 22, 0.6);
  background: var(--sidebar);
  color: var(--rail-text);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 2px 0 4px; margin-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; background: transparent; color: var(--rail-text); }
.brand-mark { display: block; flex: 0 0 auto; width: 36px; height: 36px; filter: drop-shadow(0 3px 6px rgba(5, 8, 18, 0.35)); }
.brand-name { font-size: var(--text-2xl); font-weight: 650; letter-spacing: -0.035em; }
.brand-name span { color: var(--accent); }
.sidebar-close { display: none !important; color: var(--rail-text) !important; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--rail-muted);
  font-size: var(--text-sm);
  text-align: left;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}
.nav-item:hover { background: var(--rail-raised); color: var(--rail-text); }
.nav-item.active { background: var(--rail-raised); color: var(--rail-text); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .icon { width: 17px; height: 17px; }
.nav-count { min-width: 22px; margin-left: auto; padding: 1px 6px; border: 1px solid var(--rail-line); border-radius: 99px; color: var(--rail-muted); font-size: var(--text-2xs); text-align: center; font-variant-numeric: tabular-nums; }
.learning-section { margin-top: 22px; }
.sidebar-section-head { display: flex; justify-content: space-between; align-items: center; padding: 0 9px 10px; color: var(--rail-muted); font-size: var(--text-xs); }
.sidebar-section-head h2 { font-size: var(--text-xs); font-weight: 550; }
.sidebar-section-head > span { font-variant-numeric: tabular-nums; }
.sidebar-bottom { display: flex; flex-direction: column; gap: 4px; margin-top: auto; padding-top: 20px; }

.main-shell { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { position: relative; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 var(--topbar-height); min-width: 0; padding: 0 14px 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.topbar-context, .topbar-actions { display: flex; align-items: center; min-width: 0; }
.topbar-actions { gap: 8px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--text-sm); white-space: nowrap; }
.breadcrumb > span { color: var(--muted); }
.breadcrumb > .icon { width: 12px; height: 12px; color: var(--muted); }
.breadcrumb strong { overflow: hidden; color: var(--ink); font-weight: 650; text-overflow: ellipsis; }
.crumb-course { margin-left: -7px; padding: 4px 7px; border-radius: 6px; background: transparent; color: var(--muted); font-size: inherit; }
.crumb-course:hover { background: var(--surface-hover); color: var(--ink); }
.topbar-sub { overflow: hidden; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; }
.topbar-sub:empty { display: none; }
.save-status { margin-right: 4px; color: var(--muted); font-size: var(--text-2xs); white-space: nowrap; }
.save-status.is-saving { color: var(--blue); }
.save-status.is-error { color: var(--danger); }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-soft); transition: background 150ms var(--ease), color 150ms var(--ease); }
.icon-button:hover { background: var(--surface-hover); color: var(--ink); }
.menu-button { display: none; }
.model-button { display: flex; align-items: center; gap: 8px; min-height: 34px; max-width: 250px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); color: var(--muted); font-size: var(--text-xs); }
.model-button:hover { border-color: var(--line-strong); color: var(--ink); }
.model-button .icon { width: 12px; height: 12px; }
.model-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.model-button.is-online .model-dot { background: #3fbf7f; box-shadow: 0 0 0 3px rgba(63, 191, 127, .18); }
.model-button.is-offline .model-dot { background: #d9534f; }
.call-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 34px; padding: 0 13px; border-radius: var(--radius-sm); background: var(--rail); color: var(--rail-text); font-size: var(--text-xs); font-weight: 650; transition: background 160ms var(--ease), transform 160ms var(--ease); }
.call-button:hover { background: var(--blue-dark); }
.call-button:active, .button:active { transform: scale(0.98); }
.call-button .icon { width: 15px; height: 15px; color: var(--accent); }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) var(--context-width); flex: 1; min-height: 0; }
.primary-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 28px clamp(22px, 3vw, 44px) 44px; }
/* La discussion prend toute la hauteur : ni marge haute, ni bas de page perdu sous la zone de saisie. */
.primary-panel[data-screen="chat"] { padding: 0 clamp(16px, 2.2vw, 32px); scrollbar-gutter: stable; }
.primary-panel:focus { outline: none; }
.context-panel { min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 32px; border-left: 1px solid var(--line); background: var(--panel); }
.page-backdrop { position: fixed; inset: 0; z-index: var(--z-backdrop); background: oklch(0.2 0.025 165 / 0.38); }

.course-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.course-heading h1 { max-width: 22ch; font-size: var(--text-3xl); font-weight: 650; line-height: 1.18; letter-spacing: -0.03em; }
.course-heading p { max-width: 62ch; margin-top: 8px; color: var(--muted); font-size: var(--text-sm); line-height: 1.65; }
.next-lesson { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 23px 24px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); }
.next-lesson-copy { min-width: 0; }
.lesson-position { display: flex; align-items: center; gap: 8px; color: var(--blue); font-size: var(--text-xs); font-weight: 650; }
.lesson-position .icon { width: 14px; height: 14px; }
.next-lesson h2 { margin-top: 7px; font-size: var(--text-2xl); font-weight: 650; line-height: 1.25; letter-spacing: -0.02em; }
.next-lesson-description { max-width: 60ch; margin-top: 7px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 14px; color: var(--muted); font-size: var(--text-xs); }
.lesson-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.lesson-meta .icon { width: 13px; height: 13px; }
.next-lesson-action { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 20px; min-width: 164px; }
.progress-copy { text-align: right; }
.progress-copy strong { display: block; font-size: var(--text-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.progress-copy span { color: var(--muted); font-size: var(--text-2xs); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 15px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 650; line-height: 1.3; text-decoration: none; transition: background 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease); }
.button .icon { width: 15px; height: 15px; }
.button.primary { background: var(--blue); color: oklch(0.985 0.008 155); }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { border-color: var(--line); background: var(--surface); color: var(--ink-soft); }
.button.secondary:hover { border-color: var(--line-strong); background: var(--surface-soft); color: var(--ink); }
.button.ghost { background: transparent; color: var(--muted); }
.button.ghost:hover { background: var(--surface-hover); color: var(--ink); }
.button.danger { border-color: oklch(0.78 0.08 28); background: var(--danger-soft); color: var(--danger); }
.button.danger:hover { background: oklch(0.90 0.055 28); }
.button.full { width: 100%; }
.text-button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 5px; background: transparent; color: var(--blue); font-size: var(--text-xs); font-weight: 600; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.text-button .icon { width: 13px; height: 13px; }

.curriculum { margin-top: 31px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.section-heading h2 { font-size: var(--text-lg); font-weight: 650; letter-spacing: -0.01em; }
.section-heading > span { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.module-list { border-top: 1px solid var(--line); }
.module { border-bottom: 1px solid var(--line); }
.module-summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 16px; align-items: center; gap: 11px; min-height: 64px; padding: 10px 5px; cursor: pointer; list-style: none; }
.module-summary::-webkit-details-marker { display: none; }
.module-summary:hover .module-title { color: var(--blue); }
.module-state { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); }
.module-state .icon { width: 13px; height: 13px; }
.module.is-complete .module-state { border-color: var(--blue); background: var(--blue); color: var(--surface); }
.module.is-current .module-state { border-color: var(--accent); background: var(--accent-light); color: var(--accent-ink); }
.module-heading { display: flex; flex-direction: column; min-width: 0; }
.module-title { font-size: var(--text-sm); font-weight: 650; transition: color 150ms; }
.module-description { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.module-count { color: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.module-summary > .icon { width: 13px; height: 13px; color: var(--muted); transition: transform 180ms var(--ease); }
.module[open] .module-summary > .icon { transform: rotate(90deg); }
.lesson-list { margin: 0 0 13px 39px; padding: 0 0 0 17px; border-left: 1px solid var(--line); list-style: none; }
.lesson-row { display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 45px; padding: 5px 6px 5px 0; border-radius: 7px; }
.lesson-row.is-current { background: var(--blue-soft); }
.lesson-check { display: grid; place-items: center; width: 23px; height: 23px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: transparent; }
.lesson-check:hover { border-color: var(--blue); color: var(--blue); }
.lesson-check .icon { width: 12px; height: 12px; }
.lesson-row.is-done .lesson-check { border-color: var(--blue); background: var(--blue); color: var(--surface); }
.lesson-row.is-current .lesson-check { border-color: var(--blue); color: var(--blue); }
.lesson-open { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 34px; padding: 0 4px; background: transparent; color: var(--ink-soft); font-size: var(--text-xs); text-align: left; }
.lesson-open:hover { color: var(--blue); }
.lesson-row.is-done .lesson-open { color: var(--muted); }
.lesson-row.is-current .lesson-open { color: var(--ink); font-weight: 650; }
.lesson-duration { color: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; white-space: nowrap; }

.context-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 21px; }
.context-head h2 { font-size: var(--text-base); font-weight: 650; }
.context-head .icon { width: 16px; height: 16px; color: var(--muted); }
.context-close { display: none; }
.last-point { padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.context-label { color: var(--muted); font-size: var(--text-2xs); font-weight: 600; }
.last-point h3 { margin-top: 6px; font-size: var(--text-lg); font-weight: 650; line-height: 1.35; }
.last-point p { margin-top: 9px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.65; }
.context-link { margin-top: 9px; }
.memory-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.memory-section:last-of-type { border-bottom: 0; }
.memory-section h3 { display: flex; align-items: center; gap: 7px; font-size: var(--text-xs); font-weight: 650; }
.memory-section h3 .icon { width: 14px; height: 14px; color: var(--muted); }
.memory-list { display: flex; flex-direction: column; gap: 9px; margin: 12px 0 0; padding: 0; list-style: none; }
.memory-list li { position: relative; padding-left: 16px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.5; }
.memory-list li::before { content: ""; position: absolute; top: 7px; left: 1px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.memory-list.review li::before { background: var(--accent); }
.next-focus { margin-top: 11px; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-soft); color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.6; }
.context-footer { margin-top: 23px; }
.memory-file { display: flex; align-items: flex-start; gap: 8px; margin-top: 13px; color: var(--muted); font-size: var(--text-2xs); line-height: 1.5; overflow-wrap: anywhere; }
.memory-file .icon { width: 13px; height: 13px; margin-top: 1px; }
.memory-file code { font-family: var(--mono); font-size: var(--text-2xs); }

.chat-view { display: flex; flex-direction: column; width: 100%; max-width: 940px; min-height: 100%; margin: 0 auto; }
.message-list { display: flex; flex: 1; flex-direction: column; gap: 16px; padding: 16px 0 14px; }
.message { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
.message-avatar { display: block; width: 32px; height: 32px; margin-top: -2px; }
.message-avatar img { display: block; width: 100%; height: 100%; }
.message.is-tutor.is-pending .message-avatar img { animation: kenobi-bob 1.4s ease-in-out infinite; }
@keyframes kenobi-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-2px) rotate(-4deg); } }
.message-body { min-width: 0; }
.message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.message-meta strong { color: var(--ink); font-size: var(--text-xs); font-weight: 650; }
.message-meta time, .meta-subtle { color: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.meta-live { color: var(--blue); font-size: var(--text-2xs); font-weight: 600; animation: live-pulse 1.2s ease-in-out infinite alternate; }
@keyframes live-pulse { from { opacity: 1; } to { opacity: 0.45; } }
.message.is-user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message.is-user .message-body { max-width: min(86%, 620px); padding: 9px 14px 11px; border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; background: var(--surface-soft); }
.message.is-user .message-meta { justify-content: flex-end; }
.message-text { max-width: 74ch; color: var(--ink); font-size: var(--text-md); line-height: 1.6; overflow-wrap: anywhere; }
.message.is-user .message-text { color: var(--ink); }
.message-text > :first-child { margin-top: 0; }
.message-text p { margin: 0; }
.message-text p + p, .message-text p + ul, .message-text p + ol, .message-text ul + p, .message-text ol + p { margin-top: 8px; }
.message-text ul, .message-text ol { margin: 6px 0 0; padding-left: 21px; }
.message-text li + li { margin-top: 3px; }
.message-text li::marker { color: var(--blue); font-weight: 650; }
.message-text h3, .message-text h4 { margin: 14px 0 4px; color: var(--ink); font-size: var(--text-base); font-weight: 650; letter-spacing: -0.01em; }
.message-text h4 { font-size: var(--text-sm); }
.message-text strong { color: var(--ink); font-weight: 700; }
.message-text a { color: var(--blue); }
.message-text hr { margin: 14px 0; border: 0; border-top: 1px solid var(--line); }
.message-text blockquote { margin: 10px 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.message-text code:not(pre code) { padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); color: var(--blue-dark); font: 0.88em/1.4 var(--mono); }
.message.is-user .message-text code:not(pre code) { background: var(--surface); }
.table-wrap { max-width: 100%; margin: 10px 0; overflow-x: auto; }
.message-text table, .memory-rendered table { border-collapse: collapse; font-size: var(--text-xs); }
.message-text th, .message-text td, .memory-rendered th, .memory-rendered td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.message-text th, .memory-rendered th { background: var(--surface-soft); color: var(--ink); font-weight: 650; }
.message.is-error .message-text p { color: var(--danger); }
.message.is-error .message-avatar img { filter: grayscale(0.85); opacity: 0.7; }

.code-block { margin: 10px 0; overflow: hidden; border: 1px solid var(--code-surface); border-radius: 10px; background: var(--code-bg); color: var(--code-text); }
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; padding: 0 6px 0 12px; background: var(--code-surface); }
.code-language { display: flex; align-items: center; gap: 6px; color: var(--code-muted); font: 600 var(--text-2xs)/1 var(--sans); }
.code-language .icon { width: 13px; height: 13px; }
.copy-code { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 0 8px; border-radius: 6px; background: transparent; color: var(--code-text); font-size: var(--text-2xs); }
.copy-code:hover { background: #303a53; }
.copy-code .icon { width: 13px; height: 13px; }
.code-block pre { max-width: 100%; margin: 0; overflow-x: auto; padding: 12px 14px 13px; tab-size: 4; }
.code-block pre code { font: var(--text-code)/1.6 var(--mono); white-space: pre; }
.code-block.is-output { border: 1px solid var(--line-strong); background: #fbf6f0; color: var(--ink); }
.code-block.is-output .code-head { min-height: 26px; background: transparent; border-bottom: 1px dashed var(--line-strong); }
.code-block.is-output .code-language { color: var(--muted); }
.code-block.is-output pre { padding: 9px 14px 10px; }
.code-block.is-output pre code { color: var(--ink-soft); font-size: var(--text-code); }
.token-keyword { color: var(--code-keyword); }
.token-string { color: var(--code-string); }
.token-number { color: var(--code-number); }
.token-comment { color: var(--code-comment); font-style: italic; }
.token-builtin { color: oklch(0.80 0.09 220); }

.thinking { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: var(--text-xs); }
.typing-bubble { display: inline-flex; align-items: center; gap: 5px; padding: 11px 15px; border: 1px solid var(--line-strong); border-radius: 16px 16px 16px 5px; background: var(--surface); box-shadow: 0 6px 18px oklch(0.30 0.05 165 / 0.08); }
.typing-bubble i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: dot-bounce 1.1s ease-in-out infinite; }
.typing-bubble i:nth-child(2) { animation-delay: 0.16s; }
.typing-bubble i:nth-child(3) { animation-delay: 0.32s; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); animation: dot-bounce 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot-bounce { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.tool-status { margin-top: 8px; color: var(--muted); font-size: var(--text-xs); font-style: italic; }

.lesson-card, .bilan-card { margin-top: 12px; padding: 12px 14px; border-radius: 11px; }
.lesson-card { border: 1px solid #c9d9f4; background: #f3f7fe; }
.card-head { display: flex; align-items: center; gap: 7px; color: var(--blue-dark); font-size: var(--text-xs); font-weight: 650; }
.card-head .icon { width: 15px; height: 15px; }
.card-objective { margin-top: 5px !important; color: var(--ink); font-size: var(--text-base); font-weight: 600; line-height: 1.45; }
.card-criteria { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 0 !important; padding: 0 !important; list-style: none; }
.card-criteria li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 7px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.card-criteria li::marker { content: ""; }
.card-criteria .icon { width: 14px; height: 14px; margin-top: 3px; color: var(--blue); }
.bilan-card { border: 1px solid var(--line-strong); background: var(--surface); }
.bilan-card .card-head { color: var(--ink); }
.bilan-status { margin-left: auto; padding: 2px 8px; border-radius: 99px; background: var(--accent-light); color: #8a4a12; font-size: var(--text-2xs); }
.bilan-card.is-acquired { border-color: #a9d3b2; }
.bilan-card.is-acquired .bilan-status { background: #e3f3e6; color: #2f6b3c; }
.bilan-proof { margin-top: 7px !important; color: var(--ink-soft); font-size: var(--text-sm); }
.bilan-grid { display: grid; gap: 7px; margin: 9px 0 0; }
.bilan-grid > div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
.bilan-grid dt { color: var(--muted); font-size: var(--text-xs); font-weight: 650; line-height: 1.6; }
.bilan-grid dd { margin: 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.55; }
.bilan-grid dd ul { margin: 0; padding-left: 16px; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.card-actions .button { min-height: 36px; }
.card-note { margin-top: 8px !important; color: var(--muted); font-size: var(--text-xs); }
.card-actions .card-note { margin-top: 0 !important; }
.card-done { display: inline-flex; align-items: center; gap: 6px; color: #2f6b3c; font-size: var(--text-xs); font-weight: 650; }
.card-done .icon { width: 15px; height: 15px; }
.review-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.review-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: var(--text-xs); }
.review-chip .icon { width: 13px; height: 13px; }
.review-chip.is-ok { background: #e3f3e6; color: #2f6b3c; }
.review-chip.is-miss { background: var(--accent-light); color: #8a4a12; }

.chat-start { margin: 26px auto; max-width: 560px; padding: 26px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.chat-start-mascot { display: block; width: 136px; height: 136px; margin: -8px auto -4px; }
.chat-start h2 { margin-top: 12px; font-size: var(--text-xl); font-weight: 650; }
.chat-start p { max-width: 50ch; margin: 8px auto 16px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; }
.chat-empty-state { max-width: 520px; margin: 60px auto; text-align: center; }
.chat-empty-state p { margin: 8px 0 16px; color: var(--muted); font-size: var(--text-sm); }
.suggestion-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-top: 14px; }
.suggestion { min-height: 32px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-soft); font-size: var(--text-xs); }
.suggestion:hover { border-color: var(--blue); color: var(--blue); }

.composer-wrap { position: sticky; bottom: 0; padding: 10px 0 12px; background: linear-gradient(to bottom, transparent, var(--bg) 12px); }
.closed-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border-radius: var(--radius-sm); background: #e3f3e6; color: #2f6b3c; font-size: var(--text-xs); }
.closed-notice > .icon { width: 15px; height: 15px; }
.closed-notice .text-button { margin-left: auto; color: #2f6b3c; }
.quick-actions { display: flex; gap: 6px; margin-bottom: 7px; overflow-x: auto; scrollbar-width: none; }
.quick-actions::-webkit-scrollbar { display: none; }
.quick-action { flex: 0 0 auto; min-height: 28px; padding: 3px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-soft); font-size: var(--text-xs); transition: border-color 150ms var(--ease), color 150ms var(--ease); }
.quick-action:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.composer { padding: 6px 6px 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); transition: border-color 160ms, box-shadow 160ms; }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.composer:focus-within { border-color: var(--blue); box-shadow: 0 8px 24px oklch(0.30 0.05 165 / 0.08); }
.composer textarea { display: block; flex: 1; min-width: 0; min-height: 36px; max-height: 240px; resize: none; padding: 7px 4px 6px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--text-md); line-height: 1.45; }
.composer textarea::placeholder { color: var(--muted); opacity: 1; }
.composer-tools { display: flex; align-items: center; gap: 1px; padding-bottom: 2px; }
.composer-tool { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border-radius: 7px; background: transparent; color: var(--muted); }
.composer-tool:hover { background: var(--surface-soft); color: var(--ink); }
.composer-tool .icon { width: 17px; height: 17px; }
.send-button, .stop-button { min-height: 36px; padding: 0 13px; }
.composer-setup { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 10px 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink-soft); font-size: var(--text-sm); }
.composer-setup > span { display: inline-flex; align-items: center; gap: 8px; }
.composer-setup .icon { color: var(--blue); }
.composer-setup .button { min-height: 36px; }

.sessions-view, .memory-view { max-width: 900px; margin: 0 auto; }
.view-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.view-heading h1 { font-size: var(--text-3xl); font-weight: 650; letter-spacing: -0.025em; }
.view-heading p { max-width: 62ch; margin-top: 7px; color: var(--muted); font-size: var(--text-xs); }
.session-list { border-top: 1px solid var(--line); }
.session-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 20px 3px; border-bottom: 1px solid var(--line); }
.session-title-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.session-title-line h2 { font-size: var(--text-md); font-weight: 650; }
.session-state { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 99px; background: var(--blue-soft); color: var(--blue-dark); font-size: var(--text-2xs); }
.session-state::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.session-state.completed { background: var(--surface-soft); color: var(--muted); }
.session-summary { max-width: 68ch; margin-top: 7px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.6; }
.session-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; color: var(--muted); font-size: var(--text-2xs); }
.session-open { align-self: center; }
.memory-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.markdown-preview { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.markdown-preview pre { max-width: 100%; margin: 0; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-soft); font: var(--text-xs)/1.75 var(--mono); }
.memory-explanation { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; color: var(--muted); font-size: var(--text-2xs); line-height: 1.6; }
.memory-explanation .icon { width: 14px; height: 14px; margin-top: 2px; }

.loading-state { max-width: 620px; margin: 30px auto; }
.loading-line { display: block; width: 72%; height: 22px; border-radius: 6px; background: var(--surface-hover); animation: loading-pulse 1.4s ease-in-out infinite alternate; }
.loading-line.short { width: 44%; height: 13px; margin-top: 13px; }
.loading-state p { margin-top: 22px; color: var(--muted); font-size: var(--text-xs); }
@keyframes loading-pulse { to { opacity: 0.5; } }
.error-state { max-width: 540px; margin: 60px auto; padding: 25px; border: 1px solid oklch(0.78 0.08 28); border-radius: var(--radius); background: var(--danger-soft); }
.error-state h1 { font-size: var(--text-xl); }
.error-state p { margin: 9px 0 18px; color: var(--ink-soft); font-size: var(--text-xs); }

.popover-head { padding: 2px 3px 12px; border-bottom: 1px solid var(--line); }
.popover-head strong, .popover-head span { display: block; }
.popover-head strong { font-size: var(--text-sm); }
.popover-head span { margin-top: 3px; color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
.selected-check { width: 15px; height: 15px; color: var(--blue); }

/* Kenobi in the call: blinks, tilts his head while listening, looks up while thinking, talks with his voice. */
.kenobi-live :is(.kv-eye, .kv-talk) { transform-box: fill-box; transform-origin: center; }
.kenobi-live .kv-eye { animation: kv-blink 5s ease-in-out infinite; }
.kenobi-live .kv-talk { opacity: 0; transform: scaleY(calc(0.16 + var(--voice) * 0.84)); }
.kenobi-live .kv-mouth circle { opacity: calc(0.55 + var(--voice) * 0.45); }
.voice-orb[data-state="listen"] .kenobi-live { animation: kv-listen 2.6s ease-in-out infinite; }
.voice-orb[data-state="think"] .kv-eye { animation: kv-look-up 1.8s ease-in-out infinite; }
.voice-orb[data-state="speak"] .kv-smile { opacity: 0; }
.voice-orb[data-state="speak"] .kv-talk { opacity: 1; }
.voice-orb[data-state="speak"] .kenobi-live { transform: translateY(calc(var(--voice) * -2.5px)) rotate(calc(var(--voice) * 2deg)); }
.voice-orb[data-state="reconnect"] .kenobi-live { opacity: 0.55; filter: grayscale(0.6); }
@keyframes kv-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.12); } }
@keyframes kv-listen { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes kv-look-up { 0%, 100% { transform: translate(0, -1.6px); } 50% { transform: translate(1.4px, -2px); } }
.orb-wave { position: absolute; inset: 7px; border: 1px solid var(--blue); border-radius: 50%; opacity: 0; }
.voice-orb[data-state="listen"] .orb-wave, .voice-orb[data-state="think"] .orb-wave, .voice-orb[data-state="speak"] .orb-wave { animation: orb-ripple 2.4s ease-out infinite; }
.voice-orb[data-state="think"] .orb-wave { border-color: var(--accent); animation-duration: 1.8s; }
.voice-orb[data-state="speak"] .orb-wave { border-color: var(--accent); animation-duration: 1.4s; }
.voice-orb[data-state="speak"] .orb-core { color: var(--accent-ink); background: var(--accent-light); }
.voice-orb[data-state="think"] .orb-core { color: var(--accent-ink); }
.orb-wave.second { animation-delay: 1.2s !important; }
@keyframes orb-ripple { 0% { opacity: 0.45; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.35); } }
.toast { position: fixed; z-index: var(--z-toast); right: 24px; bottom: 24px; display: flex; align-items: flex-start; gap: 9px; max-width: min(410px, calc(100vw - 32px)); padding: 13px 15px; border: 1px solid var(--rail-line); border-radius: 11px; background: var(--rail); color: var(--rail-text); box-shadow: 0 12px 35px oklch(0.20 0.03 165 / 0.2); font-size: var(--text-xs); line-height: 1.5; }
.toast .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }

::view-transition-old(course-workspace), ::view-transition-new(course-workspace) { animation-duration: 240ms; animation-timing-function: var(--ease); }
.primary-panel { view-transition-name: course-workspace; }

@media (min-width: 1700px) {
  :root { --sidebar-width: 240px; --context-width: 310px; }
  .context-panel { padding-inline: 24px; }
}
@media (max-width: 1180px) {
  .save-status { display: none; }
  .model-button > span:not(.model-dot) { display: none; }
  .model-button { width: 34px; padding: 0; justify-content: center; }
  :root { --context-width: 260px; }
  .context-panel { padding-inline: 17px; }
  .next-lesson { gap: 17px; padding: 20px; }
  .next-lesson-action { min-width: 150px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .context-panel { position: fixed; z-index: var(--z-panel); top: 0; right: 0; bottom: 0; width: min(340px, 90vw); padding: 27px 24px; border-left: 1px solid var(--line-strong); box-shadow: -14px 0 40px oklch(0.25 0.04 165 / 0.15); transform: translateX(105%); transition: transform 220ms var(--ease); }
  body.context-open .context-panel { transform: translateX(0); }
  .context-close { display: inline-grid; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(282px, 88vw); box-shadow: 14px 0 40px oklch(0.20 0.03 165 / 0.22); transform: translateX(-105%); transition: transform 220ms var(--ease); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close, .menu-button { display: inline-grid !important; }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-context { gap: 5px; }
  .topbar-actions { gap: 6px; }
  .breadcrumb > span, .breadcrumb > .icon { display: none; }
  .breadcrumb { max-width: 155px; }
  .call-button { width: 36px; min-height: 36px; padding: 0; }
  .call-button > span { display: none; }
  .model-button { display: none; }
  .primary-panel { padding: 22px 16px 34px; }
  .primary-panel[data-screen="chat"] { padding: 0 12px; }
  .course-heading, .view-heading { gap: 12px; margin-bottom: 21px; }
  .course-heading h1, .view-heading h1 { font-size: var(--text-2xl); }
  .next-lesson { grid-template-columns: minmax(0, 1fr); gap: 19px; }
  .next-lesson-action { flex-direction: row; align-items: center; min-width: 0; }
  .progress-copy { text-align: left; }
  .module-description { max-width: 48vw; }
  .toast { right: 16px; bottom: 16px; }
}
@media (max-width: 480px) {
  .breadcrumb { max-width: 128px; font-size: var(--text-xs); }
  .topbar { padding-inline: 10px; }
  .topbar-actions { gap: 3px; }
  .primary-panel { padding-inline: 14px; }
  .course-heading h1, .view-heading h1 { font-size: var(--text-2xl); }
  .course-heading p { font-size: var(--text-xs); }
  .next-lesson { padding: 18px; }
  .next-lesson h2 { font-size: var(--text-xl); }
  .next-lesson-action { align-items: stretch; flex-direction: column; gap: 13px; }
  .progress-copy { display: flex; align-items: baseline; gap: 6px; }
  .next-lesson-action .button { width: 100%; }
  .section-heading { align-items: flex-start; }
  .module-summary { grid-template-columns: 26px minmax(0, 1fr) 14px; gap: 9px; }
  .module-count { display: none; }
  .module-description { max-width: 62vw; }
  .lesson-list { margin-left: 18px; padding-left: 12px; }
  .lesson-duration { display: none; }
  .lesson-row { grid-template-columns: 25px minmax(0, 1fr); }
  .code-block pre { padding-inline: 14px; }
  .code-block pre code { font-size: var(--text-xs); }
  .session-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .session-open { justify-self: start; }
  .view-heading { flex-direction: column; }
  .memory-toolbar { width: 100%; }
  .memory-toolbar .button { flex: 1; }
  .markdown-preview { padding: 16px; }
  .markdown-preview pre { font-size: var(--text-2xs); }
}
/* Refonte du 2026-11-08 : contexte de leçon, révisions, mémoire lisible, état dégradé. */
.context-lesson { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.context-lesson h3 { margin-top: 5px; font-size: var(--text-lg); font-weight: 650; line-height: 1.35; }
.contract-objective { margin-top: 9px; color: var(--ink); font-size: var(--text-xs); font-weight: 600; line-height: 1.5; }
.criteria-list { display: flex; flex-direction: column; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }
.criteria-list li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 7px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.5; }
.criteria-list .icon { width: 13px; height: 13px; margin-top: 2px; color: var(--blue); }
.context-hint, .context-empty { margin-top: 8px; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.review-list { display: flex; flex-direction: column; gap: 7px; margin: 11px 0 0; padding: 0; list-style: none; }
.review-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.45; }
.review-list time { flex: 0 0 auto; color: var(--muted); font-size: var(--text-2xs); }
.review-list li.is-due span { color: var(--ink); font-weight: 600; }
.review-list li.is-due time { color: #8a4a12; font-weight: 650; }
.memory-section .context-empty { margin-top: 10px; }
.memory-section h3 .icon { width: 14px; height: 14px; }
.due-pill { padding: 1px 8px; border-radius: 99px; background: var(--accent-light); color: #8a4a12; font-weight: 600; }
.model-button.is-degraded .model-dot { background: var(--accent); }
.session-state.validated { background: #e3f3e6; color: #2f6b3c; }
.memory-rendered { color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; }
.memory-rendered h1, .memory-rendered h3 { margin: 18px 0 6px; color: var(--ink); font-size: var(--text-md); }
.memory-rendered h3:first-child { margin-top: 0; }
.memory-rendered h4 { margin: 12px 0 4px; color: var(--ink); font-size: var(--text-sm); }
.memory-rendered ul { margin: 0; padding-left: 18px; }
.memory-rendered p + p { margin-top: 6px; }
@media (max-width: 760px) {
  .message.is-user .message-body { max-width: 92%; }
  .bilan-grid > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .closed-notice { padding: 6px 10px; font-size: var(--text-xs); }
}
@media (max-width: 480px) {
  .message { grid-template-columns: 26px minmax(0, 1fr); gap: 9px; }
  .message-avatar { width: 26px; height: 26px; }
  .message-text { font-size: var(--text-sm); }
  .quick-action { font-size: var(--text-xs); }
}
/* Terminal intégré (2026-11-09) : tiroir bas, éditeur de la leçon, vrai terminal et exécutions vues par Kenobi. */
.terminal-drawer {
  --terminal-height: 360px;
  --term-bg: #171c2e;
  --term-head: #20283f;
  --term-line: rgba(255, 247, 240, 0.12);
  --editor-mono: "JetBrains Mono", "DejaVu Sans Mono", "Liberation Mono", "SFMono-Regular", Consolas, monospace;
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--rail);
  background: var(--rail);
  color: var(--rail-text);
}
.terminal-drawer[data-theme="konsole"] { --term-bg: #232627; --term-head: #2d3133; }
.terminal-drawer[data-state="open"] { height: min(var(--terminal-height), calc(100dvh - 190px)); }
.terminal-drawer[data-state="open"].is-maximized { height: max(260px, calc(100dvh - 164px)); }
.terminal-drawer[data-state="open"]:not(.is-resizing) { transition: height 200ms var(--ease); }
.terminal-drawer.is-resizing { user-select: none; }
.terminal-resize { position: absolute; z-index: 3; top: -4px; right: 0; left: 0; height: 8px; cursor: ns-resize; }
.terminal-resize::after { content: ""; position: absolute; top: 3px; left: 50%; width: 46px; height: 3px; border-radius: 99px; background: var(--rail-line); transform: translateX(-50%); transition: background 150ms var(--ease), width 150ms var(--ease); }
.terminal-resize:hover::after, .terminal-resize:focus-visible::after, .is-resizing .terminal-resize::after { width: 90px; background: var(--accent); }
.terminal-resize:focus-visible { outline: none; }

.terminal-bar { display: flex; align-items: center; gap: 12px; flex: 0 0 38px; min-width: 0; padding: 0 10px 0 6px; }
.terminal-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 10px 0 6px; border-radius: 7px; background: transparent; color: var(--rail-text); font: 650 var(--text-xs)/1 var(--heading); }
.terminal-toggle:hover { background: var(--rail-raised); }
.terminal-toggle .icon { width: 15px; height: 15px; }
.terminal-toggle .icon:not(.terminal-chevron) { color: var(--accent); }
.terminal-chevron { color: var(--rail-muted); transform: rotate(180deg); transition: transform 180ms var(--ease); }
.terminal-drawer[data-state="open"] .terminal-chevron { transform: none; }
.terminal-status { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--rail-muted); font-size: var(--text-xs); white-space: nowrap; }
.terminal-status span:last-child { overflow: hidden; text-overflow: ellipsis; }
.terminal-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--rail-muted); }
.terminal-drawer[data-status="ready"] .terminal-dot { background: #3fbf7f; box-shadow: 0 0 0 3px rgba(63, 191, 127, 0.2); }
.terminal-drawer[data-status="connecting"] .terminal-dot { background: var(--accent); animation: live-pulse 0.9s ease-in-out infinite alternate; }
.terminal-drawer:is([data-status="offline"], [data-status="bridge"], [data-status="exited"]) .terminal-dot { background: #e5604f; }
.terminal-last { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 46%; min-height: 26px; padding: 0 10px 0 8px; border-radius: 99px; background: rgba(255, 247, 240, 0.07); color: var(--rail-text); font-size: var(--text-xs); white-space: nowrap; }
.terminal-last .icon { width: 13px; height: 13px; }
.terminal-last > span { overflow: hidden; text-overflow: ellipsis; }
.terminal-last .last-meta, .terminal-last .last-delivery { color: var(--rail-muted); }
.terminal-last .last-delivery::before { content: "·"; margin-right: 7px; }
.terminal-last.is-ok .icon, .terminal-last.is-ok .last-label { color: #8fd8a3; }
.terminal-last.is-error .icon, .terminal-last.is-error .last-label { color: #ff9e93; }
.terminal-last.is-stopped .icon { color: var(--rail-muted); }
.terminal-last.is-running { color: var(--rail-muted); }
.terminal-last .last-cmd { color: var(--rail-text); font-family: var(--editor-mono); font-size: var(--text-2xs); }
.last-pulse { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: live-pulse 0.8s ease-in-out infinite alternate; }
.terminal-bar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.terminal-mode { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 9px 0 10px; border: 1px solid var(--rail-line); border-radius: 8px; background: transparent; color: var(--rail-muted); font-size: var(--text-xs); white-space: nowrap; }
.terminal-mode:hover { border-color: var(--rail-muted); color: var(--rail-text); }
.terminal-mode strong { color: var(--rail-text); font-weight: 650; }
.terminal-mode .icon { width: 14px; height: 14px; color: var(--accent); }
.terminal-mode .terminal-mode-caret { width: 11px; height: 11px; color: var(--rail-muted); }
.terminal-mode[data-mode="off"] .icon:first-child { color: var(--rail-muted); }
.terminal-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 7px; background: transparent; color: var(--rail-muted); }
.terminal-icon:hover { background: rgba(255, 247, 240, 0.09); color: var(--rail-text); }
.terminal-icon .icon { width: 15px; height: 15px; }
.terminal-drawer :is(button, [role="separator"]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.terminal-body { position: relative; display: grid; flex: 1; min-height: 0; border-top: 1px solid var(--term-line); }
.editor-pane, .term-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pane-head { display: flex; align-items: center; gap: 8px; flex: 0 0 38px; min-width: 0; padding: 0 8px 0 10px; border-bottom: 1px solid var(--term-line); background: var(--term-head); }
.pane-path, .pane-title { min-width: 0; overflow: hidden; color: var(--rail-muted); font: var(--text-xs)/1.3 var(--editor-mono); text-overflow: ellipsis; white-space: nowrap; }
.pane-title { flex: 1; }
.pane-path { flex: 1; }
.file-button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 8px; border-radius: 7px; background: rgba(255, 247, 240, 0.07); color: var(--rail-text); font: var(--text-xs)/1 var(--editor-mono); white-space: nowrap; }
.file-button:hover { background: rgba(255, 247, 240, 0.13); }
.file-button .icon { width: 13px; height: 13px; color: var(--accent); }
.file-button .file-caret { width: 10px; height: 10px; color: var(--rail-muted); }
.file-dirty { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.run-button { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; margin-left: auto; padding: 0 13px 0 10px; border-radius: 7px; background: var(--blue); color: #fff; font: 650 var(--text-xs)/1 var(--heading); transition: background 150ms var(--ease), transform 150ms var(--ease); }
.run-button:hover:not(:disabled) { background: #4a7cc8; }
.run-button:active:not(:disabled) { transform: scale(0.97); }
.run-button .icon { width: 13px; height: 13px; fill: currentColor; }
.run-button.is-stop { background: #c2483a; }
.run-button.is-stop:hover:not(:disabled) { background: #d4564a; }
.run-button:disabled { opacity: 0.45; }
.pane-actions { display: flex; align-items: center; gap: 2px; }
.pane-action { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; border-radius: 7px; background: transparent; color: var(--rail-muted); font-size: var(--text-xs); white-space: nowrap; }
.pane-action:hover { background: rgba(255, 247, 240, 0.09); color: var(--rail-text); }
.pane-action .icon { width: 13px; height: 13px; }
.pane-action.is-kenobi { color: var(--rail-text); }
.pane-action.is-kenobi .icon { color: var(--accent); }
.pane-splitter { position: relative; background: var(--term-line); cursor: ew-resize; }
.pane-splitter::after { content: ""; position: absolute; inset: 0 2px; border-radius: 2px; transition: background 150ms var(--ease); }
.pane-splitter:hover::after, .pane-splitter:focus-visible::after, .is-resizing .pane-splitter::after { background: var(--accent); }
.xterm-host { flex: 1; min-height: 0; padding: 8px 4px 4px 12px; background: var(--term-bg); }
.xterm-host .xterm { height: 100%; }
.xterm-host .xterm, .xterm-host .xterm-viewport { background-color: var(--term-bg) !important; }

.code-editor { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); flex: 1; min-height: 0; background: var(--term-bg); font-family: var(--editor-mono); font-size: var(--editor-font-size, 13px); line-height: 1.6; }
.editor-gutter { position: relative; min-width: 42px; overflow: hidden; padding: 12px 10px 12px 12px; border-right: 1px solid var(--term-line); color: rgba(184, 192, 212, 0.46); font-variant-numeric: tabular-nums; text-align: right; user-select: none; }
.editor-gutter-lines span { display: block; }
.editor-gutter-lines span.is-active { color: var(--accent); }
.editor-surface { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.editor-highlight, .editor-input { position: absolute; inset: 0; box-sizing: border-box; width: 100%; height: 100%; margin: 0; padding: 12px 16px 48px 14px; border: 0; font: inherit; letter-spacing: 0; tab-size: 4; white-space: pre; overflow-wrap: normal; word-break: normal; }
.editor-highlight { overflow: hidden; color: var(--code-text); pointer-events: none; }
.editor-highlight code { font: inherit; }
.editor-input { overflow: auto; resize: none; outline: 0; background: transparent; color: transparent; -webkit-text-fill-color: transparent; caret-color: var(--accent); scrollbar-width: thin; scrollbar-color: rgba(255, 247, 240, 0.22) transparent; }
.editor-input::placeholder { color: rgba(184, 192, 212, 0.55); -webkit-text-fill-color: rgba(184, 192, 212, 0.55); opacity: 1; }
.editor-input::selection { background: rgba(255, 169, 89, 0.3); -webkit-text-fill-color: transparent; }
.code-editor.is-readonly .editor-input { cursor: progress; }

.term-overlay { position: absolute; z-index: 4; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(23, 28, 46, 0.94); }
.term-overlay-card { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 46ch; text-align: center; }
.term-overlay-card > .icon { width: 26px; height: 26px; color: var(--accent); }
.term-overlay-card strong { font: 650 var(--text-md)/1.3 var(--heading); }
.term-overlay-card p { color: var(--rail-muted); font-size: var(--text-xs); line-height: 1.55; overflow-wrap: anywhere; }
.term-overlay-card .button { margin-top: 6px; min-height: 36px; }

.terminal-popover { width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 520px); margin: 0; padding: 13px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px oklch(0.25 0.04 165 / 0.22); }
.terminal-popover::backdrop { background: transparent; }
.mode-options { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.mode-option { display: grid; grid-template-columns: 30px minmax(0, 1fr) 16px; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; border-radius: 9px; background: transparent; text-align: left; }
.mode-option:hover { background: var(--surface-soft); }
.mode-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-soft); color: var(--blue); }
.mode-icon .icon { width: 15px; height: 15px; }
.mode-copy { display: flex; flex-direction: column; gap: 2px; }
.mode-copy strong { font-size: var(--text-xs); }
.mode-copy small { color: var(--muted); font-size: var(--text-2xs); line-height: 1.45; }
.mode-option .selected-check { visibility: hidden; }
.mode-option[aria-checked="true"] { background: var(--blue-soft); }
.mode-option[aria-checked="true"] .mode-icon { background: var(--surface); }
.mode-option[aria-checked="true"] .selected-check { visibility: visible; }
.file-list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.file-choice { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 0 8px; border-radius: 8px; background: transparent; color: var(--ink-soft); font: var(--text-xs)/1.3 var(--mono); text-align: left; }
.file-choice:hover { background: var(--surface-soft); color: var(--ink); }
.file-choice[aria-current="true"] { background: var(--blue-soft); color: var(--ink); }
.file-choice .icon { width: 14px; height: 14px; color: var(--muted); }
.file-choice span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.file-choice[aria-current="true"] .icon:last-child { color: var(--blue); }
.file-empty { padding: 8px; color: var(--muted); font-size: var(--text-xs); }
.file-new { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.file-new input { flex: 1; min-width: 0; min-height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font: var(--text-xs) var(--mono); }
.file-new input:focus { border-color: var(--blue); outline: none; }
.file-new .button { min-height: 34px; }
.file-error { margin-top: 8px; color: var(--danger); font-size: var(--text-xs); line-height: 1.45; }
.terminal-menu { width: 248px; padding: 6px; }
.terminal-menu button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 9px; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: var(--text-xs); text-align: left; }
.terminal-menu button:hover { background: var(--surface-soft); color: var(--ink); }
.terminal-menu .icon { width: 14px; height: 14px; color: var(--muted); }
.toast { bottom: 54px; }
body.terminal-open .toast { top: 80px; bottom: auto; }

/* Exécutions dans la discussion */
.message.is-run .message-body { width: min(560px, 100%); max-width: min(92%, 560px); padding: 0; border: 0; background: transparent; }
.run-note { margin-bottom: 7px; padding: 9px 14px 11px; border: 1px solid var(--line); border-radius: 14px 14px 4px 14px; background: var(--surface-soft); }
.run-card { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.run-card-head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 9px 0 12px; background: var(--code-bg); color: var(--code-text); }
.run-card-head .icon { width: 14px; height: 14px; color: var(--accent); }
.run-card-head code { flex: 1; min-width: 0; overflow: hidden; font: var(--text-xs)/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.run-pill { flex: 0 0 auto; padding: 2px 8px; border-radius: 99px; font-size: var(--text-2xs); font-weight: 650; white-space: nowrap; }
.run-card.is-error .run-pill { background: rgba(240, 122, 114, 0.2); color: #ffb3aa; }
.run-card.is-ok .run-pill { background: rgba(120, 186, 135, 0.22); color: #ace4b9; }
.run-card.is-interrupted .run-pill { background: rgba(255, 247, 240, 0.12); color: var(--code-muted); }
.run-card-error { padding: 9px 12px 0; color: var(--danger); font: var(--text-xs)/1.55 var(--mono); overflow-wrap: anywhere; }
.run-card-details summary { display: flex; align-items: center; gap: 6px; padding: 8px 12px 9px; color: var(--muted); font-size: var(--text-xs); cursor: pointer; list-style: none; }
.run-card-details summary::-webkit-details-marker { display: none; }
.run-card-details summary .icon { width: 12px; height: 12px; transition: transform 160ms var(--ease); }
.run-card-details[open] summary .icon { transform: rotate(90deg); }
.run-card-details summary:hover { color: var(--ink); }
.run-card-details .message-text { max-width: none; padding: 0 12px 4px; color: var(--ink-soft); font-size: var(--text-sm); }
.run-card-details .message-text > p:first-child { color: var(--muted); font-size: var(--text-xs); }
.exercise-card { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); }
.exercise-card .card-head { color: var(--ink); }
.exercise-card .card-head code { padding: 1px 6px; border-radius: 5px; background: var(--surface-soft); color: var(--blue-dark); font: var(--text-xs) var(--mono); }
.exercise-expected { margin-top: 6px !important; color: var(--ink-soft); font-size: var(--text-sm); }
.exercise-card.is-done { border-color: #a9d3b2; background: #f6fbf7; }
.composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.composer-attachments:empty { display: none; }
.code-actions { display: flex; align-items: center; gap: 2px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 28px; padding: 0 3px 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); color: var(--ink-soft); font-size: var(--text-xs); }
.attachment-chip > .icon { width: 13px; height: 13px; color: var(--blue); }
.attachment-chip.is-error > .icon { color: var(--danger); }
.attachment-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip button { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 7px; border-radius: 6px; background: transparent; color: var(--blue); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.attachment-chip button:hover { background: var(--surface-hover); }
.attachment-chip button.chip-remove { width: 24px; padding: 0; justify-content: center; color: var(--muted); }
.attachment-chip button .icon { width: 12px; height: 12px; }

/* Brancher un autre ordinateur, erreur sur sa ligne, programme en cours (2026-11-09, second passage). */
.terminal-plug { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px 0 9px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 650 var(--text-xs)/1 var(--heading); white-space: nowrap; transition: background 150ms var(--ease); }
.terminal-plug:hover { background: #ffbb7c; }
.terminal-plug .icon { width: 13px; height: 13px; }
.terminal-drawer:is([data-status="unpaired"], [data-status="absent"], [data-status="rekey"]) .terminal-dot { background: var(--accent); }
.term-overlay.is-plug { place-items: start center; overflow-y: auto; padding: 22px 24px 26px; background: var(--rail); }
.plug-panel { width: min(760px, 100%); }
.plug-head { display: flex; align-items: flex-start; gap: 14px; }
.plug-icon { display: grid; flex: 0 0 auto; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: rgba(255, 169, 89, 0.14); color: var(--accent); }
.plug-icon .icon { width: 20px; height: 20px; }
.plug-head h3 { font: 650 var(--text-lg)/1.3 var(--heading); letter-spacing: -0.01em; }
.plug-head p { max-width: 64ch; margin-top: 4px; color: var(--rail-muted); font-size: var(--text-xs); line-height: 1.55; }
.plug-os { display: inline-flex; gap: 2px; margin: 16px 0 2px 54px; padding: 3px; border: 1px solid var(--term-line); border-radius: 9px; }
.plug-warning { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0 54px; padding: 9px 12px; border: 1px solid rgba(255, 169, 89, 0.4); border-radius: 9px; background: rgba(255, 169, 89, 0.1); color: var(--rail-text); font-size: var(--text-xs); line-height: 1.5; }
.plug-warning .icon { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; color: var(--accent); }
.plug-found { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0 54px; padding: 9px 12px; border: 1px solid rgba(143, 216, 163, 0.4); border-radius: 9px; background: rgba(143, 216, 163, 0.1); color: var(--rail-text); font-size: var(--text-xs); line-height: 1.5; }
.plug-found .icon { flex: 0 0 auto; width: 14px; height: 14px; margin-top: 2px; color: #8fd8a3; }
.plug-os button { min-height: 28px; padding: 0 13px; border-radius: 7px; background: transparent; color: var(--rail-muted); font-size: var(--text-xs); transition: background 150ms var(--ease), color 150ms var(--ease); }
.plug-os button:hover { color: var(--rail-text); }
.plug-os button[aria-checked="true"] { background: rgba(255, 247, 240, 0.12); color: var(--rail-text); font-weight: 600; }
.plug-steps { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 0; padding: 0 0 0 54px; list-style: none; counter-reset: plug; }
.plug-steps li { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 14px; padding: 13px 15px; border: 1px solid var(--term-line); border-radius: 12px; background: rgba(255, 247, 240, 0.03); counter-increment: plug; }
.plug-steps li::before { content: counter(plug); position: absolute; top: 13px; left: -40px; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--term-line); border-radius: 50%; background: var(--rail-raised); color: var(--accent); font: 650 var(--text-xs)/1 var(--heading); }
.plug-steps li:only-child::before { display: none; }
.plug-step-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plug-step-copy strong { font-size: var(--text-sm); font-weight: 650; }
.plug-step-copy span { color: var(--rail-muted); font-size: var(--text-xs); line-height: 1.5; }
.plug-command, .plug-code, .plug-note, .plug-error { grid-column: 1 / -1; }
.plug-command { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 5px 5px 12px; border: 1px solid var(--term-line); border-radius: 9px; background: #10142a; }
.plug-command code { flex: 1; min-width: 0; overflow-x: auto; color: #f4ede6; font: var(--text-xs)/1.6 var(--editor-mono); white-space: nowrap; scrollbar-width: none; }
.plug-command button { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 5px; min-height: 28px; padding: 0 10px; border-radius: 7px; background: rgba(255, 247, 240, 0.08); color: var(--rail-text); font-size: var(--text-xs); }
.plug-command button:hover { background: rgba(255, 247, 240, 0.15); }
.plug-command .icon { width: 13px; height: 13px; }
.plug-note { color: var(--rail-muted); font-size: var(--text-xs); line-height: 1.5; }
.plug-code { display: flex; gap: 8px; }
.plug-code input { flex: 1; min-width: 0; min-height: 36px; padding: 0 12px; border: 1px solid var(--term-line); border-radius: 9px; background: #10142a; color: var(--rail-text); font: var(--text-xs) var(--editor-mono); transition: border-color 150ms var(--ease); }
.plug-code input::placeholder { color: rgba(184, 192, 212, 0.5); }
.plug-code input:focus { border-color: var(--accent); outline: none; }
.plug-code .button { min-height: 36px; }
.plug-error { color: #ff9e93; font-size: var(--text-xs); }
.plug-panel .button.secondary { border-color: var(--term-line); background: rgba(255, 247, 240, 0.06); color: var(--rail-text); }
.plug-panel .button.secondary:hover { border-color: var(--rail-muted); background: rgba(255, 247, 240, 0.12); }
.plug-download { white-space: nowrap; font-family: var(--editor-mono); font-size: var(--text-xs); font-weight: 500; }
.plug-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 16px 0 0 54px; }
.plug-foot p { display: flex; align-items: flex-start; gap: 8px; max-width: 70ch; color: var(--rail-muted); font-size: var(--text-xs); line-height: 1.5; }
.plug-foot p .icon { width: 14px; height: 14px; margin-top: 1px; color: #8fd8a3; }
.plug-foot .text-button { color: var(--accent); }
.editor-input { z-index: 2; }
.editor-error-band { position: absolute; z-index: 1; top: 0; right: 0; left: 0; background: rgba(240, 122, 114, 0.12); pointer-events: none; }
.editor-error-note { position: absolute; z-index: 1; top: 0; left: 0; padding: 0 9px; border-radius: 5px; background: rgba(240, 122, 114, 0.1); color: #ff9e93; font-size: 0.92em; font-style: italic; white-space: pre; pointer-events: none; }
.editor-ruler { position: absolute; top: 0; left: 0; white-space: pre; visibility: hidden; pointer-events: none; }
.editor-gutter-lines span.is-error { position: relative; color: #ff9e93; }
.editor-gutter-lines span.is-error::before { content: ""; position: absolute; top: 50%; left: -8px; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #f07a72; }
.term-pane .pane-head { position: relative; }
.terminal-drawer[data-busy="true"] .term-pane .pane-head::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent) no-repeat; background-size: 35% 100%; animation: busy-slide 1.2s var(--ease) infinite; }
@keyframes busy-slide { from { background-position: -45% 0; } to { background-position: 145% 0; } }
.xterm-host { --vscode-scrollbar-shadow: rgba(0, 0, 0, 0.45); }
.terminal-last .last-delivery.is-reply { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; margin-left: 2px; padding: 0 9px 0 7px; border-radius: 99px; background: rgba(255, 169, 89, 0.16); color: var(--accent); font-size: var(--text-xs); font-weight: 600; }
.terminal-last .last-delivery.is-reply::before { content: none; }
.terminal-last .last-delivery.is-reply:hover { background: rgba(255, 169, 89, 0.28); }
.terminal-last .last-delivery.is-reply img { width: 16px; height: 16px; margin: -2px 0 -2px -2px; }
.run-pill.is-link { display: inline-flex; align-items: center; gap: 4px; transition: filter 150ms var(--ease); }
.run-pill.is-link .icon { width: 11px; height: 11px; }
.run-pill.is-link:hover { filter: brightness(1.18); text-decoration: underline; text-underline-offset: 3px; }
.message.is-tutor.is-flash .message-body { border-radius: 10px; animation: reply-flash 1.8s var(--ease); }
@keyframes reply-flash { 0%, 30% { background: var(--accent-light); box-shadow: 0 0 0 8px var(--accent-light); } 100% { background: transparent; box-shadow: 0 0 0 8px transparent; } }
.terminal-keys { width: min(340px, calc(100vw - 24px)); }
.keys-list { display: flex; flex-direction: column; margin: 8px 0 0; }
.keys-list > div { display: grid; grid-template-columns: 132px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 3px; border-bottom: 1px solid var(--line); }
.keys-list > div:last-child { border-bottom: 0; }
.keys-list dt { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; color: var(--muted); font-size: var(--text-2xs); }
.keys-list dd { margin: 0; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.4; }
.keys-list kbd { min-width: 22px; padding: 2px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--ink); font: 600 var(--text-2xs)/1.3 var(--sans); text-align: center; }

/* Terminal ouvert = actif, fermé = désactivé ; passage sur son propre terminal ; fichiers joints (2026-11-10). */
.terminal-own { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 11px 0 9px; border: 1px solid var(--rail-line); border-radius: 8px; background: transparent; color: var(--rail-text); font-size: var(--text-xs); font-weight: 600; white-space: nowrap; transition: border-color 150ms var(--ease), background 150ms var(--ease); }
.terminal-own:hover { border-color: var(--rail-muted); background: rgba(255, 247, 240, 0.07); }
.terminal-own .icon { width: 14px; height: 14px; color: var(--accent); }
.terminal-own .own-long { display: none; }
.terminal-drawer[data-state="closed"] :is(.terminal-mode, .terminal-own) { display: none; }
.terminal-drawer[data-status="off"] .terminal-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rail-muted); }
.message.is-notice { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.notice-line { display: inline-flex; align-items: center; gap: 8px; max-width: min(92%, 640px); margin: 0; padding: 6px 13px; border: 1px dashed var(--line-strong); border-radius: 99px; background: var(--panel); color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.45; }
.notice-line .icon { flex: 0 0 auto; width: 14px; height: 14px; color: var(--blue); }
.notice-line time { flex: 0 0 auto; color: var(--muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.run-card + .run-card { margin-top: 8px; }
.file-card-list { margin: 0; padding: 4px 0; list-style: none; }
.file-card-list li { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.file-card-list .icon { flex: 0 0 auto; width: 14px; height: 14px; color: var(--blue); }
.file-card-list code { flex: 1; min-width: 0; overflow: hidden; color: var(--ink); font: var(--text-xs)/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.file-card-list span { flex: 0 0 auto; color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.attachment-chip.is-joined strong { color: var(--ink); font-weight: 650; }
.composer { position: relative; }
.composer.is-drop { border-color: var(--blue); border-style: dashed; box-shadow: 0 0 0 4px var(--blue-soft); }
.composer.is-drop::after { content: "Dépose tes fichiers : ils partent avec ton prochain message"; position: absolute; inset: 0; display: grid; place-items: center; padding: 0 16px; border-radius: inherit; background: rgba(255, 255, 255, 0.9); color: var(--blue-dark); font-size: var(--text-sm); font-weight: 600; text-align: center; pointer-events: none; }
@media (min-width: 1500px) {
  .terminal-own .own-long { display: inline; }
  .terminal-own .own-short { display: none; }
}

@media (max-width: 1180px) {
  .pane-action span { display: none; }
  .pane-action.is-kenobi span { display: inline; }
  .terminal-last { max-width: 38%; }
}
@media (max-width: 960px) {
  .terminal-last .last-delivery { display: none; }
  .terminal-mode > span, .terminal-own > span { display: none !important; }
}
@media (max-width: 960px) {
  .plug-os, .plug-steps, .plug-foot, .plug-warning, .plug-found { margin-left: 0; }
  .plug-steps { padding-left: 0; }
  .plug-steps li::before { position: static; grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .terminal-drawer { display: none; }
  .toast { bottom: 16px; }
  .note-terminal { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  ::view-transition-old(course-workspace), ::view-transition-new(course-workspace) { animation: none !important; }
  .terminal-drawer[data-busy="true"] .term-pane .pane-head::after { background: var(--accent); opacity: 0.7; }
  .message.is-tutor.is-flash .message-body { background: var(--accent-light); }
}

/* Refonte du 2026-11-12 : plusieurs cours, réglages (modèle d’IA, voix, profil), import d’un cours, appel vocal,
   verdicts sur les lancements, panneaux repliables et discussion sur toute la hauteur. */

/* Rail : cours, ajout, modèle branché */
.sidebar-toggle { width: 32px; height: 32px; color: var(--rail-muted); }
.sidebar-toggle:hover { background: var(--rail-raised); color: var(--rail-text); }
.sidebar-toggle .icon { width: 17px; height: 17px; }
.course-list { display: flex; flex-direction: column; gap: 4px; }
.course-button { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; padding: 8px 9px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--rail-text); text-align: left; transition: background 160ms var(--ease), border-color 160ms var(--ease); }
.course-button:hover { background: var(--rail-raised); }
.course-button.is-active { border-color: var(--rail-line); background: var(--rail-raised); }
.course-monogram { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: rgba(255, 247, 240, 0.12); color: var(--rail-text); font: 700 var(--text-xs)/1 var(--mono); }
.course-button.is-active .course-monogram, .import-result .course-monogram { background: var(--accent); color: var(--accent-ink); }
.course-button-copy { display: flex; flex-direction: column; min-width: 0; }
.course-button-copy strong { overflow: hidden; font-size: var(--text-sm); font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.course-button-copy > span { color: var(--rail-muted); font-size: var(--text-2xs); font-variant-numeric: tabular-nums; }
.course-progress { position: absolute; right: 9px; bottom: 5px; left: 9px; height: 2px; overflow: hidden; border-radius: 99px; background: var(--rail-line); }
.course-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.add-course { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; margin-top: 8px; padding: 0 11px; border: 1px dashed var(--rail-line); border-radius: 9px; background: transparent; color: var(--rail-muted); font-size: var(--text-xs); transition: border-color 160ms var(--ease), color 160ms var(--ease); }
.add-course:hover { border-color: var(--rail-muted); color: var(--rail-text); }
.add-course .icon { width: 15px; height: 15px; }
.agent-status { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 1px solid var(--rail-line); border-radius: 10px; background: transparent; color: var(--rail-text); text-align: left; transition: border-color 160ms var(--ease), background 160ms var(--ease); }
.agent-status:hover { border-color: var(--rail-muted); background: var(--rail-raised); }
.agent-status > .icon { grid-row: 1 / 3; width: 17px; height: 17px; color: var(--rail-muted); }
/* Le nom du modèle a sa ligne entière, sous le titre et l’état. */
.agent-status-copy { display: contents; }
.agent-status-copy strong { grid-column: 2; grid-row: 1; font-size: var(--text-xs); font-weight: 600; }
.agent-status-copy > span { grid-column: 2 / 4; grid-row: 2; overflow: hidden; margin-top: -6px; color: var(--rail-muted); font-size: var(--text-2xs); text-overflow: ellipsis; white-space: nowrap; }
.agent-status .status-badge { grid-column: 3; grid-row: 1; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 1px 8px; border: 1px solid currentColor; border-radius: 99px; color: var(--rail-muted); font-size: var(--text-2xs); white-space: nowrap; }
.agent-status.is-online .status-badge { color: #8fd8a3; }
.agent-status.is-trouble .status-badge { color: var(--accent); }
.sidebar :is(button, a):focus-visible { outline-color: var(--accent); }

/* Rail replié et panneau de la leçon masqué : le milieu prend la place */
@media (min-width: 761px) {
  body.sidebar-rail { --sidebar-width: 60px; }
  body.sidebar-rail .sidebar { padding-inline: 9px; overflow-x: hidden; }
  body.sidebar-rail .brand-row { flex-direction: column; gap: 8px; padding: 0; }
  body.sidebar-rail :is(.brand-name, .sidebar-section-head, .course-button-copy, .course-progress, .nav-count, .status-badge, .agent-status-copy) { display: none; }
  body.sidebar-rail :is(.nav-item, .add-course) > span { display: none; }
  body.sidebar-rail :is(.nav-item, .add-course) { justify-content: center; min-height: 40px; padding: 0; }
  body.sidebar-rail .course-button { grid-template-columns: 34px; justify-content: center; padding: 4px; }
  body.sidebar-rail .agent-status { grid-template-columns: auto; justify-content: center; min-height: 40px; padding: 0; }
  body.sidebar-rail .learning-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rail-line); }
}
@media (min-width: 961px) {
  body.context-hidden .workspace { grid-template-columns: minmax(0, 1fr); }
  body.context-hidden .context-panel { display: none; }
  body.context-hidden .chat-view { max-width: 1040px; }
}

/* Barre du haut */
.model-button #model-button-label { overflow: hidden; font-family: var(--mono); font-size: var(--text-2xs); text-overflow: ellipsis; white-space: nowrap; }
.model-button.is-offline { border-color: #f0c890; background: var(--accent-light); color: #6b3a0f; }
.model-button.is-offline #model-button-label { font-family: var(--sans); font-size: var(--text-xs); font-weight: 600; }
.model-button.is-offline .model-dot { background: var(--accent); }
.call-button.is-live { background: var(--blue); }
.call-button.is-live .icon { color: #fff; }
.call-button.is-live #call-button-label { min-width: 8.6em; text-align: left; font-variant-numeric: tabular-nums; }

/* Plan du cours */
.course-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 4px; }
.course-heading-actions .button { min-height: 36px; }
.setup-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 22px; padding: 14px 16px; border: 1px solid #f0c890; border-radius: var(--radius); background: var(--accent-light); text-align: left; }
.setup-banner strong { display: block; font-size: var(--text-base); font-weight: 650; }
.setup-banner span { display: block; max-width: 62ch; margin-top: 2px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.setup-banner .button { min-height: 38px; }
.course-goals { margin-top: 28px; }
.course-goals h2 { font-size: var(--text-lg); font-weight: 650; letter-spacing: -0.01em; }
.course-goals ul, .chat-start-goals { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 8px 24px; margin: 12px 0 0; padding: 0; list-style: none; }
.course-goals li, .chat-start-goals li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.course-goals li .icon, .chat-start-goals li .icon { width: 14px; height: 14px; margin-top: 3px; color: var(--blue); }
.chat-start-goals { grid-template-columns: minmax(0, 1fr); max-width: 46ch; margin: 12px auto 18px; text-align: left; }
.chat-empty-state .chat-start-mascot { margin-bottom: 4px; }
.chat-empty-state .setup-banner { margin: 18px 0; }

/* Discussion : voix, verdicts, notes de mémoire */
.meta-voice { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: var(--text-2xs); }
.meta-voice .icon { width: 12px; height: 12px; }
.verdict-chip { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 7px !important; padding: 3px 12px 3px 9px; border-radius: 99px; font-size: var(--text-sm); font-weight: 700; }
.verdict-chip .icon { width: 15px; height: 15px; }
.verdict-chip.is-ok { background: #e3f3e6; color: #25603a; }
.verdict-chip.is-near { background: var(--accent-light); color: #8a4a12; }
.verdict-chip.is-miss { background: var(--danger-soft); color: var(--danger); }
.verdict-chip + p { margin-top: 0; }
.review-chip.is-note { background: var(--blue-soft); color: var(--blue-dark); }
.exercise-expected strong { font-weight: 650; }
.terminal-last .last-delivery.is-reply.is-reussi { background: rgba(120, 186, 135, 0.2); color: #9fe0b0; }
.terminal-last .last-delivery.is-reply.is-pas-encore { background: rgba(240, 122, 114, 0.18); color: #ffa79d; }

/* Fin du cours, QCM et réponses en un clic (2026-11-14) */
.ready-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.ready-bar .button { min-height: 40px; }
.ready-bar .button.primary { padding: 0 18px; font-size: var(--text-sm); }
.reply-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reply-button { min-height: 36px; padding: 6px 14px; border: 1px solid #c9d9f4; border-radius: 99px; background: #f3f7fe; color: var(--blue-dark); font-size: var(--text-sm); font-weight: 600; line-height: 1.3; transition: background 150ms var(--ease), border-color 150ms var(--ease); }
.reply-button:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-soft); }
.quiz-card { margin-top: 12px; padding: 12px 14px 14px; border: 1px solid #c9d9f4; border-radius: 11px; background: #f8faff; }
.quiz-question { margin-top: 6px !important; color: var(--ink); font-size: var(--text-base); font-weight: 600; line-height: 1.45; }
.quiz-options { display: grid; gap: 8px; margin-top: 10px; }
.quiz-option { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 11px; width: 100%; min-height: 46px; padding: 9px 14px 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: var(--text-md); line-height: 1.45; text-align: left; transition: border-color 150ms var(--ease), background 150ms var(--ease), transform 120ms var(--ease); }
.quiz-option:hover:not(:disabled) { border-color: var(--blue); background: #f3f7fe; }
.quiz-option:active:not(:disabled) { transform: scale(0.99); }
.quiz-option:disabled { cursor: default; opacity: 1; }
.quiz-text { min-width: 0; overflow-wrap: anywhere; }
.quiz-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid var(--line-strong); border-radius: 50%; color: #fff; }
.quiz-mark .icon { width: 13px; height: 13px; stroke-width: 2.6; }
.quiz-option:hover:not(:disabled) .quiz-mark { border-color: var(--blue); }
.quiz-option.is-right, .quiz-option.is-answer { border-color: #a9d3b2; background: #f6fbf7; }
.quiz-option.is-right .quiz-mark { border-color: #3f8a52; background: #3f8a52; }
.quiz-option.is-answer .quiz-mark { border-color: #3f8a52; color: #3f8a52; }
.quiz-option.is-wrong { border-color: oklch(0.78 0.08 28); background: var(--danger-soft); }
.quiz-option.is-wrong .quiz-mark { border-color: var(--danger); background: var(--danger); }
.quiz-option.is-picked { border-color: var(--blue); background: #f3f7fe; }
.quiz-option.is-picked .quiz-mark { border-color: var(--blue); background: var(--blue); }
.quiz-option.is-dim { color: var(--muted); }
.quiz-option.is-dim .quiz-mark { opacity: 0.6; }
.quiz-feedback { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; margin-top: 10px !important; padding: 9px 12px; border-radius: 9px; background: var(--surface-soft); color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.quiz-feedback .icon { width: 15px; height: 15px; margin-top: 3px; }
.quiz-feedback.is-right { background: #e3f3e6; color: #25603a; }
.quiz-feedback.is-wrong { background: var(--accent-light); color: #6b3a0f; }
.quiz-feedback strong { color: inherit; font-weight: 700; }
.quiz-card .card-note { margin-top: 10px !important; }
.quiz-answer { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--ink); font-size: var(--text-md); line-height: 1.5; }
.quiz-answer .icon { width: 15px; height: 15px; }
.quiz-answer.is-right .icon { color: #2f6b3c; }
.quiz-answer.is-wrong .icon { color: var(--danger); }
.quiz-answer code { padding: 1px 5px; border-radius: 4px; background: var(--surface); color: var(--blue-dark); font: 0.88em/1.4 var(--mono); }

/* Appel : un panneau qui ne bloque rien, la tête de Kenobi suit sa voix */
.call-panel { position: fixed; inset: calc(var(--topbar-height) + 10px) 14px auto auto; z-index: var(--z-modal); width: 324px; max-width: calc(100vw - 28px); margin: 0; padding: 10px 14px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--panel); color: var(--ink); box-shadow: 0 18px 46px rgba(23, 28, 46, 0.2); }
.call-head { display: flex; align-items: center; gap: 2px; }
.call-head .call-timer { margin-right: 6px; }
.call-head h2 { flex: 1; font-size: var(--text-base); font-weight: 650; }
.call-timer { color: var(--muted); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.voice-stage { display: flex; flex-direction: column; align-items: center; padding: 4px 4px 6px; text-align: center; }
.voice-orb { --voice: 0; --mic: 0; position: relative; display: grid; place-items: center; width: 110px; height: 110px; margin-bottom: 8px; }
.orb-core { position: relative; z-index: 2; display: grid; place-items: center; width: 98px; height: 98px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--blue); transition: background 200ms var(--ease), box-shadow 120ms linear; }
.voice-orb[data-state="listen"] .orb-core { box-shadow: 0 0 0 calc(var(--mic) * 9px) rgba(55, 106, 183, 0.16); }
.kenobi-live { width: 86px; height: 86px; overflow: visible; transform-origin: 50% 70%; }
.voice-orb[data-state="off"] .kenobi-live { opacity: 0.82; }
.voice-stage > strong { font-size: var(--text-md); font-weight: 650; }
.voice-caption { display: -webkit-box; overflow: hidden; min-height: 2.9em; max-width: 30ch; margin-top: 4px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; text-wrap: balance; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.call-notice { margin: 0 0 8px; color: var(--muted); font-size: var(--text-xs); line-height: 1.45; text-align: center; }
.call-notice:empty { display: none; }
.voice-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.voice-actions .button { flex: 1 1 auto; min-height: 38px; padding: 0 12px; }
.call-foot { margin-top: 9px; color: var(--muted); font-size: var(--text-2xs); line-height: 1.4; text-align: center; }
.call-foot:empty { display: none; }
.call-foot .text-button { min-height: 28px; }

/* Dialogues : réglages, import d’un cours, confirmation */
.sheet-dialog { width: min(640px, calc(100vw - 28px)); max-height: min(880px, calc(100dvh - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--panel); color: var(--ink); box-shadow: 0 24px 70px rgba(23, 28, 46, 0.3); }
.sheet-dialog[open] { display: flex; flex-direction: column; }
.sheet-dialog::backdrop { background: rgba(23, 28, 46, 0.46); }
.confirm-dialog { width: min(470px, calc(100vw - 28px)); }
.sheet-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 14px 10px 22px; }
.sheet-head h2 { font-size: var(--text-xl); font-weight: 650; letter-spacing: -0.015em; }
.sheet-tabs { display: flex; flex: 0 0 auto; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.sheet-tabs [role="tab"] { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; margin-bottom: -1px; padding: 0 11px; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: var(--text-sm); font-weight: 600; transition: color 150ms var(--ease), border-color 150ms var(--ease); }
.sheet-tabs [role="tab"]:hover { color: var(--ink); }
.sheet-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--blue); color: var(--ink); }
.sheet-tabs .icon { width: 15px; height: 15px; }
.sheet-body { overflow-y: auto; padding: 18px 22px 20px; }
.sheet-body:focus { outline: none; }
#ai-provider-fields { display: flex; flex-direction: column; gap: 15px; }
#ai-provider-fields:empty { display: none; }
.sheet-intro { max-width: 64ch; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.55; }
.field-set { display: flex; flex-direction: column; gap: 15px; min-width: 0; margin: 16px 0 0; padding: 0; border: 0; }
.field-set:disabled { opacity: 0.6; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { font-size: var(--text-sm); font-weight: 650; }
.field-hint { color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
.field-hint a, .sheet-note a { color: var(--blue); }
.field-hint [data-tone="error"], .field-hint[data-tone="error"] { color: var(--danger); }
.sheet-dialog :where(input[type="text"], input[type="url"], input[type="password"], select, textarea) { width: 100%; min-width: 0; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: var(--text-base); transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease); }
.sheet-dialog textarea { padding: 9px 12px; resize: vertical; line-height: 1.5; }
.sheet-dialog :is(input, select, textarea):focus-visible { border-color: var(--blue); outline: 0; box-shadow: 0 0 0 3px var(--blue-soft); }
.sheet-dialog ::placeholder { color: var(--muted); opacity: 1; }
.field-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-row > :first-child { flex: 1; min-width: 0; }
.field-row .button { flex: 0 0 auto; min-height: 40px; white-space: nowrap; }
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 10px; margin-top: 4px; }
.sheet-body > .sheet-actions { margin-top: 18px; }
.sheet-actions > .text-button { margin-right: auto; }
.sheet-status { flex: 1 1 220px; color: var(--muted); font-size: var(--text-sm); line-height: 1.45; }
.sheet-status[data-tone="ok"] { color: #25603a; }
.sheet-status[data-tone="error"] { color: var(--danger); }
.sheet-warning { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: var(--accent-light); color: #6b3a0f; font-size: var(--text-sm); line-height: 1.5; }
.sheet-warning.is-error { background: var(--danger-soft); color: var(--danger); }
.sheet-warning .icon, .sheet-note .icon { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 3px; }
.sheet-note { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.sheet-note strong { color: var(--ink-soft); font-weight: 650; }
.link-button { padding: 0; background: transparent; color: var(--blue); font-size: inherit; text-decoration: underline; text-underline-offset: 3px; }
.model-list { max-height: 196px; margin-top: 2px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.model-choice { display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 32px; padding: 5px 9px; border-radius: 6px; background: transparent; text-align: left; }
.model-choice:hover { background: var(--surface-soft); }
.model-choice[aria-selected="true"] { background: var(--blue-soft); }
.model-choice code { color: var(--ink); font: var(--text-xs)/1.4 var(--mono); }
.model-choice span { overflow: hidden; color: var(--muted); font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.model-empty { padding: 8px 9px; color: var(--muted); font-size: var(--text-xs); }
.engine-list { display: flex; flex-direction: column; gap: 8px; }
.engine-card { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: start; gap: 11px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); cursor: pointer; transition: border-color 150ms var(--ease), background 150ms var(--ease); }
.engine-card:hover { border-color: var(--blue); }
.engine-card.is-selected { border-color: var(--blue); background: #f3f7fe; }
.engine-card input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--blue); }
.engine-copy strong { display: block; font-size: var(--text-base); font-weight: 650; }
.engine-copy span { display: block; margin-top: 1px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; }
.engine-body { margin: 0 0 4px 30px; }
.engine-fields { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 6px; }
.check-row { display: flex; align-items: flex-start; gap: 10px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; cursor: pointer; }
.check-row input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--blue); }
.install-progress { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; color: var(--ink-soft); font-size: var(--text-sm); }
.progress-track { height: 6px; overflow: hidden; border-radius: 99px; background: var(--surface-hover); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width 400ms var(--ease); }
.progress-track.is-indeterminate span { width: 34%; animation: progress-slide 1.3s var(--ease) infinite; }
@keyframes progress-slide { from { transform: translateX(-110%); } to { transform: translateX(310%); } }
.install-command { overflow: hidden; min-width: 0; color: var(--muted); font: var(--text-2xs)/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.drop-zone { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-top: 16px; padding: 26px 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink-soft); text-align: center; cursor: pointer; transition: border-color 150ms var(--ease), background 150ms var(--ease); }
.drop-zone:hover, .drop-zone.is-drop, .drop-zone:focus-within { border-color: var(--blue); background: #f3f7fe; }
.drop-zone.has-file { border-style: solid; }
.drop-zone .icon { width: 24px; height: 24px; margin-bottom: 5px; color: var(--blue); }
.drop-zone strong { color: var(--ink); font-size: var(--text-base); font-weight: 650; overflow-wrap: anywhere; }
.drop-zone span { color: var(--muted); font-size: var(--text-sm); }
.import-result-head { display: flex; align-items: flex-start; gap: 12px; }
.import-result h3 { font-size: var(--text-lg); font-weight: 650; line-height: 1.3; }
.import-result-head p { margin-top: 3px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.5; }
.import-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.import-facts div { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.import-facts dt { color: var(--muted); font-size: var(--text-2xs); font-weight: 600; }
.import-facts dd { margin: 2px 0 0; font-size: var(--text-sm); font-weight: 600; line-height: 1.35; }
.import-facts dd::first-letter { text-transform: uppercase; }
.import-result h4 { margin: 16px 0 6px; font-family: var(--heading); font-size: var(--text-sm); font-weight: 650; }
.import-goals, .import-modules { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.6; }
.import-modules strong { color: var(--ink); font-weight: 600; }
.import-modules span { margin-left: 8px; color: var(--muted); font-size: var(--text-xs); }
@media (max-width: 760px) {
  .sidebar-toggle { display: none; }
  .topbar-context { flex: 1 1 auto; }
  .breadcrumb { max-width: none; }
  .crumb-course { overflow: hidden; max-width: 38vw; text-overflow: ellipsis; }
}
@media (max-width: 560px) {
  .import-facts { grid-template-columns: minmax(0, 1fr); }
  .engine-body { margin-left: 0; }
  .field-row { flex-wrap: wrap; }
  .call-panel { inset: auto 10px 10px 10px; width: auto; }
  .send-button, .stop-button { width: 40px; padding: 0; }
  .send-button > span, .stop-button > span { display: none; }
  .course-heading-actions .button { width: 36px; padding: 0; }
  .course-heading-actions .button > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-track.is-indeterminate span { width: 100%; opacity: 0.5; }
}

/* ── Visite guidée (TourGuide JS, tour.js) ─────────────────────────────── */

.tg-dialog.kenobi-tour { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--panel); color: var(--ink); font-family: var(--sans); font-size: var(--text-sm, 0.875rem); line-height: 1.55; box-shadow: 0 18px 48px rgba(23, 28, 46, 0.28); }
.kenobi-tour .tg-dialog-header { padding: 20px 22px 0; }
.kenobi-tour .tg-dialog-header .tg-dialog-title { font-family: var(--heading); font-size: 1.05rem; font-weight: 700; color: var(--ink); }
.kenobi-tour .tg-dialog-header .tg-dialog-title + .tg-dialog-body,
.kenobi-tour .tg-dialog-body { padding: 12px 22px 16px; color: var(--ink-soft); }
.kenobi-tour .tg-dialog-body p { margin: 0 0 9px; }
.kenobi-tour .tg-dialog-body p:last-child { margin-bottom: 0; }
.kenobi-tour .tg-dialog-body ul { margin: 6px 0 0; padding-left: 18px; }
.kenobi-tour .tg-dialog-body li { margin: 4px 0; }
.kenobi-tour .tg-dialog-body strong { color: var(--ink); }
.kenobi-tour .tour-mascot { display: block; width: 96px; height: 96px; margin: 2px auto 12px; }
.kenobi-tour .tg-dialog-close-btn { color: var(--muted); opacity: 0.7; }
.kenobi-tour .tg-dialog-footer { gap: 10px; padding: 8px 22px 20px; }
.kenobi-tour .tg-dialog-footer button.tg-dialog-btn { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-soft); font-family: var(--sans); font-size: var(--text-xs); font-weight: 650; cursor: pointer; }
.kenobi-tour .tg-dialog-footer button.tg-dialog-btn:hover { border-color: var(--line-strong); background: var(--surface-soft); color: var(--ink); }
.kenobi-tour .tg-dialog-footer button#tg-dialog-next-btn { border-color: transparent; background: var(--blue); color: #fff; }
.kenobi-tour .tg-dialog-footer button#tg-dialog-next-btn:hover { border-color: transparent; background: var(--blue-dark); color: #fff; }
.kenobi-tour .tg-dialog-footer button.tg-dialog-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kenobi-tour .tg-dialog-dots > span.tg-dot { background: var(--line-strong); }
.kenobi-tour .tg-dialog-dots > span.tg-dot.tg-dot-active { background: var(--accent); }
.kenobi-tour .tg-step-progress { color: var(--muted); opacity: 1; }
.kenobi-tour .tg-arrow { background: var(--panel); }
.tg-backdrop { border-color: rgba(255, 169, 89, 0.85); }
@media (prefers-reduced-motion: reduce) {
  .tg-backdrop.tg-backdrop-animate, .tg-dialog.animate-position { transition: none; }
}

/* ── Version web : coffre des clés, pont vocal, sauvegarde ─────────────── */

.vault-box { display: grid; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.vault-box h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--heading); font-size: var(--text-sm); color: var(--ink); }
.vault-box h3 .icon { width: 16px; height: 16px; color: var(--blue); }
.vault-unlock { display: grid; gap: 8px; margin-bottom: 14px; }
.setup-steps { display: grid; gap: 10px; margin: 0 0 4px; padding-left: 20px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.6; }
.setup-steps li::marker { color: var(--blue); font-weight: 700; }
.setup-steps code, .engine-fields .field-hint code { padding: 1px 5px; border-radius: 5px; background: var(--surface-soft); font-family: var(--mono); font-size: 0.92em; color: var(--ink); }
.setup-steps .text-button { margin-left: 4px; }
.voice-custom { margin-top: 4px; color: var(--muted); font-size: var(--text-xs); }
.voice-custom summary { cursor: pointer; padding: 4px 0; }
.voice-custom[open] summary { margin-bottom: 8px; }
.data-actions { justify-content: flex-start; flex-wrap: wrap; }
.data-actions label.button { cursor: pointer; }

/* ── Ajouter un cours : format, consigne pour une IA, écriture par le modèle ── */

.format-help { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 0 14px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.6; }
.format-help summary { display: flex; align-items: center; gap: 8px; min-height: 42px; cursor: pointer; font-weight: 650; color: var(--ink); }
.format-help summary .icon { width: 15px; height: 15px; color: var(--blue); }
.format-help[open] { padding-bottom: 12px; }
.format-help p { margin: 4px 0 10px; }
.format-help code { padding: 1px 5px; border-radius: 5px; background: var(--surface-soft); font-family: var(--mono); font-size: 0.92em; color: var(--ink); }
.format-sample { margin: 0 0 10px; padding: 12px 14px; overflow-x: auto; border-radius: var(--radius-sm); background: var(--code-bg); color: var(--code-text); font-family: var(--mono); font-size: 0.75rem; line-height: 1.55; white-space: pre; }
.format-sample code { padding: 0; background: transparent; color: inherit; }
.format-actions { justify-content: flex-start; }
.course-draft { min-height: 220px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.55; }

/* ── Accueil : écran de bienvenue et « Bien démarrer » ─────────────────── */

.welcome-dialog { width: min(780px, calc(100vw - 28px)); }
.welcome-head { padding-bottom: 0; }
.welcome-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--blue); font-size: var(--text-xs); font-weight: 650; letter-spacing: 0.02em; text-transform: uppercase; }
.welcome-kicker .icon { width: 14px; height: 14px; }
.welcome-body { display: grid; gap: 18px; padding: 8px 26px 24px; overflow-y: auto; }
.welcome-hero { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 18px; }
.welcome-hero img { width: 112px; height: 112px; }
.welcome-hero h2 { margin: 0 0 6px; font-family: var(--heading); font-size: 1.75rem; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); }
.welcome-hero p { margin: 0; color: var(--ink-soft); font-size: var(--text-base, 1rem); line-height: 1.6; }
.welcome-shot { margin: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(23, 28, 46, 0.14); }
.welcome-shot img { display: block; width: 100%; height: auto; }
.welcome-points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0; padding: 0; list-style: none; }
.welcome-points li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.55; }
.welcome-points .icon { width: 20px; height: 20px; margin-top: 2px; color: var(--blue); }
.welcome-points strong { color: var(--ink); }
.welcome-subtitle { margin: 2px 0 -6px; font-family: var(--heading); font-size: var(--text-base, 1rem); color: var(--ink); }
.welcome-steps { display: grid; gap: 6px; margin: 0; padding-left: 22px; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.55; }
.welcome-steps li::marker { color: var(--accent); font-weight: 700; }
.welcome-steps strong { color: var(--ink); }
.welcome-actions { margin-top: 4px; }
@media (max-width: 640px) {
  .welcome-body { padding: 6px 18px 20px; }
  .welcome-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .welcome-hero img { width: 88px; height: 88px; }
  .welcome-hero h2 { font-size: 1.45rem; }
  .welcome-points { grid-template-columns: 1fr; }
}

.get-started { margin-bottom: 24px; padding: 18px 20px 14px; border: 1px solid #f0c890; border-radius: var(--radius-lg); background: var(--accent-light); }
.get-started-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.get-started-head h2 { margin: 0; font-family: var(--heading); font-size: var(--text-lg, 1.125rem); color: var(--ink); }
.get-started-head p { margin: 3px 0 0; color: var(--ink-soft); font-size: var(--text-sm); }
.get-started-links { display: flex; gap: 4px; }
.start-steps { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.start-step { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(23, 28, 46, 0.08); }
.start-step:first-child { border-top: 0; }
.start-step strong { display: block; color: var(--ink); font-size: var(--text-sm); font-weight: 650; }
.start-step strong em { color: var(--muted); font-style: normal; font-weight: 500; }
.start-step > div > span { display: block; margin-top: 2px; color: var(--ink-soft); font-size: var(--text-xs); line-height: 1.5; }
.start-step .button { min-height: 36px; white-space: nowrap; }
.start-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-size: var(--text-xs); font-weight: 700; }
.start-step.is-done .start-mark { border-color: transparent; background: var(--success); color: #fff; }
.start-mark .icon { width: 15px; height: 15px; }
.start-step.is-done strong { color: var(--muted); }
@media (max-width: 640px) {
  .start-step { grid-template-columns: 30px minmax(0, 1fr); }
  .start-step .button { grid-column: 2; justify-self: start; }
}
.import-dialog .sheet-body > .field { margin-top: 14px; }
.format-help .prompt-text { width: 100%; margin-top: 4px; }
