:root {
  /* ── Tokens fondamentaux ─────────────────────────── */
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #5e6b7c;
  --primary: #145bb4;
  --focus: #0a58ca;
  --shadow-soft: 0 12px 32px rgba(19, 39, 68, 0.08);
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
  --read: #a1f5ed;
  --investigate: #f8807f;
  --practice: #bb98dc;
  --produce: #bdea75;
  --discuss: #7aaeea;
  --collaborate: #ffd966;

  /* ── Typographie ─────────────────────────────────── */
  --font-family: "Inter", "Segoe UI", "Trebuchet MS", sans-serif;

  /* ── 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;

  /* ── Bouton primaire ─────────────────────────────── */
  --btn-primary-from:   #2a7be1;
  --btn-primary-to:     #135cb9;
  --btn-primary-border: #0d4f9e;

  /* ── 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 10px 20px rgba(20, 91, 180, 0.22);

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

*,
*::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;
}

.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: 3px 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;
}

.site-nav-brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: conic-gradient(
    #a1f5ed   0deg  100deg,
    #f8807f 100deg  130deg,
    #bb98dc 130deg  200deg,
    #bdea75 200deg  235deg,
    #7aaeea 235deg  325deg,
    #ffd966 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,
.site-nav-subtitle {
  margin: 0;
}

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

.site-nav-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

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

.brand-title {
  margin: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: var(--text-strong);
}

.top-panel-toggle {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0;
  background: var(--panel);
  color: var(--text-subtle);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast);
}

.top-panel-toggle:hover {
  background: rgba(20, 91, 180, 0.08);
  border-color: rgba(20, 91, 180, 0.25);
  color: #124f9c;
}

.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: 0.98fr 1.06fr 0.86fr;
  column-gap: 44px;
  row-gap: 24px;
  align-items: start;
}

.panel-column {
  display: grid;
  gap: 20px;
  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;
}

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

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

#label-meta-delivery {
  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-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);
}

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

.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;
  line-height: 1.35;
  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;
  font-size: 16px;
}

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

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

.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: 42px;
  text-align: center;
  padding: 6px 4px;
  font-size: 13px;
}

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

.analysis-wrap {
  display: grid;
  justify-items: center;
  gap: 10px;
  align-content: center;
  align-self: center;
}

.top-pie {
  width: 290px;
  height: 290px;
  border-radius: 50%;
  border: 1px solid #bfc5cb;
  background: conic-gradient(#d2d2d2 0% 100%);
}

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

.top-legend {
  display: none;
}

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

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

.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;
  font-size: 22px;
}

.analysis-alerts {
  display: grid;
  gap: 8px;
}

.analysis-alert {
  border: 1px solid var(--warning-border);
  background: var(--warning-bg);
  color: var(--warning-text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.35;
}

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

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

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

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

.analysis-big-pie,
.analysis-small-pie {
  border-radius: 50%;
  border: 1px solid #c8c8c8;
  background: conic-gradient(#d2d2d2 0% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

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

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

.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 {
  display: none;
}

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

.analysis-group-bar {
  width: min(760px, 100%);
  height: 36px;
  border: 1px solid #bfc5cb;
  border-radius: 3px;
  background: linear-gradient(90deg, #d2d2d2 0% 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* 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;
}

.partition-container,
#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;
}

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

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

#export-result-text.panel-textarea {
  flex: 1 1 auto;
  min-height: 320px;
  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-actions {
  align-self: end;
}

.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;
  font-size: 18px;
  line-height: 1.15;
}

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

.activity-link-modal {
  width: min(520px, 92vw);
}

.activity-link-modal-fields {
  display: grid;
  gap: 8px;
}

.activity-link-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.activity-link-list:empty::before {
  content: attr(data-empty);
  color: var(--muted);
  font-size: 13px;
}

.activity-link-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.activity-link-list-main {
  min-width: 0;
}

.activity-link-list-title {
  display: block;
  font-weight: 700;
  color: var(--text-strong);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.activity-link-list-title:hover {
  text-decoration: underline;
}

.activity-link-list-url {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

/* --- 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: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  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: 10px;
  align-items: center;
  flex-wrap: wrap;
}

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

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

.toolbar-icon-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.toolbar-lang-select {
  width: auto;
  min-width: 96px;
}

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

.nav-language-option {
  position: relative;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.nav-language-option + .nav-language-option::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
}

.nav-language-option:hover:not([aria-pressed="true"]) {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
}

.nav-language-option[aria-pressed="true"] {
  background: transparent;
  color: #ffffff;
  box-shadow: none;
}

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

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

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

[data-theme="dark"] .nav-language-option[aria-pressed="true"] {
  background: transparent;
  color: #ffffff;
}

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

.toolbar .btn,
.toolbar .panel-select {
  min-height: 40px;
}

.toolbar .btn {
  padding-right: 10px;
  padding-left: 10px;
}

.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: 14px;
  padding: 9px 13px;
  cursor: pointer;
  white-space: nowrap;
  min-height: 40px;
  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: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to));
  border-color: var(--btn-primary-border);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
  -webkit-text-fill-color: #fff;
  transition:
    filter 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: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to));
  border-color: var(--btn-primary-border);
  color: #fff;
  -webkit-text-fill-color: #fff;
  filter: brightness(1.08);
}

.btn-primary:focus-visible,
.btn-primary:active {
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: linear-gradient(180deg, var(--btn-primary-from), var(--btn-primary-to));
  border-color: var(--btn-primary-border);
}

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

.btn-light {
  background: #fff;
}

.btn-icon {
  width: 40px;
  min-height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
}

.btn-icon:hover {
  color: #124f9c;
}

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

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

.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) 32px;
}

/* === 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-teacher { width: 92px;  }
.grid-col-eval    { width: 100px; }
.grid-col-desc    { width: 180px; }
.grid-col-actions { width: 66px;  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 {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 10px;
}
.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-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-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); }

.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 470px;
  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: 16px 16px 16px;
}

.session-title,
.session-objectives,
.session-intentions,
.activity-description,
.session-notes-input,
.activity-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;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.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-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 0;
  flex: 0 0 auto;
  width: 100%;
}

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

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

/* ── 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;
}

.activity-links-btn[data-count]:not([data-count=""]):not([data-count="0"])::after,
.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;
}

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

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

.activity-links-btn {
  position: relative;
  overflow: visible !important;
  width: 26px;
  height: 26px;
  padding: 0;
}

.activity-links-btn svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.activity-links-btn .fa-solid,
.activity-links-btn .fa-regular {
  width: 16px;
  font-size: 14px;
  color: currentColor;
  text-align: center;
  pointer-events: none;
}

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

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

.activity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 8px;
}

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

.activity-link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  max-width: 100%;
  padding: 3px 6px 3px 8px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  line-height: 1.3;
}

.activity-link-chip-anchor {
  color: inherit;
  text-decoration: none;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-link-chip-anchor:hover {
  text-decoration: underline;
}

.activity-link-chip-remove {
  border: none;
  background: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}

.activity-link-chip-remove:hover {
  opacity: 1;
}

.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  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;
  max-width: 120px;
}

.tool-chip-name {
  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-shrink: 0;
  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-title {
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}

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

.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;
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

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

.activity-params {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 0;
  flex: 0 0 auto;
  width: 100%;
}

.activity-param {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
}

.activity-param-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.activity-param-duration {
  cursor: default;
}

.duration-symbol,
.duration-unit-inline {
  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);
}

.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) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

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

  .analysis-wrap {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  .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;
  }

  .brand-title {
    font-size: 18px;
    line-height: 1.25;
  }

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

  .analysis-main-grid {
    grid-template-columns: 1fr;
  }

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

  .top-pie {
    width: min(58vw, 240px);
    height: min(58vw, 240px);
  }

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

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

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

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

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

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar-right {
    width: 100%;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

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

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

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

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

  .activity-toolbar {
    gap: 4px;
  }

  .save-status {
    width: 36px;
  }
}

@media (max-width: 640px) {
  .top-pie {
    width: min(68vw, 260px);
    height: min(68vw, 260px);
  }

  .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: 38px;
    padding: 8px 10px;
    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 24px;
  }

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

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

  .toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px 12px;
    margin: 16px 12px 48px;
  }

  .toolbar-left,
  .toolbar-right {
    width: 100%;
    gap: 10px;
  }

  .toolbar-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
  }

  .toolbar-right {
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .toolbar-cluster {
    gap: 8px;
  }

  .toolbar-left > .toolbar-cluster:first-child {
    width: 100%;
  }

  .toolbar-right > .toolbar-cluster,
  .toolbar-left > .toolbar-cluster:last-child {
    flex: 0 0 auto;
  }

  .toolbar-sep {
    display: none;
  }

  .toolbar .btn:not(#add-session-btn) {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
  }

  .toolbar .btn:not(#add-session-btn) .btn-label {
    gap: 0;
    font-size: 0;
  }

  .toolbar .btn:not(#add-session-btn) .btn-icon-inline {
    width: 16px;
    font-size: 15px;
  }

  #add-session-btn {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    justify-content: center;
  }

  #export-design-btn {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text-body);
    font-weight: 400;
    -webkit-text-fill-color: currentColor;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    filter: none;
  }

  #export-design-btn::after {
    display: none;
  }

  #export-design-btn:hover,
  #export-design-btn:focus-visible {
    background: var(--hover-bg);
    border-color: var(--line);
    color: var(--text-body);
    -webkit-text-fill-color: currentColor;
    filter: none;
  }

  #toggle-intentions-btn,
  #new-design-btn,
  #import-design-btn,
  #save-btn,
  #publish-btn {
    aspect-ratio: 1;
  }

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

/* 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 (min-width: 901px) and (max-width: 1500px) {
  .panel-grid {
    grid-template-columns: 1fr 1fr;
  }

  .analysis-wrap {
    grid-column: 1 / -1;
  }
}

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

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

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

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

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

.site-footer-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 31;
  pointer-events: auto;
  margin-top: 6px;
}

.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-license {
  margin-top: 10px;
}

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: 12px;
  }

  .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 {
  border-top-color: var(--line);
  color: #dce4f1;
}

[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-links-btn,
.activity-toolbar .select-tools-btn,
.activity-toolbar .delete-activity-btn {
  width: 30px;
  height: 30px;
}

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

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

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

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

/* ── 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 20px 48px rgba(15, 23, 42, 0.13);
}

/* ── Button primary: shimmer on hover ──────────────────────── */
.btn-primary {
  overflow: hidden;
  position: relative;
}
.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.28) 50%,
    transparent 62%
  );
  transform: translateX(-100%) skewX(-12deg);
  pointer-events: none;
}
.btn-primary:hover::after {
  animation: shimmer 0.65s ease forwards;
}

/* ── 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),
    transform 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}
.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);
  transform: rotate(22deg) scale(1.08);
}
.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: #6ab0ff;
  --focus:   #88c4ff;

  /* ── Text hierarchy ── */
  --text-strong: #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);

  /* ── Primary button ── */
  --btn-primary-from:   #388bfd;
  --btn-primary-to:     #1f6feb;
  --btn-primary-border: #1158c7;

  /* ── 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 8px 24px  rgba(0, 0, 0, 0.4);
  --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 10px 20px rgba(31, 111, 235, 0.38);
}

/* ── 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 20px 48px rgba(0, 0, 0, 0.4);
  border-color: rgba(106, 176, 255, 0.3);
}
[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: #201f1c;
  border-color: rgba(129, 124, 112, 0.48);
  color: var(--text);
}
[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"] .session-notes-input,
[data-theme="dark"] .activity-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"] .session-notes-input::placeholder,
[data-theme="dark"] .activity-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-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"] .activity-links-btn[data-count]:not([data-count=""]):not([data-count="0"])::after,
[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"] .activity-links-btn.has-links:hover,
[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: #181816;
  border-color: var(--line);
}
[data-theme="dark"] .save-status {
  background: #181816;
  border-color: var(--line);
}
[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);
  transform: rotate(-22deg) scale(1.08);
}
[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"] .analysis-big-pie,
[data-theme="dark"] .analysis-small-pie {
  border-color: rgba(129, 124, 112, 0.42);
}
[data-theme="dark"] .pie-outer-label {
  color: var(--text-strong);
}
[data-theme="dark"] .analysis-group-bar {
  border-color: rgba(129, 124, 112, 0.42);
}
[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 DANS LE BOUTON (#save-btn)
   ═══════════════════════════════════════════════════════════ */
#save-btn {
  min-width: 160px;
}

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

#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
   ═══════════════════════════════════════════════════════════ */

/* .btn-icon (icônes de la barre d'outils) */
.btn-icon {
  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    transform 150ms cubic-bezier(0.34, 1.5, 0.64, 1);
}

.btn-icon:hover {
  transform: scale(1.12);
}

.btn-icon:active {
  transform: scale(0.88) !important;
}

/* .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);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.export-modal #export-result-text.panel-textarea {
  flex: 1 1 auto;
  min-height: 320px;
  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;
}

.modal.export-modal .modal-actions {
  align-self: end;
}

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

/* 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: #145bb4;
    --help-accent-soft: #f8f8f9;
    --help-card: #fff;
    --help-code: #18181b;
    --line: #e5e7eb;
    --surface-light: #f8f8f9;
}
.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(#a1f5ed 0 28%, #f8807f 28% 38%, #bb98dc 38% 57%, #bdea75 57% 68%, #7aaeea 68% 88%, #ffd966 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;
    max-width: 840px;
    margin: 0;
    color: var(--text-strong);
    font-size: clamp(32px, 5vw, 52px);
    letter-spacing: -.045em;
    line-height: 1.02;
}
.help-lead {
    position: relative;
    z-index: 1;
    max-width: 760px;
    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: 44px;
    align-items: start;
    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 {
    min-width: 0;
}
.help-section {
    padding: 0 0 48px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 48px;
}
.help-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
}
.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;
    margin: 0 0 16px;
    color: var(--text-strong);
    font-size: clamp(25px, 4vw, 36px);
    letter-spacing: -.025em;
    line-height: 1.15;
}
.help-heading-index {
    flex: 0 0 auto;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
}
.help-section h3 {
    margin: 30px 0 10px;
    color: var(--text-strong);
    font-size: 18px;
    line-height: 1.35;
}
.help-section h4 {
    margin: 22px 0 8px;
    color: var(--text-strong);
    font-size: 15px;
}
.help-section p,
.help-section li,
.help-table th,
.help-table td {
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.72;
}
.help-section p {
    max-width: 880px;
    margin: 0 0 14px;
}
.help-section ul,
.help-section ol {
    max-width: 880px;
    margin: 12px 0 18px;
    padding-left: 22px;
}
.help-section li + li {
    margin-top: 6px;
}
.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: 14px;
    margin-top: 20px;
}
.help-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.help-card {
    min-width: 0;
    padding: 18px;
    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: 5px;
    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.55;
}
.help-types {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}
.help-type {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px;
    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: 12px;
    align-items: flex-start;
    max-width: 900px;
    margin: 18px 0;
    padding: 16px 18px;
    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 {
    overflow-x: auto;
    margin: 18px 0 22px;
    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: 13px 15px;
    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;
}
.help-code-wrap,
.help-prompt-wrap {
    position: relative;
    max-width: 920px;
    margin: 16px 0 20px;
}
.help-code,
.help-prompt {
    overflow: auto;
    width: 100%;
    margin: 0;
    padding: 18px 54px 18px 18px;
    border: 1px solid #293348;
    border-radius: 10px;
    background: var(--help-code);
    color: #e5edf8;
    font: 12.5px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    white-space: pre;
    tab-size: 2;
}
.help-prompt {
    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 {
    max-width: 920px;
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
}
.help-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.help-details summary::-webkit-details-marker {
    display: none;
}
.help-details summary::after {
    content: "+";
    color: var(--help-accent);
    font-size: 20px;
    line-height: 1;
}
.help-details[open] summary::after {
    content: "−";
}
.help-details-body {
    padding: 0 18px 18px;
}
.help-details-body .help-code-wrap,
.help-details-body .help-prompt-wrap {
    margin-bottom: 0;
}
.help-details-grid {
    display: grid;
    gap: 0;
    max-width: 920px;
    margin: 18px 0 20px;
}
.help-details-grid > div {
    min-width: 0;
    padding: 18px 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;
}
.help-footer-note {
    max-width: 900px;
    padding: 22px;
    border-radius: 14px;
    background: #f8f8f9;
}
.help-footer-note p:last-child {
    margin-bottom: 0;
}
[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: #8cc6ff;
    --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 h2,
[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,
[data-theme="dark"] .help-details summary {
    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,
[data-theme="dark"] .help-footer-note {
    background: #2a2823;
}
@media (max-width: 1000px) {
    .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 {
        margin-bottom: 38px;
        padding-bottom: 38px;
    }
}
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

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

.help-type-read { --type-color: #a1f5ed; }
.help-type-investigate { --type-color: #f8807f; }
.help-type-practice { --type-color: #bb98dc; }
.help-type-produce { --type-color: #bdea75; }
.help-type-discuss { --type-color: #7aaeea; }
.help-type-collaborate { --type-color: #ffd966; }

/* 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 14px;
    color: var(--text);
    font-size: clamp(24px, 4vw, 32px);
}
.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: 34px 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-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;
    }
}
