/* ===== AI COACH PANEL ===== */

/* ── Panel Overlay ── */
#ai-coach-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}

#ai-coach-panel.open {
    display: flex;
    justify-content: flex-end;
}

.ai-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

/* ── Panel Content ── */
.ai-panel-content {
    position: relative;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: #0b0e15;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5), -1px 0 0 rgba(255, 255, 255, 0.05);
}

@media (max-width: 480px) {
    .ai-panel-content {
        width: 100vw;
    }
}

/* ── Panel Header ── */
.ai-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.ai-panel-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
    color: #fff;
}
.ai-panel-avatar svg { display: block; }

.ai-panel-title {
    flex: 1;
}

.ai-panel-title h3 {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.ai-panel-title small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ai-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    transition: all var(--transition);
}

.ai-panel-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.ai-panel-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.76rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition);
    font-weight: 500;
}

.ai-panel-clear:hover {
    background: rgba(248, 113, 113, 0.08);
    color: #f87171;
}

/* ── Messages Area ── */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.ai-messages::-webkit-scrollbar { width: 4px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }
.ai-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Welcome Screen ── */
.ai-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px 20px 12px;
    text-align: center;
}

.ai-welcome-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 18px rgba(99,102,241,0.5));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.ai-welcome h3 {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #c7d2fe, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-welcome p {
    margin: 0 0 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.55;
    max-width: 280px;
}

/* Ancien chip — conservé pour compatibilité CSS */
.ai-quick-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-quick-chip { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); color: var(--text-secondary); padding: 7px 14px; border-radius: 20px; font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.ai-quick-chip:hover { border-color: rgba(99,102,241,0.4); color: var(--accent-hover); background: rgba(99,102,241,0.08); }

/* ── Action chips (écran d'accueil) ── */
.ai-action-chips {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    padding: 0 2px;
    margin-top: 10px;
}

.ai-action-chip {
    width: 100%;
    padding: 15px 18px;
    border: 1px solid rgba(255,255,255,0.07);
    border-left: 3px solid rgba(99,102,241,0.7);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(99,102,241,0.03) 100%);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.04);
    letter-spacing: 0.01em;
}

.ai-action-chip:nth-child(1) {
    border-left-color: #818cf8;
    background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(99,102,241,0.03) 100%);
}
.ai-action-chip:nth-child(2) {
    border-left-color: #34d399;
    background: linear-gradient(135deg, rgba(52,211,153,0.1) 0%, rgba(52,211,153,0.02) 100%);
}
.ai-action-chip:nth-child(3) {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245,158,11,0.1) 0%, rgba(245,158,11,0.02) 100%);
}

.ai-action-chip:nth-child(1):hover {
    background: linear-gradient(135deg, rgba(99,102,241,0.2) 0%, rgba(99,102,241,0.07) 100%);
    border-color: rgba(129,140,248,0.4);
    border-left-color: #818cf8;
    box-shadow: 0 6px 22px rgba(99,102,241,0.22), inset 0 1px 0 rgba(255,255,255,0.07);
    transform: translateX(4px) translateY(-1px);
}
.ai-action-chip:nth-child(2):hover {
    background: linear-gradient(135deg, rgba(52,211,153,0.16) 0%, rgba(52,211,153,0.05) 100%);
    border-color: rgba(52,211,153,0.35);
    border-left-color: #34d399;
    box-shadow: 0 6px 22px rgba(52,211,153,0.18), inset 0 1px 0 rgba(255,255,255,0.07);
    transform: translateX(4px) translateY(-1px);
}
.ai-action-chip:nth-child(3):hover {
    background: linear-gradient(135deg, rgba(245,158,11,0.16) 0%, rgba(245,158,11,0.05) 100%);
    border-color: rgba(245,158,11,0.35);
    border-left-color: #f59e0b;
    box-shadow: 0 6px 22px rgba(245,158,11,0.18), inset 0 1px 0 rgba(255,255,255,0.07);
    transform: translateX(4px) translateY(-1px);
}

.ai-action-chip:active { transform: scale(0.97) translateX(2px) !important; }
.ai-action-chip:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

/* ── Quota info ── */
.ai-quota-info {
    font-size: 0.73rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 2px;
    margin-bottom: 2px;
    opacity: 0.7;
    letter-spacing: 0.02em;
}

/* ── Message Bubbles ── */
.ai-msg {
    display: flex;
    gap: 8px;
    max-width: 92%;
}

.ai-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-msg-assistant {
    align-self: flex-start;
}

.ai-msg-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-msg-user .ai-msg-avatar {
    background: var(--accent-grad);
    color: white;
}

.ai-msg-assistant .ai-msg-avatar {
    background: var(--accent-grad);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.ai-msg-bubble {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.83rem;
    line-height: 1.6;
    word-break: break-word;
}

.ai-msg-user .ai-msg-bubble {
    background: var(--accent-grad);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}

.ai-msg-assistant .ai-msg-bubble {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-bottom-left-radius: 4px;
}

.ai-msg-bubble p {
    margin: 0 0 8px;
}

.ai-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-msg-bubble strong {
    color: var(--accent-hover);
}

.ai-msg-user .ai-msg-bubble strong {
    color: rgba(255,255,255,0.9);
}

.ai-msg-bubble ul, .ai-msg-bubble ol {
    margin: 4px 0;
    padding-left: 18px;
}

.ai-msg-bubble li {
    margin-bottom: 3px;
}

.ai-msg-bubble code {
    background: rgba(99, 102, 241, 0.12);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: 'SF Mono', Monaco, monospace;
}

/* ── Loading Dots ── */
.ai-loading {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    align-items: center;
}

.ai-loading-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    animation: aiDotPulse 1.4s infinite ease-in-out;
}

.ai-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes aiDotPulse {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.75); }
    40% { opacity: 1; transform: scale(1); }
}

/* ── Proposal Cards ── */
.ai-proposal {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    transition: border-color var(--transition);
}

.ai-proposal:hover {
    border-color: rgba(99, 102, 241, 0.4);
}

.ai-proposal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.ai-proposal-icon {
    font-size: 1.05rem;
}

.ai-proposal-title {
    font-weight: 700;
    font-size: 0.83rem;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.ai-proposal-desc {
    font-size: 0.77rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 10px;
}

.ai-proposal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ai-proposal-btn {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.77rem;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.15s;
    letter-spacing: 0.1px;
}

.ai-proposal-btn-accept {
    background: #34d399;
    color: #051a0f;
}

.ai-proposal-btn-accept:hover {
    background: #2dd4a0;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(52, 211, 153, 0.35);
}

.ai-proposal-btn-reject {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.ai-proposal-btn-reject:hover {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, 0.06);
}

.ai-proposal.accepted {
    border-color: rgba(52, 211, 153, 0.3);
    opacity: 0.7;
}

.ai-proposal.accepted .ai-proposal-actions,
.ai-proposal.accepted .ai-plan-check-btn {
    display: none;
}

.ai-proposal.accepted::after {
    content: '\2713  Ajout\00e9 \00e0 l\0027agenda';
    display: block;
    text-align: right;
    font-size: 0.73rem;
    color: #34d399;
    margin-top: 4px;
    font-weight: 600;
}

.ai-proposal.rejected {
    border-color: rgba(255, 255, 255, 0.05);
    opacity: 0.4;
}

.ai-proposal.rejected .ai-proposal-actions,
.ai-proposal.rejected .ai-plan-check-btn {
    display: none;
}

.ai-proposal.rejected::after {
    content: '\2717  Refus\00e9';
    display: block;
    text-align: right;
    font-size: 0.73rem;
    color: #f87171;
    margin-top: 4px;
    font-weight: 600;
}

/* ── Plan View (full-width layout for weekly plan) ── */
.ai-msg-plan {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-plan-intro {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-plan-intro-icon {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--accent);
}

.ai-plan-intro p { margin: 0; }
.ai-plan-intro strong { color: var(--accent-hover); }

.ai-plan-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

@media (max-width: 480px) {
    .ai-plan-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Plan Session Cards ── */
.ai-plan-card {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-left: 3px solid;
    border-radius: 10px;
    padding: 8px 9px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, background 0.15s;
}

.ai-plan-card:hover {
    background: rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.12);
}

.ai-plan-card-head {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.ai-plan-card-info {
    flex: 1;
    min-width: 0;
}

.ai-plan-card-day {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.ai-plan-card-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 1px;
    letter-spacing: -0.2px;
}

.ai-plan-card-title svg { flex-shrink: 0; }

.ai-plan-card-meta {
    font-size: 0.66rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.ai-plan-check-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid rgba(52, 211, 153, 0.4);
    background: rgba(52, 211, 153, 0.08);
    color: #34d399;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 2px;
}

.ai-plan-check-btn:hover {
    background: rgba(52, 211, 153, 0.2);
    border-color: #34d399;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.3);
}

.ai-plan-check-btn:active {
    transform: scale(0.95);
}

.ai-plan-blocks {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.06);
    flex: 1;
}

.ai-plan-block-section {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--accent-hover);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 0 0;
}

.ai-plan-block-item {
    font-size: 0.65rem;
    color: var(--text-secondary);
    padding: 0 0 0 8px;
    position: relative;
    line-height: 1.45;
}

.ai-plan-block-item::before {
    content: '\2013';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

/* ── Accept All (grid cell) ── */
.ai-plan-grid-accept-all {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px dashed rgba(52, 211, 153, 0.3);
    border-radius: 10px;
    padding: 10px;
    min-height: 60px;
}

.ai-plan-grid-all-done {
    border-color: rgba(52, 211, 153, 0.2);
    color: #34d399;
    font-size: 0.74rem;
    font-weight: 600;
    gap: 6px;
    opacity: 0.7;
}

.ai-accept-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1.5px solid rgba(52, 211, 153, 0.35);
    background: rgba(52, 211, 153, 0.08);
    color: #34d399;
    font-size: 0.76rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
}

.ai-accept-all-btn:hover {
    background: rgba(52, 211, 153, 0.18);
    border-color: #34d399;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(52, 211, 153, 0.25);
}

.ai-accept-all-btn:active {
    transform: scale(0.97);
}

.ai-accept-all-btn svg {
    vertical-align: -2px;
}

/* ── Action Bar (barre du bas — remplace l'input libre) ── */
.ai-action-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    padding: 10px 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(to top, rgba(8,8,18,0.7), rgba(8,8,18,0.3));
    backdrop-filter: blur(6px);
    flex-shrink: 0;
}

.ai-action-btn {
    padding: 10px 6px;
    border: 1px solid rgba(99,102,241,0.18);
    border-radius: 12px;
    background: rgba(99,102,241,0.07);
    color: var(--text-secondary);
    font-size: 0.71rem;
    font-family: inherit;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    line-height: 1.35;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.ai-action-btn:nth-child(1) { border-bottom: 2px solid rgba(129,140,248,0.4); }
.ai-action-btn:nth-child(2) { border-bottom: 2px solid rgba(52,211,153,0.4); }
.ai-action-btn:nth-child(3) { border-bottom: 2px solid rgba(245,158,11,0.4); }

.ai-action-btn:nth-child(1):hover {
    background: rgba(99,102,241,0.16);
    border-color: rgba(129,140,248,0.35);
    color: #a5b4fc;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(99,102,241,0.2);
}
.ai-action-btn:nth-child(2):hover {
    background: rgba(52,211,153,0.12);
    border-color: rgba(52,211,153,0.35);
    color: #6ee7b7;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(52,211,153,0.18);
}
.ai-action-btn:nth-child(3):hover {
    background: rgba(245,158,11,0.12);
    border-color: rgba(245,158,11,0.35);
    color: #fcd34d;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(245,158,11,0.18);
}

.ai-action-btn svg { vertical-align: -3px; margin-right: 2px; }
.ai-action-btn:active { transform: scale(0.95) !important; }
.ai-action-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

/* ── Feedback Badge (in DetailPanel & Dashboard) ── */
.ai-feedback-card {
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    padding: 14px;
    margin-top: 12px;
    transition: border-color var(--transition);
}

.ai-feedback-card:hover {
    border-color: rgba(99, 102, 241, 0.25);
}

.ai-feedback-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-hover);
    margin-bottom: 8px;
    letter-spacing: 0.1px;
}

.ai-feedback-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.ai-feedback-loading {
    font-size: 0.77rem;
    color: var(--text-muted);
    font-style: italic;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ── Animations ── */
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ── Bouton analyser séance ── */
.btn-ai-analyze {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 4px;
}

.btn-ai-analyze:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
}

.btn-ai-analyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Séance trop ancienne ── */
.ai-feedback-old {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    opacity: 0.75;
}

/* ── Light theme overrides ── */
:root[data-theme="light"] .ai-panel-content {
    background: #ffffff;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12), -1px 0 0 rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .ai-panel-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.015);
}

:root[data-theme="light"] .ai-panel-close:hover {
    background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .ai-messages {
    scrollbar-color: rgba(0, 0, 0, 0.12) transparent;
}

:root[data-theme="light"] .ai-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.12);
}

:root[data-theme="light"] .ai-msg-assistant .ai-msg-bubble {
    background: rgba(0, 0, 0, 0.035);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .ai-msg-bubble code {
    background: rgba(99, 102, 241, 0.08);
}

:root[data-theme="light"] .ai-quick-chip {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

:root[data-theme="light"] .ai-quick-chip:hover {
    background: rgba(99, 102, 241, 0.06);
}

:root[data-theme="light"] .ai-action-chip {
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .ai-action-chip:nth-child(1) {
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(99,102,241,0.02) 100%);
}
:root[data-theme="light"] .ai-action-chip:nth-child(2) {
    background: linear-gradient(135deg, rgba(52,211,153,0.07) 0%, rgba(52,211,153,0.01) 100%);
}
:root[data-theme="light"] .ai-action-chip:nth-child(3) {
    background: linear-gradient(135deg, rgba(245,158,11,0.07) 0%, rgba(245,158,11,0.01) 100%);
}

:root[data-theme="light"] .ai-action-bar {
    border-top-color: rgba(0, 0, 0, 0.08);
    background: linear-gradient(to top, rgba(248, 249, 252, 0.95), rgba(255, 255, 255, 0.5));
}

:root[data-theme="light"] .ai-action-btn {
    border-color: rgba(99, 102, 241, 0.12);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .ai-proposal {
    background: rgba(99, 102, 241, 0.03);
    border-color: rgba(99, 102, 241, 0.15);
}

:root[data-theme="light"] .ai-proposal-btn-reject {
    border-color: rgba(0, 0, 0, 0.1);
}

:root[data-theme="light"] .ai-plan-intro {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .ai-plan-card {
    background: rgba(0, 0, 0, 0.015);
    border-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .ai-plan-card:hover {
    background: rgba(0, 0, 0, 0.03);
}

:root[data-theme="light"] .ai-plan-check-btn {
    background: rgba(52, 211, 153, 0.06);
}

:root[data-theme="light"] .ai-plan-grid-accept-all {
    border-color: rgba(52, 211, 153, 0.2);
}

:root[data-theme="light"] .ai-feedback-card {
    background: rgba(99, 102, 241, 0.03);
    border-color: rgba(99, 102, 241, 0.12);
}

/* ── AI Consent Dialog ── */
.ai-consent-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 9, 15, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 20px;
}

.ai-consent-overlay.visible {
    opacity: 1;
}

.ai-consent-card {
    max-width: 420px;
    width: 100%;
    background: linear-gradient(160deg, rgba(22, 25, 42, 0.97), rgba(13, 16, 28, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 20px;
    padding: 32px 28px 28px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(12px);
    transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.ai-consent-overlay.visible .ai-consent-card {
    transform: translateY(0);
}

.ai-consent-icon {
    text-align: center;
    margin-bottom: 12px;
    color: var(--accent, #6366f1);
}

.ai-consent-card h3 {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #eef0ff);
    margin-bottom: 14px;
}

.ai-consent-card p {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary, #8892aa);
    margin-bottom: 12px;
}

.ai-consent-card ul {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.ai-consent-card li {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-secondary, #8892aa);
    padding: 4px 0 4px 18px;
    position: relative;
}

.ai-consent-card li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--accent-green, #34d399);
    font-weight: 700;
}

.ai-consent-privacy-link {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    color: var(--accent, #6366f1);
    text-decoration: none;
    margin-bottom: 20px;
}

.ai-consent-privacy-link:hover {
    text-decoration: underline;
}

.ai-consent-actions {
    display: flex;
    gap: 10px;
}

.ai-consent-actions .btn-primary {
    flex: 1;
}

.ai-consent-actions .btn-secondary {
    flex: 0 0 auto;
    padding: 10px 18px;
}
