/*-----------------------------------------------------------------------------
 * Project : Athena SimLab
 * File    : frontend/css/components.css
 * Stylesheet : UI components
 * Author  : Johann Sievering
 * AI Support : Claude AI
 * Date    : 2026-06-11 (start of the project)
 * Rev     : 2026-07-03 Full code review: bug fixes, hardening, cartridge headers (Claude AI)
 * Rev     : 2026-07-06 Everyday-life analogy line style (.eco-analogy) (Claude AI)
 * Version : 0.9.0
 *-----------------------------------------------------------------------------
 * Cards, panels, scanner, slots, review, eco card, gallery, dialogs, toasts,
 * forms.
 *---------------------------------------------------------------------------*/

/* =====================================================================
 * components.css — reusable building blocks.
 *
 * Phase A: hero, section-card grid, panel, buttons, pills, stepper,
 *          more-menu, info-toggle, coming-soon, page-head, helpers.
 * Phase B: scanner viewport, slot rows, chips, warn-banner, dialogs,
 *          subject-banner, final prompt, dimension bars, review panel,
 *          generic toast.
 * ===================================================================== */

/* ── Hero (home page) ─────────────────────────────────────────────── */
.hero {
    text-align: center;
    margin: var(--space-md) 0 var(--space-xl);
}

/* ── Partner / supporter logos (home bottom + about top) ───────────── */
.partners {
    margin: var(--space-xl) 0 var(--space-sm);
    text-align: center;
}
.partners__label {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin: 0 0 var(--space-sm);
}
.partners__logos {
    /* A white card so the logos (white-background JPG) sit cleanly on the
       cream page; width/height attributes reserve the ratio (no layout shift). */
    display: block;
    width: 100%;
    max-width: 900px;
    height: auto;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}
.hero__kicker {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue);
}
.hero__title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--blue-900);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin: var(--space-xs) 0 var(--space-sm);
}
.hero__subtitle {
    font-size: var(--font-size-base);
    color: var(--text-light);
    margin: 0 0 var(--space-sm);
}
.hero__meta {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-top: var(--space-sm);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 4px; }
.hero__link { margin-top: var(--space-xs); font-size: var(--font-size-sm); }
.hero__link a { font-weight: 600; }

/* ── Underline tabs (Matériel AV pattern — e.g. the About agenda) ─── */
.tabs {
    display: flex;
    gap: var(--space-lg);
    border-bottom: 1px solid var(--border);
    margin: 0 0 var(--space-md);
}
.tabs__tab {
    border: 0;
    background: none;
    font: inherit;
    font-weight: 700;
    color: var(--text-light);
    padding: 6px 2px 10px;
    margin-bottom: -1px;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.tabs__tab:hover { color: var(--blue-900); }
.tabs__tab.is-active {
    color: var(--blue-900);
    border-bottom-color: var(--blue);
}

/* ── Rich-text bodies (data-i18n-html) that want REAL lists ─────────
   The global reset in style.css strips list styling app-wide; .prose
   restores proper bullets/numbers for content blocks that need them
   (class selector beats the element reset regardless of file order). */
.prose ul,
.prose ol {
    list-style: disc;
    padding-left: 1.4rem;
    margin: var(--space-xs) 0 var(--space-md);
}
.prose ol { list-style: decimal; }
.prose li { margin: 2px 0; }
/* In running text a link must LOOK like a link (the app-wide default
   strips underlines — fine for buttons and cards, not for prose). */
.prose a { text-decoration: underline; }

/* ── Guardian refusal message (moderation) ────────────────────────── */
.msg-blocked {
    color: var(--error, #C62828);
    font-weight: 600;
}

/* ── What's-new announcement card (home) ──────────────────────────── */
.whatsnew {
    max-width: 900px;
    margin: 0 auto var(--space-xl);
    padding: var(--space-md) var(--space-lg);
    background: var(--green-50);
    border: 1px solid var(--border);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: left;
}
.whatsnew__title {
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--green-900);
    margin: 0 0 var(--space-sm);
}
.whatsnew__list {
    /* Emoji lead each line — no extra bullets needed. */
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--ink);
}
.whatsnew__link {
    margin: 0;
    font-size: var(--font-size-sm);
}
.whatsnew__link a { color: var(--green-900); font-weight: 600; }

/* ── Section cards (home + Learn tile grids) ──────────────────────── */
.section-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
@media (min-width: 1024px) {
    .section-cards { grid-template-columns: repeat(4, 1fr); }
}

.section-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    cursor: pointer;
}
.section-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.section-card__image {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
}
.section-card__body { padding: var(--space-md); }
.section-card__title {
    margin: 0 0 4px;
    font-size: var(--font-size-base);
    font-weight: 800;
    color: var(--blue-900);
}
.section-card__desc {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
    line-height: 1.4;
}

.section-card--compose  .section-card__image { background: var(--blue-50);   color: var(--blue);   }
.section-card--create   .section-card__image { background: var(--green-50);  color: var(--green);  }
.section-card--learn    .section-card__image { background: var(--orange-50); color: var(--orange); }
.section-card--corpus   .section-card__image { background: var(--red-50);    color: var(--red);    } /* SimLab */
.section-card--more     .section-card__image { background: var(--purple-50); color: var(--purple); }

/* ── Generic panel ────────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}
.panel__title {
    margin: 0 0 4px;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.panel__desc {
    margin: 0 0 var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
.panel--scan      { border-left: 4px solid var(--blue);   }
.panel--assemble  { border-left: 4px solid var(--green);  }
.panel--evaluate  { border-left: 4px solid var(--orange); }

/* ── Page header (small breadcrumb-y title above panels) ──────────── */
.page-head { margin: var(--space-sm) 0 var(--space-md); }
.page-head__title {
    margin: 0 0 4px;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--blue-900);
    letter-spacing: -0.3px;
}
.page-head__subtitle {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

/* ── Stepper (3-step horizontal indicator) ───────────────────────── */
.stepper {
    display: flex;
    gap: var(--space-sm);
    margin: 0 0 var(--space-md);
    padding: var(--space-sm) 0;
    list-style: none;
    /* Sticky below the fixed header so it's reachable at all times. */
    position: sticky;
    top: var(--header-height);
    z-index: 900;                 /* under the header (--z-header: 1000) */
    background: var(--bg);
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.15);
}
/* When jumping to a section, leave room for the fixed header + sticky stepper. */
.panel,
#send-container { scroll-margin-top: calc(var(--header-height) + 64px); }

/* ── Collapsible cards (open/close shutters) ──────────────────────── */
.js-collapse-toggle { cursor: pointer; user-select: none; }
.panel--collapsible > .panel__title.js-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 0;
}
.panel--collapsible:not(.panel--collapsed) > .panel__title.js-collapse-toggle {
    margin-bottom: var(--space-md);    /* restore spacing above the body */
}
.panel__chevron {
    flex: 0 0 auto;
    color: var(--text-light);
    transition: transform var(--transition-fast);
}
.panel--collapsible:not(.panel--collapsed) .panel__chevron {
    transform: rotate(90deg);          /* ▸ → ▾ when open */
}
.panel--collapsed > :not(.js-collapse-keep) { display: none !important; }
.stepper__item {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-light);
    background: var(--gray-50);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-xs);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.stepper__item:hover {
    background: var(--blue-50);
    color: var(--blue);
}
.stepper__item--active {
    background: var(--blue-50);
    color: var(--blue);
    border-color: var(--blue);
}
.stepper__item--done {
    background: var(--green-50);
    color: var(--green);
}

/* ── Info toggle (collapsible "rules" block) ──────────────────────── */
.info-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-light);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: var(--space-md);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.info-toggle:hover {
    background: var(--blue-50);
    border-color: var(--blue);
    color: var(--blue);
}
.info-body {
    background: var(--blue-50);
    border: 1px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--blue-900);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--blue);
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:hover   { filter: brightness(1.05); }
.btn:active  { transform: translateY(1px); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }

/* An <a> styled as a button ("✎ Modifier dans le Composer"): unlike a
   native <button> it is inline with an underline — normalise the box so
   both elements render identically. */
a.btn {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    line-height: normal;
}

.btn--secondary { background: var(--bg-card); color: var(--blue); }
.btn--ghost     { background: transparent; color: var(--text-light); border-color: var(--border); }
.btn--danger    { background: var(--red); border-color: var(--red); }

/* ── Pills ───────────────────────────────────────────────────────── */
.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
}
.pill--ok     { background: var(--green-50);  color: var(--green);  }
.pill--info   { background: var(--blue-50);   color: var(--blue);   }
.pill--warn   { background: var(--orange-50); color: var(--orange); }
.pill--accent { background: var(--purple-50); color: var(--purple); }

/* ── More menu (full-screen drawer from the footer "⋯" tab) ──────── */
.more-menu {
    position: fixed;
    inset: 0;
    /* Above the footer bar (--z-footer) so the sheet's lower items are
       never hidden behind it; still below toasts. */
    z-index: var(--z-drawer);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 36, 56, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.more-menu.open { opacity: 1; pointer-events: auto; }
.more-menu__sheet {
    width: 100%;
    max-width: 760px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}
.more-menu.open .more-menu__sheet { transform: translateY(0); }
.more-menu__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}
.more-menu__title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.more-menu__close {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: var(--font-size-base);
    font-weight: 700;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}
.more-menu__close:hover { color: var(--blue-900); background: var(--gray-50); }
.more-menu__items {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}
@media (min-width: 600px) { .more-menu__items { grid-template-columns: repeat(2, 1fr); } }
.more-menu__item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.more-menu__item:hover {
    background: var(--blue-50);
    border-color: var(--blue);
    text-decoration: none;
}
.more-menu__icon {
    flex: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--purple-50);
    color: var(--purple);
    font-size: 1.3rem;
}
.more-menu__text { display: flex; flex-direction: column; min-width: 0; }
.more-menu__label {
    font-weight: 800;
    color: var(--blue-900);
    font-size: var(--font-size-base);
}
.more-menu__desc {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    line-height: 1.3;
}

/* ── Coming-soon stub ─────────────────────────────────────────────── */
.coming-soon {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}
.coming-soon__icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
}
.coming-soon__title {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--blue-900);
}
.coming-soon__body {
    margin: 0 auto;
    max-width: 420px;
    color: var(--text-light);
}

/* =====================================================================
 * Phase B — Compose workshop UI
 * ===================================================================== */

/* ── Warn banner (locked 3-second warning above the scanner) ─────── */
.warn-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--red-50);
    color: var(--red);
    border: 2px solid var(--red);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.warn-banner__icon { font-size: 1.25rem; flex: none; }

/* ── Subject banner (shown above the 7 slots once a subject is set) */
.subject-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    background: var(--green-50);
    color: var(--green-900);
    border: 1.5px solid var(--green);
    font-weight: 700;
    font-size: var(--font-size-sm);
}

/* ── Card-active banner (below the scanner, tinted by family colour) */
.card-active-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--blue);
    background: var(--blue-50);
    color: var(--blue-900);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.card-active-banner.hide                { display: none; }
.card-active-banner--blue   { border-color: var(--blue);   background: var(--blue-50);   color: var(--blue-900);   }
.card-active-banner--green  { border-color: var(--green);  background: var(--green-50);  color: var(--green-900);  }
.card-active-banner--orange { border-color: var(--orange); background: var(--orange-50); color: var(--orange-900); }
.card-active-banner--purple { border-color: var(--purple); background: var(--purple-50); color: var(--purple-900); }

/* ── Scanner ──────────────────────────────────────────────────────── */
.scanner__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 60vh;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #1a1a18;
}
.scanner__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.scanner__cam-off {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: #cfcdc4;
    font-size: var(--font-size-sm);
    font-weight: 700;
}
.scanner__cam-icon { font-size: 2rem; opacity: 0.7; }
.scanner__viewfinder {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.scanner__frame {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    border: 2.5px solid rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.30);
}
.scanner__hint {
    /* Moved to the top so it clears the shutter button at the bottom centre. */
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    color: #fff;
    font-size: var(--font-size-xs);
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    max-width: 80%;
    text-align: center;
}

/* Manual-capture shutter button — overlaid on the live preview, bottom centre.
   One tap decodes a single frame (see QRScanner._captureAndScan). */
.scanner__capture {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: var(--primary, #185FA5);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    z-index: 4;
    transition: transform 0.08s ease, background 0.15s ease;
}
.scanner__capture:hover { background: var(--primary-dark, #042C53); }
.scanner__capture:active { transform: translateX(-50%) scale(0.93); }
.scanner__capture:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}
.scanner__capture--busy {
    opacity: 0.6;
    cursor: progress;
}
.scanner__capture-icon { display: block; }
.scanner__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: #fff;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.55);
}
.scanner__badge--ok { background: rgba(35, 80, 10, 0.7); }
.scanner__badge-icon { font-size: 0.95rem; color: #8a8a86; }
.scanner__badge--ok .scanner__badge-icon { color: #7ED957; }
.scanner__lang-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: rgba(83, 74, 183, 0.85);
}
.scanner__toast {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: #fff;
    font-size: var(--font-size-xl);
    font-weight: 800;
    padding: 16px 28px;
    border-radius: var(--radius-md);
    opacity: 0;
    pointer-events: none;
    background: rgba(57, 109, 17, 0.94);
}
.scanner__toast--deja   { background: rgba(95, 94, 90, 0.92); }
.scanner__toast--alerte { background: rgba(163, 45, 45, 0.94); }
.scanner__toast--info   { background: rgba(57, 109, 17, 0.94); }
.scanner__toast-icon    { font-size: 1.4rem; }
@keyframes scanner-toast-pop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    7%   { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    14%  {            transform: translate(-50%, -50%) scale(1); }
    88%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.scanner__toast.show { animation: scanner-toast-pop 2.5s ease-out forwards; }

.scanner__controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.scanner__controls .btn { flex: 1 1 auto; min-width: 120px; }
.scanner__status {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-style: italic;
}

/* ── Slots & chips ────────────────────────────────────────────────── */
.slots {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.slot {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    background: var(--gray-50);
}
.slot--filled { border-style: solid; }
.slot__letter {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--font-size-xl);
}
.slot__body { flex: 1; min-width: 0; }
.slot__name {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.slot__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.slot__empty {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    font-style: italic;
    margin-top: 2px;
}
.slot__hint {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-top: 1px;
}
.slot__hint-ex { font-style: italic; opacity: 0.85; }   /* short example, to the right */
.slot__touch {
    width: 100%;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    margin-top: 6px;
    resize: vertical;          /* it's a <textarea> now */
    min-height: 2.6em;
    line-height: 1.4;
}
.slot__touch:focus {
    outline: none;
    border-style: solid;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-50);
}
.slot__touch::placeholder { color: var(--text-light); font-style: italic; }

/* Family colour variants */
.slot--blue   .slot__letter { background: var(--blue-50);   color: var(--blue);   }
.slot--blue.slot--filled    { border-color: var(--blue);   }
.slot--blue   .slot__name   { color: var(--blue);   }

.slot--green  .slot__letter { background: var(--green-50);  color: var(--green);  }
.slot--green.slot--filled   { border-color: var(--green);  }
.slot--green  .slot__name   { color: var(--green);  }

.slot--orange .slot__letter { background: var(--orange-50); color: var(--orange); }
.slot--orange.slot--filled  { border-color: var(--orange); }
.slot--orange .slot__name   { color: var(--orange); }

.slot--purple .slot__letter { background: var(--purple-50); color: var(--purple); }
.slot--purple.slot--filled  { border-color: var(--purple); }
.slot--purple .slot__name   { color: var(--purple); }

/* Flash animation when a fresh strip lands. */
@keyframes slot-flash-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(24, 95, 165, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(24, 95, 165, 0); }
    100% { box-shadow: 0 0 0 0   rgba(24, 95, 165, 0); }
}
.slot--flash { animation: slot-flash-pulse 1.1s ease-out 2; }

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px 4px 3px 11px;
    font-size: var(--font-size-sm);
}
.chip__text { color: var(--text); }
.chip__remove {
    flex: none;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--gray-50);
    color: var(--text-light);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 0;
}
.chip__remove:hover { background: var(--red-50); color: var(--red); }

/* ── Per-card personal touch (typed or dictated) ──────────────────── */
/* A discreet complement to the scanned strips: the dashed input signals
   "optional add-on", the small mic offers voice dictation. */
.slot__touch-wrap { margin-top: 6px; }
.slot__touch-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.slot__touch-row .slot__touch { flex: 1; margin-top: 0; }   /* override stand-alone margin */

/* Small, low-emphasis mic so the strips stay the visual focus. */
.slot__mic {
    flex: 0 0 auto;
    width: 34px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.95rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.slot__mic:hover { border-color: var(--blue); color: var(--text); }
.slot__mic--on {
    background: var(--red);
    border-color: var(--red);
    border-style: solid;
    color: #fff;
    animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); }
}
.slot__touch-hint {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    min-height: 0;
}
.slot__touch-hint--on:not(:empty),
.slot__touch-hint--err:not(:empty) { margin-top: 3px; }
.slot__touch-hint--on  { color: var(--red); }
.slot__touch-hint--err { color: var(--red); }

/* ── Final prompt block ───────────────────────────────────────────── */
.final-prompt {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--blue-50);
    border: 1.5px solid var(--blue);
    font-size: var(--font-size-base);
    color: var(--blue-900);
    min-height: 48px;
    line-height: 1.6;
}
.final-prompt__placeholder { color: var(--text-light); font-style: italic; }

/* Structured, sectioned layout — one tinted heading + text per component. */
.final-prompt--structured { padding: var(--space-sm) var(--space-md); }
.final-prompt__section {
    padding: 6px 0 8px var(--space-md);
    border-left: 3px solid var(--gray-border, var(--border));
}
.final-prompt__section + .final-prompt__section { margin-top: var(--space-sm); }
.final-prompt__section--blue   { border-left-color: var(--blue);   }
.final-prompt__section--green  { border-left-color: var(--green);  }
.final-prompt__section--orange { border-left-color: var(--orange); }
.final-prompt__section--purple { border-left-color: var(--purple); }
.final-prompt__h {
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 2px;
    color: var(--blue-900);
}
.final-prompt__section--green  .final-prompt__h { color: var(--green); }
.final-prompt__section--orange .final-prompt__h { color: var(--orange); }
.final-prompt__section--purple .final-prompt__h { color: var(--purple); }
.final-prompt__t {
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* "Reset all" row */
.reset-row { margin-top: var(--space-sm); }
.reset-row .btn { width: 100%; }

/* Inline confirmation — replaces a native confirm() popup, in place. */
.confirm-inline {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--red);
    border-radius: var(--radius-md);
    background: var(--red-50);
}
.confirm-inline__q {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text);
    white-space: pre-line;       /* honour the line break in the warning */
}
.confirm-inline__actions {
    display: flex;
    gap: var(--space-sm);
}
.confirm-inline__actions .btn {
    flex: 1 1 auto;
    width: auto;                 /* override .reset-row .btn { width: 100% } */
}

/* ── Dialogs (Consent + Resume + future) ─────────────────────────── */
.dialog {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.45);
}
.dialog__card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.dialog__title {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.dialog__question {
    margin: 0 0 var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text);
    line-height: 1.5;
}
.dialog__buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.dialog__buttons .btn { flex: 1 1 auto; }

/* ── Dimension bars (review panel) ────────────────────────────────── */
.dims { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-md); }
.dim-row__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: var(--font-size-xs);
    margin-bottom: 4px;
}
.dim-row__name { font-weight: 700; }
.dim-row__val  { font-weight: 800; }
.dim-row__bar {
    height: 13px;
    background: var(--border);
    border-radius: 7px;
    overflow: hidden;
}
.dim-row__bar > div {
    height: 100%;
    width: 0%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Global score number ──────────────────────────────────────────── */
.score-global {
    text-align: center;
    margin-bottom: var(--space-md);
}
.score-global__value {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
}
.score-global__label {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Review block ─────────────────────────────────────────────────── */
.review {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--blue-50);
    border: 1.5px solid var(--blue);
}
.review__head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 800;
    color: var(--blue-900);
    margin-bottom: var(--space-sm);
}
.review__title { font-weight: 800; }
.review__source { margin-left: auto; }
.review__body { font-size: var(--font-size-sm); color: var(--text); line-height: 1.6; }
.review__body ul { margin: var(--space-sm) 0 0 var(--space-md); }
.review__body li { margin-bottom: 4px; }
.review__placeholder { color: var(--text-light); font-style: italic; }

/* Model "ideal prompt" example at the end of the analysis. */
.review__example {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-left: 3px solid var(--purple);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}
.review__example-title {
    font-weight: 700;
    color: var(--purple);
    margin-bottom: 4px;
}
.review__example-body {
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--text);
}

/* ── Generic top-of-screen toast (Toast.js — non-scanner contexts) ─ */
.toast {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    z-index: var(--z-toast);
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    background: var(--blue-900);
    color: #fff;
    font-size: var(--font-size-sm);
    font-weight: 700;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal);
    pointer-events: none;
}
.toast.show     { transform: translateX(-50%) translateY(0); }
.toast--ok      { background: var(--green-900); }
.toast--error   { background: var(--red); }
.toast--info    { background: var(--blue-900); }

/* ── Forms (Contact page) ─────────────────────────────────────────── */
.contact-form { display: flex; flex-direction: column; gap: var(--space-sm); }
.form-label {
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--blue-900);
}
.form-input, .form-textarea {
    font: inherit;
    font-size: var(--font-size-sm);
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
}
.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-50);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint {
    margin: 4px 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.form-counter {
    text-align: right;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-top: 2px;
}
.form-banner {
    margin-top: var(--space-md);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
}
.form-banner.hide    { display: none; }
.form-banner--ok     { background: var(--green-50); color: var(--green-900); border: 1.5px solid var(--green); }
.form-banner--error  { background: var(--red-50);   color: var(--red);       border: 1.5px solid var(--red);   }

/* Pill button group (radio-group look) */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-btn {
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-light);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.pill-btn:hover { background: var(--blue-50); color: var(--blue); border-color: var(--blue); }
.pill-btn--active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.pill-btn--active:hover { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }

/* ── Create section (image generation) ───────────────────────────── */
.cmp-fields {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.cmp-field {
    padding-left: var(--space-sm);
    border-left: 4px solid var(--gray-border);
}
.cmp-field--blue   { border-left-color: var(--blue);   }
.cmp-field--green  { border-left-color: var(--green);  }
.cmp-field--orange { border-left-color: var(--orange); }
.cmp-field--purple { border-left-color: var(--purple); }
.cmp-field__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 4px;
}
.cmp-field__name {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text);
}
.cmp-field__row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.cmp-field__input {
    flex: 1;
    width: 100%;
    font: inherit;
    font-size: var(--font-size-base);
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    resize: vertical;
    min-height: 2.6em;
    line-height: 1.4;
}
.cmp-field__input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

.prompt-preview {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-style: italic;
    color: var(--text);
    min-height: 2.5em;
}
.prompt-preview--empty { color: var(--text-light); }

.gen-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}
.gen-quota {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-light);
}
.gen-status {
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-light);
    min-height: 1.2em;
}
.gen-figure {
    margin: var(--space-md) 0 0;
    text-align: center;
}
.gen-image {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    background: var(--gray-50);
}
.gen-caption {
    margin-top: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

/* Discreet facilitator-only quota reset. */
.gen-reset {
    margin-top: var(--space-md);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.gen-reset__link {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.6;
}
.gen-reset__link:hover { opacity: 1; }
.gen-reset__form {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}
.gen-reset__input {
    width: 9em;
    letter-spacing: 0.3em;
    text-align: center;
}
.gen-reset__ok { padding: 4px 12px; font-size: var(--font-size-sm); }
.gen-reset__msg {
    font-size: var(--font-size-xs);
    color: var(--red);
}
.gen-reset__msg--ok { color: var(--green); }

/* ── Estimated environmental footprint card (Compose) ─────────────── */
.eco-card { border-left: 4px solid var(--green); }
.eco-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.eco-card__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
}
.eco-help-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-light);
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.eco-help-btn:hover { border-color: var(--green); color: var(--green); }

.eco-table {
    width: 100%;
    margin-top: var(--space-md);
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
.eco-table th,
.eco-table td {
    padding: 6px 4px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.eco-table thead th {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.eco-table tbody th {
    text-align: left;
    font-weight: 600;
    color: var(--text);
}
.eco-table thead th:first-child,
.eco-table tbody th { white-space: normal; }
.eco-table__total th,
.eco-table__total td {
    border-top: 1.5px solid var(--border);
    font-weight: 700;
    color: var(--green);
}
.eco-caption {
    margin-top: 4px;
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}
/* Everyday-life analogy — the last block of the eco card. Slightly more
   visible than the caption: these are the lines participants should
   remember. One example per line; the examples indent under the intro. */
.eco-analogy {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-sm);
    color: var(--text);
}
.eco-analogy > div + div {
    margin-top: 2px;
    padding-left: var(--space-md);
}

/* ── Survey (workshop evaluation) ──────────────────────────────────── */
.rating-q { margin-bottom: var(--space-md); }
.rating-q__label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}
.rating-row {
    display: flex;
    gap: var(--space-sm);
}
.rating-btn {
    width: 52px;
    height: 52px;
    font-size: 1.55rem;
    line-height: 1;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast),
                background var(--transition-fast);
}
.rating-btn:hover { border-color: var(--primary); }
.rating-btn[aria-checked="true"] {
    border-color: var(--primary);
    background: var(--blue-50);
    transform: scale(1.12);
}
.rating-scale {
    margin: calc(-1 * var(--space-xs)) 0 var(--space-md);
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}
.survey-workshop { max-width: 220px; }
.survey-thanks__msg {
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
}
@media (max-width: 380px) {
    .rating-btn { width: 44px; height: 44px; font-size: 1.3rem; }
}

/* ── Learn articles — small decorative illustrations ──────────────── */
/* Language-neutral inline SVGs (numbers, letters and symbols only), so
   one image serves FR/EN/DE/IT. Colors come from the design tokens. */
.learn-illu {
    margin: 0 auto var(--space-md);
    max-width: 420px;
}
.learn-illu--wide { max-width: 560px; }
.learn-illu svg   { display: block; width: 100%; height: auto; }

.eco-help {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    border: 1px solid var(--border);
    font-size: var(--font-size-sm);
    color: var(--text);
    line-height: 1.5;
}
.eco-help__intro { margin: 0 0 var(--space-sm); }
.eco-help__subtitle {
    font-weight: 700;
    margin-top: var(--space-sm);
    margin-bottom: 4px;
}
.eco-help__values,
.eco-help__sources {
    margin: 0;
    padding-left: 1.2em;
}
.eco-help__values li,
.eco-help__sources li { margin: 2px 0; }
.eco-help__sources a { color: var(--blue); word-break: break-word; }
.eco-help__caveat {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}

/* ── "Send your prompt to the AI" card (Compose) ──────────────────── */
.send-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}
.send-answer {
    margin-top: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    overflow: hidden;
}
.send-answer__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--space-sm) var(--space-md);
    background: var(--blue-50);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--blue-900);
}
.send-answer__body {
    padding: var(--space-md);
    line-height: 1.55;
    color: var(--text);
    /* Was pre-wrap for raw text; the answer is now rendered Markdown, so the
       block elements handle spacing (code blocks keep their own pre-wrap). */
    max-height: 360px;
    overflow-y: auto;
    overflow-wrap: anywhere;
}

/* ── Rendered Markdown (AI answers) — safe vanilla renderer output ──── */
.md-p { margin: 0 0 var(--space-sm); }
.md-p:last-child { margin-bottom: 0; }
.md-h {
    margin: var(--space-md) 0 var(--space-xs);
    line-height: 1.25;
    color: var(--blue-900);
}
.md-h:first-child { margin-top: 0; }
.md-ul, .md-ol { margin: 0 0 var(--space-sm); padding-left: 1.4em; }
.md-ul li, .md-ol li { margin: 2px 0; }
.md-quote {
    margin: 0 0 var(--space-sm);
    padding: 2px 0 2px var(--space-md);
    border-left: 3px solid var(--gray-border);
    color: var(--text-light);
}
.md-hr { border: 0; border-top: 1px solid var(--gray-border); margin: var(--space-md) 0; }
.send-answer__body code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.92em;
}
.md-pre {
    margin: 0 0 var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--blue-900);
    color: #EDE9E1;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
}
.md-pre code { background: none; padding: 0; color: inherit; }
.send-answer__body a { color: var(--blue); }

/* Inline consent mini-form (replaces the modal) — appears by the trigger. */
.inline-consent {
    flex-basis: 100%;            /* take its own line inside a flex button row */
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-md);
    background: var(--blue-50);
}
.inline-consent__q {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text);
}
/* Optional AI-provider chooser inside the consent form (Swiss default). */
.inline-consent__choice {
    margin: 0 0 var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.inline-consent__choice-title {
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
}
.inline-consent__option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    border: 1.5px solid var(--gray-200, #d7dde5);
    border-radius: var(--radius-md);
    background: var(--white, #fff);
    font-size: var(--font-size-sm);
    cursor: pointer;
}
.inline-consent__option input { margin-top: 2px; flex: 0 0 auto; }
.inline-consent__option:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-50);
}

/* Always-visible AI selector (rendered only when root enables the choice). */
.provider-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: var(--space-sm) 0;
}
.provider-select__title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text);
}
.provider-select__option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    border: 1.5px solid var(--gray-200, #d7dde5);
    border-radius: var(--radius-md);
    background: var(--white, #fff);
    font-size: var(--font-size-sm);
    cursor: pointer;
}
.provider-select__option input { margin-top: 2px; flex: 0 0 auto; }
.provider-select__option:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-50);
}

/* Dropdown variant (07.09): one compact line — label + native <select>;
   phones open their own picker instead of a tall radio list. */
.provider-select--dropdown {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.provider-select__select {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    font: inherit;
    font-size: var(--font-size-sm);
    padding: 6px 10px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
}
.provider-select__select:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* Danger variant — destructive confirmations (delete, deactivate). */
.inline-consent--danger {
    border-color: var(--red, #b91c1c);
    background: var(--red-50, #fef2f2);
}

.inline-consent__actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.inline-consent__actions .btn { flex: 1 1 auto; width: auto; }

/* ── Save image to gallery (Create) ──────────────────────────────── */
.gallery-save {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border: 1.5px solid var(--green);
    border-radius: var(--radius-md);
    background: var(--green-50, var(--gray-50));
}
.gallery-save__title { margin: 0 0 4px; font-size: var(--font-size-base); color: var(--text); }
.gallery-save__desc  { margin: 0 0 var(--space-sm); font-size: var(--font-size-sm); color: var(--text-light); }
.gallery-save__row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}
.gallery-save__row .form-input { flex: 1 1 12em; }
.gallery-save__select { flex: 0 0 auto; }
.gallery-save__msg { font-size: var(--font-size-sm); color: var(--text-light); }
.gallery-save__msg--ok  { color: var(--green); font-weight: 600; }
.gallery-save__msg--err { color: var(--red); }

/* ── Stage gallery page ──────────────────────────────────────────── */
.gallery-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}
.gallery-bar__group { display: inline-flex; align-items: center; gap: var(--space-sm); }
.gallery-bar__count { font-size: var(--font-size-sm); color: var(--text-light); margin-left: auto; }
.gallery-empty { color: var(--text-light); font-style: italic; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
}
.gallery-card {
    position: relative;          /* anchor for the delete button + confirm overlay */
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.gallery-card:hover, .gallery-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    outline: none;
}
.gallery-card__img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery-card__cap {
    padding: 6px 8px;
    font-size: var(--font-size-xs);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Moderation: delete button + inline confirm overlay. */
.gallery-card__del {
    position: absolute;
    top: 6px; right: 6px;
    width: 30px; height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.gallery-card:hover .gallery-card__del,
.gallery-card:focus-within .gallery-card__del { opacity: 1; }
.gallery-card__del:hover { background: var(--red); }

/* The "view prompt" corner button — same treatment, opposite corner. */
.gallery-card__prompt {
    position: absolute;
    top: 6px; left: 6px;
    width: 30px; height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.gallery-card:hover .gallery-card__prompt,
.gallery-card:focus-within .gallery-card__prompt { opacity: 1; }
.gallery-card__prompt:hover { background: var(--blue); }

/* Projection tiles: same bubble, faintly visible so the presenter can
   find it on stage (the projection hides the mouse cursor otherwise). */
.proj-card__prompt {
    position: absolute;
    top: 6px; left: 6px;
    width: 34px; height: 34px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;           /* overrides the projection's cursor:none */
    opacity: 0.35;
    transition: opacity 0.12s;
}
.proj-card:hover .proj-card__prompt { opacity: 1; }
.proj-card__prompt:hover { background: var(--blue); }

/* ── Prompt lightbox: the generation recipe behind a resource ──────── */
.prompt-box {
    position: fixed;
    inset: 0;
    /* Above the slideshow (z 2000) AND the projection (z 2100): the
       prompt must be readable from inside both stage surfaces. */
    z-index: 2200;
    cursor: auto;              /* the projection hides the cursor — not here */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: rgba(15, 36, 56, 0.55);
}
.prompt-box__card {
    width: 100%;
    max-width: 640px;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-lg);
}
.prompt-box__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.prompt-box__title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.prompt-box__meta {
    margin: 4px 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
.prompt-box__text {
    flex: 1;
    overflow: auto;
    margin: 0 0 var(--space-md);
    padding: var(--space-md);
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;              /* the prompt is prose, not code */
    font-size: var(--font-size-sm);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.prompt-box__actions { display: flex; justify-content: flex-end; }
.gallery-card__confirm {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: var(--font-size-sm);
}
.gallery-card__confirm-actions { display: flex; gap: var(--space-sm); }
.gallery-card__confirm-actions .btn { width: auto; }

/* Full-screen slideshow overlay */
.slideshow {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-md);
}
.slideshow__figure { margin: 0; text-align: center; max-height: 80vh; }
.slideshow__img {
    max-width: 92vw;
    max-height: 74vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.slideshow__cap { margin-top: var(--space-sm); color: #fff; font-size: var(--font-size-lg, 1.1rem); }
.slideshow__nav { display: flex; gap: var(--space-md); align-items: center; }
.slideshow__btn {
    font-size: 1.6rem;
    line-height: 1;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}
.slideshow__btn:hover { background: rgba(255, 255, 255, 0.22); }
.slideshow__close {
    position: absolute;
    top: var(--space-md); right: var(--space-md);
    width: 44px; height: 44px;
    font-size: 1.6rem; line-height: 1;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}
/* Projection mode: a full-screen grid of all the workshop's images. */
.projection {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: #000;
    cursor: none;
    padding: 10px;
}
.projection__grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 10px;
    grid-template-columns: repeat(var(--cols, 4), 1fr);
    grid-auto-rows: 1fr;
}
.proj-card {
    position: relative;
    min-width: 0;
    min-height: 0;
}
/* Code productions are playable from the projection: the pointer comes
   back over their tiles (the projection hides it elsewhere). */
.proj-card--playable { cursor: pointer; }
.projection__player {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: #000;
    cursor: default;
}
.projection__player-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}
.projection__player-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 11;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.projection__player-close:hover { background: rgba(0, 0, 0, 0.8); }
.proj-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.proj-card__cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 14px 8px 6px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: clamp(0.6rem, 1.3vw, 1.05rem);
    line-height: 1.25;
}
.proj-card__who {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.proj-card__subj {
    opacity: 0.92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Controls row (rules toggle + export button) ───────────────────── */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.controls-row .info-toggle {
    flex-shrink: 0;
}

.controls-row .btn {
    flex-shrink: 0;
}

/* ── Save indicator ─────────────────────────────────────────────────── */
.save-indicator {
    position: fixed;
    top: 72px;
    right: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: var(--z-toast);
}

.save-indicator--saving {
    opacity: 1;
    color: var(--blue);
}

.save-indicator--saved {
    opacity: 1;
    color: var(--green-900);
}

.save-indicator--idle {
    opacity: 0;
}

/* =====================================================================
 * Mobile responsiveness — small-screen polish (phones)
 *
 * The base styles above are mobile-first; these tweaks tighten spacing,
 * stop iOS Safari from zooming when a form control gains focus (any
 * control under 16px triggers it), and keep dense UI within the viewport.
 * ===================================================================== */
@media (max-width: 599px) {
    /* iOS focus-zoom guard: every text-entry control must be ≥16px. */
    input, select, textarea { font-size: 16px; }
    .form-input, .form-textarea, .slot__touch, .cmp-field__input,
    .gen-reset__input, .gallery-save__select { font-size: 16px; }

    /* Panels reclaim horizontal room on narrow screens. */
    .panel { padding: var(--space-md); }

    /* Hero spacing tightens; the title size is handled by the fluid 3xl token. */
    .hero { margin: var(--space-sm) 0 var(--space-lg); }

    /* Section-card tiles: keep two columns, but more compact. */
    .section-cards { gap: var(--space-sm); }
    .section-card__image { height: 84px; font-size: 2rem; }
    .section-card__body { padding: var(--space-sm) var(--space-md); }

    /* Eco footprint table shrinks so its numeric columns fit. */
    .eco-table { font-size: var(--font-size-xs); }
    .eco-table th, .eco-table td { padding: 5px 3px; }

    /* Gallery: two tiles per row on phones (was 1 at the 180px min). */
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

    /* Modals use a little less padding so the card takes the width. */
    .dialog { padding: var(--space-md); }

    /* Slideshow controls stay comfortable on small screens. */
    .slideshow__btn { width: 46px; height: 46px; font-size: 1.4rem; }
    .slideshow__close { width: 40px; height: 40px; }
}

/* Very small phones (≤360px): keep the 6-tab footer + header legible. */
@media (max-width: 360px) {
    .app-footer__item  { padding: var(--space-xs) 0; gap: 1px; }
    .app-footer__icon  { font-size: 1.05rem; }
    .app-footer__label { font-size: 0.55rem; max-width: 52px; }
    /* Free a little header room for the brand. */
    .lang-pill { min-width: 32px; padding: 5px 7px; }
}

/* ── Generic helpers ─────────────────────────────────────────────── */
.hide { display: none !important; }
.center-text { text-align: center; }

/* ── Guide page (instructions for use): assistant + PDF documents ──
 * Mobile-first; the ≥768px block widens the working surfaces. The
 * desktop shell (app-shell.css) already handles the page frame. */
.guide-scope {
    background: var(--blue-50);
    border: 1px solid var(--blue);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--blue-900);
}

.guide-chat {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin: var(--space-md) 0;
    min-height: 180px;
    max-height: 55vh;
    overflow-y: auto;
    padding: var(--space-xs);
}
.guide-msg {
    max-width: 88%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
}
.guide-msg p { margin: 0 0 0.4em; }
.guide-msg p:last-child { margin-bottom: 0; }
.guide-msg--user {
    align-self: flex-end;
    background: var(--blue);
    color: #fff;
    border-bottom-right-radius: var(--radius-sm);
}
.guide-msg--ai {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--gray-border);
    border-bottom-left-radius: var(--radius-sm);
}

.guide-sources {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: center;
    align-self: flex-start;
    max-width: 95%;
}
.guide-sources__label {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.guide-sources__chip {
    font-size: var(--font-size-xs);
    background: var(--purple-50);
    color: var(--purple);
    border: 1px solid var(--purple);
    border-radius: var(--radius-pill);
    padding: 1px 8px;
}

.guide-ask {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}
.guide-ask__input { flex: 1 1 auto; resize: none; }
.guide-ask__btn   { flex: 0 0 auto; }

/* ── the PDF document tree ── */
.guide-doc {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: flex-start;
    justify-content: space-between;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: var(--space-sm) var(--space-md);
    margin: var(--space-sm) 0;
}
.guide-doc--big {
    border-color: var(--blue);
    background: var(--blue-50);
}
.guide-doc__info  { flex: 1 1 16rem; min-width: 0; }
.guide-doc__title { font-weight: bold; color: var(--blue-900); }
.guide-doc__desc  {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-top: 2px;
}
.guide-doc__actions {
    display: flex;
    gap: var(--space-xs);
    flex: 0 0 auto;
}
.guide-doc__actions .btn {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    white-space: nowrap;
}
.guide-doc__chapters { margin-top: var(--space-xs); }
.guide-doc__chapters summary {
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--blue);
}
.guide-doc__chapters ul {
    margin: var(--space-xs) 0 0;
    padding-left: 1.4em;
    font-size: var(--font-size-sm);
    color: var(--text);
}
.guide-doc__chapters li { margin: 2px 0; }

/* comfortable reading on tablets and desktops */
@media (min-width: 768px) {
    .guide-chat { max-height: 48vh; }
    .guide-msg  { max-width: 75%; }
}

/* the guide assistant's mic: same .slot__mic look, stacked above the
   Ask button and twice the size, for one-thumb dictation on a phone */
.guide-ask__side {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    flex: 0 0 auto;
    align-self: stretch;
    justify-content: flex-end;
}
.guide-ask__mic {
    width: 100%;
    height: 68px;
    font-size: 1.9rem;
}

/* the PDF tab's edition chooser: every language one tap away */
.guide-doclangs {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-bottom: var(--space-sm);
}
.guide-doclangs__label {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-right: var(--space-xs);
}

/* ── Cadre pédagogique (Composer step 1 — SimLab increment ②) ─────── */
/* The frame form: objective, skills with Bloom chips, plan/assessment/
   scenario. Mobile-first; chips wrap on narrow screens. */

.cadre-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-lg);
}
.cadre-block__label {
    font-weight: 700;
    color: var(--text);
}
.cadre-block__optional {
    font-weight: 400;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-left: var(--space-sm);
}
.cadre-block__hint {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
.cadre-block__area {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    padding: var(--space-sm);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    resize: vertical;
}
.cadre-block__area:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

.cadre-skills {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.cadre-skills__add { align-self: flex-start; }

.cadre-skill {
    border: 1px solid var(--gray-border);
    border-left: 4px solid var(--green);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.cadre-skill__top {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}
.cadre-skill__input {
    flex: 1;
    min-width: 0;
    font: inherit;
    padding: var(--space-sm);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    resize: vertical;          /* the skill field is a textarea (06.09) */
    box-sizing: border-box;
}
.cadre-skill__input:focus {
    outline: 2px solid var(--green);
    outline-offset: 1px;
}
.cadre-skill__remove {
    border: none;
    background: var(--red-50);
    color: var(--red);
    font-size: var(--font-size-lg);
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
}
.cadre-skill__blooms {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}
.cadre-bloom {
    font: inherit;
    font-size: var(--font-size-xs);
    padding: 3px 10px;
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-light);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.cadre-bloom--on {
    background: var(--green-50);
    border-color: var(--green);
    color: var(--green);
    font-weight: 700;
}

.cadre-gate {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--red);
}
.cadre-gate--ok { color: var(--green); }

/* Label row: the field label on the left, its tools (🎤 ✨) on the right. */
.cadre-block__labelrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.cadre-block__tools {
    display: flex;
    gap: var(--space-xs);
    align-items: stretch;
}
.cadre-block__tools .slot__mic { height: 30px; }
.cadre-block__required {
    font-weight: 400;
    font-size: var(--font-size-xs);
    color: var(--red);
    margin-left: var(--space-sm);
}

/* Inline Bloom definition (no popup — appears under the chips, 8 s). */
.cadre-bloom-def {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    background: var(--gray-50);
    border-left: 3px solid var(--green);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: var(--space-xs) var(--space-sm);
}

/* ✨ per-field AI drafting help (DraftAssist.js) — mirrors the mic look. */
.draft-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 30px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.draft-btn:hover:not(:disabled) { border-color: var(--purple); }
.draft-btn:disabled { cursor: wait; opacity: 0.7; }
/* Labelled variant (Copier, Actualiser…): the fixed 34px icon square
   wraps icon and label onto two lines — this one sizes to its text. */
.draft-btn--label {
    width: auto;
    height: auto;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border-style: solid;
    border-width: 1px;
    font-size: var(--font-size-xs);
    line-height: 1.4;
}
.draft-btn--label:hover:not(:disabled) {
    border-color: var(--blue);
    background: var(--blue-50);
}
.draft-btn--busy { border-style: solid; border-color: var(--purple); }

/* Generic working animation, shown at the action trigger while an AI
   request runs (06.09 note n°2). Reusable by any button. */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--purple-50);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
    vertical-align: middle;
}
@keyframes spinner-rotate { to { transform: rotate(360deg); } }

/* Rendered-Markdown children inside the suggestion box and the preview:
   compact spacing so short texts stay tight. */
.draft-suggest__text .md-p,
.pslot-preview__text .md-p    { margin: 0 0 4px; }
.draft-suggest__text .md-ul, .draft-suggest__text .md-ol,
.pslot-preview__text .md-ul, .pslot-preview__text .md-ol { margin: 0 0 4px; padding-left: 18px; }
.draft-suggest__text .md-h,
.pslot-preview__text .md-h    { margin: 4px 0 2px; font-size: var(--font-size-sm); }
.draft-suggest__text > :last-child,
.pslot-preview__text > :last-child { margin-bottom: 0; }

.draft-suggest {
    margin-top: var(--space-xs);
    border: 1px solid var(--purple);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    background: var(--purple-50);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}
.draft-suggest__label {
    margin: 0;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--purple);
}
.draft-suggest__text {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text);
    /* content is rendered Markdown now — no pre-wrap (block joins would
       show as blank lines) */
}
.draft-suggest__actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.draft-suggest--note,
.draft-suggest--error {
    font-size: var(--font-size-sm);
}
.draft-suggest--error {
    border-color: var(--red);
    background: var(--red-50);
    color: var(--red);
}

/* ── Composer tabs + Prompt step (increment ③) ─────────────────────── */
/* One panel visible at a time — [hidden] must win over the panel's own
   display, whatever it is. */
.panel[hidden] { display: none !important; }

.panel-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}
.panel-nav .btn:only-child { margin-left: auto; }

.pseed {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}
.pseed__hint {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.pseed__note {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--green);
}

/* One R-C-T-F-T-C-E part: letter badge + name + tools, hint, textarea. */
.pslot {
    border: 1px solid var(--gray-border);
    border-left: 4px solid var(--gray);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}
.pslot__head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.pslot__letter {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: #fff;
    background: var(--gray);
}
.pslot__name { font-weight: 700; flex: 1; }
.pslot__help {
    margin: 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.pslot--blue   { border-left-color: var(--blue);   } .pslot--blue   .pslot__letter { background: var(--blue);   }
.pslot--green  { border-left-color: var(--green);  } .pslot--green  .pslot__letter { background: var(--green);  }
.pslot--orange { border-left-color: var(--orange); } .pslot--orange .pslot__letter { background: var(--orange); }
.pslot--purple { border-left-color: var(--purple); } .pslot--purple .pslot__letter { background: var(--purple); }

/* Assembled-prompt preview: the tinted sections, read-only. */
.pslot-preview {
    border: 1px dashed var(--gray-border);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    padding: var(--space-sm);
    margin: var(--space-md) 0;
}
.pslot-preview__title {
    margin: 0 0 var(--space-xs);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.pslot-preview__label {
    margin: var(--space-xs) 0 0;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pslot-preview__label--blue   { color: var(--blue);   }
.pslot-preview__label--green  { color: var(--green);  }
.pslot-preview__label--orange { color: var(--orange); }
.pslot-preview__label--purple { color: var(--purple); }
.pslot-preview__text {
    margin: 0;
    font-size: var(--font-size-sm);
    /* rendered Markdown — see the md-* compact rules below */
}
.pslot-preview__empty {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
.pslot-preview--field { margin: var(--space-xs) 0 0; }

/* ── The prompt stack — Simple / Structuré / Complet (increment ④) ─── */
.stackview__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}
.stackview__head .pslot-preview__title { margin: 0; }
.stackview__hint {
    margin: 0 0 var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.stackview__toolrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin: var(--space-xs) 0;
}
.stackview__chars {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    white-space: nowrap;
}
.stackview__provider { font-size: var(--font-size-sm); font-weight: 600; }
.stackview__stale {
    font-size: var(--font-size-xs);
    color: var(--orange);
    font-weight: 600;
}
.stack-plain {
    margin: 0;
    padding: var(--space-sm);
    background: var(--bg-card);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    font-size: var(--font-size-xs);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 340px;
    overflow-y: auto;
}
.stack-layer {
    background: var(--bg-card);
    border: 1px solid var(--gray-border);
    border-left: 4px solid var(--gray-border);
    border-radius: var(--radius-sm);
    padding: 0 var(--space-sm);
    margin: var(--space-xs) 0;
}
.stack-layer--blue   { border-left-color: var(--blue);   }
.stack-layer--green  { border-left-color: var(--green);  }
.stack-layer--orange { border-left-color: var(--orange); }
.stack-layer--purple { border-left-color: var(--purple); }
.stack-layer--red    { border-left-color: var(--red);    }
.stack-layer--gray   { border-left-color: var(--text-light); }
.stack-layer__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) 0;
    cursor: pointer;
    list-style: none;
}
.stack-layer__summary::-webkit-details-marker { display: none; }
.stack-layer__summary::before {
    content: '▸';
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.stack-layer[open] > .stack-layer__summary::before { content: '▾'; }
.stack-layer__num {
    flex: 0 0 auto;
    width: 1.35rem;
    height: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gray-50);
    font-size: var(--font-size-xs);
    font-weight: 700;
}
.stack-layer__name { font-weight: 700; font-size: var(--font-size-sm); }
.stack-layer__badges {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-left: auto;
}
.stack-layer__badge { font-size: 0.66rem; }
.stack-layer__sub {
    margin: 0 0 var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.stack-layer__text {
    margin: 0;
    padding: var(--space-xs);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--font-size-xs);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}
.stack-layer__text--code {
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.stack-honesty {
    margin: var(--space-sm) 0 0;
    padding: var(--space-xs) var(--space-sm);
    border-left: 3px solid var(--text-light);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

/* ── Générateur (increment ⑤): spec summary, runs list, provider tag ── */
.gen-spec {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    padding: var(--space-sm);
}
.gen-spec__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    align-items: baseline;
}
.gen-spec__label {
    flex: 0 0 auto;
    min-width: 9rem;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
}
.gen-spec__value {
    flex: 1 1 12rem;
    font-size: var(--font-size-sm);
    word-break: break-word;
}
.gen-spec__chips {
    flex: 1 1 12rem;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
}
.gen-spec__actions { margin: var(--space-sm) 0 0; }

.code-result__provider {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    white-space: nowrap;
}

.runs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.runs-list__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    padding: 6px var(--space-sm);
}
.runs-list__time {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
}
.runs-list__provider { font-size: var(--font-size-sm); font-weight: 600; }
.runs-list__meta {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    margin-left: auto;
}
.runs-list__view { padding: 2px 10px; font-size: var(--font-size-xs); }

/* ── Corpus (increment ⑥): filter, card grid, player detail ─────────── */
.corpus-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}
.corpus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--space-sm);
}
.corpus-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: var(--space-sm);
    border: 1px solid var(--gray-border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.corpus-card:hover { border-color: var(--blue); }
.corpus-card:active { transform: translateY(1px); }
.corpus-card__title {
    font-weight: 700;
    font-size: var(--font-size-sm);
    word-break: break-word;
}
.corpus-card__by {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.corpus-card__meta {
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.corpus-detail__head { margin-bottom: var(--space-sm); }
.corpus-detail__head .panel__title { margin-bottom: 2px; }
.corpus-detail__meta {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
#corpus-back { margin-bottom: var(--space-sm); }
.corpus-prompt {
    padding: var(--space-sm);
    border-top: 1px solid var(--gray-border);
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* ── Composer head row + Plan de leçon tab (increment ③c) ──────────── */
.page-head__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.page-head__clear { flex: 0 0 auto; }

.planbar {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
    margin-bottom: var(--space-xs);
}
.planbar__btn {
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 700;
    min-width: 34px;
    height: 30px;
    padding: 0 8px;
    border: 1.5px solid var(--gray-border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    cursor: pointer;
}
.planbar__btn:hover { border-color: var(--blue); }
.planbar__btn[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-50); }

.plan-editor {
    font-family: ui-monospace, Consolas, monospace;
    font-size: var(--font-size-sm);
    line-height: 1.5;
}
.plan-preview { margin-top: var(--space-sm); }
.plan-downloads {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}

/* Reference-URL rows (Prompt tab) — input + remove, one per line. */
.plink {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}
.plink__input { resize: none; }

/* Rendered-Markdown tables (lesson plan, previews): bordered, compact,
   scrolling horizontally inside their wrapper when too wide. */
.md-tablewrap { overflow-x: auto; margin: var(--space-xs) 0; }
.md-table {
    border-collapse: collapse;
    font-size: var(--font-size-sm);
    min-width: 50%;
}
.md-table th,
.md-table td {
    border: 1px solid var(--gray-border);
    padding: 4px 10px;
    text-align: left;
    vertical-align: top;
}
.md-table th {
    background: var(--gray-50);
    font-weight: 700;
}

/* "n / max" character counters under capped fields (07.09 request):
   the HTML maxlength stop is silent — this makes it visible. */
.charcount {
    align-self: flex-end;
    font-size: 0.66rem;              /* deliberately below --font-size-xs:
                                        the counter informs, never competes */
    color: var(--text-light);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.charcount--warn { color: var(--red); font-weight: 700; }
.cadre-skill .charcount { text-align: right; }

/* Panel title row: title left, action buttons right (Plan tab exports). */
.panel__titlerow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.panel__titlerow .panel__title { margin: 0; }
