/* ============================================================================
 * NeonWave IA — vue #aiView (+ fenêtre de clé #aiSetupSheet)
 * Surfaces neutres, filets fins, un seul accent, animations courtes.
 * Les variables --nw-* sont définies dans nw-pro.css (chargée juste après).
 * ========================================================================== */

#aiView.ai-app {
    --ai-bg: #09090c;
    --ai-panel: #111116;
    --ai-field: #0c0c10;
    --ai-col: 820px;
    position: relative; display: flex; flex-direction: column;
    height: var(--ai-h, calc(100vh - 210px)); min-height: 320px;
    color: var(--nw-text, #f4f5f7);
    font-feature-settings: "ss01", "cv11";
}
#aiView.ai-app.hidden { display: none; }
#aiView.ai-app { border-radius: 16px; overflow: hidden; isolation: isolate; padding: 0 18px; }
#aiView.ai-app > :not(.ai-backdrop) { position: relative; z-index: 1; }

/* ── Fond : même aurore animée que la page de connexion (Kawarp + secours CSS) ── */
.ai-backdrop { position: absolute !important; inset: 0; z-index: 0 !important; overflow: hidden; pointer-events: none; background: #04050b; border-radius: inherit; }
.ai-backdrop i { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(110px); opacity: 0.38; animation: aiAurora 22s ease-in-out infinite alternate; }
.ai-backdrop i:nth-child(1) { background: #3f6fe0; left: -18vmax; top: -24vmax; }
.ai-backdrop i:nth-child(2) { background: #5038a0; right: -22vmax; top: 6vh; animation-duration: 28s; animation-delay: -6s; }
.ai-backdrop i:nth-child(3) { background: #1e3264; left: 15vw; bottom: -32vmax; animation-duration: 34s; animation-delay: -12s; }
@keyframes aiAurora { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vw, 4vh) scale(1.12); } 100% { transform: translate(-4vw, 8vh) scale(0.95); } }
.ai-backdrop.has-kawarp i { display: none; }
.ai-backdrop .nw-kawarp { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* voile pour garder le texte lisible sur le fond qui bouge */
.ai-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 4, 10, 0.52), rgba(3, 4, 10, 0.68)); }

/* Les champs ont déjà un état « actif » sur leur conteneur : pas de 2e contour (règle globale de neon-finish) */
#aiView textarea:focus, #aiView textarea:focus-visible,
.ai-sheet input:focus, .ai-sheet input:focus-visible, .ai-sheet select:focus, .ai-sheet select:focus-visible {
    outline: none !important; box-shadow: none !important; border: 0 !important; background: transparent !important;
}

/* Logo NeonWave */
.ai-glyph img, .ai-avatar .ai-logo { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.ai-glyph { overflow: hidden; padding: 0 !important; background: #050816 !important; }
.ai-avatar { overflow: visible; }
.ai-avatar .ai-logo { position: relative; z-index: 1; }

/* ── Plein écran : couvre l'appli, laisse la barre de lecture visible ───── */
#aiView.ai-app.is-fullscreen {
    position: fixed; z-index: 10050; inset: 0 0 var(--ai-fs-bottom, 0px) 0; height: auto; min-height: 0;
    --ai-col: 880px;
    background: #04050b; border-radius: 0;
    padding: 0 24px;
}
#aiView.ai-app.is-morphing { animation: aiMorph 380ms var(--nw-ease-out, ease-out); }
@keyframes aiMorph { from { opacity: 0.4; transform: scale(0.985); } to { opacity: 1; transform: none; } }
body.ai-fullscreen-open .main-content { overflow: hidden !important; }

/* ── Barre du haut ──────────────────────────────────────────────────────── */
.ai-bar {
    flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 0 14px; border-bottom: 1px solid var(--nw-line, rgba(255, 255, 255, 0.08));
}
.is-fullscreen .ai-bar { padding: 16px 0 14px; -webkit-app-region: drag; }
.is-fullscreen .ai-bar button { -webkit-app-region: no-drag; }
.ai-bar-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.ai-glyph {
    width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
    background: #15151c; border: 1px solid var(--nw-line-strong, rgba(255, 255, 255, 0.14));
}
.ai-glyph svg, .ai-avatar svg { width: 16px; height: 16px; fill: #cfd5ff; }
.ai-bar-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-bar-text strong { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

.ai-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--nw-text-2); }
.ai-state i { width: 6px; height: 6px; border-radius: 50%; background: #6b6b76; flex-shrink: 0; }
.ai-state[data-state="ready"] i { background: var(--nw-ok, #4ade80); }
.ai-state[data-state="setup"] i { background: #fbbf24; }
.ai-state[data-state="offline"] i { background: var(--nw-danger, #ff7a85); }
.ai-state[data-state="thinking"] { color: #cfd5ff; }
.ai-state[data-state="thinking"] i { background: var(--nw-accent); animation: aiPulse 1.4s ease-in-out infinite; }
@keyframes aiPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(124, 140, 255, 0.5); } 50% { box-shadow: 0 0 0 4px rgba(124, 140, 255, 0); } }

.ai-bar-actions { display: flex; align-items: center; gap: 6px; }
.ai-tool {
    height: 34px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid var(--nw-line, rgba(255, 255, 255, 0.08)); background: transparent; color: var(--nw-text-2);
    font: 500 13px/1 Inter, "Segoe UI", sans-serif; cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease;
}
.ai-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-tool:hover:not(:disabled) { background: var(--nw-surface-2); color: var(--nw-text); border-color: var(--nw-line-strong); }
.ai-tool:active:not(:disabled) { transform: scale(0.97); }
.ai-tool:disabled { opacity: 0.4; cursor: default; }
.ai-tool:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.ai-tool.is-icon { width: 34px; padding: 0; justify-content: center; }
.ai-tool.is-armed { color: var(--nw-danger); border-color: rgba(255, 122, 133, 0.4); background: rgba(255, 122, 133, 0.06); }
.ai-ico-collapse { display: none; }
.is-fullscreen .ai-ico-expand { display: none; }
.is-fullscreen .ai-ico-collapse { display: block; }

/* ── Zone de conversation ───────────────────────────────────────────────── */
.ai-scroll {
    flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 18px, #000 calc(100% - 18px), transparent 100%);
}
.ai-column { width: 100%; max-width: var(--ai-col); margin: 0 auto; padding: 28px 2px 28px; }

/* Accueil */
.ai-welcome { padding: 6vh 0 8px; animation: aiRise 520ms var(--nw-ease-out, ease-out) both; }
.ai-welcome.hidden { display: none; }
.ai-welcome-title { margin: 0; font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.12; }
.ai-welcome-sub { margin: 10px 0 28px; max-width: 560px; font-size: 15px; line-height: 1.6; color: var(--nw-text-2); }
.ai-suggestions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ai-suggestion {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px; text-align: left; cursor: pointer;
    border-radius: 14px; border: 1px solid var(--nw-line); background: var(--nw-surface); color: inherit;
    font: inherit; animation: aiRise 460ms var(--nw-ease-out, ease-out) both; animation-delay: calc(var(--i, 0) * 45ms + 80ms);
    transition: background 180ms ease, border-color 180ms ease, transform 180ms var(--nw-ease-out, ease-out);
}
.ai-suggestion:hover { background: var(--nw-surface-2); border-color: var(--nw-line-strong); transform: translateY(-2px); }
.ai-suggestion:active { transform: translateY(0) scale(0.99); }
.ai-suggestion:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.ai-suggestion-ico {
    width: 32px; height: 32px; flex-shrink: 0; border-radius: 9px; display: grid; place-items: center;
    background: rgba(255, 255, 255, 0.05); color: #cfd5ff;
}
.ai-i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ai-suggestion-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-suggestion-copy strong { font-size: 14px; font-weight: 600; }
.ai-suggestion-copy span { font-size: 12.5px; line-height: 1.45; color: var(--nw-text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Carte « à configurer » */
.ai-setup {
    display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 22px; padding: 16px 18px;
    border-radius: 14px; border: 1px solid var(--nw-line-strong); background: var(--nw-surface);
    box-shadow: inset 3px 0 0 #fbbf24;
}
.ai-setup.hidden { display: none; }
.ai-setup.is-nudge { animation: aiNudge 480ms ease; }
.ai-setup-copy { display: flex; flex-direction: column; gap: 3px; }
.ai-setup-copy strong { font-size: 14.5px; font-weight: 650; }
.ai-setup-copy span { font-size: 13px; color: var(--nw-text-2); line-height: 1.5; }
@keyframes aiNudge { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Messages */
.ai-thread { display: flex; flex-direction: column; gap: 26px; transition: opacity 200ms ease; }
.ai-thread.is-clearing { opacity: 0; }
.ai-msg { display: flex; gap: 14px; align-items: flex-start; transition: opacity 320ms var(--nw-ease-out, ease-out), transform 320ms var(--nw-ease-out, ease-out); }
.ai-msg.is-entering { opacity: 0; transform: translateY(8px); }
.ai-msg.is-leaving { opacity: 0; transition-duration: 160ms; }
.ai-msg.is-user { justify-content: flex-end; }
.ai-msg.is-user .ai-bubble {
    max-width: min(72%, 560px); padding: 10px 16px; border-radius: 18px 18px 6px 18px;
    background: #1c1c25; border: 1px solid var(--nw-line); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere;
}
.ai-avatar {
    position: relative; width: 30px; height: 30px; flex-shrink: 0; margin-top: 1px; border-radius: 9px;
    display: grid; place-items: center; background: #15151c; border: 1px solid var(--nw-line-strong);
}
.ai-avatar svg { width: 14px; height: 14px; }
.ai-answer { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.ai-text { font-size: 15.5px; line-height: 1.68; color: var(--nw-text); max-width: 680px; overflow-wrap: anywhere; }
.ai-w { display: inline; animation: aiWord 420ms var(--nw-ease-out, ease-out) both; }
@keyframes aiWord { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }

/* Réflexion : le logo respire (halo bleu), un arc lumineux tourne autour, étape + secondes */
.ai-avatar.is-live { border-color: transparent; animation: aiBreath 2.4s ease-in-out infinite; }
.ai-avatar.is-live .ai-logo { animation: aiLogoPulse 2.4s ease-in-out infinite; }
@keyframes aiBreath {
    0%, 100% { box-shadow: 0 0 0 0 rgba(91, 154, 255, 0), 0 0 18px 0 rgba(91, 154, 255, 0.25); }
    50% { box-shadow: 0 0 0 5px rgba(91, 154, 255, 0.10), 0 0 28px 4px rgba(91, 154, 255, 0.45); }
}
@keyframes aiLogoPulse { 0%, 100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(0.94); filter: brightness(1.35); } }
.ai-orbit {
    position: absolute; inset: -3px; border-radius: 12px; padding: 2px; pointer-events: none; z-index: 2;
    background: conic-gradient(from 0deg, transparent 0 50%, rgba(91, 154, 255, 0.2) 62%, #8fb8ff 80%, #ffffff 86%, transparent 92%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
    animation: aiSpin 1.4s linear infinite;
}
@keyframes aiSpin { to { transform: rotate(1turn); } }
.ai-thinking { flex: 1; min-width: 0; padding-top: 4px; display: flex; flex-direction: column; gap: 12px; }
.ai-thinking-row { display: flex; align-items: baseline; gap: 10px; }
.ai-thinking-time { font-size: 12px; color: var(--nw-text-3); font-variant-numeric: tabular-nums; }
.ai-steps { display: flex; gap: 6px; }
.ai-steps:empty { display: none; }
.ai-steps i { width: 18px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); transition: background 300ms ease, width 300ms var(--nw-ease-out, ease-out); }
.ai-steps i.is-done { background: rgba(143, 184, 255, 0.55); }
.ai-steps i.is-active { width: 34px; background: linear-gradient(90deg, #5b9aff, #b9d0ff, #5b9aff); background-size: 200% 100%; animation: aiShimmer 1.2s linear infinite; }
.ai-thinking-label {
    font-size: 14.5px; font-weight: 600; width: fit-content;
    background: linear-gradient(90deg, rgba(244, 245, 247, 0.45) 0%, #f4f5f7 45%, rgba(244, 245, 247, 0.45) 90%);
    background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: aiShimmerText 2.2s linear infinite; transition: opacity 180ms ease, transform 180ms ease;
}
.ai-thinking-label.is-out { opacity: 0; transform: translateY(-4px); }
@keyframes aiShimmerText { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.ai-skeleton { display: flex; flex-direction: column; gap: 9px; max-width: 520px; }
.ai-skeleton i {
    display: block; height: 10px; border-radius: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
    background-size: 200% 100%; animation: aiShimmer 1.6s ease-in-out infinite;
}
.ai-skeleton i:nth-child(1) { width: 92%; }
.ai-skeleton i:nth-child(2) { width: 74%; animation-delay: 120ms; }
.ai-skeleton i:nth-child(3) { width: 48%; animation-delay: 240ms; }
@keyframes aiShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Résultat (sélection de titres) */
.ai-result {
    border-radius: 16px; border: 1px solid var(--nw-line); background: rgba(255, 255, 255, 0.022);
    animation: aiRise 460ms var(--nw-ease-out, ease-out) 120ms both; overflow: hidden;
}
.ai-result-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 14px 16px; border-bottom: 1px solid var(--nw-line);
}
.ai-result-title { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ai-result-title strong { font-size: 16px; font-weight: 650; letter-spacing: -0.015em; }
.ai-result-title span { font-size: 12.5px; color: var(--nw-text-3); }
.ai-result-actions { display: flex; gap: 8px; }
.ai-result .ai-tracks { margin: 0 !important; padding: 14px 16px 16px; }
.ai-result .ai-tracks > * { animation: aiRise 420ms var(--nw-ease-out, ease-out) both; }
.ai-result .ai-tracks > :nth-child(1) { animation-delay: 160ms; } .ai-result .ai-tracks > :nth-child(2) { animation-delay: 195ms; }
.ai-result .ai-tracks > :nth-child(3) { animation-delay: 230ms; } .ai-result .ai-tracks > :nth-child(4) { animation-delay: 265ms; }
.ai-result .ai-tracks > :nth-child(5) { animation-delay: 300ms; } .ai-result .ai-tracks > :nth-child(6) { animation-delay: 335ms; }
.ai-result .ai-tracks > :nth-child(n+7) { animation-delay: 370ms; }
@keyframes aiRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Boutons */
.ai-btn {
    position: relative; height: 36px; padding: 0 14px; border-radius: 10px; display: inline-flex; align-items: center; gap: 8px;
    border: 1px solid transparent; font: 600 13.5px/1 Inter, "Segoe UI", sans-serif; cursor: pointer; white-space: nowrap;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease, opacity 160ms ease;
}
.ai-btn .ai-i { width: 15px; height: 15px; }
.ai-btn:active:not(:disabled) { transform: scale(0.97); }
.ai-btn:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.ai-btn:disabled { opacity: 0.55; cursor: default; }
.ai-btn.is-primary { background: #f4f5f7; color: #0b0d1a; }
.ai-btn.is-primary .ai-i { fill: currentColor; stroke: none; }
.ai-btn.is-primary [data-act] .ai-i, .ai-btn.is-primary .ai-i path[d^="M12 5v14"] { stroke: currentColor; }
.ai-btn.is-primary:hover:not(:disabled) { background: #fff; }
.ai-btn.is-ghost { background: transparent; color: var(--nw-text); border-color: var(--nw-line-strong); }
.ai-btn.is-ghost:hover:not(:disabled) { background: var(--nw-surface-2); }
.ai-btn.is-danger-ghost { background: transparent; color: var(--nw-danger); padding: 0 10px; }
.ai-btn.is-danger-ghost:hover:not(:disabled), .ai-btn.is-danger-ghost.is-armed { background: rgba(255, 122, 133, 0.08); }
.ai-btn.is-loading { pointer-events: none; }
.ai-btn.is-done { background: rgba(74, 222, 128, 0.14) !important; color: #bbf7d0 !important; border-color: rgba(74, 222, 128, 0.3) !important; }
/* icônes « plus » / « coche » en trait */
.ai-btn .ai-i path[d^="M12 5v14"], .ai-btn .ai-i path[d^="m5 12.5"], .ai-btn .ai-i path[d^="M4 12a8"], .ai-btn .ai-i path[d^="M14 5h5"] { fill: none; stroke: currentColor; stroke-width: 2; }

/* Erreur / notice */
.ai-error {
    flex: 1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px;
    padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255, 122, 133, 0.26); background: rgba(255, 122, 133, 0.05);
}
.ai-error-ico { width: 20px; height: 20px; color: var(--nw-danger); }
.ai-error-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-error-copy strong { font-size: 14px; font-weight: 650; }
.ai-error-copy span { font-size: 13px; color: #ffc7cc; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.is-notice { justify-content: center; }
.ai-notice { font-size: 12.5px; color: var(--nw-text-3); padding: 6px 12px; border-radius: 500px; border: 1px solid var(--nw-line); }

/* ── Saisie ─────────────────────────────────────────────────────────────── */
.ai-dock { flex-shrink: 0; padding: 10px 0 2px; }
.is-fullscreen .ai-dock { padding-bottom: 16px; }
.ai-composer {
    max-width: var(--ai-col); margin: 0 auto; display: flex; align-items: flex-end; gap: 10px;
    padding: 7px 7px 7px 16px; border-radius: 18px; background: #121218; border: 1px solid var(--nw-line-strong);
    transition: border-color 180ms ease, box-shadow 180ms ease;
}
.ai-composer:focus-within { border-color: rgba(124, 140, 255, 0.55); box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.12); }
.ai-composer textarea {
    flex: 1; min-height: 38px; max-height: 180px; resize: none; padding: 9px 0 !important; border: 0 !important; outline: none;
    background: transparent !important; box-shadow: none !important; border-radius: 0 !important;
    color: var(--nw-text); font: 400 15px/1.45 Inter, "Segoe UI", sans-serif;
}
.ai-composer textarea::placeholder { color: var(--nw-text-3); }
.ai-send {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; border: 0; display: grid; place-items: center; cursor: pointer;
    background: #f4f5f7; color: #0b0d1a; transition: background 160ms ease, color 160ms ease, transform 120ms ease, opacity 160ms ease;
}
.ai-send svg { width: 18px; height: 18px; grid-area: 1 / 1; transition: opacity 160ms ease, transform 200ms var(--nw-ease-out, ease-out); }
.ai-send-arrow { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ai-send-stop { fill: currentColor; opacity: 0; transform: scale(0.6); }
.ai-send:hover:not(:disabled) { background: #fff; }
.ai-send:active:not(:disabled) { transform: scale(0.94); }
.ai-send:disabled { background: rgba(255, 255, 255, 0.07); color: var(--nw-text-3); cursor: default; }
.ai-send.is-stop { background: rgba(255, 255, 255, 0.1); color: var(--nw-text); }
.ai-send.is-stop .ai-send-arrow { opacity: 0; transform: translateY(-6px); }
.ai-send.is-stop .ai-send-stop { opacity: 1; transform: none; }
.ai-send:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.ai-hint { max-width: var(--ai-col); margin: 8px auto 0; text-align: center; font-size: 11.5px; color: var(--nw-text-3); }
.ai-hint kbd {
    display: inline-block; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--nw-line-strong); border-bottom-width: 2px;
    font: 500 10.5px/1.4 Inter, "Segoe UI", sans-serif; color: var(--nw-text-2); background: rgba(255, 255, 255, 0.03);
}

/* ── Fenêtre « Clé d'accès » ────────────────────────────────────────────── */
.ai-sheet { position: fixed; inset: 0; z-index: 10100; display: grid; place-items: center; padding: 16px; }
.ai-sheet[hidden] { display: none; }
.ai-sheet-backdrop {
    position: absolute; inset: 0; background: rgba(4, 4, 8, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    opacity: 0; transition: opacity 220ms ease;
}
.ai-sheet-panel {
    position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
    padding: 24px; border-radius: 20px; background: #111116; border: 1px solid var(--nw-line-strong);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); color: var(--nw-text);
    opacity: 0; transform: translateY(14px) scale(0.98);
    transition: opacity 240ms var(--nw-ease-out, ease-out), transform 300ms var(--nw-ease-out, ease-out);
}
.ai-sheet.is-open .ai-sheet-backdrop { opacity: 1; }
.ai-sheet.is-open .ai-sheet-panel { opacity: 1; transform: none; }
.ai-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.ai-sheet-head h3 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.ai-sheet-head p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--nw-text-2); }

.ai-key-status {
    display: flex; align-items: center; gap: 9px; margin-bottom: 18px; padding: 10px 12px; border-radius: 12px;
    background: var(--nw-surface); border: 1px solid var(--nw-line); font-size: 13px; color: var(--nw-text-2);
    font-variant-numeric: tabular-nums;
}
.ai-key-status i { width: 7px; height: 7px; border-radius: 50%; background: #6b6b76; flex-shrink: 0; }
.ai-key-status[data-state="ready"] { color: var(--nw-text); }
.ai-key-status[data-state="ready"] i { background: var(--nw-ok); }
.ai-key-status[data-state="empty"] i { background: #fbbf24; }
.ai-key-status[data-state="offline"] i { background: var(--nw-danger); }

.ai-sheet-form { display: flex; flex-direction: column; gap: 14px; }
.ai-field { display: flex; flex-direction: column; gap: 8px; }
.ai-field-label { font-size: 13px; font-weight: 600; color: var(--nw-text); }
.ai-field-box {
    display: flex; align-items: center; height: 48px; padding: 0 4px 0 14px; border-radius: 12px;
    background: var(--ai-field, #0c0c10); border: 1px solid var(--nw-line-strong);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.ai-field-box:focus-within { border-color: rgba(124, 140, 255, 0.6); box-shadow: 0 0 0 4px rgba(124, 140, 255, 0.12); }
.ai-field-box.is-invalid { border-color: rgba(255, 122, 133, 0.6); box-shadow: 0 0 0 4px rgba(255, 122, 133, 0.1); }
.ai-field-box.is-valid { border-color: rgba(74, 222, 128, 0.45); }
.ai-field-box input, .ai-field-box select {
    flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--nw-text);
    font: 500 14px/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.02em;
}
.ai-field-box input::placeholder { font-family: Inter, "Segoe UI", sans-serif; letter-spacing: 0; color: var(--nw-text-3); }
.ai-field-box input:disabled { cursor: not-allowed; }
/* Choix du modèle : trois boutons (pas de liste déroulante Windows) */
.ai-models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ai-model {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 12px; text-align: left; cursor: pointer;
    border-radius: 12px; border: 1px solid var(--nw-line-strong); background: var(--ai-field, #0c0c10); color: var(--nw-text);
    font: inherit; transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.ai-model strong { font-size: 13.5px; font-weight: 650; }
.ai-model span { font-size: 11.5px; color: var(--nw-text-3); }
.ai-model:hover { border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.04); }
.ai-model:active { transform: scale(0.98); }
.ai-model[aria-checked="true"] { border-color: rgba(124, 140, 255, 0.7); background: rgba(124, 140, 255, 0.10); box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.12); }
.ai-model[aria-checked="true"] span { color: #c9d0ff; }
.ai-model:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 2px; }
.ai-field .is-custom { margin-top: 8px; }
.ai-field-box.is-custom[hidden] { display: none; }
.ai-field-eye {
    width: 40px; height: 40px; flex-shrink: 0; border: 0; border-radius: 9px; background: transparent; color: var(--nw-text-2);
    display: grid; place-items: center; cursor: pointer; transition: background 160ms ease, color 160ms ease;
}
.ai-field-eye:hover { background: var(--nw-surface-2); color: var(--nw-text); }
.ai-field-eye:focus-visible { outline: 2px solid var(--nw-accent); outline-offset: 0; }
.ai-field-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; grid-area: 1 / 1; }
.ai-field-eye .eye-off, .ai-field-eye[aria-pressed="true"] .eye-on { display: none; }
.ai-field-eye[aria-pressed="true"] .eye-off { display: block; }
.ai-field-help { font-size: 12.5px; line-height: 1.5; color: var(--nw-text-3); }
.ai-field-help a { color: #b8c0ff; text-decoration: none; font-weight: 600; }
.ai-field-help a:hover { text-decoration: underline; }

.ai-advanced { border-top: 1px solid var(--nw-line); padding-top: 12px; }
.ai-advanced summary { list-style: none; cursor: pointer; font-size: 13px; color: var(--nw-text-2); display: inline-flex; align-items: center; gap: 8px; }
.ai-advanced summary::-webkit-details-marker { display: none; }
.ai-advanced summary::before { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform 200ms ease; }
.ai-advanced[open] summary::before { transform: rotate(45deg); }
.ai-advanced summary:hover { color: var(--nw-text); }
.ai-advanced .ai-field { margin-top: 12px; }

.ai-form-msg { margin: 0; min-height: 20px; font-size: 13px; line-height: 1.5; color: var(--nw-text-2); transition: color 160ms ease; }
.ai-form-msg.is-error { color: #ffb3ba; }
.ai-form-msg.is-ok { color: #bbf7d0; }
.ai-form-msg.is-info { color: var(--nw-text-2); }

.ai-sheet-foot { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.ai-foot-spacer { flex: 1; }
.ai-btn[hidden] { display: none; }
.ai-save { min-width: 132px; justify-content: center; }
.ai-spinner, .ai-save-check { display: none; }
.ai-save.is-loading .ai-spinner {
    display: block; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(11, 13, 26, 0.25); border-top-color: #0b0d1a; animation: aiSpin 700ms linear infinite;
}
.ai-save.is-done .ai-save-check { display: block; animation: aiPop 360ms var(--nw-ease-out, ease-out); }
@keyframes aiPop { from { transform: scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.ai-sheet-form.is-readonly .ai-save, .ai-sheet-form.is-readonly .ai-advanced { display: none; }

/* entrée vers l'assistant dans la barre du haut */
.sp-ai-btn { color: #cfd5ff !important; }
.sp-ai-btn:hover { color: #fff !important; }

/* ── Petits écrans ──────────────────────────────────────────────────────── */
@media (max-width: 900px) { .ai-suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
    .ai-suggestions { grid-template-columns: 1fr; }
    #aiNewBtn span { display: none; }
    #aiNewBtn { width: 34px; padding: 0; justify-content: center; }
    #aiView.ai-app.is-fullscreen { padding: 0 14px; }
    .ai-msg.is-user .ai-bubble { max-width: 88%; }
    .ai-result-head { flex-direction: column; align-items: flex-start; }
    .ai-hint { display: none; }
    .ai-sheet-foot { flex-wrap: wrap; }
    .ai-models { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    #aiView *, .ai-sheet * { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
    .ai-orbit { display: none; }
}

/* ── Mix du jour (accueil) : bannière compacte + étagère, composés par NeonWave IA ────────── */
.nw-daily-mix { margin: 4px 0 30px; }
.nw-daily-mix.hidden { display: none; }
.nw-mix-hero {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 24px 28px; border-radius: 20px; margin-bottom: 16px; min-height: 150px;
    background: radial-gradient(110% 160% at 100% 0%, rgba(34, 211, 238, 0.22), transparent 55%), radial-gradient(70% 120% at 0% 100%, rgba(139, 92, 246, 0.45), transparent 60%), linear-gradient(135deg, #0b2a6b 0%, #2436a8 45%, #4c1d95 100%);
    border: 1px solid rgba(255, 255, 255, 0.10); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.nw-mix-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(60% 120% at 20% 120%, rgba(91, 154, 255, 0.28), transparent 60%); }
.nw-mix-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; flex: 1; }
.nw-mix-kicker::before { background: #22d3ee !important; box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.25) !important; }
.nw-mix-title { margin: 4px 0 0; font-size: clamp(22px, 2.2vw, 30px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; color: #fff; }
.nw-mix-reply { margin: 0; font-size: 14px; line-height: 1.5; color: rgba(255, 255, 255, 0.82); max-width: 640px; }
.nw-mix-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nw-mix-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 500px; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08); color: #fff; font: 700 13px Inter, "Segoe UI", sans-serif; cursor: pointer; transition: transform 0.15s, filter 0.15s, background 0.15s; }
.nw-mix-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); transform: scale(1.03); }
.nw-mix-btn.is-primary { background: #fff; color: #0b1437; border-color: transparent; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); }
.nw-mix-btn.is-primary:hover:not(:disabled) { background: #fff; filter: brightness(1.04); }
.nw-mix-btn.is-ghost { background: transparent; }
.nw-mix-btn:disabled { opacity: 0.55; cursor: default; }
.nw-mix-btn svg { width: 16px; height: 16px; }
.nw-mix-art { position: relative; z-index: 1; width: 220px; height: 130px; flex-shrink: 0; }
.nw-mix-art img { position: absolute; top: 4px; width: 120px; height: 120px; border-radius: 12px; object-fit: cover; background: #282828; border: 1px solid rgba(255, 255, 255, 0.12); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); transition: transform 0.4s cubic-bezier(.2, .8, .2, 1); }
.nw-mix-art img:nth-child(1) { right: 100px; transform: rotate(-10deg) translateY(6px); z-index: 1; }
.nw-mix-art img:nth-child(2) { right: 50px; transform: rotate(-2deg); z-index: 2; }
.nw-mix-art img:nth-child(3) { right: 0; transform: rotate(8deg) translateY(4px); z-index: 3; }
.nw-mix-hero:hover .nw-mix-art img:nth-child(1) { transform: rotate(-14deg) translate(-8px, 2px); }
.nw-mix-hero:hover .nw-mix-art img:nth-child(3) { transform: rotate(12deg) translate(8px, 0); }
.nw-mix-hero.is-skeleton .nw-mix-copy .skeleton { display: block; animation: nwShimmer 1.4s linear infinite; }
.nw-mix-skel-note { display: inline-flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 12.5px; color: rgba(255, 255, 255, 0.72); }
.nw-daily-mix .pod-shelf-head { flex-wrap: wrap; }
.nw-daily-mix .pod-shelf-head h3 { font-size: 20px; }
@media (max-width: 760px) { .nw-mix-hero { flex-direction: column; align-items: flex-start; padding: 20px; min-height: 0; } .nw-mix-art { display: none; } }

/* « Plus d'options » d'une playlist : entrée NeonWave IA (même format que les autres) */
.nw-playlist-menu .ai-menu-item svg { color: #a78bfa; }
.ai-result-head .ai-target { color: #c7d7ff; }
