:root {
    --primary: #4338ca;
    --primary-dark: #3730a3;
    --primary-light: #eef2ff;
    --accent: #f59e0b;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --text: #1e1b2e;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #fafafa;
    --card-bg: #ffffff;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(67,56,202,0.12);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 18px 40px;
}

/* Header */
.site-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.brand-badge {
    background: var(--primary);
    color: white;
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
}
.nav-links { display: flex; gap: 14px; align-items: center; }
.nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.92rem; font-weight: 500; }
.nav-links a:hover { color: var(--primary); }

/* Typography */
h1 { font-size: 1.6rem; font-weight: 800; margin: 24px 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 10px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 6px; color: var(--primary-dark); }
p { color: var(--text); }
.subtitle { color: var(--text-muted); margin-top: -4px; margin-bottom: 20px; }

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.card-link { display: block; text-decoration: none; color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.card-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }

/* Forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 22px;
    border-radius: 9px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
    transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: white; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-secondary:hover { background: var(--primary-light); }
.btn-block { display: flex; }

/* Flash messages */
.flash { padding: 12px 16px; border-radius: 9px; margin-bottom: 16px; font-size: 0.9rem; font-weight: 500; }
.flash-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.flash-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }

/* Badges de statut */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-progress { background: #fef3c7; color: #92400e; }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }

/* Résultat sujet */
.result-section { background: var(--primary-light); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.result-final { background: var(--success-bg); border-left: 4px solid var(--success); border-radius: 8px; padding: 16px; margin: 16px 0; }
.confidence-tag { font-size: 0.8rem; color: var(--text-muted); }

/* Conversation */
.msg { padding: 10px 16px; border-radius: 14px; margin-bottom: 8px; max-width: 85%; font-size: 0.92rem; }
.msg-user { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 4px; }
.msg-assistant { background: var(--card-bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* Loader */
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.4); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

a { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 1rem;
    background-color: #0d1321;
    color: #b0b5c0;
    font-size: 0.85rem;
}

.site-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.site-footer-inner p {
    margin: 0;
}

.site-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.site-footer-links a {
    color: #b0b5c0;
    text-decoration: none;
}

.site-footer-links a:hover {
    color: #ef3011;
    text-decoration: underline;
}

@media (max-width: 600px) {
    .site-footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* Footer */
.site-footer {
    margin-top: 40px;
    padding: 24px 18px;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}
.site-footer-inner {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}
.site-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 10px;
}
.site-footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.site-footer-links a {
    color: var(--text-muted);
    font-size: 0.82rem;
    text-decoration: none;
}
.site-footer-links a:hover {
    color: var(--primary);
}

/* Hero page d'accueil */
.hero {
    text-align: center;
    padding: 40px 0 50px;
}
.hero-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 18px;
}
.hero h1 {
    font-size: 2rem;
    line-height: 1.25;
    margin: 0 0 14px;
}
.hero .subtitle {
    max-width: 480px;
    margin: 0 auto 28px;
    font-size: 1rem;
}
.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.hero-actions .btn {
    width: auto;
    padding: 13px 26px;
}

/* Steps */
.steps { padding: 30px 0; text-align: center; }
.steps h2 { margin-bottom: 24px; }
.step-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}
.step-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.step-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}
.step-card h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}
.step-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Features */
.features { padding: 30px 0; }
.features h2 { text-align: center; margin-bottom: 24px; }
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.feature-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.feature-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
}
.feature-item h3 {
    font-size: 0.95rem;
    margin: 0 0 4px;
}
.feature-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* CTA final */
.cta-final {
    text-align: center;
    padding: 40px 0 20px;
    border-top: 1px solid var(--border);
    margin-top: 20px;
}
.cta-final h2 {
    margin-bottom: 18px;
}
.cta-final .btn {
    max-width: 320px;
    margin: 0 auto;
}

/* Password toggle */
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-muted);
}
.password-toggle:hover {
    color: var(--primary);
}
