/* ============================================================
   BreakTheSilence — VIVESCO — Feuille de styles principale
   ============================================================ */

/* ----- Variables CSS ---------------------------------------- */
:root {
    --primary:           #1E3A8A;
    --primary-hover:     #1E40AF;
    --primary-light:     #DBEAFE;
    --primary-dark:      #1e2f6a;

    --sidebar-bg:        #16213e;
    --sidebar-text:      #94A3B8;
    --sidebar-hover:     rgba(255,255,255,0.07);
    --sidebar-active:    rgba(99,179,237,0.15);
    --sidebar-border:    #60A5FA;

    --bg:                #F1F5F9;
    --card-bg:           #FFFFFF;
    --text:              #1E293B;
    --text-muted:        #64748B;
    --border:            #E2E8F0;
    --border-focus:      #93C5FD;

    --success:           #10B981;
    --success-light:     #D1FAE5;
    --warning:           #F59E0B;
    --warning-light:     #FEF3C7;
    --danger:            #EF4444;
    --danger-light:      #FEE2E2;
    --info:              #3B82F6;
    --info-light:        #DBEAFE;

    --navbar-height:     64px;
    --sidebar-width:     252px;
    --footer-height:     56px;
    --radius:            8px;
    --radius-lg:         12px;
    --shadow-sm:         0 1px 2px rgba(0,0,0,0.05);
    --shadow:            0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md:         0 4px 6px -1px rgba(0,0,0,0.10), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg:         0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -2px rgba(0,0,0,0.05);

    --transition:        150ms ease;
}

/* ----- Reset & base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

ul { list-style: none; }

/* ----- Navbar ----------------------------------------------- */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--navbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.navbar-left { display: flex; align-items: center; gap: 1rem; }
.navbar-right { display: flex; align-items: center; gap: 1rem; }

/* Logo / marque */
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.navbar-brand:hover { color: var(--text); }

.brand-icon {
    width: 34px; height: 34px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.brand-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}

.brand-text { font-weight: 400; color: var(--text-muted); }
.brand-text strong { font-weight: 700; color: var(--text); }

/* Bouton toggle sidebar (mobile) */
.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.sidebar-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: var(--transition);
}

/* Infos utilisateur navbar */
.user-info { display: flex; align-items: center; gap: 0.6rem; }

.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.user-name { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.user-role  { font-size: 0.72rem; color: var(--text-muted); text-transform: capitalize; }

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition);
}
.btn-logout:hover { background: var(--danger-light); color: var(--danger); }

/* ----- Sidebar ---------------------------------------------- */
.sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 900;
    transition: transform var(--transition);
}

.sidebar-nav { padding: 1rem 0; flex: 1; }

.sidebar-nav ul { display: flex; flex-direction: column; gap: 2px; padding: 0 0.75rem; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    white-space: nowrap;
}
.nav-link:hover { background: var(--sidebar-hover); color: #E2E8F0; }
.nav-link.active {
    background: var(--sidebar-active);
    color: #BFDBFE;
    border-left: 3px solid var(--sidebar-border);
    padding-left: calc(0.85rem - 3px);
}
.nav-link svg { flex-shrink: 0; opacity: 0.8; }
.nav-link.active svg { opacity: 1; }

.nav-separator {
    padding: 1.2rem 0.85rem 0.35rem;
    pointer-events: none;
}
.nav-separator span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}
.sidebar-footer .version {
    font-size: 0.7rem;
    color: #475569;
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 850;
}

/* ----- Layout principal ------------------------------------- */
.layout-wrapper {
    padding-top: var(--navbar-height);
    padding-left: var(--sidebar-width);
    padding-bottom: var(--footer-height);
    min-height: 100vh;
    transition: padding-left var(--transition);
}

.main-content {
    padding: 2rem;
    padding-bottom: calc(2rem + var(--footer-height));
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
}

/* Fond jaune clair pour les pages Sociétés */
.page-societes .main-content { background: #FEFCE8; }

/* Fond bleu clair pour les pages Clients */
.page-clients .main-content { background: #EFF6FF; }

/* ----- Page header ------------------------------------------ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-header-left { display: flex; flex-direction: column; gap: 0.2rem; }
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); }

/* ----- Cards ------------------------------------------------ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.card-title { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.card-body { padding: 1.5rem; }

/* ----- Stats cards ------------------------------------------ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card-link { text-decoration: none; color: inherit; cursor: pointer; }
.stat-card-link:hover { text-decoration: none; color: inherit; }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue    { background: var(--primary-light); color: var(--primary); }
.stat-icon.green   { background: var(--success-light); color: var(--success); }
.stat-icon.orange  { background: var(--warning-light); color: var(--warning); }
.stat-icon.red     { background: var(--danger-light);  color: var(--danger); }

.stat-info { flex: 1; }
.stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ----- Boutons ---------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }

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

.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-success  { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover  { background: #059669; color: #fff; }

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

.btn-warning  { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover  { background: #D97706; color: #fff; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ----- Formulaires ------------------------------------------ */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 0.875rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(147,197,253,0.3);
}
.form-control::placeholder { color: #94A3B8; }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 0.65rem center; background-size: 1.2em; padding-right: 2.5rem; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 0.3rem; }

/* ----- Alertes ---------------------------------------------- */
.alert {
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
.alert-success { background: var(--success-light); color: #065F46; border: 1px solid #6EE7B7; }
.alert-danger  { background: var(--danger-light);  color: #991B1B; border: 1px solid #FCA5A5; }
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FCD34D; }
.alert-info    { background: var(--info-light);    color: #1E40AF; border: 1px solid #93C5FD; }

/* ----- Tableaux --------------------------------------------- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}
.table-wrapper table { min-width: 720px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
thead th {
    background: var(--bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }

/* ----- Badges ----------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-green   { background: var(--success-light); color: #065F46; }
.badge-orange  { background: var(--warning-light); color: #92400E; }
.badge-red     { background: var(--danger-light);  color: #991B1B; }
.badge-blue    { background: var(--info-light);    color: #1E40AF; }
.badge-gray    { background: #F1F5F9; color: var(--text-muted); }

/* ----- Priorité relances ------------------------------------ */
.priority-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.priority-dot.green  { background: var(--success); }
.priority-dot.orange { background: var(--warning); }
.priority-dot.red    { background: var(--danger); }

/* ----- Page de connexion ------------------------------------ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #0f172a 100%);
    padding: 1.5rem;
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2.25rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-img {
    width: 130px;
    height: 130px;
    object-fit: contain;
    margin: 0 auto .75rem;
    display: block;
}

.login-logo {
    width: 56px; height: 56px;
    background: var(--primary);
    color: #fff;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 14px rgba(30,58,138,0.35);
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}

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

.login-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ----- Page d'erreur accès interdit ------------------------- */
.forbidden-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    flex-direction: column;
    gap: 1rem;
    text-align: center;
}

/* ----- État vide (empty state) ------------------------------ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
    gap: 0.75rem;
    color: var(--text-muted);
}
.empty-state svg { opacity: 0.3; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.empty-state-text  { font-size: 0.875rem; }

/* ----- Utilitaires ------------------------------------------ */
.mt-0  { margin-top: 0; }
.mb-0  { margin-bottom: 0; }
.mt-1  { margin-top: 0.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mb-2  { margin-bottom: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-3  { margin-bottom: 1.5rem; }

.text-muted   { color: var(--text-muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-center  { text-align: center; }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.font-bold    { font-weight: 700; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.w-full { width: 100%; }
.w-100  { width: 100%; }
.hidden { display: none; }

/* ----- Grille de formulaire --------------------------------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 1.5rem;
}
.form-grid .form-full { grid-column: 1 / -1; }

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ----- Groupe de boutons ------------------------------------ */
.action-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ----- Card footer ------------------------------------------ */
.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ----- Section header (entre deux cards) -------------------- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 1.75rem 0 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

/* ----- Utilitaires supplémentaires -------------------------- */
.fw-600     { font-weight: 600; }
.mt-3       { margin-top: 1.5rem; }
.mt-4       { margin-top: 2rem; }
.mb-4       { margin-bottom: 2rem; }
.text-primary { color: var(--primary); }

/* Badges priorité relance */
.priority-green  { background: var(--success-light); color: #065F46; }
.priority-orange { background: var(--warning-light); color: #92400E; }
.priority-red    { background: var(--danger-light);  color: #991B1B; }

/* Badge jours */
.badge-days {
    display: inline-block;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    margin-left: 0.35rem;
}

/* Email preview */
.email-preview {
    font-family: Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Alert warning */
.alert-warning { background: var(--warning-light); color: #92400E; border: 1px solid #FCD34D; }

/* Spinner variante sombre */
.spinner-dark { border-color: var(--border); border-top-color: var(--text); }

/* Filtre/recherche liste */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.list-toolbar .form-control { max-width: 280px; }
.list-toolbar .form-control.wide { max-width: 400px; }

/* Champ de détail (label + valeur) */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem 2rem;
}
.detail-item {}
.detail-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.detail-value {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .form-full { grid-column: 1; }
    .action-btns { justify-content: flex-start; }
    .list-toolbar .form-control { max-width: 100%; }
}

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

/* ----- Spinner de chargement -------------------------------- */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Responsive ------------------------------------------- */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    /* Relances — bascule en 1 colonne plus tôt pour éviter l'écrasement */
    div[style*="grid-template-columns:1fr 1.3fr"] {
        display: block !important;
    }
    div[style*="grid-template-columns:1fr 1.3fr"] > div {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open { display: block; }

    .layout-wrapper { padding-left: 0; }

    .main-content {
        padding: 1.25rem;
        padding-bottom: calc(1.25rem + var(--footer-height));
    }

    .app-footer { left: 0; }

    .user-details { display: none; }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .page-title { font-size: 1.35rem; }

    .card-header,
    .card-body,
    .card-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .card-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .form-grid { grid-template-columns: 1fr !important; }
    .form-grid .form-full { grid-column: 1; }

    .list-toolbar { gap: 0.6rem; }
    .list-toolbar .form-control,
    .list-toolbar .form-control.wide { max-width: 100%; }

    .action-btns { width: 100%; }
    .action-btns .btn { max-width: 100%; }

    .table-wrapper table { min-width: 640px; }

    /* Import steps : compact */
    .import-steps { gap: .25rem; flex-wrap: wrap; }
    .step-sep { display: none; }
    .step-label { font-size: .75rem; }
}

/* ----- Responsive mobile (480px) -------------------------- */
@media (max-width: 480px) {
    .login-card { padding: 2rem 1.5rem; }
    .navbar { padding: 0 1rem; }
    .main-content {
        padding: 1rem;
        padding-bottom: calc(1rem + var(--footer-height));
    }

    .stats-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* Boutons pleine largeur dans form-actions */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; text-align: center; }

    /* Action buttons en colonne */
    .action-btns { flex-direction: column; gap: .35rem; }
    .action-btns .btn { width: 100%; text-align: center; }
    .btn { white-space: normal; justify-content: center; }

    .table-wrapper table { min-width: 560px; }

    /* Modale d'envoi */
    #modale-envoi { padding: .75rem !important; }
    #modale-envoi > div {
        width: 100% !important;
        max-height: 94vh !important;
    }
    #modal-corps { min-height: 220px !important; }
}

/* ----- Lignes de tableau cliquables ------------------------- */
tr.tr-clickable { cursor: pointer; }
tr.tr-clickable:hover td { background: var(--primary-light); }
tr.tr-clickable.is-active td,
tr.tr-clickable.is-active:hover td { background: #F8FAFC; }

/* ----- En-têtes de colonnes triables ------------------------ */
.sort-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.sort-link:hover { color: var(--primary); }
.sort-link.active { color: var(--primary); }

.sort-icon {
    font-size: .8rem;
    opacity: .5;
    transition: opacity var(--transition);
}
.sort-link:hover .sort-icon,
.sort-link.active .sort-icon { opacity: 1; }
.sort-link.active .sort-icon { color: var(--primary); }

/* ----- Footer application ----------------------------------- */
.app-footer {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    z-index: 920;
    min-height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: .75rem 1.5rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(15, 23, 42, 0.06);
    font-size: .78rem;
    color: var(--text-muted);
    text-align: center;
    flex-wrap: wrap;
}
.app-footer-text { line-height: 1.5; }
.app-footer-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.app-footer-link:hover { text-decoration: underline; }
.app-footer-logo {
    height: 28px;
    width: auto;
    opacity: .85;
    flex-shrink: 0;
}
