@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  /* ── Tokens fondamentaux ─────────────────────────── */
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #5e6b7c;
  --primary: #245a8f;
  --link-color: #145bb4;
  --link-hover: #0f4f9d;
  --focus: #737373;
  --shadow-soft: 0 12px 32px rgba(19, 39, 68, 0.08);
  --shadow-card:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 12px 28px -14px rgba(15, 23, 42, 0.22);
  /* Six learning types, normalised in OKLCH: equal perceived weight, with
     lightness allowed to follow each hue's own gamut so yellow stays yellow
     instead of turning to mustard. CIE L* spread is 11 (was 24).
     Mirrored in js/editor/config.js (LEARNING_TYPES) and view.php, which is
     self-contained and cannot read these tokens. */
  --read: #5bddd3;
  --investigate: #f19492;
  --practice: #c498ec;
  --produce: #a2d681;
  --discuss: #85b6f0;
  --collaborate: #e7b959;

  /* ── Typographie ─────────────────────────────────── */
  --font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;
  --font-heading: var(--font-family);
  --font-prompt: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --heading-ink: #1f1f1d;
  /* A shared, comfortable reading rhythm for the site's content pages. */
  --page-section-gap: clamp(26px, 2.4vw, 34px);
  --page-heading-gap: 18px;
  --page-subsection-gap: clamp(48px, 5vw, 64px);
  --card-padding: clamp(24px, 2.4vw, 32px);
  --card-gap: clamp(18px, 2vw, 24px);
  --content-leading: 1.72;

  /* ── Hiérarchie textuelle ────────────────────────── */
  --text-strong: #253245;
  --text-body:   #314255;
  --text-subtle: #415067;

  /* ── Surfaces ────────────────────────────────────── */
  --surface-menu:  #f5f5f5;
  --surface-input: #f7f7f7;
  --surface-light: #fafafa;

  /* ── Hover / sélection ───────────────────────────── */
  --hover-bg:        #f7f7f7;
  --hover-bg-mid:    #ededed;
  --active-bg:       #e2e7ff;
  --active-bg-light: #eef2ff;

  /* ── Famille indigo (tool picker & chips) ────────── */
  --indigo:        #4f46e5;
  --indigo-hover:  #6366f1;
  --indigo-dark:   #3730a3;
  --indigo-bg:     #eef2ff;
  --indigo-border: #c7d2fe;
  --indigo-active: #e0e7ff;

  /* ── Danger / suppression ────────────────────────── */
  --danger:        #c0303b;
  --danger-bg:     #fde8ea;
  --danger-border: #f5b8bc;

  /* ── Actions ─────────────────────────────────────── */
  --action-primary:          #285f96;
  --action-primary-hover:    #204f7d;
  --action-primary-border:   #204f7d;
  --action-secondary-bg:     #f8fafb;
  --action-secondary-border: #c8d2db;
  --action-secondary-text:   #40576b;
  --action-secondary-hover:  #edf2f5;
  --action-focus:            rgba(40, 95, 150, 0.28);
  --btn-primary-from:        #1f1f1d;
  --btn-primary-to:          #1f1f1d;
  --btn-primary-hover:       #343430;
  --btn-primary-border:      #1f1f1d;
  --btn-primary-text:        #ffffff;

  /* ── Alerte / avertissement ──────────────────────── */
  --warning-bg:     #fff4cc;
  --warning-border: #d8c46f;
  --warning-text:   #4f3a00;

  /* ── Tooltip ─────────────────────────────────────── */
  --tooltip-bg:     #efefe4;
  --tooltip-border: #b7b7a8;

  /* ── Ombres supplémentaires ──────────────────────── */
  --shadow-menu:        0 8px 20px rgba(26, 35, 53, 0.20);
  --shadow-modal:       0 18px 42px rgba(0, 0, 0, 0.20);
  --shadow-picker:      0 12px 32px rgba(26, 35, 53, 0.22);
  --shadow-btn-primary: 0 5px 14px rgba(32, 79, 125, 0.16);

  /* ── Transitions ─────────────────────────────────── */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

@media (max-width: 600px) {
  :root {
    --page-section-gap: 24px;
    --page-heading-gap: 16px;
    --page-subsection-gap: 40px;
    --card-padding: 22px;
    --card-gap: 18px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--text);
  font-family: var(--font-family);
}

body {
  display: flex;
  flex-direction: column;
}

/* ── Hiérarchie typographique commune ────────────────
   La page d'accueil conserve volontairement sa direction en Inter. */
html body:not(.home-page) :is(h1, h2, h3, h4, h5, h6) {
  color: var(--heading-ink);
  font-family: var(--font-heading);
}

html body:not(.home-page) h1 {
  color: var(--heading-ink);
  font-size: 42px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

html body:not(.home-page) h2 {
  color: var(--primary);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-transform: none;
}

html body:not(.home-page) h3 {
  color: var(--primary);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

[data-theme="dark"] body:not(.home-page) h3 {
  color: var(--primary);
}

/* ── Rythme vertical commun ───────────────────────────
   Ces valeurs reprennent la cadence de la page d'aide. */
html body:not(.home-page) :is(
  .help-section,
  .ld-section,
  .cf-section
) > h2 {
  margin-bottom: var(--page-heading-gap);
}

.help-content {
  gap: var(--page-section-gap);
}

.help-section h3 {
  margin-top: var(--page-subsection-gap);
}

.ld-hero,
.ld-quote,
.ld-section {
  margin-bottom: var(--page-subsection-gap);
}

.bloom-header,
.saved-header,
.shared-header {
  margin-bottom: var(--page-section-gap);
}

.ld-section:last-child {
  margin-bottom: 0;
}

.competencies-shell {
  display: grid;
  gap: var(--page-section-gap);
}

.competencies-header,
.competencies-controls {
  margin: 0;
}

.saved-grid,
.shared-grid {
  gap: var(--page-section-gap);
}

html body.profile-page .profile-cli,
html body.admin-page .account-form.panel {
  margin-bottom: var(--page-section-gap);
}

.cf-prose {
  display: grid;
  gap: var(--page-subsection-gap);
}

.cf-section {
  margin: 0;
  padding: 0;
}

.cf-type-section {
  margin: var(--page-subsection-gap) 0 0;
  padding: 0;
}

.cf-schema,
.cf-table-wrap,
.cf-final-schema {
  margin-top: var(--page-section-gap);
}

.cf-prose > .cf-final-schema {
  margin-top: 0;
}

.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;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 3000;
  background: #123f78;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #0f3564;
}

.skip-link:focus {
  top: 8px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.material-icon-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  display: inline-block;
  vertical-align: middle;
}

.top-panel {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: none;
  background: #1f1f1d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  backdrop-filter: none;
}

.site-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.site-nav-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--read)          0deg  100deg,
    var(--investigate) 100deg  130deg,
    var(--practice)    130deg  200deg,
    var(--produce)     200deg  235deg,
    var(--discuss)     235deg  310deg,
    var(--collaborate) 310deg  360deg
  );
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  box-shadow: none;
}

.site-nav-brand-copy {
  display: grid;
  gap: 2px;
  margin-left: 4px;
}

.site-nav-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f1f5f9;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid rgba(203, 213, 225, 0.7);
}

.top-brand-actions {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.brand-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

html body.designer-page h1.brand-title {
  margin: 0;
  font-family: var(--font-family);
  font-size: 18px;
  line-height: 1.25;
}

.top-panel-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--btn-primary-border);
  border-radius: 999px;
  padding: 0;
  background: var(--btn-primary-from);
  color: var(--btn-primary-text);
  box-shadow: 0 8px 18px rgba(20, 24, 32, 0.14);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.top-panel-toggle:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
  color: var(--btn-primary-text);
}

.top-panel-toggle .chevron {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.top-panel.collapsed .top-panel-toggle .chevron {
  transform: rotate(180deg);
}

.top-panel-body {
  padding: 22px 24px 26px;
  background: #ffffff;
  overflow: hidden;
  max-height: 8000px;
  transition: max-height var(--transition-fast), padding var(--transition-fast);
}

.top-panel.collapsed .top-panel-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top: 0;
}

.top-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  position: relative;
}

.top-tab-slider {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition:
    left 200ms cubic-bezier(0.4, 0, 0.2, 1),
    width 200ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity 120ms ease;
  pointer-events: none;
  opacity: 0;
}

.top-brand .top-tabs {
  margin-bottom: 0;
  align-items: center;
}

.top-tab {
  position: relative;
  z-index: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  padding: 8px 14px;
  font-size: 15px;
  color: var(--text-subtle);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.top-tab.active {
  font-weight: 600;
  color: var(--primary);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 3vw, 48px);
  row-gap: 28px;
  align-items: start;
}

.panel-column {
  display: grid;
  gap: 24px;
  align-content: start;
}

.form-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: start;
}

.form-row label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-strong);
  padding-top: 11px;
  line-height: 1.3;
}

#top-panel [data-tooltip-i18n] {
  cursor: help;
}

.panel-column-left .form-row {
  grid-template-columns: 156px minmax(0, 1fr);
}

.panel-column-right .form-row {
  grid-template-columns: 176px minmax(0, 1fr);
}

#label-meta-delivery,
#label-meta-school-system,
#label-meta-level {
  align-self: center;
  padding-top: 0;
}

.panel-input,
.panel-select,
.panel-textarea {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 14px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

select.panel-select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23334155' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 12px 8px;
}

select.panel-select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background-color: color-mix(in srgb, var(--panel) 72%, var(--line));
}

.panel-textarea {
  min-height: 64px;
  resize: none;
  overflow: hidden;
  line-height: 1.6;
}

.expandable-field {
  position: relative;
}

.expandable-field-placeholder {
  pointer-events: none;
}

.expandable-field-placeholder .markdown-toolbar {
  display: none;
}

.expandable-field-placeholder .expand-btn {
  visibility: hidden;
}

.expandable-field-placeholder textarea {
  color: var(--text);
  background: #fff;
}

.markdown-toolbar {
  display: none;
}

.markdown-tool-btn {
  min-width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-input);
  color: var(--text-body);
  font: 600 12px/1 "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  cursor: pointer;
  padding: 0 8px;
}

.markdown-tool-btn:hover {
  background: var(--hover-bg-mid);
}

.expand-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-input);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.expandable-field textarea {
  padding-right: 30px;
}

.markdown-preview {
  display: none;
}

.expandable-field.preview-active:not(.fullscreen):not(.is-editing) textarea {
  position: absolute;
  inset: 0;
  height: 100% !important;
  opacity: 0;
  pointer-events: none;
}

.expandable-field.preview-active:not(.fullscreen):not(.is-editing) .markdown-preview {
  display: block;
  min-height: 64px;
  padding: 10px 30px 10px 12px;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  /* Matches the textarea underneath: the preview replaces it when the field
     loses focus, so a different line-height would make the field jump height
     between reading and editing. */
  line-height: 1.6;
  white-space: normal;
  cursor: text;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.markdown-preview p,
.markdown-preview blockquote,
.markdown-preview ul,
.markdown-preview ol {
  margin: 0 0 8px;
}

.markdown-preview > :last-child {
  margin-bottom: 0;
}

.markdown-preview h2 {
  margin: 0 0 8px;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 20px;
}

.markdown-preview blockquote {
  padding-left: 10px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.markdown-preview a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.expandable-field.fullscreen {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, calc(100vw - 32px));
  max-width: 100%;
  max-height: min(78vh, 820px);
  z-index: 1200;
  background: #f5f5f5;
  border: 1px solid #bcc3cb;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-modal);
}

.expandable-field.fullscreen .markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding-right: 38px;
}

.expandable-field.fullscreen textarea {
  flex: 0 1 auto;
  min-height: 160px;
  max-height: calc(min(78vh, 820px) - 84px);
  resize: none;
  overflow: auto;
}

body.fullscreen-editor-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .expandable-field.fullscreen {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 32px);
    padding: 10px;
    border-radius: 10px;
    z-index: 2600;
  }

  .expandable-field.fullscreen .markdown-toolbar {
    padding-right: 32px;
  }

  .expandable-field.fullscreen textarea {
    min-height: 180px;
    max-height: calc(100dvh - 116px);
  }
}

.time-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.time-inline .panel-input {
  width: 32px;
  min-width: 32px;
  max-width: 10ch;
  appearance: textfield;
  text-align: center;
  padding: 6px 4px;
  font-size: 13px;
}

@supports (field-sizing: content) {
  .time-inline .panel-input {
    width: auto;
    field-sizing: content;
  }
}

.time-inline .panel-input::-webkit-inner-spin-button,
.time-inline .panel-input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.time-unit {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-input);
  font-size: 11px;
  padding: 6px 6px;
  color: var(--muted);
  white-space: nowrap;
}

.pie-with-labels {
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 52px;
}

.pie-with-labels.pie-large {
  padding: 46px;
}

.pie-outer-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pie-outer-label {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  color: #2f2f2f;
  font-size: 12px;
  line-height: 1;
  padding: 0;
  min-width: 0;
  cursor: default;
  pointer-events: auto;
}

.pie-tooltip {
  position: absolute;
  z-index: 20;
  border: 1px solid var(--tooltip-border);
  border-radius: 9px;
  background: var(--tooltip-bg);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  padding: 8px 10px;
  min-width: 106px;
  max-width: 170px;
  pointer-events: none;
}

.pie-tooltip::after {
  content: "";
  position: absolute;
  left: var(--pie-tooltip-arrow, 14px);
  bottom: -6px;
  width: 11px;
  height: 11px;
  border-left: 1px solid var(--tooltip-border);
  border-bottom: 1px solid var(--tooltip-border);
  background: var(--tooltip-bg);
  transform: rotate(-45deg);
}

.pie-tooltip.tooltip-below::after {
  top: -6px;
  bottom: auto;
  transform: rotate(135deg);
}

.pie-tooltip-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.18;
  text-wrap: balance;
}

.pie-tooltip-pct {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot--undefined {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--muted) 60%, transparent);
}

.analysis-view {
  display: grid;
  gap: 12px;
}

#chronology-view {
  padding-bottom: 56px;
}

.analysis-view:not(.hidden),
#timeline-view:not(.hidden) {
  animation: tab-fade-in 220ms ease-out;
}

@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: translateY(0); }
}

.analysis-title {
  margin: 0;
  text-align: center;
}

#analysis-title {
  margin-bottom: 32px;
}

.analysis-alerts {
  display: grid;
  gap: 5px;
  width: min(860px, 100%);
  justify-self: center;
  margin-bottom: 32px;
}

.analysis-alert {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1.3;
}

.analysis-alert.is-dismissing {
  pointer-events: none;
  animation: analysis-alert-dismiss 240ms ease-in forwards;
}

@keyframes analysis-alert-dismiss {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 80px;
    padding-top: 7px;
    padding-bottom: 7px;
  }
  to {
    opacity: 0;
    transform: translateY(-4px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-width: 0;
    border-bottom-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-alert.is-dismissing {
    animation-duration: 1ms;
  }
}

.analysis-alert.info {
  border-color: var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
}

.analysis-main-grid {
  display: grid;
  grid-template-columns: minmax(352px, 1.7fr) repeat(4, minmax(130px, 1fr));
  gap: 12px;
  align-items: start;
}

.analysis-block {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.analysis-learning-block {
  justify-items: center;
}

.analysis-main-grid > .analysis-block:not(.analysis-learning-block) .analysis-chart-title {
  margin-bottom: 12px;
}

.analysis-big-pie,
.analysis-small-pie {
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
}

.analysis-big-pie:not(.is-empty),
.analysis-small-pie:not(.is-empty) {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Empty charts read as an outline, never as a filled grey slice. */
.analysis-big-pie.is-empty,
.analysis-small-pie.is-empty {
  border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
}

/* The "Non défini" share is hatched so it cannot be mistaken for a real
   category. renderConic sets both bounds of that share; both stay 0%
   when it is absent, which hides the overlay entirely. */
.analysis-big-pie,
.analysis-small-pie {
  position: relative;
}

.analysis-big-pie::after,
.analysis-small-pie::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-linear-gradient(
    45deg,
    transparent 0 4px,
    rgba(71, 85, 105, 0.4) 4px 6px
  );
  -webkit-mask-image: conic-gradient(
    transparent 0 var(--undefined-start, 0%),
    #000 var(--undefined-start, 0%) var(--undefined-end, 0%),
    transparent var(--undefined-end, 0%) 100%
  );
  mask-image: conic-gradient(
    transparent 0 var(--undefined-start, 0%),
    #000 var(--undefined-start, 0%) var(--undefined-end, 0%),
    transparent var(--undefined-end, 0%) 100%
  );
}

.analysis-big-pie {
  width: 260px;
  height: 260px;
}

.analysis-small-pie {
  width: 145px;
  height: 145px;
}

.analysis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: center;
  font-size: 11px;
  line-height: 1.2;
}

.analysis-legend .legend-item {
  white-space: nowrap;
}

.analysis-learning-block .analysis-legend {
  max-width: 320px;
}

.analysis-group-section {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.analysis-group-bar,
.analysis-aias-bar {
  width: min(760px, 100%);
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
}

.analysis-group-bar:not(.is-empty),
.analysis-aias-bar:not(.is-empty) {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.analysis-group-bar.is-empty,
.analysis-aias-bar.is-empty {
  border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
}

.analysis-aias-section {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding-top: 10px;
}

html body:not(.home-page) h3.analysis-chart-title,
html body:not(.home-page) h3.analysis-section-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  text-align: center;
}

.analysis-aias-bar {
  height: 32px;
}

/* Partition musicale (Musical timeline view) */
.partition-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--surface-light);
  border-radius: 6px;
  font-size: 13px;
}

.partition-controls-label {
  color: var(--text-body);
  font-weight: 600;
}

.partition-config-btn {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.partition-config-btn:hover {
  background: var(--hover-bg);
  border-color: rgba(20, 91, 180, 0.25);
  color: #124f9c;
}

#chronology-container {
  display: flex;
  flex-direction: column;
  gap: 56px;
  padding: 8px 0;
}

.partition-session {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.partition-session-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-left: 128px;
  margin-bottom: 6px;
}

.partition-session-title {
  font-weight: 600;
  color: var(--text-body);
  font-size: 13px;
}

.partition-session-total {
  color: var(--muted);
  font-size: 12px;
}

.partition-line {
  display: flex;
  align-items: stretch;
  height: 36px;
  gap: 0;
}

.partition-line-label {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body);
  text-align: right;
}

.partition-line-track {
  flex: 1;
  position: relative;
  border-bottom: 1px solid var(--line);
}

.partition-line-track.has-blocks {
  border-bottom: none;
}

.partition-block {
  position: absolute;
  bottom: 4px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: filter var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
  box-shadow: 0 2px 6px rgba(15,23,42,0.10);
  padding: 0 6px;
  overflow: hidden;
  text-align: center;
}

.partition-block:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  z-index: 10;
}

.partition-block-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.partition-block-duration {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
}

.partition-scale {
  display: flex;
  width: calc(100% - 120px);
  margin-left: 128px;
  margin-top: 4px;
  padding: 0 8px;
  font-size: 10px;
  color: var(--muted);
  justify-content: space-between;
}

.partition-scale-mark {
  position: relative;
  text-align: center;
  flex: 1;
}

/* Responsive partition */
@media (max-width: 900px) {
  .partition-line-label {
    width: 100px;
    font-size: 11px;
    padding-right: 8px;
  }
  .partition-session-header {
    padding-left: 108px;
  }
  .partition-scale {
    width: calc(100% - 100px);
    margin-left: 108px;
  }
  .partition-block-label {
    font-size: 10px;
  }
}

@media (max-width: 720px) {
  .partition-line-label {
    width: 80px;
    font-size: 10px;
    padding-right: 4px;
  }
  .partition-session-header {
    padding-left: 88px;
  }
  .partition-scale {
    width: calc(100% - 80px);
    margin-left: 88px;
  }
  .partition-block {
    height: 24px;
    border-radius: 3px;
  }
  .partition-block-label {
    font-size: 9px;
  }
  .partition-block-duration {
    display: none;
  }
}

/* Partition config modal rows */
.partition-config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-light);
  border-radius: 6px;
  border: 1px solid var(--line);
}

.partition-config-row-label {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
}

.partition-config-row-type {
  font-size: 11px;
  color: var(--muted);
  background: var(--hover-bg-mid);
  padding: 2px 6px;
  border-radius: 10px;
  white-space: nowrap;
}

.partition-config-row-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}

.partition-config-row-btns button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.partition-config-row-btns button:disabled {
  opacity: 0.3;
  cursor: default;
}

.partition-config-row-btns button:not(:disabled):hover {
  background: var(--hover-bg-mid);
}

.partition-config-row-btns button.del:not(:disabled):hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.partition-config-row-btns input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  width: min(420px, 92vw);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-modal);
  padding: 20px;
  display: grid;
  gap: 10px;
}

/* Styled confirmations use the same surfaces and controls as the editor. */
.account-confirm-dialog {
  width: min(560px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  margin: auto;
  padding: 28px;
  gap: 18px;
  color: var(--text);
  overflow-y: auto;
}

.account-confirm-dialog:not([open]) {
  display: none;
}

.account-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

[data-theme="dark"] .account-confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.account-confirm-message {
  margin: 0;
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.6;
}

.account-confirm-dialog .modal-actions {
  margin-top: 6px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .account-confirm-dialog {
    padding: 22px;
  }

  .account-confirm-dialog .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .account-confirm-dialog .btn {
    width: 100%;
    white-space: normal;
  }
}

#export-modal-backdrop {
  padding: 24px;
}

/* Careful: this outranks .modal.export-modal further down (id+class beats two
   classes), so the height below is the one that actually applies and the 780px
   stated there never takes effect. That is also why the width there needs
   !important. Sizing the export modal means editing this block, or removing it
   and dropping the !important. */
#export-modal-backdrop .modal {
  width: min(920px, 96vw);
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* The export result textarea and the actions row are styled once, further
   down, under .modal.export-modal — do not restate them here. */

.partition-config-modal {
  width: min(520px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
}

.partition-config-modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 4px;
}

.partition-config-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.partition-add-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.partition-add-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.partition-add-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.partition-add-select {
  flex: 1;
  min-width: 130px;
}

.partition-add-button {
  white-space: nowrap;
}

.modal-title {
  margin: 0;
}

.modal p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.modal label {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-body);
}

.modal .panel-select {
  min-height: 48px;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 12px;
  line-height: 1.2;
}

.modal-text-input {
  width: 100%;
}

.modal-inline-error {
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
}

.modal-inline-error.hidden {
  display: none;
}

.modal-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.export-scope-fieldset {
  min-width: 0;
  margin: 0 0 4px;
  padding: 0 0 4px;
  border: 0;
}

.export-scope-fieldset legend {
  margin-bottom: 9px;
  color: var(--text-body);
  font-size: 14px;
  font-weight: 700;
}

.export-scope-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.modal .export-scope-option {
  width: 100%;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-body);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--transition-base),
    background var(--transition-base),
    box-shadow var(--transition-base);
}

.modal .export-scope-option:hover,
.modal .export-scope-option:focus-within,
.modal .export-scope-option:has(input:checked) {
  border-color: var(--primary);
  background: var(--active-bg-light);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
  outline: none;
}

.export-scope-option input {
  margin: 3px 6px 0 0;
  accent-color: var(--primary);
}

.export-scope-option-copy {
  display: grid;
  gap: 3px;
}

.export-scope-option-title {
  font-size: 15px;
  font-weight: 750;
}

.export-scope-option-description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.export-moments-details {
  min-width: 0;
  margin: 4px 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.export-moments-details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.export-moments-details > summary::-webkit-details-marker {
  display: none;
}

.export-moments-details > summary:hover,
.export-moments-details > summary:focus-visible {
  color: var(--primary);
}

.export-moments-details > summary:focus-visible {
  border-radius: 6px;
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 3px;
}

.export-moments-summary-trailing {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 500;
}

.export-moments-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--transition-base);
}

.export-moments-details[open] .export-moments-chevron {
  transform: rotate(225deg);
}

.export-moments-content {
  margin-top: 12px;
}

.export-preview-details {
  min-width: 0;
  margin: 2px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.export-preview-details[open] {
  flex: 0 0 auto;
  min-height: 180px;
  display: flex;
  flex-direction: column;
}

.export-preview-details.hidden {
  display: none;
}

.export-preview-details > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.export-preview-details > summary::-webkit-details-marker {
  display: none;
}

.export-preview-details > summary:hover,
.export-preview-details > summary:focus-visible {
  color: var(--primary);
}

.export-preview-details > summary:focus-visible {
  border-radius: 6px;
  outline: 2px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 3px;
}

.export-preview-details[open] > summary {
  margin-bottom: 12px;
}

.export-preview-chevron {
  width: 8px;
  height: 8px;
  margin-right: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--transition-base);
}

.export-preview-details[open] .export-preview-chevron {
  transform: rotate(225deg);
}

.export-moments-controls {
  display: flex;
  align-items: center;
  margin-bottom: 9px;
}

.modal .export-moments-all-option,
.modal .export-moment-option {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.modal .export-moments-all-option {
  font-weight: 700;
}

.export-moments-all-option input,
.export-moment-option input {
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--primary);
}

.export-moments-summary {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.export-moments-list {
  max-height: 104px;
  overflow-y: auto;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
}

.modal .export-moment-option {
  min-width: 0;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.modal .export-moment-option:hover,
.modal .export-moment-option:focus-within {
  background: var(--active-bg-light);
}

.export-moment-number {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.export-moment-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export-moments-empty {
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .export-scope-options,
  .export-moments-list {
    grid-template-columns: 1fr;
  }
}

/* --- Outcomes (Acquis d'apprentissage) --- */

.outcomes-row {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.outcomes-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.outcomes-header label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-label);
}

.outcomes-add-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-body);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}

.outcomes-add-btn .fa-plus {
  font-size: 12px;
  line-height: 1;
}

.outcomes-add-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}

.outcomes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.outcome-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.outcome-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 5px 2px 7px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.outcome-verb-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-body);
  text-align: left;
}

.outcome-verb-btn:hover {
  background: var(--hover);
}

.outcome-verb-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outcome-verb-edit {
  opacity: 0.45;
  font-size: 11px;
  flex-shrink: 0;
}

.outcome-verb-btn:hover .outcome-verb-edit {
  opacity: 0.8;
}

.outcome-delete-btn {
  flex-shrink: 0;
  width: 20px !important;
  height: 20px !important;
}

.outcome-delete-btn svg {
  width: 8px !important;
  height: 8px !important;
}

.outcome-text {
  border: none !important;
  border-radius: 0 !important;
  resize: none;
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  font-size: 13px;
  line-height: 22px;
  padding-top: 4px;
  padding-bottom: 4px;
  overflow: hidden;
}

/* --- Bloom taxonomy modal --- */

.bloom-modal {
  width: min(460px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bloom-modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.bloom-category-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}

.bloom-category {
  border-radius: 6px;
  overflow: hidden;
}

.bloom-category-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  list-style: none;
  user-select: none;
  color: var(--text-body);
}

.bloom-category-summary::-webkit-details-marker {
  display: none;
}

.bloom-category-summary::before {
  content: "▶";
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.bloom-category[open] > .bloom-category-summary::before {
  transform: rotate(90deg);
}

.bloom-category-summary:hover,
.bloom-category-summary.selected {
  background: var(--hover);
}

.bloom-category-summary.selected {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.bloom-verb-item {
  padding: 6px 10px 6px 28px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-body);
  margin: 1px 0;
}

.bloom-verb-item:hover {
  background: var(--hover);
}

.bloom-verb-item.selected {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 600;
}

/* --- end outcomes --- */

.toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: 24px 22px 80px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-right {
  justify-content: flex-end;
}

.toolbar-cluster {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-language-switch {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
}

.nav-language-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-align: center;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.nav-language-label {
  display: block;
  transform-origin: center;
}

.nav-language-toggle:hover,
.nav-language-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.22);
}

.nav-language-toggle.is-leaving .nav-language-label {
  opacity: 0;
  transform: translateY(-5px) scale(0.92);
  transition: opacity 90ms ease, transform 90ms ease;
}

.nav-language-toggle.is-entering .nav-language-label {
  animation: language-label-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes language-label-enter {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nav-language-toggle:active {
  transform: scale(0.96);
}

.nav-language-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

[data-theme="dark"] .nav-language-switch {
  background: transparent;
}

[data-theme="dark"] .nav-language-toggle:hover,
[data-theme="dark"] .nav-language-toggle:focus-visible {
  background: rgba(88, 166, 255, 0.1);
  color: #ffffff;
  border-color: rgba(88, 166, 255, 0.3);
}

.toolbar-sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
  flex-shrink: 0;
}

.toolbar .btn {
  min-height: 36px;
  padding: 7px 9px;
  font-size: 13px;
}

.toolbar .btn-label {
  gap: 6px;
}

.toolbar .btn-icon-inline {
  width: 14px;
  font-size: 13px;
}

.layout-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-light);
}

.layout-toggle-btn {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--text-subtle);
  width: 42px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.layout-toggle-btn:last-child {
  border-right: 0;
}

.layout-toggle-btn[aria-pressed="true"] {
  background: #fff;
  color: #1d4f91;
}

.layout-toggle-btn:hover {
  background: var(--hover-bg);
}

.layout-toggle-btn[aria-pressed="true"]:hover {
  background: var(--hover-bg);
}

.toolbar .panel-select {
  padding-top: 8px;
  padding-bottom: 8px;
}

.btn {
  -webkit-appearance: none;
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text-body);
  font-size: 13px;
  padding: 7px 11px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.btn:hover {
  background: var(--hover-bg);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--btn-primary-from);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-text);
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(20, 24, 32, 0.14);
  -webkit-text-fill-color: currentColor;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.btn-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-icon-inline {
  width: 16px;
  text-align: center;
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
  color: var(--btn-primary-text);
  -webkit-text-fill-color: currentColor;
  filter: none;
}

.btn-primary:focus-visible,
.btn-primary:active {
  color: var(--btn-primary-text);
  -webkit-text-fill-color: currentColor;
  background: #111110;
  border-color: #111110;
}

.btn-primary .btn-label,
.btn-primary .btn-icon-inline {
  position: relative;
  z-index: 1;
}

/* Secondary emphasis without a filled accent block. */
.btn-outline {
  background: var(--action-secondary-bg);
  border-color: var(--action-secondary-border);
  color: var(--action-secondary-text);
  font-weight: 600;
}

.btn-outline:hover {
  background: var(--action-secondary-hover);
  border-color: color-mix(in srgb, var(--action-primary) 45%, var(--action-secondary-border));
  color: var(--action-primary);
}

.btn-light {
  background: #fff;
}

main {
  flex: 1 1 auto;
  overflow: visible;
  background: transparent;
}

.board {
  display: flex;
  gap: 20px;
  flex-direction: row;
  align-items: stretch;
  padding: 24px 20px 72px;
}

.board.layout-columns {
  flex-direction: row;
  align-items: stretch;
  overflow-x: auto;
}

.board.layout-list {
  flex-direction: column;
  align-items: stretch;
  overflow-x: hidden;
  gap: 20px;
  padding: 24px clamp(20px, 4vw, 72px) 72px;
}

/* === Grid (tableur) view === */
.board.layout-grid {
  flex-direction: column;
  overflow: auto;
  padding: 0;
  gap: 0;
}
.grid-view-wrapper {
  width: 100%;
  overflow-x: auto;
  min-height: 100%;
}
.grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}
.grid-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 6px 8px;
  background: var(--surface-light);
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
  text-align: left;
}
.grid-col-num     { width: 32px;  text-align: center; }
.grid-col-type    { width: 136px; }
.grid-col-dur     { width: 70px;  }
.grid-col-loc     { width: 100px; }
.grid-col-group   { width: 100px; }
.grid-col-sync    { width: 84px;  }
.grid-col-teaching { width: 180px; }
.grid-col-eval    { width: 100px; }
.grid-col-aias    { width: 116px; }
.grid-col-desc    { width: 180px; }
.grid-col-instructions { width: 200px; }
.grid-col-actions { width: 96px;  text-align: center; }
.grid-activity-row td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.grid-activity-row:hover td { background: var(--hover-bg); }
.grid-activity-row td:first-child {
  border-left: 3px solid transparent;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}
.grid-session-row td {
  padding: 6px 10px;
  background: var(--surface-light);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.grid-session-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  margin-right: 6px;
}
.grid-session-title-input {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  width: 240px;
  padding: 2px 4px;
  border-radius: 4px;
  outline: none;
  font-family: inherit;
}
.grid-session-title-input:hover,
.grid-session-title-input:focus {
  background: var(--hover-bg-mid);
  outline: 2px solid var(--primary);
  outline-offset: 0;
}
.grid-session-total {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 10px;
  vertical-align: middle;
}
.duplicate-session-btn.grid-duplicate-session-btn {
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin-left: 6px;
  border-radius: 6px;
  vertical-align: middle;
}
.duplicate-session-btn.grid-duplicate-session-btn .fa-copy {
  font-size: 12px;
}
.grid-select {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  color: var(--text-body);
  padding: 3px 2px;
  border-radius: 4px;
  cursor: pointer;
  appearance: auto;
  outline: none;
  font-family: inherit;
}
.grid-select:hover  { background: var(--hover-bg-mid); border-color: var(--line); }
.grid-select:focus  { outline: 2px solid var(--primary); outline-offset: 0; }
.grid-aias-select { font-size: 11px; }
.grid-aias-select.aias-level {
  border-color: color-mix(in srgb, var(--aias-color) 65%, #111827);
  background: var(--aias-color);
  color: var(--aias-ink);
  font-weight: 650;
}
.grid-aias-select.aias-level:hover {
  border-color: #111827;
  background: var(--aias-color);
  filter: brightness(.97);
}
.grid-dur-wrap { display: flex; align-items: center; gap: 2px; }
.grid-dur-input {
  width: 44px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  color: var(--text-body);
  padding: 3px 4px;
  border-radius: 4px;
  text-align: right;
  font-family: inherit;
  outline: none;
}
.grid-dur-input:hover { background: var(--hover-bg-mid); border-color: var(--line); }
.grid-dur-input:focus { outline: 2px solid var(--primary); outline-offset: 0; }
.grid-dur-unit { font-size: 11px; color: var(--muted); white-space: nowrap; }
.grid-type-cell { display: flex; align-items: center; gap: 5px; }
.grid-type-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.grid-type-select {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  color: var(--text-body);
  padding: 3px 2px;
  border-radius: 4px;
  cursor: pointer;
  appearance: auto;
  font-family: inherit;
  outline: none;
  min-width: 0;
}
.grid-type-select:hover { background: var(--hover-bg-mid); border-color: var(--line); }
.grid-type-select:focus { outline: 2px solid var(--primary); outline-offset: 0; }
.grid-desc-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12px;
  color: var(--text-body);
  padding: 3px 6px;
  border-radius: 4px;
  font-family: inherit;
  outline: none;
  resize: none;
  overflow: hidden;
  height: 24px;
  line-height: 1.5;
  display: block;
}
.grid-desc-input:hover { background: var(--hover-bg-mid); border-color: var(--line); }
.grid-desc-input:focus { outline: 2px solid var(--primary); outline-offset: 0; height: auto; min-height: 24px; overflow: auto; }
.grid-action-btns { display: flex; gap: 2px; align-items: center; justify-content: center; }
.grid-action-btn {
  width: 20px; height: 20px;
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  border-radius: 3px; font-size: 12px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.grid-duplicate-activity-btn .fa-copy {
  font-size: 11px;
  line-height: 1;
}
.grid-action-btn:hover { background: var(--hover-bg-mid); color: var(--text-body); }
.grid-action-btn.del:hover { background: #fee2e2; color: #dc2626; }
.grid-add-activity-row td { padding: 2px 4px; border-bottom: 1px solid var(--line); }
.grid-add-activity-btn {
  background: none;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.grid-add-activity-btn:hover { background: var(--hover-bg); border-color: var(--primary); color: var(--primary); }
.grid-add-session-row td { padding: 8px 12px; }
.grid-add-session-btn {
  background: none;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}
.grid-add-session-btn:hover { background: var(--hover-bg); border-color: var(--primary); color: var(--primary); }

.add-session-card {
  --add-card-border: #9ca3af;
  --add-card-border-hover: #6b7280;
  flex: 0 0 520px;
  min-height: 560px;
  padding: 32px;
  border: 1px dashed var(--add-card-border);
  border-radius: 16px;
  background: #ffffff;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font: inherit;
  cursor: pointer;
  animation: slideInUp 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) both;
  transition:
    background var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    color var(--transition-base),
    transform var(--transition-base);
}

.add-session-card-icon {
  width: 58px;
  height: 58px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  transition:
    background var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    transform var(--transition-base);
}

.add-session-card-icon .fa-plus {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.add-session-card-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.add-session-card:hover {
  border-color: var(--add-card-border-hover);
  background: var(--surface-light);
  color: var(--muted);
  box-shadow: 0 18px 40px -22px rgba(36, 90, 143, 0.38);
  transform: translateY(-4px);
}

.add-session-card:hover .add-session-card-icon {
  border-color: currentColor;
  background: var(--panel);
  color: var(--muted);
  transform: scale(1.06);
}

.add-session-card:active {
  transform: translateY(-1px);
}

.add-session-card:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
  border-color: var(--add-card-border-hover);
}

.board.layout-list .add-session-card {
  flex: 0 0 auto;
  width: min(1200px, 100%);
  min-height: 220px;
  margin-inline: auto;
}

.session-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #fafafa);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.board.layout-columns .session-card {
  flex: 0 0 520px;
  height: auto;
  min-height: 560px;
}

.board.layout-list .session-card {
  flex: 0 0 auto;
  width: min(1200px, 100%);
  margin-inline: auto;
  min-height: 420px;
  height: auto;
}

.session-header {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.session-strip {
  height: 18px;
  border-bottom: 1px solid var(--line);
}

.delete-session-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
}

.session-title-wrap {
  display: grid;
  gap: 12px;
  padding: 24px 16px 16px;
}

.session-title,
.session-objectives,
.session-intentions,
.activity-description,
.activity-instructions,
.session-notes-input {
  width: 100%;
  border: 1px solid rgba(203, 213, 225, 0.72);
  border-radius: 10px;
  padding: 10px 12px;
  resize: none;
  overflow: hidden;
  font: inherit;
  font-size: 13px;
  background: #fff;
  min-height: 44px;
  line-height: 1.6;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

/* A textarea is two rows tall by default, so a one-line placeholder sat
   against the top edge and left the field looking top-heavy. field-sizing
   also lets a wrapping placeholder reserve its real height instead of
   pushing its last line against the bottom edge. Scoped to :placeholder-shown
   on purpose: filled fields keep the existing auto-resize behaviour. */
.panel-textarea:placeholder-shown,
.session-title:placeholder-shown,
.session-objectives:placeholder-shown,
.session-intentions:placeholder-shown,
.activity-description:placeholder-shown,
.activity-instructions:placeholder-shown,
.session-notes-input:placeholder-shown {
  field-sizing: content;
  align-content: center;
}

.activity-text-fields {
  display: grid;
  gap: 12px;
}

.activity-field-group {
  display: grid;
  gap: 5px;
}

.activity-field-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.session-title {
  font-size: 14px;
  font-weight: 600;
}

.session-intentions {
  min-height: 88px;
}

.board.intentions-collapsed .session-intentions-wrap {
  display: none;
}

.activities {
  flex: 1 1 auto;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.activities::before {
  content: "Activités";
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding-top: 10px;
  margin-top: 2px;
  border-top: 1px solid var(--line);
}

.activities:empty::before {
  content: "Activités — aucune pour l’instant";
  opacity: 0.7;
}

.activity-card {
  border-left: 8px solid #999;
  border-radius: 12px;
  background: var(--panel);
  box-shadow:
    inset 0 0 0 1px rgba(229, 231, 235, 0.9),
    0 4px 14px rgba(15, 23, 42, 0.04);
  padding: 14px;
  position: relative;
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base),
    opacity var(--transition-base);
}

.activity-card:hover {
  box-shadow:
    inset 0 0 0 1px rgba(229, 231, 235, 0.9),
    0 6px 20px rgba(15, 23, 42, 0.09);
}

.activity-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--card-type-color, transparent) 30%, transparent),
    transparent
  );
  border-radius: 12px 0 0 12px;
  pointer-events: none;
}

.session-card,
.activity-card {
  cursor: grab;
}

.session-card:active,
.activity-card:active {
  cursor: grabbing;
}

.dragging {
  opacity: 0.55;
}

.session-card.drop-before {
  box-shadow: inset 6px 0 0 var(--primary);
}

.session-card.drop-after {
  box-shadow: inset -6px 0 0 var(--primary);
}

.board.layout-list .session-card.drop-before {
  box-shadow: inset 0 6px 0 var(--primary);
}

.board.layout-list .session-card.drop-after {
  box-shadow: inset 0 -6px 0 var(--primary);
}

.activity-card.drop-before {
  box-shadow: inset 0 4px 0 var(--primary), inset 0 0 0 1px #cfcfcf;
}

.activity-card.drop-after {
  box-shadow: inset 0 -4px 0 var(--primary), inset 0 0 0 1px #cfcfcf;
}

.activities.drop-append {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  border-radius: 5px;
}

.activity-toolbar {
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: space-between;
  flex-wrap: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--card-type-color, var(--line)) 70%, white);
  background: color-mix(in srgb, var(--card-type-color, var(--panel-2)) 12%, var(--panel-2));
  border-radius: 6px 6px 0 0;
  margin: -14px -14px 10px -14px;
  padding: 8px 14px;
}

.activity-toolbar .activity-actions {
  margin-left: 0;
}

.aias-level {
  --aias-ink: #111827;
}

.aias-level-1 { --aias-color: #64deff; }
.aias-level-2 { --aias-color: #c1ffd2; }
.aias-level-3 { --aias-color: #cfdeff; }
.aias-level-4 { --aias-color: #fffecb; }
.aias-level-5 { --aias-color: #ffc1ee; }

.aias-modal {
  width: min(820px, 94vw);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  gap: 12px;
}

.aias-modal-intro {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.aias-status-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.aias-status-btn {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-body);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.aias-status-btn:hover,
.aias-level-btn:hover {
  border-color: color-mix(in srgb, var(--primary) 52%, var(--line));
  background: color-mix(in srgb, var(--primary) 5%, var(--panel-2));
}

.aias-status-btn:focus-visible,
.aias-level-btn:focus-visible {
  outline: 1px solid var(--primary);
  outline-offset: 1px;
}

.aias-status-btn.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--panel-2));
  color: var(--primary);
  font-weight: 650;
}

.aias-levels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.aias-level-btn {
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-body);
  display: grid;
  grid-template-columns: 34px clamp(100px, 20vw, 175px) minmax(0, 1fr);
  align-items: stretch;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.aias-level-btn.selected {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, var(--panel-2));
  box-shadow: inset 0 0 0 1px var(--primary);
}

.aias-level-number {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 6px;
  border-right: 1px solid color-mix(in srgb, var(--aias-color) 65%, #111827);
}

.aias-level-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  align-items: center;
  padding: 9px;
  border-right: 1px solid color-mix(in srgb, var(--aias-color) 65%, #111827);
}

.aias-level-description {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  display: flex;
  align-items: center;
  padding: 9px;
}

.aias-level-btn.aias-level {
  border-color: color-mix(in srgb, var(--aias-color) 65%, #111827);
  background: var(--aias-color);
  color: var(--aias-ink);
}

.aias-level-btn.aias-level:hover {
  border-color: #111827;
  background: var(--aias-color);
  filter: brightness(.97);
}

.aias-level-btn.aias-level.selected {
  border-color: #111827;
  background: var(--aias-color);
  box-shadow: none;
}

.aias-level-btn.aias-level .aias-level-number,
.aias-level-btn.aias-level .aias-level-description {
  color: var(--aias-ink);
}

.modal .aias-attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

.aias-attribution a {
  color: inherit;
  text-underline-offset: 2px;
}

.aias-attribution a:hover,
.aias-attribution a:focus-visible {
  color: var(--primary);
}

.chip.aias-level {
  border-color: color-mix(in srgb, var(--aias-color) 65%, #111827);
  background: var(--aias-color);
  color: var(--aias-ink);
  font-weight: 650;
}

.activity-duration {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: center;
  color: var(--text-strong);
}

.choice-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 8px;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-body);
  max-width: none;
  flex-shrink: 0;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.choice-btn:hover {
  background: var(--hover-bg);
  border-color: rgba(20, 91, 180, 0.25);
}

.choice-btn.open {
  border-color: var(--indigo-hover);
  background: var(--indigo-bg);
  color: var(--indigo-dark);
}

.choice-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.choice-btn .material-icon-svg,
.choice-menu-item .material-icon-svg,
.choice-btn .fa-solid,
.choice-btn .fa-regular,
.choice-menu-item .fa-solid,
.choice-menu-item .fa-regular {
  flex: 0 0 auto;
}

.choice-btn .fa-solid,
.choice-btn .fa-regular,
.choice-menu-item .fa-solid,
.choice-menu-item .fa-regular {
  width: 18px;
  font-size: 16px;
  color: currentColor;
  text-align: center;
}

.duration-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
}

.duration-symbol .fa-solid,
.duration-symbol .fa-regular {
  font-size: 15px;
  color: currentColor;
}

.choice-btn .choice-label {
  display: none;
}

.choice-menu {
  position: fixed;
  min-width: 190px;
  max-width: 240px;
  max-height: min(420px, calc(100vh - 16px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-menu);
  box-shadow: var(--shadow-menu);
  padding: 6px;
  z-index: 1500;
}

.choice-menu-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  padding: 8px 10px 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.choice-menu-item {
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  color: var(--text-body);
  font-size: 14px;
  transition: background var(--transition-fast);
}

.choice-menu-item:hover {
  background: var(--hover-bg-mid);
}

.choice-menu-item.active {
  background: var(--active-bg);
  color: var(--indigo-dark);
  font-weight: 600;
}

.choice-menu-item svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.choice-menu-with-descriptions {
  width: min(480px, calc(100vw - 16px));
  max-width: min(480px, calc(100vw - 16px));
}

.choice-menu-with-descriptions .choice-menu-item {
  align-items: flex-start;
  padding: 10px;
}

.choice-menu-item-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.choice-menu-item-label {
  font-weight: 600;
}

.choice-menu-item-description {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

/* ── Tool picker ─────────────────────────────────────────────── */
.select-tools-btn {
  position: relative;
  color: #4a5568;
  overflow: visible !important;
}

.select-tools-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  pointer-events: none;
}

.select-tools-btn[data-count]:not([data-count=""]):not([data-count="0"])::after {
  content: attr(data-count);
  position: absolute;
  top: -5px;
  right: -4px;
  background: var(--indigo);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  pointer-events: none;
  line-height: 1;
  box-shadow: 0 0 0 1px #fff;
  z-index: 1;
}

.select-tools-btn.has-tools {
  border-color: var(--indigo);
  color: var(--indigo);
  background: var(--indigo-bg);
}

.select-tools-btn.has-tools:hover {
  border-color: var(--indigo-hover);
  color: var(--indigo-dark);
  background: var(--active-bg);
}

.activity-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px 6px;
  min-width: 0;
}

.activity-tools.hidden {
  display: none;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-sizing: border-box;
  background: var(--competency-bg, var(--indigo-bg));
  border: 1px solid var(--competency-border, var(--indigo-border));
  border-radius: 999px;
  padding: 2px 6px 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--competency-text, var(--indigo-dark));
  line-height: 1.4;
  min-width: 0;
  max-width: 100%;
}

.tool-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.tool-chip-remove {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
  transition: opacity var(--transition-fast);
}

.tool-chip-remove:hover {
  opacity: 1;
}

.tool-picker {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(800px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-picker);
  z-index: 1500;
  overflow: hidden;
}

.tool-picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1499;
}

.tool-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.tool-picker-framework {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  flex-shrink: 0;
}

.tool-picker-framework-label {
  color: var(--text-body);
  font-size: 12px;
  font-weight: 700;
}

.tool-picker-framework-select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 30px 7px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.tool-picker-framework-select:focus {
  border-color: var(--indigo-hover);
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.tool-picker-source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--link-color) 45%, var(--line));
  border-radius: 6px;
  background: #fff;
  color: var(--link-color);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.tool-picker-source-link::after {
  content: "↗";
  font-size: 11px;
}

.tool-picker-source-link:visited {
  color: var(--link-color);
}

.tool-picker-source-link:hover {
  border-color: var(--link-color);
  background: color-mix(in srgb, var(--link-color) 7%, #fff);
  color: var(--link-hover);
}

.tool-picker-source-link:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

.tool-picker-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #6b7280;
  padding: 2px 5px;
  border-radius: 6px;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.tool-picker-close:hover {
  background: var(--hover-bg-mid);
  color: var(--text);
}

.tool-picker-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  overflow-x: auto;
}

.tool-picker-search {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.tool-picker-search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  box-sizing: border-box;
}

.tool-picker-search-input:focus {
  border-color: var(--indigo-hover);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.tool-picker-search-input::placeholder {
  color: #9ca3af;
}

.tool-picker-tab {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #6b7280;
  flex: 0 0 auto;
  white-space: nowrap;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

@media (max-width: 640px) {
  .tool-picker-framework {
    grid-template-columns: 1fr auto;
  }

  .tool-picker-framework-label {
    grid-column: 1 / -1;
  }
}

.tool-picker-tab:hover {
  background: var(--hover-bg-mid);
  color: var(--text);
}

.tool-picker-tab.active {
  background: var(--competency-bg, var(--panel));
  border-color: var(--competency-border, var(--indigo-border));
  color: var(--competency-text, var(--indigo));
}

.tool-picker-body {
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 4px 6px 8px;
}

.tool-picker-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--competency-text, #4b5563);
  padding: 12px 10px 6px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.3;
}

.tool-picker-item {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition-base);
}

.tool-picker-item:hover {
  background: var(--hover-bg-mid);
}

.tool-picker-item.selected {
  background: var(--competency-active, var(--indigo-active));
}

.tool-picker-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.tool-picker-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.tool-picker-item-desc {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.3;
}

.tool-picker-item.selected .tool-picker-item-name {
  color: var(--competency-text, var(--indigo-dark));
  font-weight: 600;
}

.tool-picker-item.selected .tool-picker-item-desc {
  color: var(--competency-text, var(--indigo-hover));
  opacity: 0.88;
}

.tool-picker-item-check {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border: 2px solid var(--competency-border, var(--indigo-border));
  border-radius: 4px;
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: transparent;
  font-weight: 900;
  line-height: 1;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.tool-picker-item.selected .tool-picker-item-check {
  background: var(--competency-text, var(--indigo));
  border-color: var(--competency-text, var(--indigo));
  color: #fff;
}

.activity-duration {
  width: 48px;
}

.mini-label {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 26px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-body);
  flex-shrink: 0;
}

.activity-actions {
  display: contents;
  margin-left: 0;
  align-self: center;
  flex-shrink: 0;
}

.duration-symbol {
  color: var(--muted);
  font-weight: 600;
}

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  width: 26px;
  height: 26px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-body);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.icon-btn:hover {
  background: var(--hover-bg);
  border-color: rgba(20, 91, 180, 0.25);
  color: var(--text-strong);
}

.duplicate-session-btn,
.duplicate-activity-btn {
  color: var(--muted);
}

.duplicate-session-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 9px;
  flex-shrink: 0;
}

.duplicate-session-btn .fa-copy,
.duplicate-activity-btn .fa-copy {
  font-size: 14px;
}

.delete-btn {
  background: #eeeeee;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  color: #6b7280;
  width: 26px;
  height: 26px;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
}

.delete-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.delete-btn svg {
  width: 11px;
  height: 11px;
  display: block;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.session-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(250, 250, 250, 0.9);
}

.session-card .btn {
  font-size: 13px;
  padding: 6px 9px;
}

.session-footer-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.session-footer-actions .btn-label {
  gap: 5px;
}

.session-metas {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}

.duration-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  min-width: 70px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 600;
}

.session-notes {
  padding: 0 16px 16px;
}

.hidden {
  display: none;
}

@media (max-width: 1200px) {
  .form-row,
  .panel-column-left .form-row,
  .panel-column-right .form-row {
    grid-template-columns: 1fr;
  }

  .form-row label {
    padding-top: 0;
  }

  .time-inline {
    flex-wrap: wrap;
  }

}

@media (max-width: 1050px) {
  .analysis-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(32px, 8vw, 80px);
    row-gap: 40px;
    margin-bottom: 18px;
  }

  .analysis-learning-block {
    grid-column: 1 / -1;
  }

  .analysis-group-section {
    margin-top: 8px;
  }

  .analysis-aias-section {
    padding-top: 18px;
  }
}

@media (max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .top-brand {
    align-items: center;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
  }

  .brand-left {
    min-width: 0;
  }

  .top-brand-actions {
    display: contents;
  }

  .top-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 100%;
    overflow-x: auto;
    padding: 7px 0;
  }

  .top-tabs .top-tab-slider {
    top: 7px;
    height: calc(100% - 14px);
  }

  .top-panel-toggle {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .top-tab {
    flex: 0 0 auto;
  }

  html body.designer-page h1.brand-title {
    font-size: 16px;
    line-height: 1.3;
  }

  .top-tab {
    font-size: 14px;
  }

  .form-row label,
  .panel-input,
  .panel-select,
  .panel-textarea,
  .time-unit {
    font-size: 14px;
  }

  .pie-with-labels {
    padding: 28px;
  }

  .pie-outer-label {
    font-size: 11px;
  }

  .analysis-big-pie {
    width: 220px;
    height: 220px;
  }

  .analysis-small-pie {
    width: 140px;
    height: 140px;
  }

  .legend-item {
    font-size: 12px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .toolbar-left > .toolbar-cluster,
  .toolbar-right > .toolbar-cluster {
    display: contents;
  }

  .toolbar-left > .toolbar-cluster > .btn,
  .toolbar-right > .toolbar-cluster > .btn {
    width: 100%;
    min-width: 0;
    padding-right: 7px;
    padding-left: 7px;
  }

  .toolbar-left .layout-toggle {
    width: 100%;
  }

  .toolbar-left .layout-toggle-btn {
    width: auto;
    flex: 1 1 0;
  }

  .toolbar-right #save-btn {
    width: 100%;
    min-width: 0;
  }

  .toolbar-sep {
    display: none;
  }

  .toolbar-right {
    padding-bottom: 4px;
  }

  main {
    min-height: 0;
    overflow: auto;
  }

  .board {
    height: auto;
    min-height: 100%;
    align-items: flex-start;
    padding-bottom: 56px;
  }

  .session-card {
    height: auto;
    min-height: 420px;
  }

  .board.layout-columns :is(.session-card, .add-session-card) {
    flex-basis: min(94vw, 520px);
  }

  .add-session-card {
    min-height: 420px;
  }

  .activity-toolbar {
    gap: 4px;
  }

}

@media (max-width: 640px) {
  .analysis-main-grid {
    grid-template-columns: 1fr;
    row-gap: 36px;
  }

  .pie-with-labels {
    padding: 24px;
  }
}

@media (max-width: 1024px) {
  .toolbar {
    gap: 14px;
    padding: 13px 16px;
    margin: 18px 16px 64px;
    border-radius: 16px;
  }

  .toolbar-left,
  .toolbar-right,
  .toolbar-cluster {
    gap: 9px;
  }

  .toolbar .btn {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 13px;
  }

  .btn-label {
    gap: 6px;
  }

  .btn-icon-inline {
    width: 14px;
    font-size: 13px;
  }

  .layout-toggle-btn {
    width: 40px;
    height: 34px;
  }

  .toolbar-sep {
    height: 20px;
    margin: 0 2px;
  }
}

@media (max-width: 640px) {
  .board {
    gap: 12px;
    padding: 16px 8px 48px;
  }

  .board.layout-columns {
    scroll-padding-inline: 8px;
  }

  .board.layout-columns :is(.session-card, .add-session-card) {
    flex-basis: calc(100vw - 16px);
  }
}

@media (min-width: 521px) and (max-width: 640px) {
  .toolbar-left,
  .toolbar-right {
    gap: clamp(6px, 1.5vw, 9px);
  }

  .toolbar .btn {
    padding-right: clamp(4px, 1.2vw, 7px);
    padding-left: clamp(4px, 1.2vw, 7px);
    font-size: clamp(12px, 2.15vw, 13px);
  }

  .toolbar .btn-label {
    gap: clamp(4px, 1vw, 6px);
  }

  .toolbar .btn-icon-inline {
    width: clamp(12px, 2.15vw, 14px);
    font-size: clamp(12px, 2.15vw, 13px);
  }
}

@media (max-width: 520px) {
  .toolbar {
    --mobile-toolbar-control-width: clamp(52px, 16.5vw, 64px);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px 12px;
    margin: 16px 12px 48px;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: center;
    justify-content: center;
    gap: clamp(3px, 1vw, 6px);
  }

  .toolbar-left > .toolbar-cluster,
  .toolbar-right > .toolbar-cluster {
    display: contents;
  }

  .toolbar-sep {
    display: none;
  }

  .toolbar-left > .toolbar-cluster > .btn,
  .toolbar-right > .toolbar-cluster > .btn {
    width: var(--mobile-toolbar-control-width);
    min-width: var(--mobile-toolbar-control-width);
    height: 38px;
    min-height: 38px;
    padding: 0;
    aspect-ratio: auto;
  }

  .toolbar-right #save-btn {
    width: var(--mobile-toolbar-control-width);
    min-width: var(--mobile-toolbar-control-width);
  }

  .toolbar .btn .btn-label {
    gap: 0;
    font-size: 0;
  }

  .toolbar .btn .btn-icon-inline {
    width: 16px;
    font-size: 15px;
  }

  .toolbar-left .layout-toggle-btn {
    width: var(--mobile-toolbar-control-width);
    height: 38px;
    flex: 0 0 var(--mobile-toolbar-control-width);
  }

  .toolbar-left .layout-toggle {
    width: auto;
  }
}

@media (min-width: 490px) and (max-width: 520px) {
  .toolbar.toolbar {
    --mobile-toolbar-control-width: 50px;
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 10px 8px;
    margin-right: 8px;
    margin-left: 8px;
  }

  .toolbar > .toolbar-left,
  .toolbar > .toolbar-right {
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
  }
}

/* Conserver le grand espace uniquement pour un design encore vide. */
body:has(#board:not(:empty)) .toolbar {
  margin-bottom: 16px;
}

@media (max-width: 1024px) {
  body:has(#board:not(:empty)) .toolbar {
    margin-bottom: 12px;
  }
}

@media (max-width: 640px) {
  body:has(#board:not(:empty)) .toolbar {
    margin-bottom: 10px;
  }
}

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}

.nav-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}

.hamburger-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: #f1f5f9;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 720px) {
  .nav-hamburger {
    display: flex;
    order: 2;
  }

  .site-nav {
    flex-wrap: wrap;
    align-items: center;
  }

  .site-nav-brand {
    flex: 1;
    order: 1;
  }

  .site-nav-actions {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .site-nav-actions.nav-open {
    display: flex;
  }

  .top-brand {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toolbar {
    gap: 8px;
  }

  .toolbar-left,
  .toolbar-right {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .site-nav {
    gap: 10px;
    padding: 12px 14px;
  }

  .site-nav-brand-link {
    gap: 9px;
  }

  .site-nav-brand-mark {
    width: 34px;
    height: 34px;
  }

  .site-nav-brand-copy {
    margin-left: 0;
  }

  .site-nav-title {
    font-size: 18px;
    letter-spacing: .015em;
  }
}

/* ═══════════════════════════════════════════════════════════
   MODERN REDESIGN — Light enhancements + Dark theme
   ═══════════════════════════════════════════════════════════ */

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  display: block;
  padding: 28px;
  border-top: 0;
  margin-top: auto;
  font-size: 12px;
  text-align: center;
  line-height: 1.6;
  color: var(--muted);
  position: relative;
  z-index: 30;
  pointer-events: auto;
}

.site-footer::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(var(--content-shell-width, 1180px), calc(100% - var(--content-shell-gutter, 36px)));
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(to right, transparent, var(--line) 14%, var(--line) 86%, transparent);
  content: "";
  opacity: 0.72;
}

.site-footer-copy-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  margin: 0 auto;
}

.site-footer-copy {
  letter-spacing: 0.01em;
}

.site-footer-copy abbr {
  text-decoration: none;
}

.site-footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  position: relative;
  z-index: 31;
  pointer-events: auto;
  margin-top: 6px;
}

.site-footer-link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.site-footer-link {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-family);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 400;
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
  z-index: 32;
  pointer-events: auto;
}

.site-footer-separator {
  color: var(--muted);
}

.site-footer-link-row:last-child .site-footer-link,
.site-footer-link-row:last-child .site-footer-separator,
.site-footer-license {
  font-size: 11px;
}

.site-footer-link-row + .site-footer-link-row {
  margin-top: 8px;
}

.site-footer-license {
  margin-top: 10px;
}

.site-footer-license a {
  color: inherit;
  text-decoration: none;
}

.site-footer-license a:hover,
.site-footer-license a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.designs-page .saved-shell {
  padding-bottom: 56px;
}

@media (max-width: 760px) {
  body.designs-page .saved-shell {
    padding-bottom: 40px;
  }
}

@media (max-width: 640px) {
  .site-footer {
    padding: 24px 12px 28px;
  }

  .site-footer-copy-stack {
    width: 100%;
    gap: 18px;
  }

  .site-footer-copy {
    line-height: 1.5;
  }

  .site-footer-link {
    display: inline-block;
    line-height: 1.5;
  }
}

.site-footer-link:hover {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

[data-theme="dark"] .site-footer {
  color: #dce4f1;
}

[data-theme="dark"] .site-footer::before {
  background: linear-gradient(to right, transparent, var(--line) 22%, var(--line) 78%, transparent);
  opacity: 0.2;
}

[data-theme="dark"] .site-footer-link {
  color: #f3f6ff;
}

[data-theme="dark"] .site-footer-separator {
  color: #aeb9ca;
}

[data-theme="dark"] .site-footer-link:hover,
[data-theme="dark"] .site-footer-link:focus-visible {
  color: #8cc6ff;
}

.app-notice-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2100;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.app-notice {
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(20, 91, 180, 0.16);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text-strong);
  box-shadow: 0 16px 36px rgba(19, 39, 68, 0.16);
  font-size: 14px;
  line-height: 1.45;
}

.app-notice-info {
  border-color: rgba(20, 91, 180, 0.18);
}

.app-notice-success {
  border-color: rgba(20, 140, 80, 0.22);
}

.app-notice-warning {
  border-color: rgba(209, 140, 19, 0.22);
}

.app-notice-error {
  border-color: rgba(192, 48, 59, 0.24);
}

[data-theme="dark"] .app-notice {
  background: rgba(36, 35, 31, 0.96);
  color: var(--text);
  border-color: rgba(129, 124, 112, 0.42);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.44);
}

[data-theme="dark"] .app-notice-info {
  border-color: rgba(106, 176, 255, 0.28);
}

[data-theme="dark"] .app-notice-success {
  background: rgba(36, 35, 31, 0.96);
  color: var(--text);
  border-color: rgba(106, 176, 255, 0.28);
}

[data-theme="dark"] .app-notice-warning {
  background: rgba(36, 35, 31, 0.96);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.24);
}

[data-theme="dark"] .app-notice-error {
  background: rgba(36, 35, 31, 0.96);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.24);
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(220%) skewX(-12deg); }
}

@keyframes spin-slow {
  to { transform: rotate(360deg); }
}

/* ── Activity toolbar: boutons compacts ────────────────────── */
.activity-toolbar .choice-btn {
  min-width: 30px;
  min-height: 30px;
  padding: 0 5px;
  font-size: 12px;
}

.activity-toolbar .choice-btn svg {
  width: 16px;
  height: 16px;
}

.activity-toolbar .mini-label {
  min-height: 30px;
  padding: 0 4px;
  font-size: 11px;
}

.activity-toolbar .activity-duration {
  width: 36px;
  font-size: 12px;
}

.activity-toolbar .icon-btn,
.activity-toolbar .delete-btn {
  width: 24px;
  height: 24px;
}

.activity-toolbar .activity-aias-btn,
.activity-toolbar .select-tools-btn,
.activity-toolbar .duplicate-activity-btn,
.activity-toolbar .delete-activity-btn {
  width: 30px;
  height: 30px;
}

.activity-toolbar .activity-aias-btn .fa-solid {
  width: 18px;
  font-size: 15px;
}

.activity-toolbar .activity-aias-btn.aias-level {
  border-color: color-mix(in srgb, var(--aias-color) 65%, #111827);
  background: var(--aias-color);
  color: var(--aias-ink);
}

.activity-toolbar .aias-trigger-number {
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.activity-toolbar .select-tools-btn svg {
  width: 18px;
  height: 18px;
}

.activity-toolbar .delete-activity-btn svg {
  width: 13px;
  height: 13px;
}

/* On narrow screens, keep every activity control inside the card. */
@media (max-width: 480px) {
  .activity-toolbar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    justify-content: initial;
    padding: 8px;
  }

  .activity-toolbar .choice-btn,
  .activity-toolbar .activity-aias-btn,
  .activity-toolbar .select-tools-btn,
  .activity-toolbar .duplicate-activity-btn,
  .activity-toolbar .delete-activity-btn {
    width: 100%;
    min-width: 0;
  }

  .activity-toolbar .mini-label {
    grid-column: span 2;
    width: 100%;
    min-width: 0;
  }

  .activity-toolbar .activity-duration {
    width: 100%;
    min-width: 0;
  }
}

@keyframes duplicated-outline-highlight {
  0%,
  28% {
    outline-color: color-mix(in srgb, var(--primary) 72%, transparent);
  }
  100% {
    outline-color: transparent;
  }
}

@keyframes duplicated-row-highlight {
  0%,
  28% {
    box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--primary) 12%, transparent);
  }
  100% {
    box-shadow: inset 0 0 0 999px transparent;
  }
}

.session-card.is-duplicated,
.activity-card.is-duplicated {
  outline: 2px solid transparent;
  outline-offset: 2px;
  animation: duplicated-outline-highlight 1.4s ease-out both;
}

.grid-session-row.is-duplicated > td,
.grid-activity-row.is-duplicated > td {
  animation: duplicated-row-highlight 1.4s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .session-card.is-duplicated,
  .activity-card.is-duplicated {
    animation: none;
    outline-color: color-mix(in srgb, var(--primary) 72%, transparent);
  }

  .grid-session-row.is-duplicated > td,
  .grid-activity-row.is-duplicated > td {
    animation: none;
    box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--primary) 12%, transparent);
  }
}

/* ── Session card: entrance + hover lift ───────────────────── */
.session-card {
  animation: slideInUp 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) both;
  transition:
    box-shadow var(--transition-base),
    transform var(--transition-base),
    border-color var(--transition-base);
}
.session-card:nth-child(2) { animation-delay: 0.05s; }
.session-card:nth-child(3) { animation-delay: 0.10s; }
.session-card:nth-child(4) { animation-delay: 0.15s; }
.session-card:nth-child(5) { animation-delay: 0.20s; }
.session-card:nth-child(n+6) { animation-delay: 0.22s; }

.session-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.06),
    0 18px 40px -18px rgba(15, 23, 42, 0.26);
}

/* ── Button primary ────────────────────────────────────────── */
.btn-primary {
  overflow: hidden;
  position: relative;
}

/* ── Nav: stronger glass ───────────────────────────────────── */
.site-nav {
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}

/* ── Theme toggle button ───────────────────────────────────── */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}
.theme-toggle-btn:hover,
.theme-toggle-btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.22);
}
.theme-icon-moon { display: none; }
.theme-icon-sun  { display: block; }

/* ── Tab active: cleaner indicator ────────────────────────── */
.top-tab {
  font-weight: 500;
  letter-spacing: 0.01em;
}
.top-tab.active {
  font-weight: 600;
  color: #111827;
}

/* ── Brand mark: subtle pulse on logo ─────────────────────── */
.site-nav-brand-mark {
  transition: transform 0.3s cubic-bezier(0.34, 1.6, 0.64, 1), box-shadow 0.3s ease;
}
.site-nav-brand:hover .site-nav-brand-mark {
  transform: scale(1.08);
}

/* ══════════════════════════════════════════════════════════
   DARK THEME  [data-theme="dark"]
   ══════════════════════════════════════════════════════════ */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background: #181816;
  color: #f1efe9;
}

[data-theme="dark"] {
  /* ── Core tokens ── */
  --bg:      #181816;
  --panel:   #24231f;
  --panel-2: #181816;
  --line:    rgba(129, 124, 112, 0.42);
  --text:    #f1efe9;
  --muted:   #aaa59a;
  --primary: #78a6ca;
  --link-color: #8cc6ff;
  --link-hover: #b9dcff;
  --focus:   #aaa59a;

  /* ── Text hierarchy ── */
  --text-strong: #f7f4ed;
  --heading-ink: #f7f4ed;
  --text-body:   #d6d1c7;
  --text-subtle: #aaa59a;

  /* ── Surfaces ── */
  --surface-menu:  #2a2823;
  --surface-input: #201f1c;
  --surface-light: #24231f;

  /* ── Hover / selection ── */
  --hover-bg:        rgba(255, 255, 255, 0.06);
  --hover-bg-mid:    rgba(255, 255, 255, 0.10);
  --active-bg:       rgba(88, 166, 255, 0.14);
  --active-bg-light: rgba(88, 166, 255, 0.08);

  /* ── Indigo family ── */
  --indigo:        #a5b4fc;
  --indigo-hover:  #c7d2fe;
  --indigo-dark:   #e0e7ff;
  --indigo-bg:     rgba(99, 102, 241, 0.12);
  --indigo-border: rgba(99, 102, 241, 0.25);
  --indigo-active: rgba(99, 102, 241, 0.18);

  /* ── Danger ── */
  --danger:        #ff7b72;
  --danger-bg:     rgba(248, 81, 73, 0.12);
  --danger-border: rgba(248, 81, 73, 0.28);

  /* ── Actions ── */
  --action-primary:          #3f78a8;
  --action-primary-hover:    #396f9d;
  --action-primary-border:   #6d9fc5;
  --action-secondary-bg:     rgba(255, 255, 255, 0.035);
  --action-secondary-border: rgba(199, 210, 229, 0.24);
  --action-secondary-text:   #d4dde6;
  --action-secondary-hover:  rgba(255, 255, 255, 0.08);
  --action-focus:            rgba(109, 159, 197, 0.34);
  --btn-primary-from:        #111110;
  --btn-primary-to:          #111110;
  --btn-primary-hover:       #050505;
  --btn-primary-border:      rgba(255, 255, 255, 0.18);
  --btn-primary-text:        #ffffff;

  /* ── Warnings / tooltips ── */
  --warning-bg:     rgba(187, 128, 9, 0.14);
  --warning-border: rgba(187, 128, 9, 0.30);
  --warning-text:   #f0e68c;
  --tooltip-bg:     #201f1c;
  --tooltip-border: rgba(129, 124, 112, 0.48);

  /* ── Shadows ── */
  --shadow-soft:        0 12px 32px rgba(0, 0, 0, 0.5);
  --shadow-card:
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 14px 32px -14px rgba(0, 0, 0, 0.58);
  --shadow-menu:        0 8px 20px  rgba(0, 0, 0, 0.6);
  --shadow-modal:       0 18px 42px rgba(0, 0, 0, 0.6);
  --shadow-picker:      0 12px 32px rgba(0, 0, 0, 0.6);
  --shadow-btn-primary: 0 5px 14px rgba(0, 0, 0, 0.24);
}

/* ── Structural surfaces ── */
[data-theme="dark"] .site-nav {
  background: rgba(31, 31, 29, 0.96);
  border-bottom-color: rgba(129, 124, 112, 0.42);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
[data-theme="dark"] .top-panel {
  background: rgba(36, 35, 31, 0.97);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .top-brand {
  background: linear-gradient(180deg, #24231f, #181816);
  border-bottom-color: rgba(129, 124, 112, 0.42);
}
[data-theme="dark"] .top-panel-body {
  background: linear-gradient(180deg, rgba(36, 35, 31, 0.98), rgba(24, 24, 22, 0.98));
}
[data-theme="dark"] .toolbar {
  background: rgba(36, 35, 31, 0.95);
  border-color: var(--line);
}

/* ── Cards ── */
[data-theme="dark"] .session-card {
  background: linear-gradient(180deg, #2a2823 0%, #201f1c 100%);
  border-color: rgba(129, 124, 112, 0.42);
}
[data-theme="dark"] .session-card:hover {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.34),
    0 20px 44px -18px rgba(0, 0, 0, 0.66);
  border-color: rgba(106, 176, 255, 0.3);
}
[data-theme="dark"] .add-session-card {
  --add-card-border: #6b7280;
  --add-card-border-hover: #9ca3af;
  background: rgba(42, 40, 35, 0.42);
  color: var(--muted);
}
[data-theme="dark"] .add-session-card-icon {
  background: var(--panel);
  border-color: currentColor;
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
[data-theme="dark"] .add-session-card:hover {
  background: rgba(58, 79, 105, 0.28);
  border-color: var(--add-card-border-hover);
  color: var(--muted);
  box-shadow: 0 20px 44px -22px rgba(0, 0, 0, 0.72);
}
[data-theme="dark"] .add-session-card:hover .add-session-card-icon {
  background: var(--panel);
  border-color: currentColor;
  color: var(--muted);
}
[data-theme="dark"] .session-header {
  background: rgba(36, 35, 31, 0.78);
  border-bottom-color: var(--line);
}
[data-theme="dark"] .session-footer {
  background: rgba(36, 35, 31, 0.78);
  border-top-color: var(--line);
}
[data-theme="dark"] .activities::before {
  color: var(--text-strong);
}
[data-theme="dark"] .activity-card {
  background: rgba(32, 31, 28, 0.96);
}
[data-theme="dark"] .activity-toolbar {
  background: color-mix(in srgb, var(--card-type-color, #24231f) 16%, #24231f);
  border-bottom-color: color-mix(in srgb, var(--card-type-color, var(--line)) 55%, #24231f);
}

/* ── Form controls ── */
[data-theme="dark"] .panel-input,
[data-theme="dark"] .panel-select,
[data-theme="dark"] .panel-textarea {
  background-color: #201f1c;
  border-color: rgba(129, 124, 112, 0.48);
  color: var(--text);
}
[data-theme="dark"] select.panel-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23f1efe9' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme="dark"] input.panel-input[type="number"] {
  color-scheme: dark;
}
[data-theme="dark"] .session-title,
[data-theme="dark"] .session-objectives,
[data-theme="dark"] .session-intentions,
[data-theme="dark"] .activity-description,
[data-theme="dark"] .activity-instructions,
[data-theme="dark"] .session-notes-input {
  background: #201f1c;
  border-color: rgba(129, 124, 112, 0.48);
  color: var(--text);
}
[data-theme="dark"] .panel-input::placeholder,
[data-theme="dark"] .panel-textarea::placeholder,
[data-theme="dark"] .session-title::placeholder,
[data-theme="dark"] .session-objectives::placeholder,
[data-theme="dark"] .session-intentions::placeholder,
[data-theme="dark"] .activity-description::placeholder,
[data-theme="dark"] .activity-instructions::placeholder,
[data-theme="dark"] .session-notes-input::placeholder {
  color: var(--muted);
}

[data-theme="dark"] .expandable-field.preview-active:not(.fullscreen):not(.is-editing) .markdown-preview {
  background: #201f1c;
  color: var(--text);
  border-color: rgba(129, 124, 112, 0.48);
}

[data-theme="dark"] .markdown-preview blockquote {
  border-left-color: rgba(129, 124, 112, 0.58);
  color: var(--muted);
}

/* ── Buttons & interactive ── */
[data-theme="dark"] .btn {
  background: #2a2823;
  border-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .btn:hover {
  background: rgba(255, 255, 255, 0.10);
}
[data-theme="dark"] .btn-primary {
  background: var(--btn-primary-from);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-text);
  -webkit-text-fill-color: currentColor;
}
[data-theme="dark"] .btn-primary:hover {
  background: var(--btn-primary-hover);
  border-color: rgba(255, 255, 255, 0.26);
  color: var(--btn-primary-text);
  filter: none;
}
/* Must sit after [data-theme="dark"] .btn, which matches .btn-outline too and
   would otherwise strip the accent back to neutral body text. */
[data-theme="dark"] .btn-outline {
  background: var(--action-secondary-bg);
  color: var(--action-secondary-text);
  border-color: var(--action-secondary-border);
}
[data-theme="dark"] .btn-outline:hover {
  background: var(--action-secondary-hover);
  border-color: color-mix(in srgb, var(--action-primary) 55%, var(--action-secondary-border));
  color: #e3eaf0;
}
[data-theme="dark"] .btn-light {
  background: rgba(36, 35, 31, 0.92);
}
[data-theme="dark"] .choice-btn {
  background: #2a2823;
  border-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .icon-btn {
  background: #2a2823;
  border-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .icon-btn:hover {
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.28);
  color: var(--text-strong);
}
[data-theme="dark"] .select-tools-btn[data-count]:not([data-count=""]):not([data-count="0"])::after {
  background: var(--text-strong);
  color: #111827;
  box-shadow: 0 0 0 1px #111827;
}
[data-theme="dark"] .select-tools-btn.has-tools:hover {
  background: rgba(88, 166, 255, 0.18);
  border-color: rgba(136, 196, 255, 0.48);
  color: var(--text-strong);
}
[data-theme="dark"] .delete-btn {
  background: rgba(24, 24, 22, 0.92);
  border-color: var(--line);
  color: var(--muted);
}
[data-theme="dark"] .duration-pill {
  background: rgba(24, 24, 22, 0.92);
  border-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .mini-label {
  background: #181816;
  border-color: var(--line);
}
[data-theme="dark"] .top-panel-toggle {
  background: var(--btn-primary-from);
  border-color: var(--btn-primary-border);
  color: var(--btn-primary-text);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}
[data-theme="dark"] .top-panel-toggle:hover {
  background: var(--btn-primary-hover);
  border-color: rgba(255, 255, 255, 0.26);
  color: var(--btn-primary-text);
}
[data-theme="dark"] .layout-toggle {
  background: #2a2823;
  border-color: rgba(129, 124, 112, 0.42);
}
[data-theme="dark"] .layout-toggle-btn {
  background: #2a2823;
  border-right-color: rgba(129, 124, 112, 0.42);
  color: var(--text-body);
}
[data-theme="dark"] .layout-toggle-btn[aria-pressed="true"] {
  background: #2a2823;
  color: #6ab0ff;
}
[data-theme="dark"] .layout-toggle-btn:hover {
  background: var(--hover-bg);
  color: var(--text-strong);
}

/* ── Tabs in dark mode ── */
[data-theme="dark"] .top-tab.active {
  color: var(--primary);
}
[data-theme="dark"] .top-tab-slider {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.30), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ── Overlays / modals ── */
[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.65);
}
[data-theme="dark"] .modal {
  background: #181816;
  border-color: var(--line);
}
[data-theme="dark"] .modal label,
[data-theme="dark"] .modal p {
  color: var(--text-body);
}
[data-theme="dark"] .tool-picker {
  background: #181816;
  border-color: var(--line);
}
[data-theme="dark"] .tool-picker-backdrop {
  background: rgba(0, 0, 0, 0.6);
}
[data-theme="dark"] .choice-menu {
  background: #201f1c;
  border-color: var(--line);
}

/* ── Grid view ── */
[data-theme="dark"] .grid-table thead th {
  background: #181816;
  border-bottom-color: var(--line);
  color: var(--muted);
}
[data-theme="dark"] .grid-session-row td {
  background: rgba(24, 24, 22, 0.92);
  border-color: var(--line);
}
[data-theme="dark"] .grid-activity-row td {
  border-bottom-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .grid-activity-row:hover td {
  background: var(--hover-bg);
}

/* ── Theme toggle in dark mode ── */
[data-theme="dark"] .theme-toggle-btn {
  background: transparent;
  border-color: transparent;
  color: #ffffff;
}
[data-theme="dark"] .theme-toggle-btn:hover,
[data-theme="dark"] .theme-toggle-btn:focus-visible {
  background: rgba(88, 166, 255, 0.1);
  color: #ffffff;
  border-color: rgba(88, 166, 255, 0.3);
}
[data-theme="dark"] .theme-icon-sun  { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }

/* ── Nav brand mark in dark mode ── */
[data-theme="dark"] .site-nav-brand-mark {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .site-nav-brand:hover .site-nav-brand-mark {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

/* ── Partition (chronology) ── */
[data-theme="dark"] .partition-controls {
  background: rgba(24, 24, 22, 0.84);
}
[data-theme="dark"] .partition-config-btn {
  background: #181816;
  border-color: var(--line);
  color: var(--text-body);
}
[data-theme="dark"] .partition-config-row {
  background: rgba(24, 24, 22, 0.84);
  border-color: var(--line);
}
[data-theme="dark"] .partition-config-row-btns button {
  background: #181816;
  border-color: var(--line);
}

/* ── Misc ── */
[data-theme="dark"] .pie-outer-label {
  color: var(--text-strong);
}
[data-theme="dark"] .toolbar-sep {
  background: var(--line);
}
[data-theme="dark"] .expand-btn {
  background: rgba(24, 24, 22, 0.92);
  border-color: var(--line);
  color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════
   RETOUR DE SAUVEGARDE COMPACT DANS LE BOUTON (#save-btn)
   ═══════════════════════════════════════════════════════════ */
#save-btn {
  overflow: hidden;
}

#save-btn .btn-label {
  justify-content: center;
  width: 100%;
}

#save-btn[data-save-status="saving"] .btn-label {
  animation: save-status-enter 180ms ease-out both;
}

#save-btn[data-save-status="success"] .btn-label {
  animation: save-status-roll 2500ms ease-in-out both;
}

#save-btn[data-save-status="error"] .btn-label {
  animation: save-status-roll 4000ms ease-in-out both;
}

@keyframes save-status-enter {
  from {
    opacity: 0;
    transform: translateY(55%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes save-status-roll {
  0% {
    opacity: 0;
    transform: translateY(55%);
  }
  10%,
  84% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-55%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #save-btn[data-save-status] .btn-label {
    animation: none;
  }
}

#save-btn[data-save-status="saving"] {
  color: var(--text-subtle);
}

#save-btn[data-save-status="success"] {
  color: #15803d;
  border-color: rgba(21, 128, 61, 0.2);
  background: #effaf3;
}

#save-btn[data-save-status="error"] {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.22);
  background: #fff1f2;
}

[data-theme="dark"] #save-btn[data-save-status="success"] {
  color: #86efac;
  background: rgba(21, 128, 61, 0.18);
}

[data-theme="dark"] #save-btn[data-save-status="error"] {
  background: rgba(220, 38, 38, 0.16);
}

/* ═══════════════════════════════════════════════════════════
   TOOLTIP PERSONNALISÉ (#app-tooltip)
   ═══════════════════════════════════════════════════════════ */
#app-tooltip {
  position: fixed;
  z-index: 9999;
  padding: 5px 11px 6px;
  border-radius: 7px;
  background: #1e2433;
  color: #eef2ff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  max-width: 220px;
  white-space: normal;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30);
  opacity: 0;
  transform: translateY(5px) scale(0.96);
  transition:
    opacity 140ms ease,
    transform 140ms cubic-bezier(0.34, 1.4, 0.64, 1);
  will-change: opacity, transform;
}

#app-tooltip.tip-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#app-tooltip::after {
  content: '';
  position: absolute;
  left: var(--tip-arrow, 50%);
  transform: translateX(-50%);
  border: 5px solid transparent;
}

#app-tooltip.tip-above::after {
  top: 100%;
  border-top-color: #1e2433;
}

#app-tooltip.tip-below::after {
  bottom: 100%;
  border-bottom-color: #1e2433;
}

[data-theme="dark"] #app-tooltip {
  background: #e7e4dc;
  color: #201f1c;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
}

[data-theme="dark"] #app-tooltip.tip-above::after {
  border-top-color: #e7e4dc;
}

[data-theme="dark"] #app-tooltip.tip-below::after {
  border-bottom-color: #e7e4dc;
}

/* ═══════════════════════════════════════════════════════════
   RIPPLE AU CLIC
   ═══════════════════════════════════════════════════════════ */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(20, 91, 180, 0.14);
  transform: scale(0);
  animation: ripple-expand 550ms ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Conteneurs qui reçoivent le ripple */
.btn:not(.btn-primary),
.icon-btn:not(.delete-btn),
.layout-toggle-btn {
  position: relative;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS BOUTONS
   ═══════════════════════════════════════════════════════════ */

/* .icon-btn (boutons icône dans les cartes) sauf delete */
.icon-btn:not(.delete-btn) {
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform 150ms cubic-bezier(0.34, 1.5, 0.64, 1);
}

.icon-btn:not(.delete-btn):hover {
  transform: scale(1.1);
}

.icon-btn:not(.delete-btn):active {
  transform: scale(0.88);
}

/* Boutons de suppression : shake + scale */
@keyframes btn-shake {
  0%   { transform: rotate(0deg) scale(1.1); }
  25%  { transform: rotate(-9deg) scale(1.1); }
  75%  { transform: rotate(9deg) scale(1.1); }
  100% { transform: rotate(0deg) scale(1.1); }
}

.delete-btn {
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform 120ms ease;
}

.delete-btn:hover {
  animation: btn-shake 220ms ease-in-out;
}

.delete-btn:active {
  transform: scale(0.88) !important;
  animation: none;
}

/* Layout toggle : pop au clic */
.layout-toggle-btn {
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform 130ms cubic-bezier(0.34, 1.5, 0.64, 1);
}

.layout-toggle-btn:active {
  transform: scale(0.82);
}

/* Bouton "+ Activité" : lift au survol */
.add-activity-btn {
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast),
    transform 160ms cubic-bezier(0.34, 1.5, 0.64, 1) !important;
}

.add-activity-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.10);
}

.add-activity-btn:active {
  transform: scale(0.94) !important;
}

/* Bouton expand (plein écran) : rotation douce */
.expand-btn {
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform 200ms cubic-bezier(0.34, 1.5, 0.64, 1) !important;
}

.expand-btn:hover {
  transform: scale(1.15) rotate(6deg) !important;
}

/* Tabs : transition couleur/fond fluide */
.top-tab {
  transition:
    background var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    transform 130ms cubic-bezier(0.34, 1.5, 0.64, 1);
}

.top-tab:not(.active):hover {
  transform: translateY(-1px);
}

.top-tab:active {
  transform: scale(0.96);
}

.modal.export-modal {
  width: min(1040px, calc(100vw - 48px)) !important;
  height: min(780px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.modal.export-modal .modal-title {
  margin-bottom: 2px;
}

.modal.export-modal > label {
  margin-top: 4px;
}

.modal.export-modal #export-format-select {
  margin-bottom: 4px;
}

.modal.export-modal #export-filename-input {
  margin-bottom: 6px;
}

.modal.export-modal #export-result-modal-copy {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.modal.export-modal #export-result-text.panel-textarea {
  flex: 0 0 120px;
  min-height: 120px;
  height: auto;
  max-height: none;
  overflow: auto;
  resize: vertical;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1.45;
  white-space: pre;
}

#export-modal-backdrop .modal.export-modal {
  overflow-y: auto;
}

.modal.export-modal .modal-actions {
  width: 100%;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  align-self: stretch;
}

@media (max-width: 640px) {
  .modal.export-modal {
    width: calc(100vw - 24px) !important;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    padding: 20px;
  }

  #export-modal-backdrop .modal.export-modal {
    overflow-y: auto;
  }

  .modal.export-modal #export-result-text.panel-textarea {
    flex: 0 0 120px;
    min-height: 120px;
  }

  .modal.export-modal .export-preview-details[open] {
    flex: 0 0 auto;
    min-height: 180px;
  }

  .modal.export-modal .modal-actions {
    flex: 0 0 auto;
  }
}

/* Help page */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
}
html:has(body.help-page),
body.help-page {
    background: #fff !important;
}
body.help-page {
    --help-accent: var(--link-color);
    --help-accent-soft: #f8f8f9;
    --help-card: #fff;
    --help-code: #18181b;
    --line: #e5e7eb;
    --surface-light: #f8f8f9;
    overflow-x: hidden;
    overflow-x: clip;
}
.help-shell {
    width: min(var(--content-shell-width, 1180px), calc(100vw - var(--content-shell-gutter, 36px)));
    margin: 34px auto 0;
    padding-bottom: 72px;
}
.help-hero {
    position: relative;
    overflow: hidden;
    padding: clamp(28px, 5vw, 56px);
    border: 1px solid var(--line);
    border-radius: 24px;
    background: linear-gradient(135deg, #fff, #f7f7f8 68%, #fafafa);
}
.help-hero::after {
    position: absolute;
    right: clamp(-90px, -6vw, -54px);
    bottom: -132px;
    width: clamp(300px, 31vw, 420px);
    height: clamp(300px, 31vw, 420px);
    border-radius: 50%;
    background: conic-gradient(var(--read) 0 28%, var(--investigate) 28% 38%, var(--practice) 38% 57%, var(--produce) 57% 68%, var(--discuss) 68% 88%, var(--collaborate) 88%);
    content: "";
    opacity: .82;
    filter: saturate(.82);
}
.help-kicker {
    position: relative;
    z-index: 1;
    margin: 0 0 10px;
    color: var(--help-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.help-title {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: none;
    margin: 0;
}
.help-lead {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: none;
    margin: 20px 0 0;
    color: var(--text-body);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.7;
}
.help-quick-links {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}
.help-quick-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 14px;
    border: 1px solid rgba(20, 91, 180, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .84);
    color: var(--help-accent);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.help-quick-link:hover,
.help-quick-link:focus-visible {
    border-color: var(--help-accent);
    background: #fff;
}
.help-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    gap: 52px;
    align-items: start;
    min-width: 0;
    margin-top: 38px;
}
.help-sidebar {
    position: sticky;
    top: 86px;
    max-height: calc(100vh - 110px);
    overflow: auto;
    padding: 18px 14px 18px 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, .96);
}
.help-sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.help-progress {
    width: 34px;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}
.help-progress-bar {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--help-accent);
    transition: width 160ms ease;
}
.help-toc {
    display: grid;
    gap: 3px;
}
.help-toc-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 2px;
    align-items: start;
}
.help-toc-link {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 8px 9px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
}
.help-toc-link:hover,
.help-toc-link:focus-visible {
    background: var(--surface-light);
    color: var(--text-strong);
}
.help-toc-link.is-active {
    background: var(--help-accent-soft);
    color: var(--help-accent);
    font-weight: 800;
}
.help-toc-index {
    color: inherit;
    font-variant-numeric: tabular-nums;
    opacity: .72;
}
.help-toc-toggle {
    display: grid;
    place-items: center;
    width: 30px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.help-toc-toggle:hover,
.help-toc-toggle:focus-visible {
    background: var(--surface-light);
    color: var(--text-strong);
}
.help-toc-toggle i {
    font-size: 10px;
    transition: transform 160ms ease;
}
.help-toc-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}
.help-toc-submenu {
    display: grid;
    gap: 2px;
    margin: 2px 0 6px 30px;
    padding-left: 9px;
    border-left: 1px solid var(--line);
}
.help-toc-submenu[hidden] {
    display: none;
}
.help-toc-sublink {
    display: block;
    padding: 6px 8px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease;
}
.help-toc-sublink:hover,
.help-toc-sublink:focus-visible {
    background: var(--surface-light);
    color: var(--text-strong);
}
.help-toc-sublink.is-active {
    color: var(--help-accent);
    font-weight: 800;
}
.help-mobile-menu {
    display: none;
    width: 100%;
    margin-top: 24px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text-strong);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
}
.help-content {
    display: grid;
    gap: var(--page-section-gap);
    min-width: 0;
    max-width: 100%;
}
.prompt-library-content {
    width: 100%;
    margin: var(--page-section-gap) 0 0;
}
.prompt-page-header {
    padding-top: 8px;
}
.prompt-library {
    max-width: 1040px;
}
.prompt-library > p {
    margin: 0 0 14px;
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.76;
}
.prompt-library-content #prompts-intro,
.prompt-library-content #prompts-intro-followup {
    width: 100%;
    max-width: none;
}
.prompt-title-text {
    color: inherit;
    font-size: inherit;
    line-height: inherit;
}
.prompt-card {
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--line);
    scroll-margin-top: 96px;
}
.prompt-card:first-of-type {
    margin-top: var(--page-section-gap);
}
.prompt-card-heading {
    position: relative;
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: clamp(22px, 3vw, 30px) 44px clamp(22px, 3vw, 30px) 0;
    cursor: pointer;
    list-style: none;
}
.prompt-card-heading::-webkit-details-marker {
    display: none;
}
.prompt-card-heading::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 8px;
    color: var(--help-accent);
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    transform: translateY(-50%);
}
.prompt-card-details[open] > .prompt-card-heading::after {
    content: "−";
}
.prompt-card-heading:hover,
.prompt-card-heading:focus-visible {
    background: color-mix(in srgb, var(--primary) 5%, transparent);
}
.prompt-card-heading:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}
.prompt-card-body {
    padding: 0 0 clamp(28px, 4vw, 40px);
}
.prompt-card-heading > strong {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--text-strong);
    font-size: 1rem;
}
.prompt-objective {
    max-width: 820px;
    color: var(--text-body);
    font-size: 0.9375rem;
    line-height: 1.6;
}
.prompt-card .prompt-library-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
}
.prompt-library-text {
    box-sizing: border-box;
    min-height: 0;
    overflow-x: hidden;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.help-section {
    position: relative;
    min-width: 0;
    max-width: 100%;
    padding: clamp(30px, 3.4vw, 42px);
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 0 8px 28px rgba(19, 39, 68, .035);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.help-section:last-child {
    border-bottom: 1px solid var(--line);
}
.help-section.is-expanded {
    border-color: color-mix(in srgb, var(--help-accent) 28%, var(--line));
    box-shadow: 0 14px 38px rgba(19, 39, 68, .07);
}
.help-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--help-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.help-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: none;
    padding-right: 52px;
    margin: 0 0 18px;
}
.help-heading-index {
    flex: 0 0 auto;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
}
.help-section h3 {
    width: 100%;
    max-width: none;
    margin: var(--page-subsection-gap) 0 var(--page-heading-gap);
    font-size: 18px;
    line-height: 1.35;
}
.help-subheading-index {
    margin-right: 9px;
    color: var(--help-accent);
    font-variant-numeric: tabular-nums;
}
.help-section h4 {
    width: 100%;
    max-width: none;
    margin: 32px 0 10px;
    font-size: 15px;
}
.help-section p,
.help-section li,
.help-table th,
.help-table td {
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.76;
}
.help-section p {
    width: 100%;
    max-width: none;
    margin: 0 0 18px;
}
.help-section ul,
.help-section ol {
    width: 100%;
    max-width: none;
    margin: 16px 0 24px;
    padding-left: 22px;
}
.help-section li + li {
    margin-top: 9px;
}
.help-section a:not(.help-card-link) {
    color: var(--help-accent);
    font-weight: 650;
    text-underline-offset: 3px;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 26px;
}
.help-grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.help-section-toggle {
    position: absolute;
    top: clamp(22px, 3vw, 30px);
    right: clamp(22px, 3vw, 30px);
    display: inline-grid;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.help-section-toggle:hover,
.help-section-toggle:focus-visible {
    border-color: rgba(20, 91, 180, .2);
    background: var(--help-accent-soft);
    color: var(--help-accent);
}
.help-section-toggle i {
    font-size: 13px;
    transition: transform 160ms ease;
}
.help-section-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}
.help-section-body {
    min-width: 0;
    max-width: 100%;
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}
.help-section-body > h3:first-child {
    margin-top: 0;
}
.help-section-body[hidden] {
    display: none;
}
.help-card {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--help-card);
}
.help-card-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--help-accent-soft);
    color: var(--help-accent);
}
.help-card strong {
    display: block;
    margin-bottom: 8px;
    color: var(--text-strong);
    font-size: 14px;
}
.help-card strong:has(.help-card-icon) {
    display: flex;
    align-items: center;
    gap: 9px;
}
.help-card span,
.help-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.65;
}
.help-types {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.help-type {
    display: flex;
    gap: 13px;
    align-items: flex-start;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
}
.help-type-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--type-color);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--type-color) 24%, transparent);
}
.help-type strong {
    display: block;
    color: var(--text-strong);
    font-size: 13px;
    line-height: 1.35;
}
.help-type span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.help-callout {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    max-width: 900px;
    margin: 24px 0;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--help-accent-soft);
}
.help-callout.warning {
    border-color: #dbc36a;
    background: #fff8dc;
}
.help-callout i {
    margin-top: 3px;
    color: var(--help-accent);
}
.help-callout.warning i {
    color: #8a6400;
}
.help-callout p {
    margin: 0;
}
.help-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 24px 0 28px;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.help-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}
.help-table th,
.help-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.help-table th {
    background: var(--surface-light);
    color: var(--text-strong);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.help-table tr:last-child td {
    border-bottom: 0;
}
.help-table code,
.help-section code:not(.help-code) {
    padding: .12em .38em;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-light);
    color: var(--text-strong);
    font-size: .92em;
    overflow-wrap: anywhere;
}
.help-code-wrap,
.help-prompt-wrap {
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 920px;
    margin: 16px 0 20px;
}
.help-code,
.help-prompt {
    overflow: auto;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 18px 54px 18px 18px;
    border: 1px solid #293348;
    border-radius: 10px;
    background: var(--help-code);
    color: #e5edf8;
    font-size: 12.5px;
    line-height: 1.65;
    white-space: pre;
    tab-size: 2;
}
.help-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.help-prompt {
    font-family: var(--font-prompt);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: -.01em;
    min-height: 240px;
    resize: vertical;
}
.help-prompt-compact {
    min-height: 150px;
}
.help-copy-btn {
    position: absolute;
    top: 9px;
    right: 9px;
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #f7fbff;
    cursor: pointer;
}
.help-copy-btn:hover,
.help-copy-btn:focus-visible {
    background: rgba(255,255,255,.18);
}
.help-details-grid {
    display: grid;
    gap: 0;
    width: 100%;
    min-width: 0;
    max-width: 920px;
    margin: 24px 0 28px;
}
.help-details-grid > div {
    min-width: 0;
    padding: 22px 0;
    border-top: 1px solid var(--line);
}
.help-details-grid > div:first-child {
    padding-top: 0;
    border-top: 0;
}
.help-details-grid > div > strong {
    color: var(--text-strong);
    font-size: 14px;
}
.help-details-grid > div > p {
    margin-top: 8px;
}
.help-format-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--help-accent-soft);
    color: var(--help-accent);
    font-size: 11px;
    font-weight: 800;
}
[data-theme="dark"] html:has(body.help-page),
[data-theme="dark"] body.help-page {
    background: #181816 !important;
}
[data-theme="dark"] body.help-page {
    --help-accent: var(--link-color);
    --help-accent-soft: rgba(255, 255, 255, .08);
    --help-card: #24231f;
    --help-code: #0f0f0f;
    --line: rgba(129, 124, 112, .42);
    --panel: #24231f;
    --surface-light: #2a2823;
}
[data-theme="dark"] .help-hero {
    background: linear-gradient(135deg, #24231f, #2a2823);
}
[data-theme="dark"] .help-title,
[data-theme="dark"] .help-section h3,
[data-theme="dark"] .help-section h4,
[data-theme="dark"] .help-card strong,
[data-theme="dark"] .help-type strong,
[data-theme="dark"] .help-sidebar-title {
    color: #f3f6ff;
}
[data-theme="dark"] .help-lead,
[data-theme="dark"] .help-section p,
[data-theme="dark"] .help-section li,
[data-theme="dark"] .help-table td,
[data-theme="dark"] .help-card span,
[data-theme="dark"] .help-card p,
[data-theme="dark"] .help-type span {
    color: var(--text-body);
}
[data-theme="dark"] .help-sidebar {
    background: rgba(36, 35, 31, .96);
}
[data-theme="dark"] .help-toc-link,
[data-theme="dark"] .help-toc-link.is-active,
[data-theme="dark"] .help-toc-sublink,
[data-theme="dark"] .help-toc-sublink.is-active,
[data-theme="dark"] .help-toc-toggle {
    color: #f3f6ff;
}
[data-theme="dark"] .help-toc-link:hover,
[data-theme="dark"] .help-toc-link:focus-visible,
[data-theme="dark"] .help-toc-link.is-active:hover,
[data-theme="dark"] .help-toc-link.is-active:focus-visible,
[data-theme="dark"] .help-toc-sublink:hover,
[data-theme="dark"] .help-toc-sublink:focus-visible,
[data-theme="dark"] .help-toc-sublink.is-active:hover,
[data-theme="dark"] .help-toc-sublink.is-active:focus-visible,
[data-theme="dark"] .help-toc-toggle:hover,
[data-theme="dark"] .help-toc-toggle:focus-visible {
    color: var(--help-accent);
}
[data-theme="dark"] .help-quick-link {
    background: rgba(36, 35, 31, .82);
}
[data-theme="dark"] .help-callout.warning {
    border-color: rgba(219, 195, 106, .42);
    background: rgba(138, 100, 0, .14);
}
[data-theme="dark"] .help-table th {
    background: #2a2823;
}
@media (max-width: 1280px) {
    .help-layout {
        grid-template-columns: 1fr;
        gap: 0;
        margin-top: 22px;
    }
    .help-mobile-menu {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    .help-sidebar {
        position: static;
        display: none;
        max-height: none;
        margin-top: 8px;
    }
    .help-sidebar.is-open {
        display: block;
    }
    .help-content {
        margin-top: 34px;
    }
}
@media (max-width: 720px) {
    .help-shell {
        margin-top: 20px;
    }
    .help-hero {
        border-radius: 18px;
    }
    .help-hero::after {
        right: -62px;
        opacity: .24;
    }
    .help-grid,
    .help-grid.three,
    .help-types {
        grid-template-columns: 1fr;
    }
    .help-section {
        padding: 26px 22px;
    }
    .help-section-toggle {
        top: 18px;
        right: 18px;
    }
    .help-section-body {
        margin-top: 24px;
        padding-top: 24px;
    }
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

.help-section .help-spaced {
  margin-top: 18px;
}

.help-type-read { --type-color: var(--read); }
.help-type-investigate { --type-color: var(--investigate); }
.help-type-practice { --type-color: var(--practice); }
.help-type-produce { --type-color: var(--produce); }
.help-type-discuss { --type-color: var(--discuss); }
.help-type-collaborate { --type-color: var(--collaborate); }

/* About page */
body.about-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
}
.about-shell {
    display: grid;
    flex: 1 0 auto;
    align-items: center;
    width: min(760px, calc(100vw - var(--content-shell-gutter, 36px)));
    margin: 0 auto;
    padding: 32px 0 64px;
}
.about-card {
    padding: 42px 46px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow);
}
.about-title {
    margin: 0 0 6px;
}
.about-version {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}
.about-intro {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}
.about-intro a,
.about-meta a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.about-divider {
    margin: var(--page-section-gap) 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.about-meta {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 2.15;
}
.about-meta abbr {
    border-bottom: 0;
    text-decoration: none;
}
[data-theme="dark"] body.about-page {
    background: #181816;
}
[data-theme="dark"] .about-card {
    border-color: rgba(129, 124, 112, .42);
    background: #24231f;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .about-title {
    color: #f3f6ff;
}
[data-theme="dark"] .about-version,
[data-theme="dark"] .about-intro,
[data-theme="dark"] .about-meta {
    color: var(--text-body);
}
[data-theme="dark"] .about-divider {
    border-top-color: rgba(129, 124, 112, .42);
}
@media (max-width: 600px) {
    .about-shell {
        align-items: start;
        padding-top: 24px;
    }
    .about-card {
        padding: 30px 24px 34px;
    }
}

/* Legal and privacy pages */
body.legal-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #fff;
}
.legal-shell {
    flex: 1 0 auto;
    width: min(880px, calc(100vw - var(--content-shell-gutter, 36px)));
    margin: 0 auto;
    padding: 32px 0 64px;
}
.legal-card {
    padding: 42px 46px 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow);
}
.legal-card h1 {
    margin: 0 0 12px;
}
.legal-card h2 {
    margin: 38px 0 12px;
    font-size: clamp(1.25rem, 2.2vw, 1.55rem);
}
.legal-card h3 {
    margin: 24px 0 8px;
    font-size: 1.05rem;
}
.legal-card p,
.legal-card li,
.legal-card address {
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.75;
}
.legal-card p {
    margin: 0 0 14px;
}
.legal-card ul {
    margin: 10px 0 18px;
    padding-left: 24px;
}
.legal-card li + li {
    margin-top: 7px;
}
.legal-card a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.legal-card address {
    margin: 0 0 14px;
    font-style: normal;
}
.legal-updated,
.legal-lead {
    color: var(--muted) !important;
}
.legal-updated {
    font-size: 13px !important;
}
.legal-lead {
    margin-top: 20px !important;
    font-size: 16px !important;
}
.legal-note {
    margin: 22px 0 !important;
    padding: 16px 18px;
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    background: var(--surface-light);
}
.legal-attribution {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-light);
}
[data-theme="dark"] body.legal-page {
    background: #181816;
}
[data-theme="dark"] .legal-card {
    border-color: rgba(129, 124, 112, .42);
    background: #24231f;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .35);
}
[data-theme="dark"] .legal-card h1,
[data-theme="dark"] .legal-card h2,
[data-theme="dark"] .legal-card h3 {
    color: #f3f6ff;
}
[data-theme="dark"] .legal-card p,
[data-theme="dark"] .legal-card li,
[data-theme="dark"] .legal-card address {
    color: var(--text-body);
}
[data-theme="dark"] .legal-note,
[data-theme="dark"] .legal-attribution {
    border-color: rgba(129, 124, 112, .42);
    background: #2a2823;
}
@media (max-width: 600px) {
    .legal-shell {
        padding-top: 24px;
    }
    .legal-card {
        padding: 30px 24px 34px;
    }
}

/* ── Import modal: template library or local file ─────────────────────────── */

#import-modal-backdrop {
  padding: 24px;
}

#import-modal-backdrop .modal {
  width: min(840px, calc(100vw - 48px));
  height: min(760px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.import-modal-desc {
  color: var(--muted);
}

.import-source {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}

/* Outranks the global `html body:not(.home-page) h3` rule so these stay small
   uppercase labels rather than page headings. */
html body .import-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.import-drop-zone {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 92px;
  border: 1.5px dashed color-mix(in srgb, var(--text-subtle) 42%, var(--line));
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-light);
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    color var(--transition-fast);
}

.import-drop-icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--panel);
  color: var(--heading-ink);
  font-size: 17px;
  box-shadow: inset 0 0 0 1px var(--line);
}

.import-drop-copy {
  min-width: 0;
}

.import-drop-title,
.import-drop-hint {
  margin: 0;
}

.import-drop-title {
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 700;
}

.import-drop-hint {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.import-drop-zone.is-dragover {
  border-color: var(--heading-ink);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--heading-ink) 9%, transparent);
}

.import-drop-zone.is-dragover .import-drop-icon {
  background: var(--btn-primary-from);
  color: var(--btn-primary-text);
  box-shadow: none;
}

.import-drop-zone.is-dragover .import-drop-title {
  color: var(--text-strong);
}

.import-drop-zone.is-dragover .import-drop-hint {
  color: var(--muted);
}

#import-modal-backdrop .import-file-formats {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
  opacity: 0.72;
}

.import-models-section {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.import-models-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

html body .import-models-head .import-section-title {
  margin: 0;
}

.import-models-link {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}

.import-models-link:hover,
.import-models-link:focus-visible {
  color: var(--primary);
}

.import-models-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-models-filters #import-models-search {
  flex: 1 1 220px;
  min-width: 0;
}

.import-models-filters #import-models-family {
  flex: 0 1 220px;
  min-width: 0;
}

.import-models-status {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.import-models-status-error {
  color: var(--danger, #b91c1c);
  font-weight: 650;
}

.import-models-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 2px;
}

.import-model-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  padding: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.import-model-card:hover,
.import-model-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
}

.import-model-head {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.import-model-icon {
  color: var(--primary);
  font-size: 13px;
}

html body .import-model-title {
  font-size: 14.5px;
  font-weight: 750;
  line-height: 1.3;
}

.import-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.import-model-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.import-model-summary {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-body);
}

.import-model-types {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.import-model-dot {
  width: 14px;
  height: 6px;
  border-radius: 3px;
  background: #d1d5db;
}

.import-model-dot.type-read { background: var(--read); }
.import-model-dot.type-investigate { background: var(--investigate); }
.import-model-dot.type-practice { background: var(--practice); }
.import-model-dot.type-produce { background: var(--produce); }
.import-model-dot.type-discuss { background: var(--discuss); }
.import-model-dot.type-collaborate { background: var(--collaborate); }

.import-model-todo {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.import-model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 3px;
}

.import-model-action.btn {
  flex: 0 1 auto;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.import-modal.is-previewing-model > :not(.import-model-preview) {
  display: none;
}

.import-model-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.import-model-preview.hidden {
  display: none;
}

.import-model-preview-header {
  display: grid;
  gap: 10px;
}

.modal .import-model-preview-eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal .import-model-preview-summary {
  color: var(--text-body);
}

.import-model-preview-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.import-model-preview-status {
  color: var(--muted);
}

.import-model-preview-status-error {
  color: var(--danger, #b91c1c);
  font-weight: 650;
}

.import-model-preview-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  gap: 18px;
  padding: 2px 10px 4px 2px;
}

.import-model-preview-moment {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  background: var(--panel-2);
}

.import-model-preview-moment-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.import-model-preview-moment-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

html body .import-model-preview-moment h3 {
  margin: 0;
  color: var(--heading-ink);
  font-size: 15px;
  line-height: 1.35;
}

.import-model-preview-text {
  display: grid;
  gap: 6px;
}

.import-model-preview-text > strong {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.modal .import-model-preview-text > p {
  color: var(--text-body);
  font-size: 12.5px;
  line-height: 1.6;
}

.import-model-preview-activities {
  display: grid;
  gap: 12px;
}

.import-model-preview-activity {
  display: grid;
  gap: 11px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--activity-color, #d1d5db);
  border-radius: 7px;
  padding: 14px 15px;
  background: var(--panel);
}

.import-model-preview-activity.type-read { --activity-color: var(--read); }
.import-model-preview-activity.type-investigate { --activity-color: var(--investigate); }
.import-model-preview-activity.type-practice { --activity-color: var(--practice); }
.import-model-preview-activity.type-produce { --activity-color: var(--produce); }
.import-model-preview-activity.type-discuss { --activity-color: var(--discuss); }
.import-model-preview-activity.type-collaborate { --activity-color: var(--collaborate); }

.import-model-preview-activity-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px;
  align-items: center;
}

.import-model-preview-activity-header > strong {
  font-size: 12.5px;
}

.import-model-preview-activity-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.import-model-preview-type {
  border-radius: 999px;
  padding: 2px 7px;
  background: var(--activity-color, #d1d5db);
  color: #111827;
}

.import-model-preview-instructions {
  border-radius: 6px;
  padding: 11px 12px;
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}

.import-model-preview-actions {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.import-model-preview-actions .btn {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12.5px;
}

@media (max-width: 640px) {
  #import-modal-backdrop {
    padding: 12px;
  }

  #import-modal-backdrop .modal {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
  }

  .import-models-list {
    grid-template-columns: 1fr;
  }

  .import-drop-zone {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
    text-align: center;
  }

  .import-model-summary {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .import-model-todo {
    display: none;
  }
}

/* ── Retour utilisateur ───────────────────────────── */
.feedback-widget {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 1100;
  font-family: var(--font-family, "Inter", sans-serif);
}

.feedback-trigger {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line, #d6dde6);
  border-radius: 999px;
  background: var(--panel, #fff);
  color: #1f1f1d;
  box-shadow: none;
  cursor: pointer;
  font-size: 18px;
  animation: feedback-trigger-pulse 4.8s ease-in-out infinite;
  transition:
    background var(--transition-fast, 120ms ease),
    border-color var(--transition-fast, 120ms ease),
    color var(--transition-fast, 120ms ease);
}

@keyframes feedback-trigger-pulse {
  0%, 68%, 100% {
    transform: scale(1);
  }
  78% {
    transform: scale(1.06);
  }
  88% {
    transform: scale(1);
  }
}

.feedback-trigger:hover,
.feedback-trigger:focus-visible,
.feedback-trigger[aria-expanded="true"] {
  animation: none;
  border-color: #a8a8a3;
  background: var(--surface-light, #fafafa);
  color: #1f1f1d;
  box-shadow: none;
  transform: none;
}

.feedback-trigger:focus-visible,
.feedback-close:focus-visible,
.feedback-rating:has(input:focus-visible),
.feedback-submit:focus-visible,
.feedback-panel textarea:focus-visible {
  outline: 3px solid var(--action-focus, rgba(40, 95, 150, 0.28));
  outline-offset: 2px;
}

.feedback-trigger:focus-visible {
  outline: 2px solid #1f1f1d;
  outline-offset: 2px;
}

.feedback-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  width: min(360px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid var(--line, #d6dde6);
  border-radius: 18px;
  background: var(--panel, #fff);
  color: var(--text-body, #314255);
  box-shadow: 0 22px 58px rgba(15, 30, 48, 0.24);
  animation: feedback-panel-in 150ms ease-out;
}

.feedback-panel[hidden],
.feedback-form[hidden],
.feedback-success[hidden] {
  display: none !important;
}

@keyframes feedback-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
}

.feedback-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 8px;
}

.feedback-kicker {
  margin: 0 0 5px;
  color: var(--primary, #245a8f);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.2;
  text-transform: uppercase;
}

html body .feedback-panel h2 {
  margin: 0;
  color: var(--text-strong, #253245);
  font-family: var(--font-family, "Inter", sans-serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
}

.feedback-close {
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-subtle, #415067);
  cursor: pointer;
  font-size: 16px;
}

.feedback-close:hover {
  background: var(--hover-bg, #f3f5f7);
}

.feedback-form {
  padding: 10px 20px 18px;
}

.feedback-rating-group {
  margin: 0 0 17px;
  padding: 0;
  border: 0;
}

.feedback-rating-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.feedback-rating {
  position: relative;
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--line, #d6dde6);
  border-radius: 13px;
  background: var(--surface-light, #fafafa);
  color: var(--text-subtle, #415067);
  cursor: pointer;
  font-size: 27px;
  transition: transform var(--transition-fast, 120ms ease), border-color var(--transition-fast, 120ms ease), background var(--transition-fast, 120ms ease);
}

.feedback-rating input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.feedback-rating:hover {
  transform: translateY(-1px);
}

.feedback-rating-positive {
  border-color: #85bf9d;
  background: #e0f2e8;
  color: #166534;
}

.feedback-rating-neutral {
  border-color: #ddb45d;
  background: #fff0c2;
  color: #854d0e;
}

.feedback-rating-negative {
  border-color: #dc9298;
  background: #fbe1e3;
  color: #991b1b;
}

.feedback-rating-positive:hover,
.feedback-rating-positive:has(input:checked) {
  border-color: #23804d;
  background: #c7e9d5;
  color: #145c30;
}

.feedback-rating-neutral:hover,
.feedback-rating-neutral:has(input:checked) {
  border-color: #b87513;
  background: #ffe39a;
  color: #78420a;
}

.feedback-rating-negative:hover,
.feedback-rating-negative:has(input:checked) {
  border-color: #bd3542;
  background: #f5c5ca;
  color: #881922;
}

.feedback-rating:has(input:checked) {
  box-shadow: inset 0 0 0 1px currentColor;
}

.feedback-comment-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--text-strong, #253245);
  font-size: 13px;
  font-weight: 700;
}

.feedback-comment-label small {
  color: var(--muted, #5e6b7c);
  font-size: 11px;
  font-weight: 500;
}

.feedback-panel textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line, #d6dde6);
  border-radius: 11px;
  background: var(--surface-input, #f7f7f7);
  color: var(--text-strong, #253245);
  padding: 10px 11px;
  font: 400 13px/1.5 var(--font-family, "Inter", sans-serif);
}

.feedback-panel textarea::placeholder {
  color: var(--muted, #5e6b7c);
  opacity: 0.82;
}

.feedback-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.feedback-status {
  min-height: 18px;
  margin: 7px 0 2px;
  color: var(--danger, #c0303b);
  font-size: 12px;
  line-height: 1.4;
}

.feedback-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-actions a {
  color: var(--muted, #5e6b7c);
  font-size: 11px;
  text-underline-offset: 2px;
}

.feedback-submit {
  min-height: 38px;
  border: 1px solid #1f1f1d;
  border-radius: 10px;
  background: #1f1f1d;
  color: #fff;
  padding: 8px 16px;
  cursor: pointer;
  font: 700 13px/1 var(--font-family, "Inter", sans-serif);
}

.feedback-submit:hover:not(:disabled) {
  border-color: #343430;
  background: #343430;
}

.feedback-submit:focus-visible {
  outline: 2px solid #1f1f1d;
  outline-offset: 2px;
}

.feedback-submit:disabled {
  cursor: wait;
  opacity: 0.58;
}

.feedback-success {
  display: grid;
  min-height: 150px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: #25734c;
  text-align: center;
}

.feedback-success i {
  font-size: 34px;
}

.feedback-success p {
  margin: 0;
  color: var(--text-strong, #253245);
  font-weight: 700;
}

[data-theme="dark"] .feedback-panel,
[data-theme="dark"] .feedback-trigger {
  border-color: rgba(148, 163, 184, 0.34);
  background: #24231f;
}

[data-theme="dark"] .feedback-trigger {
  color: #d8d5cc;
  box-shadow: none;
}

[data-theme="dark"] .feedback-trigger:hover,
[data-theme="dark"] .feedback-trigger:focus-visible,
[data-theme="dark"] .feedback-trigger[aria-expanded="true"] {
  border-color: #8b887f;
  background: #302f2a;
  color: #ffffff;
  box-shadow: none;
}

[data-theme="dark"] .feedback-rating {
  background: #2a2823;
}

[data-theme="dark"] .feedback-rating-positive {
  background: #183b29;
  color: #5ee08f;
}

[data-theme="dark"] .feedback-rating-neutral {
  background: #46330f;
  color: #ffc857;
}

[data-theme="dark"] .feedback-rating-negative {
  background: #482026;
  color: #ff7b86;
}

[data-theme="dark"] .feedback-rating-positive:hover,
[data-theme="dark"] .feedback-rating-positive:has(input:checked) {
  background: #205237;
  color: #6feb9c;
}

[data-theme="dark"] .feedback-rating-neutral:hover,
[data-theme="dark"] .feedback-rating-neutral:has(input:checked) {
  background: #5a4215;
  color: #ffd166;
}

[data-theme="dark"] .feedback-rating-negative:hover,
[data-theme="dark"] .feedback-rating-negative:has(input:checked) {
  background: #5c2930;
  color: #ff8b95;
}

@media (max-width: 480px) {
  .feedback-widget {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .feedback-panel {
    position: fixed;
    right: 12px;
    bottom: 66px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-panel {
    animation: none;
  }

  .feedback-trigger,
  .feedback-rating {
    animation: none;
    transition: none;
  }
}
