/* ═══════════════════════════════════════════════════════════════
   TUNET – Feuille de style principale
   Design : Moderne, sobre, professionnel
   Fonts  : DM Sans (UI) + IBM Plex Mono (chiffres)
═══════════════════════════════════════════════════════════════ */

/* ─── Variables CSS ─────────────────────────────────────────── */
:root {
    /* Palette principale */
    --color-primary:       #6366f1;
    --color-primary-light: #818cf8;
    --color-primary-dark:  #4f46e5;
    --color-primary-bg:    #eef2ff;

    /* Accents */
    --color-success:    #10b981;
    --color-success-bg: #d1fae5;
    --color-danger:     #ef4444;
    --color-danger-bg:  #fee2e2;
    --color-warning:    #f59e0b;
    --color-warning-bg: #fef3c7;
    --color-info:       #0ea5e9;
    --color-info-bg:    #e0f2fe;

    /* Gris (fond, texte) */
    --color-bg:          #f8fafc;
    --color-surface:     #ffffff;
    --color-surface-alt: #f1f5f9;
    --color-border:      #e2e8f0;
    --color-border-dark: #cbd5e1;

    --color-text:        #0f172a;
    --color-text-muted:  #64748b;
    --color-text-light:  #94a3b8;

    /* Sidebar */
    --sidebar-bg:       #0f172a;
    --sidebar-width:    260px;
    --sidebar-text:     #94a3b8;
    --sidebar-active:   #6366f1;
    --sidebar-hover-bg: rgba(255,255,255,0.06);

    /* Layout */
    --topbar-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Ombres */
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl:  0 20px 60px rgba(0,0,0,0.12);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

img { max-width: 100%; height: auto; }

/* ─── Typographie ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: 1.875rem; font-weight: 700; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

.mono {
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    letter-spacing: 0;              /* Espacement neutre pour les chiffres */
    font-feature-settings: 'tnum' 1; /* Chiffres tabulaires alignés */
}

/* ─── Layout Principal ──────────────────────────────────────── */
.layout-body {
    display: flex;
    min-height: 100vh;
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition-slow);
    overflow: hidden;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    backdrop-filter: blur(2px);
}

/* Logo */
.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    max-height: 36px;
    width: auto;
    object-fit: contain;
    filter: brightness(1.1);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.03em;
}

.logo-text::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    margin-left: 2px;
    vertical-align: super;
}

.sidebar-close-btn {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition);
}
.sidebar-close-btn:hover { color: #fff; }

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.nav-section {
    margin-bottom: 1.75rem;
    padding: 0 0.75rem;
}

.nav-section-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(148,163,184,0.5);
    padding: 0 0.625rem;
    margin-bottom: 0.375rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--border-radius-sm);
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary-light);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--color-primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--color-danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.125rem 0.45rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Footer sidebar */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.user-details {
    flex: 1;
    overflow: hidden;
}

.user-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    display: block;
    font-size: 0.75rem;
    color: var(--sidebar-text);
}

.logout-btn {
    color: var(--sidebar-text);
    font-size: 1rem;
    padding: 0.375rem;
    border-radius: 6px;
    transition: var(--transition);
    flex-shrink: 0;
}
.logout-btn:hover {
    color: var(--color-danger);
    background: rgba(239,68,68,0.1);
}

/* ─── Contenu Principal ─────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition-slow);
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text);
}

.topbar-subtitle {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}
.mobile-menu-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-sm);
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}
.topbar-btn:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.topbar-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border-radius: 50%;
    border: 2px solid var(--color-surface);
}

/* Zone de contenu des pages */
.page-content {
    flex: 1;
    padding: 2rem 1.75rem;
}

/* ─── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    background: var(--color-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--color-primary));
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stat-card.primary   { --card-accent: var(--color-primary); }
.stat-card.success   { --card-accent: var(--color-success); }
.stat-card.danger    { --card-accent: var(--color-danger); }
.stat-card.warning   { --card-accent: var(--color-warning); }
.stat-card.info      { --card-accent: var(--color-info); }

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.stat-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.03em;
    line-height: 1;
}

.stat-value.large {
    font-size: 2.25rem;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.375rem;
}

.stat-icon {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--card-accent, var(--color-primary));
    opacity: 0.12;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon-inner {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: var(--card-accent, var(--color-primary));
    z-index: 1;
}

/* ─── Grilles ───────────────────────────────────────────────── */
.grid {
    display: grid;
    gap: 1.25rem;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ─── Boutons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5625rem 1.25rem;
    border-radius: var(--border-radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1;
}

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

.btn-primary {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background: var(--color-primary-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--color-success);
    color: white;
}
.btn-success:hover {
    background: #059669;
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
    color: white;
}

.btn-warning {
    background: var(--color-warning);
    color: white;
}
.btn-warning:hover { background: #d97706; color: white; }

.btn-secondary {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

/* ─── Formulaires ───────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.125rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.form-label.required::after {
    content: ' *';
    color: var(--color-danger);
}

.form-control {
    width: 100%;
    padding: 0.5625rem 0.875rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-surface);
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.form-control:invalid:not(:placeholder-shown) {
    border-color: var(--color-danger);
}

.form-control::placeholder {
    color: var(--color-text-light);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='2' d='M2 5l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.25rem;
    cursor: pointer;
}

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

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

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.5625rem 0.875rem;
    background: var(--color-surface-alt);
    border: 1.5px solid var(--color-border);
    border-right: none;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.input-group .form-control {
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

/* Checkbox & Radio stylisés */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.form-check-input {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--color-border-dark);
    appearance: none;
    background: var(--color-surface);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.form-check-input:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L5 8.5 2 5.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px;
}

/* ─── Tableaux ───────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

table.tunet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.tunet-table th {
    text-align: left;
    padding: 0.875rem 1rem;
    background: var(--color-surface-alt);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.tunet-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

.tunet-table tbody tr {
    transition: var(--transition);
}

.tunet-table tbody tr:hover {
    background: var(--color-surface-alt);
}

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

/* ─── Badges de statut ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-planned  { background: var(--color-info-bg);    color: var(--color-info); }
.badge-paid     { background: var(--color-success-bg); color: var(--color-success); }
.badge-late     { background: var(--color-danger-bg);  color: var(--color-danger); }
.badge-cancelled{ background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-expected { background: var(--color-info-bg);    color: var(--color-info); }
.badge-received { background: var(--color-success-bg); color: var(--color-success); }
.badge-partial  { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-recurring { background: var(--color-primary-bg); color: var(--color-primary); }

/* ─── Modales ───────────────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.93) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.125rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: var(--transition);
    line-height: 1;
}
.modal-close:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* ─── Alertes / Notifications ───────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    border-left: 4px solid;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--color-success-bg);
    border-color: var(--color-success);
    color: #065f46;
}
.alert-danger {
    background: var(--color-danger-bg);
    border-color: var(--color-danger);
    color: #7f1d1d;
}
.alert-warning {
    background: var(--color-warning-bg);
    border-color: var(--color-warning);
    color: #78350f;
}
.alert-info {
    background: var(--color-info-bg);
    border-color: var(--color-info);
    color: #0c4a6e;
}

/* ─── Toast notifications ───────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: all;
    background: var(--color-text);
    color: white;
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    max-width: 360px;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.success { background: var(--color-success); }
.toast.danger  { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); }
.toast.info    { background: var(--color-primary); }

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.page-btn:hover {
    background: var(--color-primary-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.page-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

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

/* ─── États vides ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3.5rem 2rem;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

/* ─── Loading spinner ───────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ─── Utilities ─────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap    { flex-wrap: wrap; }
.gap-xs { gap: 0.375rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

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

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }

.w-full { width: 100%; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
}

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

/* ─── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.page-header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.page-header-sub {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* ─── Filtres ───────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: var(--color-surface);
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
}

.filter-bar .form-control {
    width: auto;
    min-width: 140px;
}

/* ─── Progress bar ──────────────────────────────────────────── */
.progress {
    height: 8px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--color-primary);
    transition: width 0.6s ease;
}

/* ─── Connexion (page login) ────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 1.5rem;
}

.login-card {
    background: var(--color-surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--color-border);
}

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

.login-logo img {
    max-width: 160px;
    max-height: 60px;
    object-fit: contain;
}

.login-logo-text {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.04em;
}

.login-logo-text::after {
    content: '.';
    color: var(--color-success);
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 0.375rem;
}

.login-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    text-align: center;
}
