/**
 * Modern Dashboard V2 - A/B Test Variant
 * Shared styles loaded from topbar.css
 * This file contains only page-specific styles
 */

/* ===================================================================
   Brand overrides (page-specific tokens)
   =================================================================== */
:root {
    /* Primary Colors - ConformPDF Brand */
    --primary-200: #09235c;
    --primary-400: #1a3a7a;
    --primary-500: #0f2d6e;
    --primary-600: #09235c;
    --primary-700: #061938;
    --primary-50: #e6e9f1;
    --primary-100: #ccd3e3;

    /* Accent Color - Pink */
    --accent-600: #fe3960;
    --accent-700: #e5334d;
    --accent-50: #ffe8ed;
    --accent-100: #ffd1db;

    /* Status - additional */
    --warning-700: #B45309;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Additional spacing */
    --space-16: 4rem;

    /* Additional shadow */
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

body {
    font-family: var(--font-sans);
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===================================================================
   Accessibility utilities
   =================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: inherit;
}

:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ===================================================================
   6. ALERTS
   =================================================================== */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.alert-success {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: var(--error-50);
    color: var(--error-700);
    border: 1px solid #fecaca;
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-700);
    border: 1px solid #fde68a;
}

/* ===================================================================
   7. DROP ZONE
   =================================================================== */
.drop-section {
    margin-bottom: var(--space-8);
}

.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-xl);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: white;
}

.drop-zone:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
}

.drop-zone:focus-visible {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

.drop-zone.drag-over {
    border-color: var(--primary-600);
    background: var(--primary-50);
    box-shadow: 0 0 0 4px rgba(9, 35, 92, 0.1);
}

.drop-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-4);
    color: var(--gray-400);
}

.drop-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

.drop-subtitle {
    font-size: 0.9375rem;
    color: var(--gray-600);
    margin-bottom: var(--space-3);
}

.drop-hint {
    font-size: 0.8125rem;
    color: var(--gray-400);
}

.link-button {
    background: none;
    border: none;
    color: var(--primary-600);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
}

.file-list {
    margin-top: var(--space-6);
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
}

.file-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    padding-right: calc(var(--space-4) + 24px); /* espace pour le bouton × */
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    position: relative;
    min-height: 56px;
}

.file-card-icon {
    font-size: 1.5rem;
    color: var(--primary-600);
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-card-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-size {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray-500);
    line-height: 1;
}

.file-card-remove {
    position: absolute;
    top: 50%;
    right: var(--space-2);
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 1.125rem;
    padding: var(--space-1);
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    line-height: 1;
}

.file-card-remove:hover {
    color: var(--error-600);
    background: var(--error-50);
}

.file-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
}

.file-estimate {
    color: var(--gray-700);
    font-weight: 600;
}

.file-balance {
    color: var(--gray-500);
}

.file-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    justify-content: center;
}

.upload-loader {
    text-align: center;
    padding: var(--space-8);
}

/* ===================================================================
   8. POLLING SECTION
   =================================================================== */
.polling-section {
    margin-bottom: var(--space-8);
}

.polling-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.polling-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-6);
}

.polling-job {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--gray-100);
}

.polling-job:last-child {
    border-bottom: none;
}

.polling-job-name {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.polling-job-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-completed {
    background: var(--success-50);
    color: var(--success-700);
}

.status-processing {
    background: var(--primary-50);
    color: var(--primary-600);
}

.status-queued {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-failed {
    background: var(--error-50);
    color: var(--error-700);
}

.polling-job-score {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
    min-width: 40px;
    text-align: right;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: var(--space-4);
}

.progress-fill {
    height: 100%;
    background: var(--primary-600);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: var(--space-2);
    text-align: center;
}

.job-icon-spin {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ===================================================================
   9. RESULT SECTION
   =================================================================== */
.result-section {
    margin-bottom: var(--space-8);
}

.result-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
}

.result-card--success {
    border-left: 4px solid var(--success-500);
}

.result-card--warning {
    border-left: 4px solid var(--warning-500);
}

.result-card--error {
    border-left: 4px solid var(--error-500);
}

.result-verdict {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.verdict-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.result-card--success .verdict-icon {
    background: var(--success-50);
    color: var(--success-600);
}

.result-card--warning .verdict-icon {
    background: var(--warning-50);
    color: var(--warning-600);
}

.result-card--error .verdict-icon {
    background: var(--error-50);
    color: var(--error-600);
}

.verdict-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
}

.verdict-subtitle {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: var(--space-1);
}

.result-scores {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.score-item {
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: var(--space-5) var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.score-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5em; /* force la même hauteur pour labels 1 et 2 lignes */
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    margin-bottom: var(--space-3);
    line-height: 1.3;
}

.score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-3);
}

.score-value--lg {
    font-size: 1.75rem;
}

.score-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-top: auto; /* pousse la barre en bas de la carte pour l'alignement */
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.score-bar-fill--high {
    background: var(--success-500);
}

.score-bar-fill--mid {
    background: var(--warning-500);
}

.score-bar-fill--low {
    background: var(--error-500);
}

.result-handoff {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: var(--primary-50);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

.handoff-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.handoff-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
}

.handoff-desc {
    font-size: 0.8125rem;
    color: var(--gray-600);
    margin-top: var(--space-1);
}

.result-file {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.result-filename {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.result-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

@media (max-width: 767px) {
    .result-scores {
        grid-template-columns: 1fr;
    }

    .result-card {
        padding: var(--space-5);
    }

    .result-actions {
        flex-direction: column;
    }
}

/* ===================================================================
   10. STATS ROW
   =================================================================== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-5) var(--space-6);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

@media (max-width: 767px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

/* ===================================================================
   11. HISTORY SECTION
   =================================================================== */
.history-section {
    margin-bottom: var(--space-8);
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
    gap: var(--space-4);
}

.history-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.history-count {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.search-field input {
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--gray-900);
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 220px;
}

.search-field input:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 3px var(--primary-50);
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    background: white;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.history-table td {
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
}

.history-table tbody tr:hover {
    background: var(--gray-50);
}

.sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 0 var(--space-1);
    font-size: 0.75rem;
    vertical-align: middle;
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.verdict-badge--success {
    background: var(--success-50);
    color: var(--success-700);
}

.verdict-badge--warning {
    background: var(--warning-50);
    color: var(--warning-700);
}

.verdict-badge--error {
    background: var(--error-50);
    color: var(--error-700);
}

.score-num {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-6);
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

@media (max-width: 767px) {
    .history-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-field input {
        width: 100%;
    }

    .history-actions {
        width: 100%;
    }

    .table-wrapper {
        font-size: 0.8125rem;
    }
}

/* ===================================================================
   12. BUTTONS
   =================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-danger {
    background: var(--error-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: var(--error-700);
    box-shadow: var(--shadow-md);
}

.btn-accent {
    background: var(--accent-600);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    background: var(--accent-700);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-ghost {
    background: none;
    color: var(--gray-600);
    border: none;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: 0.8125rem;
}

.btn-icon {
    padding: var(--space-2);
    line-height: 1;
}

.btn-icon svg {
    display: block;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: 1rem;
}

/* ===================================================================
   13. TOAST NOTIFICATIONS
   =================================================================== */
.toast {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.toast--visible {
    transform: translateY(0);
    opacity: 1;
}

.toast--warning {
    background: var(--warning-50);
    color: var(--warning-700);
    border: 1px solid #fde68a;
}

.toast--error {
    background: var(--error-50);
    color: var(--error-700);
    border: 1px solid #fecaca;
}

.toast--success {
    background: var(--success-50);
    color: var(--success-700);
    border: 1px solid #a7f3d0;
}

/* ===================================================================
   14. SPINNER ANIMATION
   =================================================================== */
.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-4);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 0.9375rem;
    color: var(--gray-600);
    text-align: center;
}

/* ===================================================================
   15. BATCH DEVIS SECTION
   =================================================================== */
.batch-quote {
    background: white;
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--warning-500);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-8);
}

.batch-quote-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-6);
}

.batch-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: var(--space-6);
}

.batch-table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-300);
}

.batch-table th:last-child {
    text-align: right;
}

.batch-table td {
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
}

.batch-table td:last-child {
    text-align: right;
    font-weight: 600;
}

.batch-table tfoot td {
    border-top: 2px solid var(--gray-900);
    font-weight: 700;
    font-size: 1rem;
    color: var(--gray-900);
    padding-top: var(--space-4);
}

.batch-table tfoot td:last-child {
    color: var(--primary-600);
}

.batch-balance {
    background: var(--gray-50);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.batch-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.batch-balance-row + .batch-balance-row {
    margin-top: var(--space-2);
}

.batch-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

.batch-actions form:first-child {
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════
   WIDGET IA SUPPORT
═══════════════════════════════════════════════════════════════ */
.ai-widget {
    position: fixed; bottom: 24px; right: 24px; z-index: 8000;
    display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
}
.ai-widget__toggle {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    background: linear-gradient(135deg, #09235c, #1a3a8a);
    color: #fff; border: none; border-radius: 50px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 20px rgba(9,35,92,.35);
    transition: all .2s;
}
.ai-widget__toggle:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(9,35,92,.45); }
.ai-widget__label { white-space: nowrap; }

.ai-widget__panel {
    width: 340px; max-height: 480px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 12px 48px rgba(9,35,92,.18);
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid rgba(9,35,92,.1);
}
.ai-widget__panel[hidden] { display: none; }

.ai-widget__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(135deg, #09235c, #1a3a8a);
    color: #fff;
}
.ai-widget__header-info { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.ai-widget__dot {
    width: 8px; height: 8px; background: #4ade80; border-radius: 50%;
    animation: aiPulse 2s infinite;
}
@keyframes aiPulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.ai-widget__close {
    background: none; border: none; color: rgba(255,255,255,.7);
    cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 4px; transition: color .2s;
}
.ai-widget__close:hover { color: #fff; }

.ai-widget__messages {
    flex: 1; overflow-y: auto; padding: 14px;
    display: flex; flex-direction: column; gap: 10px; max-height: 280px;
}
.ai-msg {
    padding: 10px 14px; border-radius: 12px;
    font-size: 13px; line-height: 1.55; max-width: 92%;
}
.ai-msg--user {
    background: #09235c; color: #fff;
    align-self: flex-end; border-bottom-right-radius: 4px;
}
.ai-msg--assistant {
    background: #f3f4f6; color: #1f2937;
    align-self: flex-start; border-bottom-left-radius: 4px;
}
.ai-msg--typing { opacity: .6; font-style: italic; }
.ai-msg__icon {
    display: inline-block; vertical-align: middle;
    margin-left: 6px; opacity: .45; flex-shrink: 0;
}
.ai-msg--assistant { display: flex; align-items: flex-end; gap: 4px; flex-wrap: wrap; }

.ai-widget__rate-info {
    padding: 6px 16px; background: #fef9c3;
    font-size: 12px; color: #92400e; text-align: center;
}

.ai-widget__input-area {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 12px; border-top: 1px solid #e5e7eb;
}
.ai-widget__input {
    flex: 1; border: 1px solid #d1d5db; border-radius: 10px;
    padding: 8px 12px; font-size: 13px; resize: none;
    font-family: inherit; line-height: 1.4; transition: border-color .2s;
}
.ai-widget__input:focus { outline: none; border-color: #09235c; }
.ai-widget__send {
    padding: 9px; background: #fe3960; color: #fff; border: none;
    border-radius: 10px; cursor: pointer; display: flex; align-items: center; transition: all .2s; flex-shrink: 0;
}
.ai-widget__send:hover:not(:disabled) { background: #e02d52; }
.ai-widget__send:disabled { opacity: .4; cursor: not-allowed; }

.ai-widget__footer { padding: 8px 12px; border-top: 1px solid #f3f4f6; text-align: center; }
.ai-widget__escalate {
    background: none; border: 1px dashed #d1d5db; color: #6b7280;
    font-size: 12px; padding: 6px 14px; border-radius: 8px;
    cursor: pointer; transition: all .2s; width: 100%;
}
.ai-widget__escalate:hover { border-color: #09235c; color: #09235c; background: #f8faff; }

@media (max-width: 480px) {
    .ai-widget { right: 12px; bottom: 12px; }
    .ai-widget__panel { width: calc(100vw - 24px); }
    .ai-widget__label { display: none; }
}

