/*
 * Docteur Froid — thème applicatif.
 * Tokens et composants extraits STRICTEMENT de prototype/index.html (référence UI de la Phase 1).
 */

:root {
    --ink: #18181b;
    --white: #ffffff;
    --warm-gray: #71717a;
    --light-gray: #e4e4e7;
    --whisper: #f4f4f5;
    --accent: #fc5f2b;
    --accent-soft: #feaf95;
    --accent-tint: #fff1ec;
    --sky: #42a5f5;
    /* Phase 6 — sémantique confiance/prudence (badges curaté vs IA, SC-1) */
    --trust: #2e7d32;
    --trust-tint: #e9f5ec;
    --caution: #b45309;
    --caution-tint: #fdf3e0;
    --radius-card: 16px;
    --radius-pill: 9999px;
    --shadow-card: 0 2px 8px rgba(24, 24, 27, 0.06);
    --shadow-lift: 0 14px 30px rgba(24, 24, 27, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--white);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.01em;
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px 80px;
    position: relative;
}

/* NAV */
nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    z-index: 50;
}

.logo {
    font-weight: 800;
    font-size: 19px;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    text-decoration: none;
}

.logo .flake {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 4px;
}

/* BUTTONS */
.btn-primary,
.btn-ghost,
.btn-link {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    padding: 13px 22px;
    letter-spacing: -0.01em;
    border-radius: var(--radius-pill);
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:active,
.btn-ghost:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--accent);
    color: var(--white);
}

.btn-primary:hover {
    box-shadow: 0 10px 24px rgba(252, 95, 43, 0.35);
    transform: translateY(-2px);
}

.btn-ghost {
    background: var(--white);
    color: var(--ink);
    border: 1px solid var(--light-gray);
}

.btn-ghost:hover {
    border-color: var(--ink);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
}

.btn-link {
    background: transparent;
    color: var(--warm-gray);
    padding: 8px 14px;
    border-radius: 8px;
}

.btn-link:hover {
    color: var(--ink);
    background: var(--whisper);
}

/* HERO */
.hero-wrap {
    padding-top: 16px;
}

.eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 16px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.eyebrow .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

h1.display {
    font-size: 50px;
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -1.4px;
    margin: 0 0 20px;
    color: var(--ink);
}

.subtext {
    font-size: 17px;
    line-height: 1.55;
    color: var(--warm-gray);
    max-width: 480px;
    margin: 0 0 32px;
    font-weight: 400;
}

.cta-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.stat-row {
    display: flex;
    gap: 48px;
    margin-top: 8px;
    padding-top: 32px;
    border-top: 1px solid var(--light-gray);
    flex-wrap: wrap;
}

.stat .num {
    font-size: 30px;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.stat .label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--warm-gray);
    text-transform: uppercase;
    margin-top: 4px;
}

/* CARDS */
.option-card,
.result-card {
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.option-card {
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

.option-card:hover {
    border-color: #c9c9cd;
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
}

.result-card {
    padding: 32px;
    margin-bottom: 24px;
}

/* SEARCH / FORM FIELDS */
.search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.search-box input,
input[type="text"],
input[type="email"],
input[type="password"] {
    flex: 1;
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    padding: 14px 18px;
    border-radius: var(--radius-pill);
    font-weight: 400;
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    width: 100%;
}

.search-box input::placeholder,
input::placeholder {
    color: var(--warm-gray);
}

.search-box input:focus,
input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-tint);
}

footer {
    text-align: center;
    color: var(--warm-gray);
    font-size: 12px;
    font-family: 'Space Mono', monospace;
    padding: 40px 0 0;
}

/* AUTH (inscription / connexion / tableau de bord) */
.auth-card {
    max-width: 440px;
    margin: 40px auto 0;
    padding: 40px 36px;
}

.auth-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 8px;
    color: var(--ink);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.field-hint {
    font-size: 12px;
    color: var(--warm-gray);
    margin: 0;
}

.form-errors {
    background: #fdf2f0;
    border: 1px solid #f3c6be;
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-error {
    font-size: 13px;
    color: #c0392b;
    margin: 0;
    font-weight: 500;
}

.auth-submit {
    width: 100%;
    text-align: center;
    margin-top: 4px;
}

.auth-switch {
    margin-top: 24px;
    font-size: 14px;
    color: var(--warm-gray);
    text-align: center;
}

.dashboard-placeholders {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
}

.dashboard-item {
    background: var(--whisper);
    border-radius: var(--radius-card);
    padding: 16px 18px;
    font-size: 14px;
    color: var(--warm-gray);
}

/* BADGES (extrait de prototype/index.html) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    letter-spacing: 0.04em;
    font-weight: 700;
}

.badge-high {
    background: var(--accent-tint);
    color: var(--accent);
}

/* Pastille ambre « Simulation » du back-office (tokens caution existants). */
.badge-warn {
    background: var(--caution-tint);
    color: var(--caution);
}

/* Badges de source (Phase 6, SC-1) : curaté (manuel, confiance) vs IA (prudence).
   La distinction n'est JAMAIS la couleur seule : libellé texte + icône aria-hidden. */
.source-badge {
    margin: 0 0 10px;
}

.source-badge-manual {
    background: var(--trust-tint);
    color: var(--trust);
}

.source-badge-ai {
    background: var(--caution-tint);
    color: var(--caution);
}

/* QUOTA IA (ACCT-04) — badge header + carte dashboard */
.quota-badge {
    align-self: center;
    margin-right: 8px;
}

.quota-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.quota-details {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--ink);
}

.quota-note {
    margin: 4px 0 0;
    font-size: 13px;
}

/* PLANS (choix de formule — ACCT-03) */
.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.plan-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px 22px;
    text-align: left;
    cursor: default;
}

.plan-card .body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.plan-card .title {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
}

.plan-card .plan-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.plan-card .desc {
    font-size: 13px;
    color: var(--warm-gray);
    font-weight: 400;
}

.plan-submit {
    width: 100%;
    text-align: center;
}

/* Bandeau "paiement en mode démo" — admin/dev uniquement (Pitfall 3) */
.demo-banner {
    background: var(--accent-tint);
    border: 1px solid var(--accent-soft);
    color: var(--accent);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-radius: var(--radius-card);
    padding: 10px 16px;
    margin: 16px 0;
    text-align: center;
}

.account-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.flash-success {
    background: #eefaf1;
    border: 1px solid #b7e4c7;
    color: #1e7d3c;
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================================
 * PARCOURS GUIDÉ (GUIDE-01→05) — classes portées de prototype/index.html,
 * STRICTEMENT à partir des tokens existants (aucun nouveau thème).
 * ============================================================ */

/* Écrans */
.screen {
    display: none;
    padding-top: 40px;
}

.screen.visible {
    display: block;
    animation: fade 0.3s ease;
}

@keyframes fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Progression */
.progress-track {
    height: 5px;
    background: var(--whisper);
    border-radius: 4px;
    margin-bottom: 32px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-soft), var(--accent));
    background-size: 200% 100%;
    animation: shimmerMove 2s linear infinite;
    transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 4px;
}

@keyframes shimmerMove {
    0% { background-position: 0% 0; }
    100% { background-position: 200% 0; }
}

.step-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--warm-gray);
    text-transform: uppercase;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}

.question {
    font-size: 29px;
    font-weight: 700;
    letter-spacing: -0.6px;
    margin: 0 0 32px;
    line-height: 1.2;
    color: var(--ink);
}

.question-help {
    font-size: 14px;
    line-height: 1.55;
    color: var(--warm-gray);
    margin: -20px 0 32px;
    font-weight: 400;
}

/* Grille appareils (GUIDE-01) */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 32px;
}

.option-card .body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.option-card .title {
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.option-card .desc {
    font-size: 13px;
    color: var(--warm-gray);
    font-weight: 400;
}

.option-card {
    position: relative;
}

.option-card.selected {
    border-color: var(--accent);
    background: var(--accent-tint);
}

.option-card.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.option-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-card);
    border-color: var(--light-gray);
}

.soon-badge {
    margin-top: 6px;
    background: var(--whisper);
    color: var(--warm-gray);
}

.check-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    transform: scale(0);
    opacity: 0;
}

.option-card.selected .check-badge {
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes popIn {
    0% { transform: scale(0) rotate(-20deg); opacity: 0; }
    60% { transform: scale(1.2) rotate(6deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Liste symptômes (GUIDE-02) */
.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.option-row {
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 18px 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.option-row:hover {
    border-color: #c9c9cd;
    transform: translateX(4px);
}

.option-row.selected {
    border-color: var(--accent);
    background: var(--accent-tint);
}

.option-row .title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}

.option-row .arrow {
    color: var(--accent);
    font-weight: 700;
    transition: transform 0.2s ease;
}

.option-row:hover .arrow {
    transform: translateX(4px);
}

/* Questions Oui/Non (GUIDE-03) */
.yn-row {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.yn-btn {
    flex: 1;
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    box-shadow: var(--shadow-card);
    padding: 20px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    border-radius: var(--radius-card);
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease, background 0.15s ease;
}

.yn-btn:hover {
    border-color: #c9c9cd;
    transform: translateY(-3px);
}

.yn-btn.selected {
    border-color: var(--accent);
    background: var(--accent-tint);
    animation: wiggle 0.35s ease;
}

@keyframes wiggle {
    0%, 100% { transform: translateY(-2px) rotate(0); }
    25% { transform: translateY(-2px) rotate(-1.5deg); }
    75% { transform: translateY(-2px) rotate(1.5deg); }
}

.nav-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.btn-primary:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Résultat (GUIDE-04/05) */
.result-icon {
    font-size: 40px;
    display: inline-block;
    margin-bottom: 8px;
    animation: iconSpin 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iconSpin {
    0% { transform: scale(0) rotate(-90deg); opacity: 0; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.result-card h2 {
    font-size: 25px;
    margin: 16px 0 8px;
    letter-spacing: -0.3px;
    font-weight: 800;
}

.result-card .meta {
    color: var(--warm-gray);
    font-size: 14px;
    margin-bottom: 24px;
    font-weight: 400;
}

.steps {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    counter-reset: step;
}

.steps li {
    counter-increment: step;
    padding: 14px 0 14px 44px;
    position: relative;
    border-bottom: 1px solid var(--whisper);
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.5;
    color: #2c2c30;
    opacity: 0;
    transform: translateX(-12px);
    animation: slideIn 0.4s ease forwards;
}

.steps li:nth-child(1) { animation-delay: 0.05s; }
.steps li:nth-child(2) { animation-delay: 0.15s; }
.steps li:nth-child(3) { animation-delay: 0.25s; }
.steps li:nth-child(4) { animation-delay: 0.35s; }
.steps li:nth-child(5) { animation-delay: 0.45s; }

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
}

.steps li:last-child {
    border-bottom: none;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 12px;
    width: 26px;
    height: 26px;
    background: var(--accent);
    color: var(--white);
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.source-ref {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
    border-top: 1px solid var(--whisper);
    padding-top: 16px;
}

.source-ref .tag {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

/* Page du manuel citée (résultat guidé) — bouton repliable + figure lazy-load */
.btn-manual-page {
    margin-top: 14px;
    background: var(--whisper);
    color: var(--ink);
    border: 1px solid var(--light-gray);
}

.btn-manual-page:hover {
    background: var(--accent-tint);
    border-color: var(--accent-soft);
}

.manual-page-figure {
    margin: 14px 0 0;
    padding: 8px;
    background: var(--whisper);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius-card);
}

.manual-page-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

.result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.diagnostic-error {
    margin: 0 0 24px;
}

/* Guide d'installation PWA (APP-01) — encart discret, tokens existants */
.install-hint {
    margin-top: 40px;
    padding: 16px 20px;
    background: var(--whisper);
    border: 1px solid var(--light-gray);
    border-radius: var(--radius-card);
    font-size: 13px;
    color: var(--warm-gray);
    line-height: 1.55;
}

.install-hint-title {
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 6px;
    font-size: 13px;
}

.install-hint-row {
    margin: 4px 0;
}

.install-hint-row strong {
    color: var(--ink);
    font-weight: 600;
}

/* MOBILE-FIRST */
@media (max-width: 600px) {
    h1.display {
        font-size: 34px;
    }

    .stat-row {
        gap: 24px;
    }
}

/* ============================================================
 * TABLETTE ATELIER (APP-02) — divergence EXCLUSIVEMENT CSS :
 * même DOM/vue que le mobile, réorganisé à partir de 1024px
 * (les tablettes en portrait gardent le layout mobile).
 * - Deux colonnes : parcours à gauche, panneau résultat PERSISTANT
 *   à droite dès qu'un résultat est affiché — pendant « Ce n'était
 *   pas ça », la question reste à gauche, le résultat reste à droite.
 * - Cibles tactiles généreuses (>= 44px effectifs, nettement plus
 *   grandes qu'en mobile), typo et espacements élargis.
 * :has() est supporté par tous les navigateurs cibles (Safari 15.4+,
 * Chrome 105+) — cf. 02-RESEARCH, pas de fallback JS nécessaire.
 * ============================================================ */
@media (min-width: 1024px) {
    /* Conteneur élargi uniquement sur la page du parcours */
    .app:has(#diagnostic-app) {
        max-width: 1240px;
    }

    /* Grille atelier : une seule zone par défaut, deux colonnes dès
       qu'un résultat existe dans l'état de traversée (écran résultat rendu) */
    #diagnostic-app {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        column-gap: 56px;
        align-items: start;
    }

    #diagnostic-app .screen {
        grid-column: 1 / -1;
        max-width: 760px;
        margin: 0 auto;
        width: 100%;
    }

    /* Panneau résultat persistant : quand le résultat est affiché, la
       DERNIÈRE QUESTION reste visible à gauche (même markup, simplement
       ré-affiché en CSS) et la carte résultat se range à droite, sticky.
       « Ce n'était pas ça » / « Retour » se rejouent alors côte à côte. */
    #diagnostic-app:has(#screen-result.visible) #screen-question {
        display: block;
        grid-column: 1;
        grid-row: 1;
        max-width: none;
        margin: 0;
    }

    #diagnostic-app:has(#screen-result.visible) #screen-result {
        grid-column: 2;
        grid-row: 1;
        max-width: none;
        margin: 0;
        position: sticky;
        top: 88px; /* sous la nav sticky */
        align-self: start;
    }

    /* Typo / espacements atelier */
    #diagnostic-app .question {
        font-size: 34px;
    }

    #diagnostic-app .question-help {
        font-size: 15px;
    }

    #diagnostic-app .card-grid {
        gap: 20px;
    }

    /* Cibles tactiles >= 44px effectifs — nettement plus grandes qu'en mobile */
    #diagnostic-app .yn-btn {
        min-height: 76px;
        padding: 26px 24px;
        font-size: 18px;
    }

    #diagnostic-app .option-row {
        min-height: 64px;
        padding: 22px 28px;
    }

    #diagnostic-app .option-row .title {
        font-size: 17px;
    }

    #diagnostic-app .option-card .body {
        padding: 22px 24px;
        gap: 6px;
    }

    #diagnostic-app .option-card .title {
        font-size: 18px;
    }

    #diagnostic-app .option-card .desc {
        font-size: 14px;
    }

    #diagnostic-app .btn-primary,
    #diagnostic-app .btn-ghost {
        min-height: 52px;
        padding: 15px 30px;
        font-size: 16px;
    }

    #diagnostic-app .btn-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* BANDEAU CONNECTIVITÉ HONNÊTE (02-04) — rempli par offline-banner.js à
   partir de la dernière synchro réussie (jamais navigator.onLine seul).
   Discret, non bloquant, tokens existants uniquement. */
.connectivity-banner {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 60;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lift);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

.connectivity-banner.is-offline {
    background: var(--ink);
    color: var(--white);
}

.connectivity-banner.is-synced {
    background: var(--accent-tint);
    color: var(--accent);
    border: 1px solid var(--accent-soft);
}

/* ============================================================
 * RECHERCHE LIBRE (SEARCH-01..04, 03-04) — effet « thinking » et
 * conteneurs d'états portés de prototype/index.html, STRICTEMENT
 * à partir des tokens existants (aucun nouveau thème).
 * ============================================================ */

.search-page {
    padding-top: 40px;
}

.search-page textarea {
    width: 100%;
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-page textarea::placeholder {
    color: var(--warm-gray);
}

.search-page textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-tint);
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}

.quota-reminder {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
    margin: 0 0 24px;
}

/* Effet de chargement IA « thinking » (prototype) */
.thinking {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 20px 4px;
    color: var(--warm-gray);
    font-size: 14px;
    font-family: 'Space Mono', monospace;
}

.thinking.active {
    display: flex;
}

.dot-flash {
    display: flex;
    gap: 5px;
}

.dot-flash span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: dotFlash 1s infinite ease-in-out;
}

.dot-flash span:nth-child(2) { animation-delay: 0.15s; }
.dot-flash span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotFlash {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* Réponse IA : answer reformulée + sources + quota */
.ai-answer {
    display: none;
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 28px;
}

.ai-answer.visible {
    display: block;
    animation: fade 0.4s ease;
}

.ai-answer .tag-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ai-answer p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ink);
    margin: 0 0 16px;
}

.cite {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    border: 1px solid var(--accent-soft);
    background: var(--accent-tint);
    padding: 4px 10px;
    display: inline-block;
    border-radius: 8px;
    font-weight: 700;
    opacity: 0;
    transform: scale(0.7);
    animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cite:nth-child(2) { animation-delay: 0.15s; }
.cite:nth-child(3) { animation-delay: 0.3s; }

.search-answer-quota {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    color: var(--warm-gray);
}

.ai-answer p.search-answer-quota {
    margin: 0;
    font-size: 12px;
    color: var(--warm-gray);
}

/* États honnêtes : quota épuisé / rate limit / aucun résultat / erreur / hors-ligne */
.search-state {
    background: var(--whisper);
    border-radius: var(--radius-card);
    padding: 20px 22px;
    animation: fade 0.3s ease;
}

.search-state p {
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink);
    font-weight: 500;
    margin: 0;
}

.search-state .btn-ghost {
    margin-top: 14px;
}

/* ============================================================
 * ANALYSE PHOTO (VISION-01..03, 04-03) — formulaire appareil/zone/photo,
 * préview (= blob envoyé) et rappel prudence. Réutilise thinking /
 * ai-answer / search-state, STRICTEMENT à partir des tokens existants
 * (aucun nouveau thème).
 * ============================================================ */

.photo-page select,
.photo-page textarea {
    width: 100%;
    background: var(--white);
    border: 1.5px solid var(--light-gray);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.photo-page select:focus,
.photo-page textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-tint);
}

.photo-page input[type="file"] {
    width: 100%;
    background: var(--white);
    border: 1.5px dashed var(--light-gray);
    color: var(--warm-gray);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-card);
    cursor: pointer;
}

.photo-page input[type="file"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-tint);
}

/* Préview = l'image redimensionnée qui part réellement au serveur */
.photo-preview {
    display: block;
    max-width: 100%;
    max-height: 320px;
    margin-top: 12px;
    border-radius: var(--radius-card);
    border: 1.5px solid var(--light-gray);
    box-shadow: var(--shadow-card);
}

/* Rappel prudent SYSTÉMATIQUE — jamais masqué par photo.js */
.prudence-note {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    color: var(--accent);
    background: var(--accent-tint);
    border: 1px solid var(--accent-soft);
    border-radius: var(--radius-card);
    padding: 12px 16px;
    margin: 0 0 20px;
}

/* ============================================================
   Curation admin (05-03) — sobre, tokens existants uniquement.
   Écrans réservés au rôle admin (jamais cachés par le SW : /admin
   est dans NETWORK_ONLY_PREFIXES, caches v4).
   ============================================================ */

.admin-page {
    max-width: 1100px;
}

/* Filtres de la file de travail : rangée compacte */
.admin-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 16px;
    margin: 16px 0 24px;
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-card);
    background: var(--whisper);
}

.admin-filters .form-group {
    margin: 0;
}

.admin-filters select,
.admin-filters input[type="number"] {
    padding: 8px 12px;
    border: 1.5px solid var(--light-gray);
    border-radius: 8px;
    background: var(--white);
    font: inherit;
}

/* Liste des chunks : lignes cliquables + actions rapides */
.admin-chunk-list .dashboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-chunk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-chunk-actions form {
    display: inline-flex;
    gap: 8px;
}

.admin-chunk-actions .btn-ghost {
    padding: 6px 14px;
    font-size: 13px;
}

/* Édition : formulaire + image de la page source côte à côte (>= 900px) */
.admin-edit-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

@media (min-width: 900px) {
    .admin-edit-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.admin-edit-form textarea,
.admin-edit-form input[type="text"],
.admin-edit-form select,
.admin-tree-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--light-gray);
    border-radius: 8px;
    background: var(--white);
    font: inherit;
}

.admin-tree-form textarea {
    font-family: 'Space Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
}

/* La page rendue du manuel : collée en haut au scroll, jamais déformée */
.admin-page-image {
    position: sticky;
    top: 16px;
}

.admin-page-image img {
    display: block;
    width: 100%;
    height: auto;
    border: 1.5px solid var(--light-gray);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    background: var(--white);
}

.admin-pagination {
    margin-top: 24px;
}

/* Back-office (comptes / stats / paramètres) — tables compactes lecture seule. */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 16px 0 24px;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1.5px solid var(--whisper);
    vertical-align: middle;
}

.admin-table thead th,
.admin-table tbody th {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--warm-gray);
    font-weight: 700;
}

.admin-note {
    background: var(--whisper);
    border-radius: var(--radius-card);
    padding: 16px 18px;
    font-size: 14px;
    color: var(--warm-gray);
    margin: 24px 0;
}

.admin-tree-list .dashboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
