/*
 * MySondage - Design System (inspired by Flexo)
 * Font: Outfit | Icons: Font Awesome 6
 */

/* =============================================
   CSS VARIABLES - Light Theme (RGAA)
   ============================================= */

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e3a8a;
    --primary-light: #eff6ff;
    --primary-rgb: 29, 78, 216;

    --bg-color: #f8fafc;
    --glass-bg: #ffffff;
    --glass-border: #94a3b8;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --success: #15803d;
    --success-light: #dcfce7;
    --danger: #b91c1c;
    --danger-light: #fee2e2;
    --warning: #b45309;
    --warning-light: #fef3c7;
    --info: #0369a1;
    --info-light: #e0f2fe;

    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --surface: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* =============================================
   RESET & BASE
   ============================================= */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* =============================================
   AUTH PAGES
   ============================================= */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-color);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-box {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #fff;
    font-size: 1.5rem;
}

.auth-logo-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    object-fit: contain;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.auth-alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.auth-alert-warning {
    background: #fef9ee;
    color: #92680a;
    border: 1px solid #fde68a;
}

.auth-alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    background: var(--glass-bg);
    padding: 0 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    position: relative;
}

.sso-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-sso {
    width: 100%;
    padding: 11px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-sso:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-footer a {
    font-weight: 600;
}

/* =============================================
   FORM COMPONENTS
   ============================================= */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group label i {
    color: var(--text-muted);
    width: 18px;
    margin-right: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--glass-bg);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-group input:disabled {
    background: var(--surface);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.char-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
    font-weight: 600;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none !important;
}

a.btn:hover,
a.btn:focus {
    text-decoration: none !important;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-primary);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-outline-primary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.btn-outline-danger {
    background: transparent;
    border: 2px solid var(--danger);
    color: var(--danger);
}

.btn-outline-danger:hover:not(:disabled) {
    background: var(--danger);
    color: #fff;
}

.btn-outline-success {
    background: transparent;
    border: 2px solid var(--success);
    color: var(--success);
}

.btn-outline-success:hover:not(:disabled) {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #991b1b;
}

.btn-text {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-text:hover:not(:disabled) {
    color: var(--primary);
    background: var(--primary-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Action buttons (table rows) */
.actions-cell {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
}

.btn-action-edit { background: var(--primary-light); color: var(--primary); }
.btn-action-edit:hover { background: var(--primary); color: #fff; }
.btn-action-duplicate { background: var(--info-light); color: var(--info); }
.btn-action-duplicate:hover { background: var(--info); color: #fff; }
.btn-action-approve { background: var(--success-light); color: var(--success); }
.btn-action-approve:hover { background: var(--success); color: #fff; }
.btn-action-refuse { background: var(--danger-light); color: var(--danger); }
.btn-action-refuse:hover { background: var(--danger); color: #fff; }
.btn-action-warning { background: var(--warning-light); color: var(--warning); }
.btn-action-warning:hover { background: var(--warning); color: #fff; }

/* Dropdown menu (three dots) */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.btn-action-menu {
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: 0.2s;
}

.btn-action-menu:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.dropdown-menu {
    display: none;
    position: fixed;
    min-width: 180px;
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 6px 0;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--surface);
}

.dropdown-item i {
    width: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dropdown-item-danger {
    color: var(--danger);
}

.dropdown-item-danger i {
    color: var(--danger);
}

.dropdown-item-danger:hover {
    background: var(--danger-light);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* =============================================
   MAIN APP LAYOUT
   ============================================= */

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
}

.sidebar {
    width: 260px;
    height: 100%;
    background: var(--glass-bg);
    border-right: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
    overflow-y: auto;
    transition: width 0.25s ease, padding 0.25s ease;
}

/* Sidebar header (logo + toggle) */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
}

.sidebar-header .sidebar-logo {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

/* Sidebar toggle button */
.sidebar-toggle {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--glass-bg);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: 62px;
    padding: 12px 8px;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

/* Sidebar tooltip (JS-positioned) */
.sidebar-tooltip {
    position: fixed;
    background: #1e293b;
    color: #f8fafc;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 500;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: none;
}

.theme-dark .sidebar-tooltip {
    background: #f1f5f9;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.sidebar-tooltip.visible {
    display: block;
}

.sidebar.collapsed .sidebar-toggle {
    width: 36px;
    height: 36px;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-logo-text {
    display: none;
}

.sidebar.collapsed .nav-links li span {
    display: none;
}

.sidebar.collapsed .nav-links li {
    justify-content: center;
    padding: 10px;
    width: 42px;
    height: 42px;
    margin: 0 auto;
    border-radius: 10px;
}

.sidebar.collapsed .nav-links li i {
    margin-right: 0;
    font-size: 1.15rem;
}

.sidebar.collapsed .sidebar-user-meta {
    display: none;
}

.sidebar.collapsed .sidebar-user-info {
    justify-content: center;
}

.sidebar.collapsed .sidebar-actions {
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.sidebar.collapsed .sidebar-actions button,
.sidebar.collapsed .sidebar-actions .notif-wrapper {
    width: 42px;
    height: 42px;
    min-height: 42px;
    flex: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    border-radius: 10px;
}

.sidebar.collapsed .sidebar-actions .notif-wrapper button {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.sidebar.collapsed .sidebar-divider {
    margin: 8px 4px;
}

.sidebar.collapsed .sidebar-logo {
    justify-content: center;
    gap: 0;
}

/* Adjust main content when sidebar is collapsed */
.sidebar.collapsed + .main-content {
    /* The flex layout handles this automatically */
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 24px;
    text-decoration: none !important;
}

.sidebar-logo:hover {
    text-decoration: none !important;
}

.sidebar-logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-logo-icon.has-logo {
    background: none;
    border: 2px solid var(--border);
    overflow: hidden;
}

.sidebar-logo-icon.has-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-logo-text strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.sidebar-logo-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-links li:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.nav-links li.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-links li i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 8px;
}

.sidebar-user {
    padding: 12px;
    border-top: 2px solid var(--border);
    margin-top: auto;
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    background: var(--surface);
}

.sidebar-user-meta strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-user-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.sidebar-actions button {
    flex: 1;
    padding: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.05rem;
}

.sidebar-actions button:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.sidebar-actions .notif-wrapper {
    position: relative;
    flex: 1;
    display: flex;
}

.sidebar-actions .notif-wrapper button {
    flex: 1;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notification Overlay */
.notif-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 999998;
}

/* Notification Panel : sous la cloche de la barre du haut, à droite */
.notif-panel {
    position: fixed;
    top: 64px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 32px);
    background: #ffffff !important;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 8px 24px rgba(0,0,0,0.12);
    z-index: 999999;
    overflow: hidden;
    animation: notifSlideUp 0.2s ease-out;
}

.theme-dark .notif-panel {
    background: #1e293b !important;
    border-color: #334155;
}

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

.notif-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.notif-panel-header strong {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-panel-header strong::before {
    content: '\f0f3';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: var(--primary);
}

.notif-panel-list {
    max-height: 420px;
    overflow-y: auto;
}

.notif-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: background 0.15s;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover, #f8fafc); }
.notif-item.unread { background: rgba(29, 78, 216, 0.06); border-left: 3px solid var(--primary); }
.notif-item.unread:hover { background: rgba(29, 78, 216, 0.10); }

.notif-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.notif-item.unread .notif-item-icon {
    background: var(--primary);
    color: #fff;
}

.notif-item-content { flex: 1; min-width: 0; }

.notif-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.notif-item-message {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.notif-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.notif-panel-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.notif-panel-empty i { display: block; margin-bottom: 12px; }

.notif-panel-empty p { margin: 0; font-size: 0.9rem; }

.notif-panel:focus { outline: none; }

/* =============================================
   BARRE DU HAUT (compte, notifications, thème, déconnexion)
   Sur ordinateur dans .main-content ; sur téléphone dans .mobile-topbar.
   ============================================= */

.app-topbar {
    position: sticky;
    /* Le collage se mesure depuis le bord du contenu de .main-content, sous ses 24 px de
       marge intérieure : -24px colle la barre tout en haut (sinon le contenu défile au-dessus). */
    top: -24px;
    z-index: 80;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: -24px -28px 20px;
    padding: 10px 28px;
    background: var(--glass-bg);
    border-bottom: 2px solid var(--border);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    min-width: 40px;
    justify-content: center;
    padding: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.05rem;
    font-family: inherit;
    transition: 0.2s;
}

.topbar-btn:hover,
.topbar-btn:focus-visible {
    color: var(--primary);
    background: var(--primary-light);
}

.topbar-btn-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.topbar-preview-btn.is-on {
    color: #92400e;
    background: #fef3c7;
    border-color: #f59e0b;
}

.topbar-notif {
    position: relative;
    display: inline-flex;
}

.topbar-notif .notif-badge {
    top: 2px;
    right: 2px;
    pointer-events: none;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    margin-left: 4px;
    border-radius: 999px;
    cursor: pointer;
    transition: 0.2s;
}

.topbar-user:hover,
.topbar-user:focus-visible {
    background: var(--primary-light);
    outline: none;
}

.topbar-user .sidebar-avatar {
    width: 34px;
    height: 34px;
}

.topbar-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-user-meta strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-user-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Bandeau de l'aperçu « Voir comme un rôle » */
.role-preview-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 2px solid #f59e0b;
    border-radius: 10px;
    background: #fffbeb;
    color: #78350f;
}

.role-preview-banner > i { font-size: 1.2rem; }
.role-preview-banner > span:first-of-type { flex: 1; min-width: 220px; }
.role-preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.theme-dark .role-preview-banner {
    background: #451a03;
    color: #fde68a;
    border-color: #b45309;
}

.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;
}

/* Barre mobile : actions à droite, compactes */
.mobile-topbar .topbar-actions {
    margin-left: auto;
    gap: 2px;
}

.mobile-topbar .topbar-btn-label,
.mobile-topbar .topbar-user-meta {
    display: none;
}

.mobile-topbar .topbar-btn {
    min-width: 36px;
    padding: 0 6px;
}

.mobile-topbar .topbar-user {
    padding: 2px;
    margin-left: 0;
}

@media (max-width: 768px) {
    .app-topbar { display: none; }
    .notif-panel { top: 64px; right: 16px; }
}

@media print {
    .app-topbar, .mobile-topbar, .role-preview-banner { display: none !important; }
}

/* Share Modal Tabs */
.share-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin: -8px -24px 20px;
    padding: 0 8px;
}

.share-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.share-tab:hover { color: var(--primary); background: var(--bg-main, #f8fafc); }
.share-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: transparent; }
.share-tab i { font-size: 0.85rem; }

/* Share sections */
.share-section {
    padding: 8px 0;
}
.share-section-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--primary-light, #eef2ff);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}
.share-section h4 {
    margin: 0 0 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-dark);
}
.share-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.4;
}

/* Lien */
.share-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.share-url-field {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--bg-main, #f8fafc);
    color: var(--text-dark);
    cursor: text;
    text-overflow: ellipsis;
}

/* Widen the modal when it hosts the share dialog (link + QR + iframe + collaborators) */
.modal-box:has(.share-tabs) {
    max-width: 720px;
}
.share-url-field:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* QR Code */
.share-qr-box {
    background: white;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    display: inline-block;
    margin: 8px 0 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.share-qr-image {
    width: 200px;
    height: 200px;
    border-radius: 4px;
    display: block;
}
.share-qr-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 4px;
}

/* Iframe */
.share-code-field {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.78rem;
    background: var(--bg-main, #f8fafc);
    color: var(--text-dark);
    resize: vertical;
    line-height: 1.5;
}
.share-code-field:focus {
    border-color: var(--primary);
    outline: none;
}
.share-embed-options {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.share-embed-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.share-embed-size {
    width: 80px;
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    text-align: center;
}

/* Collaborateurs */
.share-collab-search {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.share-collab-input-row {
    flex: 1;
    position: relative;
}
.share-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}
.share-collab-input-row input {
    width: 100%;
    padding: 10px 12px 10px 34px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
}
.share-collab-input-row input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.share-perm-select {
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    min-width: 120px;
    cursor: pointer;
    background: white;
}
.share-search-results {
    max-height: 150px;
    overflow-y: auto;
}
.share-current-list {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.main-content {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-color);
    padding: 24px 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.page-header .page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

/* =============================================
   CARDS
   ============================================= */

.card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--primary);
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-grid-5 {
    grid-template-columns: repeat(5, 1fr);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.stat-pct {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* =============================================
   ANALYSIS HEADER (Formbricks-style)
   ============================================= */

.analysis-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.analysis-header-left {
    flex: 1;
    min-width: 0;
}

.analysis-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

.analysis-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 16px;
}

.analysis-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Status dropdown */
.analysis-status-dropdown {
    position: relative;
}

.analysis-status-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
}

.analysis-status-btn:hover {
    border-color: var(--primary);
}

.analysis-status-btn .fa-chevron-down {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot-active { background: #22c55e; }
.status-dot-paused { background: #eab308; }
.status-dot-completed { background: #3b82f6; }
.status-dot-draft { background: #94a3b8; }

.analysis-status-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 50;
    overflow: hidden;
}

.analysis-status-menu.open {
    display: block;
}

.analysis-status-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.analysis-status-option:hover {
    background: var(--surface);
}

/* Action icons bar */
.analysis-actions-bar {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.analysis-action-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 38px;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    font-size: 0.9rem;
}

.analysis-action-icon:last-child {
    border-right: none;
}

.analysis-action-icon:hover {
    background: var(--surface);
    color: var(--primary);
}

/* =============================================
   ANALYSIS FILTERS
   ============================================= */

.analysis-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.analysis-filter-select {
    padding: 9px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.analysis-filter-select:hover {
    border-color: var(--border-hover);
}

.analysis-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Download dropdown */
.analysis-download-dropdown {
    position: relative;
}

.analysis-download-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 50;
    overflow: hidden;
}

.analysis-download-dropdown.open .analysis-download-menu {
    display: block;
}

.analysis-download-menu a {
    display: block;
    padding: 10px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.1s;
}

.analysis-download-menu a:hover {
    background: var(--surface);
}

#question-results-container {
    max-width: 800px;
    margin: 0 auto;
}

/* =============================================
   SUMMARY QUESTION CARDS (Reference-style)
   ============================================= */

.summary-question-card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.summary-question-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.summary-question-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.summary-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.summary-meta-badge i {
    font-size: 0.7rem;
}

.summary-question-content {
    margin-top: 8px;
}

/* Choice bars (reference style) */
.summary-choice-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.summary-choice-label {
    color: var(--text-primary);
}

.summary-choice-right {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.summary-choice-bar-track {
    width: 100%;
    height: 10px;
    background: var(--surface);
    border-radius: 5px;
    margin-bottom: 12px;
    overflow: hidden;
}

.summary-choice-bar-fill {
    height: 100%;
    background: var(--border-hover);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.summary-choice-bar-fill.bar-primary {
    background: var(--primary);
}

/* Rating stacked bar */
.summary-rating-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.summary-rating-stacked {
    display: flex;
    height: 40px;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 8px;
}

.summary-rating-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    transition: width 0.5s ease;
}

.summary-rating-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Text results table */
.summary-text-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-text-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.summary-text-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.summary-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    vertical-align: middle;
    margin-right: 6px;
}

.summary-user-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.6rem;
    vertical-align: middle;
    margin-right: 4px;
}

/* =============================================
   NPS RESULT
   ============================================= */

.nps-result {
    padding: 4px 0;
}

.nps-explainer,
.csat-explainer {
    background: var(--bg-tertiary, #f0f4ff);
    border-left: 3px solid var(--primary, #3b82f6);
    padding: 10px 14px;
    margin-bottom: 14px;
    border-radius: 0 6px 6px 0;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-secondary, #475569);
}

.nps-explainer i,
.csat-explainer i {
    color: var(--primary, #3b82f6);
    margin-right: 4px;
}

.nps-score-display {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.nps-score-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.nps-score-value.nps-excellent { color: #16a34a; }
.nps-score-value.nps-good { color: #eab308; }
.nps-score-value.nps-poor { color: #ef4444; }

.nps-score-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.nps-segments {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.nps-segment {
    flex: 1;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.nps-segment-detractors { background: #fef2f2; border: 1px solid #fecaca; }
.nps-segment-passives { background: #fefce8; border: 1px solid #fef08a; }
.nps-segment-promoters { background: #f0fdf4; border: 1px solid #bbf7d0; }

.nps-segment-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.nps-segment-detractors .nps-segment-value { color: #dc2626; }
.nps-segment-passives .nps-segment-value { color: #ca8a04; }
.nps-segment-promoters .nps-segment-value { color: #16a34a; }

.nps-segment-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.nps-distribution {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
    padding-top: 8px;
}

.nps-dist-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nps-dist-bar-wrap {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.nps-dist-bar {
    width: 100%;
    max-width: 36px;
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
    min-height: 2px;
}

.nps-bar-detractor { background: #ef4444; }
.nps-bar-passive { background: #eab308; }
.nps-bar-promoter { background: #22c55e; }

.nps-dist-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
}

.nps-dist-count {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary);
}

.nps-average {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =============================================
   MATRIX RESULT
   ============================================= */

.matrix-result-wrapper {
    overflow-x: auto;
}

.matrix-result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.matrix-result-table th {
    padding: 8px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

.matrix-result-table td {
    padding: 8px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.matrix-row-label {
    text-align: left !important;
    font-weight: 600;
    color: var(--text-primary);
}

.matrix-cell {
    border-radius: 4px;
    padding: 6px 10px;
    font-weight: 600;
}

/* Matrix view toggle (analysis) */
.matrix-view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}
.matrix-view-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.matrix-view-btn:hover { background: #e2e8f0; }
.matrix-view-btn.active {
    background: #1d4ed8;
    color: #fff;
    border-color: #1d4ed8;
}

/* Risk view cells */
.matrix-risk-cell {
    padding: 10px 8px !important;
    min-width: 60px;
    position: relative;
}
.matrix-cell-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    opacity: 0.95;
}
.matrix-cell-count {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-top: 2px;
}

/* =============================================
   RANKING RESULT
   ============================================= */

.ranking-result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ranking-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: var(--radius);
}

.ranking-result-pos {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ranking-result-label {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ranking-result-avg {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* =============================================
   DATE / TEXT / RAW RESULTS
   ============================================= */

.date-result-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.date-result-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.date-result-item i {
    color: var(--primary);
    font-size: 0.85rem;
}

.text-response-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.text-response-item:last-child {
    border-bottom: none;
}

.raw-result-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* =============================================
   RESPONSE DETAIL MODAL
   ============================================= */

.response-detail {
    padding: 4px 0;
}

.response-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.response-detail-meta strong {
    color: var(--text-primary);
}

.response-detail-answers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.response-answer-item {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.response-answer-question {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.response-answer-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.file-download-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    margin: 2px 4px 2px 0;
    transition: background 0.15s;
}
.file-download-link:hover {
    background: #e2e8f0;
}

/* Column Settings Panel */
/* Responses search bar */
.responses-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.responses-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted, #94a3b8);
    font-size: 0.82rem;
    pointer-events: none;
}
.responses-search-input {
    padding: 9px 32px 9px 34px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 260px;
    transition: border-color 0.2s;
}
.responses-search-input:hover {
    border-color: var(--border-hover);
}
.responses-search-input:focus {
    outline: none;
    border-color: var(--primary);
}
.responses-search-input::placeholder {
    color: var(--text-muted, #94a3b8);
    font-weight: 400;
}
.responses-search-clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.75rem;
    border-radius: 4px;
}
.responses-search-clear:hover {
    color: var(--text-primary, #1a1a1a);
    background: var(--hover-bg, #f1f5f9);
}

.column-settings-wrapper {
    position: relative;
}

.column-settings-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--glass-bg, #fff);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 0;
}
.column-settings-panel.open {
    display: block;
}

.column-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border, #e2e8f0);
}
.column-settings-header strong {
    font-size: 0.9rem;
}

.column-settings-list {
    padding: 6px 0;
}

.column-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.85rem;
    user-select: none;
}
.column-setting-item:hover {
    background: var(--bg-secondary, #f8fafc);
}
.column-setting-item span:first-child {
    display: flex;
    align-items: center;
    gap: 8px;
}
.column-setting-item span:first-child i {
    width: 16px;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    font-size: 0.8rem;
}

/* Toggle switch */
.col-toggle-input {
    display: none;
}
.col-toggle-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 11px;
    transition: background 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}
.col-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.col-toggle-input:checked + .col-toggle-slider {
    background: var(--primary, #1d4ed8);
}
.col-toggle-input:checked + .col-toggle-slider::after {
    transform: translateX(18px);
}

/* Locked toggle */
.column-setting-item.locked {
    opacity: 0.6;
    cursor: default;
}
.col-toggle-slider.locked {
    cursor: not-allowed;
}

/* Column settings separator */
.column-settings-separator {
    padding: 8px 16px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #94a3b8);
    border-top: 1px solid var(--border-color, #e2e8f0);
    margin-top: 4px;
}

/* Response ID badge */
.response-id-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    background: var(--surface);
    border-radius: 4px;
    font-size: 0.78rem;
    font-family: monospace;
    color: var(--text-muted);
}

.btn-copy-id {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.7rem;
    padding: 2px;
}

.btn-copy-id:hover {
    color: var(--primary);
}

/* SHARE MODAL - styles définis plus haut dans Share Modal Tabs */

.share-link-row {
    display: flex;
    gap: 8px;
}

.share-link-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}

.share-embed-textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 0.8rem;
    background: var(--surface);
    resize: vertical;
}

.stat-card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-card:hover {
    border-color: var(--primary);
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Survey cards */
.survey-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.survey-card {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}

.survey-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.survey-card-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.survey-card-header-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.survey-card-header-badges .dropdown-wrapper {
    margin-left: auto;
}

.survey-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.survey-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    line-height: 1.5;
    margin-bottom: 12px;
}

.survey-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.survey-card-meta i {
    margin-right: 4px;
}

.survey-card-owner {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.survey-card-owner i {
    margin-right: 4px;
}

.survey-card-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* =============================================
   BADGES
   ============================================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-neutral { background: var(--surface); color: var(--text-muted); }
.badge-category { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary); font-weight: 700; }

/* =============================================
   TABLES
   ============================================= */

.table-container {
    overflow-x: auto;
}

/* Bounded table: vertical + horizontal scroll happen INSIDE the container,
   so the horizontal scrollbar stays visible at the bottom of the table area
   instead of forcing the user to scroll the whole page. */
.table-container-bounded {
    max-height: calc(100vh - 320px);
    min-height: 360px;
    overflow: auto;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    /* Always reserve space for scrollbars to avoid layout shift */
    scrollbar-gutter: stable;
}

/* When inside a bounded container, the table itself loses its own border
   and rounding (the wrapper provides them) and the thead becomes sticky. */
.table-container-bounded .admin-table {
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}
.table-container-bounded .admin-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
    /* Solid background so rows scrolling underneath don't show through */
    background: var(--surface);
    box-shadow: inset 0 -2px 0 var(--border);
}

.admin-table {
    width: 100%;
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border-collapse: collapse;
}

.admin-table thead {
    background: var(--surface);
    border-bottom: 2px solid var(--border);
}

.admin-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.admin-table th.sortable:hover {
    color: var(--primary);
}

.admin-table th .sort-icon {
    margin-left: 4px;
    font-size: 0.7rem;
    opacity: 0.4;
}

.admin-table th.sortable:hover .sort-icon {
    opacity: 0.7;
}

.admin-table th .sort-icon.fa-sort-up,
.admin-table th .sort-icon.fa-sort-down {
    opacity: 1;
    color: var(--primary);
}

.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Réponses individuelles : tronquer les cellules (surtout les commentaires
   texte libre) sur une seule ligne pour garder des lignes compactes et lisibles.
   Le contenu complet reste accessible en ouvrant le détail de la réponse (œil). */
#responses-table tbody td {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    padding-top: 9px;
    padding-bottom: 9px;
}
/* Cellules à NE PAS tronquer : Actions (boutons) et ID de réponse (badge + copie). */
#responses-table tbody td.resp-cell-keep {
    max-width: none;
    overflow: visible;
    white-space: nowrap;
}

.admin-table tbody tr:hover {
    background: var(--surface);
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-cell img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}

.user-meta strong {
    display: block;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-meta span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* =============================================
   TABS
   ============================================= */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* =============================================
   MODALS
   ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--glass-bg);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    padding: 18px 20px;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* =============================================
   TOAST NOTIFICATIONS
   ============================================= */

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease-out, opacity 0.3s, visibility 0.3s;
    cursor: pointer;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    visibility: visible;
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

/* =============================================
   UTILITY CLASSES
   ============================================= */

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
.font-extra-bold { font-weight: 800; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }

/* =============================================
   EMPTY STATE
   ============================================= */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.empty-state .btn {
    text-decoration: none;
    margin-top: 4px;
    padding: 10px 24px;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb, 29, 78, 216), 0.3);
    transition: all 0.2s ease;
}

.empty-state .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb, 29, 78, 216), 0.4);
}

/* =============================================
   SEARCH INPUT
   ============================================= */

/* =============================================
   ADMIN FILTERS
   ============================================= */

.admin-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-filter-select {
    padding: 9px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.admin-filter-select:hover {
    border-color: var(--border-hover);
}

.admin-filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.search-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--glass-bg);
    transition: border-color 0.2s;
    flex: 1;
    min-width: 200px;
}

.search-input:focus-within {
    border-color: var(--primary);
}

.search-input i {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-input input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-primary);
    width: 100%;
}

/* =============================================
   PROGRESS BAR
   ============================================= */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* =============================================
   RESPONSIVE
   ============================================= */

/* Mobile top bar + backdrop are hidden on desktop */
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile top bar with hamburger (hidden on desktop) */
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        background: var(--glass-bg);
        border-bottom: 2px solid var(--border);
        position: sticky;
        top: 0;
        z-index: 90;
    }

    .mobile-hamburger {
        width: 40px;
        height: 40px;
        border-radius: var(--radius);
        border: 1px solid var(--border);
        background: var(--glass-bg);
        color: var(--text-primary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
        flex-shrink: 0;
    }

    .mobile-hamburger:hover,
    .mobile-hamburger:focus-visible {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--primary);
    }

    .mobile-topbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        text-decoration: none;
        color: var(--text-primary);
        min-width: 0;
    }

    .mobile-topbar-brand img {
        width: 32px;
        height: 32px;
        object-fit: contain;
        border-radius: 8px;
    }

    .mobile-topbar-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: linear-gradient(135deg, var(--primary), #3b82f6);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
    }

    .mobile-topbar-brand strong {
        font-size: 1rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #app {
        flex-direction: column;
    }

    /* Sidebar becomes an off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        border-right: 2px solid var(--border);
        border-bottom: none;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Hide the desktop collapse toggle on mobile */
    .sidebar-toggle {
        display: none;
    }

    /* Backdrop behind drawer */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 150;
    }

    .sidebar-backdrop.visible {
        display: block;
    }

    /* Prevent background scrolling when drawer is open */
    body.sidebar-open {
        overflow: hidden;
    }

    .main-content {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .survey-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .stats-grid-5 {
        grid-template-columns: 1fr;
    }

    .analysis-filters {
        flex-direction: column;
    }

    /* Analysis header stacks vertically on mobile */
    .analysis-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .analysis-title {
        font-size: 1.2rem;
        line-height: 1.25;
        word-break: break-word;
    }

    .analysis-header-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .analysis-status-dropdown {
        flex: 1;
        min-width: 130px;
    }

    .analysis-status-btn {
        width: 100%;
        justify-content: space-between;
    }

    .analysis-actions-bar {
        flex: 0 0 auto;
    }

    .analysis-header-right .btn-primary {
        flex: 1;
        min-width: 110px;
        justify-content: center;
    }

    /* Tabs become a compact 2-row grid (5 tabs fit on 2 lines) so all are visible without scrolling */
    .tabs {
        flex-wrap: wrap;
        gap: 2px;
        overflow-x: visible;
    }

    .tab {
        padding: 7px 8px;
        font-size: 0.78rem;
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
        min-width: 0;
    }

    .tab i {
        margin-right: 2px;
        font-size: 0.85em;
    }

    /* Card headers stack vertically on mobile so title + controls don't fight */
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .card-header > .flex,
    .card-header > div:not(:first-child) {
        flex-wrap: wrap;
        width: 100%;
    }

    /* Responses tab: search input + filters take full width and wrap */
    .responses-search-wrapper {
        flex: 1 1 100%;
    }

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

    #response-status-filter {
        flex: 1 1 auto;
        min-width: 130px;
    }

    /* AI Analysis card header: label/select/button wrap on multiple lines */
    #tab-ai-analysis .card-header > div:last-child {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    #tab-ai-analysis #ai-tone {
        flex: 1 1 100%;
        min-width: 0;
    }

    #tab-ai-analysis label[for="ai-tone"] {
        flex: 1 1 auto;
    }

    #tab-ai-analysis #btn-ai-analyze {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* Chat IA: hide the long explanatory hint to free space; shorten the panel */
    #tab-ai-chat .card {
        height: 70vh !important;
        min-height: 460px;
    }

    #tab-ai-chat .card-header > div:last-child > span {
        display: none;
    }

    /* Floating Chat IA overlay uses full screen on mobile */
    #ai-chat-floating-wrapper {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw;
        border-radius: 0 !important;
    }

    .modal-box {
        width: 95%;
        margin: 10px;
    }

    /* Generic responsive table → stacked cards on mobile (opt-in via class) */
    .responsive-stack-table,
    .responsive-stack-table thead,
    .responsive-stack-table tbody,
    .responsive-stack-table tr,
    .responsive-stack-table td {
        display: block;
        width: 100%;
    }

    .responsive-stack-table thead {
        display: none;
    }

    .responsive-stack-table tbody tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 12px 14px;
        margin-bottom: 10px;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    }

    .responsive-stack-table tbody tr:hover {
        background: var(--surface);
    }

    .responsive-stack-table td {
        border: none;
        padding: 4px 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        font-size: 0.85rem;
    }

    /* Field label (from data-label attr) on the left */
    .responsive-stack-table td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--text-muted);
        font-weight: 600;
        flex-shrink: 0;
    }

    /* First cell (Nom + kind badge) becomes the card title — full width, no label */
    .responsive-stack-table td:first-child {
        flex-direction: column;
        align-items: flex-start;
        padding-bottom: 8px;
        margin-bottom: 6px;
        border-bottom: 1px solid var(--border);
        font-size: 0.95rem;
    }

    .responsive-stack-table td:first-child::before {
        display: none;
    }

    .responsive-stack-table td:first-child strong {
        font-size: 1rem;
        line-height: 1.3;
    }

    .responsive-stack-table td:first-child .kind-badge {
        margin-top: 6px;
        margin-left: 0 !important;
    }

    /* Hide redundant Actions-as-link column — the whole card is already tappable */
    .responsive-stack-table td.cell-actions {
        display: none;
    }

    /* Floating dropdown action button at the top-right of each card */
    .responsive-stack-table td.cell-actions-menu {
        position: absolute;
        top: 8px;
        right: 8px;
        padding: 0;
        width: auto;
        display: block;
    }

    .responsive-stack-table td.cell-actions-menu::before {
        display: none;
    }

    .responsive-stack-table tbody tr {
        position: relative;
    }

    /* Reserve space at the top-right so the menu button doesn't overlap the title */
    .responsive-stack-table td:first-child {
        padding-right: 36px;
    }
}

/* =============================================
   REPORT TAB - DATAVIZ & AI
   ============================================= */

.report-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.report-chart-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    overflow: hidden;
}

.report-chart-wrapper {
    position: relative;
    min-height: 250px;
    width: 100%;
}

.report-chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.ai-analysis-content {
    padding: 20px;
}

.ai-analysis-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.ai-download-buttons {
    display: inline-flex;
    gap: 6px;
    margin-left: auto;
}

.btn-xs {
    padding: 3px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.ai-analysis-body {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.ai-analysis-body h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 20px 0 8px;
    color: var(--text-primary);
}

.ai-analysis-body h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 16px 0 6px;
    color: var(--text-primary);
}

.ai-analysis-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 14px 0 4px;
    color: var(--text-primary);
}

.ai-analysis-body ul {
    padding-left: 20px;
    margin: 8px 0;
}

.ai-analysis-body li {
    margin-bottom: 4px;
}

.ai-analysis-body strong {
    color: var(--primary);
}

.nps-score-big {
    text-align: center;
    padding: 16px 0;
}

/* Collapsible cards */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.85;
}

.collapse-icon {
    transition: transform 0.25s ease;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.collapsible-card.collapsed .collapse-icon {
    transform: rotate(180deg);
}

.collapsible-body {
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    max-height: 5000px;
    opacity: 1;
}

.collapsible-card.collapsed .collapsible-body {
    max-height: 0;
    opacity: 0;
}

.ai-chart-placeholder {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    height: 300px;
    max-width: 700px;
}

.ai-chart-placeholder canvas {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: calc(100% - 32px) !important;
    height: calc(100% - 32px) !important;
}

.ai-analysis-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 0.88rem;
}

.ai-analysis-body th,
.ai-analysis-body td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.ai-analysis-body th {
    background: var(--surface);
    font-weight: 600;
}

.ai-analysis-body tr:hover td {
    background: var(--surface);
}

/* Très petit écran : la barre mobile garde le logo, le nom de l'application cède la place aux actions. */
@media (max-width: 420px) {
    .mobile-topbar-brand strong { display: none; }
}
