/* ============================================================
   Convention Manager — Feuille de style principale
   Charte graphique : bleu foncé #0F2A4A / or #D4AF37
   Inspirations : Notion (navigation), Trello (Kanban),
                   Power BI (tableau de bord)
   ============================================================ */

:root {
    /* Couleurs principales */
    --color-primary: #0F2A4A;
    --color-primary-light: #1C3F66;
    --color-accent: #D4AF37;
    --color-accent-soft: #F4E9C8;
    --color-white: #FFFFFF;

    /* Couleurs de support */
    --color-bg: #F4F5F7;
    --color-surface: #FFFFFF;
    --color-border: #E2E5EA;
    --color-text: #1A1A1A;
    --color-text-muted: #6B7280;

    --color-success: #22A06B;
    --color-success-bg: #E7F6EF;
    --color-warning: #E0A800;
    --color-warning-bg: #FDF3DD;
    --color-error: #D64545;
    --color-error-bg: #FBEAEA;
    --color-info: #2C6FBB;
    --color-info-bg: #E8F1FB;

    --sidebar-width: 248px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(15, 42, 74, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 42, 74, 0.10);
    --transition: 160ms ease;
}

[data-theme="dark"] {
    --color-primary: #15355C;
    --color-primary-light: #1F4470;
    --color-bg: #0A1929;
    --color-surface: #102A43;
    --color-border: #1E3A5F;
    --color-text: #E6EDF3;
    --color-text-muted: #93A6BD;

    --color-success-bg: rgba(34, 160, 107, 0.16);
    --color-warning-bg: rgba(224, 168, 0, 0.16);
    --color-error-bg: rgba(214, 69, 69, 0.16);
    --color-info-bg: rgba(44, 111, 187, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--color-primary); text-decoration: none; }
[data-theme="dark"] a { color: var(--color-accent); }

h1, h2, h3, h4 {
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.25;
}

p { line-height: 1.55; }

/* ============================================================
   AUTH (login)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--color-primary) 0%, #0A1929 100%);
    padding: 20px;
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border-top: 4px solid var(--color-accent);
}

.auth-card .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-card .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.auth-card h1 { font-size: 20px; margin-bottom: 2px; }
.auth-card .subtitle { color: var(--color-text-muted); font-size: 14px; margin: 0; }

.auth-demo {
    margin-top: 20px;
    padding: 12px 14px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.auth-demo strong { color: var(--color-text); }

/* ============================================================
   LAYOUT GENERAL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar (style Notion) ---- */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header .brand-mark {
    width: 36px; height: 36px;
    background: var(--color-accent);
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-header .brand-name {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}
.sidebar-header .brand-name small {
    display: block;
    font-weight: 400;
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.sidebar-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.40);
    padding: 14px 10px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.78);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background var(--transition), color var(--transition);
}

.sidebar-link .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(212, 175, 55, 0.14);
    color: var(--color-accent);
    border-left-color: var(--color-accent);
}

.sidebar-link.disabled {
    color: rgba(255,255,255,0.30);
    cursor: default;
}
.sidebar-link.disabled:hover { background: none; }

.sidebar-link .phase-tag {
    margin-left: auto;
    font-size: 10px;
    background: rgba(255,255,255,0.10);
    padding: 1px 6px;
    border-radius: 999px;
    color: rgba(255,255,255,0.55);
}

/* Groupes déroulants par convention */
.sidebar-conv-group { margin-bottom: 2px; }

.sidebar-conv-toggle {
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.78);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    font-family: inherit;
}
.sidebar-conv-toggle:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-conv-toggle.open  { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-conv-toggle .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-conv-name { flex: 1; }

.sidebar-conv-arrow {
    font-size: 12px;
    color: rgba(255,255,255,0.40);
    transition: transform var(--transition);
    display: inline-block;
}
.sidebar-conv-toggle.open .sidebar-conv-arrow { transform: rotate(180deg); }

.sidebar-conv-menu { padding-left: 8px; }

.sidebar-sublink {
    padding: 7px 10px 7px 14px;
    font-size: 13px;
    font-weight: 400;
    color: rgba(255,255,255,0.62);
    border-left: 2px solid rgba(255,255,255,0.10) !important;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 1px;
}
.sidebar-sublink:hover { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.9); }
.sidebar-sublink.active {
    background: rgba(212,175,55,0.14);
    color: var(--color-accent);
    border-left-color: var(--color-accent) !important;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 13px;
}

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

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

.sidebar-user .name { font-weight: 600; font-size: 13px; }
.sidebar-user .role { font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar-footer a {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
}
.sidebar-footer a:hover { color: #fff; }

/* ---- Main column ---- */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.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 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar h1 { font-size: 18px; margin: 0; }

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

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--color-text);
    padding: 4px 8px;
}

.theme-toggle {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--color-text);
}

.content {
    padding: 24px;
    flex: 1;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.page-header .subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 4px 0 0 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 41, 0.5);
    z-index: 99;
}

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
    line-height: 1.2;
    white-space: nowrap;
}

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

.btn-accent {
    background: var(--color-accent);
    color: var(--color-primary);
}
.btn-accent:hover { opacity: 0.88; }

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

.btn-danger {
    background: var(--color-error);
    color: #fff;
}
.btn-danger:hover { opacity: 0.88; }

.btn-ghost {
    background: transparent;
    color: var(--color-text-muted);
}
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }

.btn-sm { padding: 5px 10px; font-size: 13px; }

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

.btn-icon {
    width: 34px; height: 34px;
    padding: 0;
    justify-content: center;
}

/* ============================================================
   CARTES & TABLEAU DE BORD (style Power BI)
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-accent);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
}
[data-theme="dark"] .stat-card .stat-value { color: var(--color-accent); }

.stat-card.stat-success { border-left-color: var(--color-success); }
.stat-card.stat-warning { border-left-color: var(--color-warning); }
.stat-card.stat-error   { border-left-color: var(--color-error); }

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-bar {
    height: 10px;
    border-radius: 999px;
    background: var(--color-border);
    overflow: hidden;
}
.progress-bar > span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
    border-radius: 999px;
    transition: width 300ms ease;
}

/* Liste compacte (ex : tâches en retard sur le dashboard) */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}
.mini-list li:last-child { border-bottom: none; }
.mini-list .meta { color: var(--color-text-muted); font-size: 12px; }

/* Répartition par équipe (barres horizontales) */
.team-bars { display: flex; flex-direction: column; gap: 10px; }
.team-bar-row { display: grid; grid-template-columns: 130px 1fr 50px; align-items: center; gap: 10px; font-size: 13px; }
.team-bar-row .progress-bar { height: 8px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-neutral { background: var(--color-border); color: var(--color-text); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-error   { background: var(--color-error-bg);   color: var(--color-error); }
.badge-info    { background: var(--color-info-bg);    color: var(--color-info); }
.badge-accent  { background: var(--color-accent-soft); color: #8a6d10; }
[data-theme="dark"] .badge-accent { background: rgba(212,175,55,0.18); color: var(--color-accent); }

/* ============================================================
   TABLEAUX
   ============================================================ */
.table-wrapper {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.data-table th, table.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

table.data-table th {
    background: var(--color-bg);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
table.data-table th.sortable:hover { color: var(--color-primary); }
[data-theme="dark"] table.data-table th.sortable:hover { color: var(--color-accent); }

table.data-table th .sort-arrow { opacity: 0.4; font-size: 10px; margin-left: 4px; }

table.data-table tbody tr:hover { background: var(--color-bg); }
table.data-table tbody tr:last-child td { border-bottom: none; }

table.data-table td.actions { text-align: right; white-space: nowrap; }
table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-total {
    font-size: 13px;
    color: var(--color-text-muted);
    padding: 10px 16px;
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
}
.table-total strong { color: var(--color-text); font-size: 14px; }

/* ============================================================
   FORMULAIRES & MODALES
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--color-text);
}
label .optional { color: var(--color-text-muted); font-weight: 400; }

input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

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

.field-error {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 25, 41, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--color-surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    border-top: 4px solid var(--color-accent);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-close {
    background: none; border: none; font-size: 20px; cursor: pointer;
    color: var(--color-text-muted); line-height: 1;
}
.modal-body { padding: 20px 22px; }
.modal-footer {
    padding: 16px 22px;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   TOASTS
   ============================================================ */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    max-width: 320px;
}

.toast {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-info);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
    font-size: 13px;
    animation: toast-in 200ms ease;
}
.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-error { border-left-color: var(--color-error); }
.toast.toast-warning { border-left-color: var(--color-warning); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   KANBAN (style Trello)
   ============================================================ */
.view-switch {
    display: inline-flex;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}
.view-switch a {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
}
.view-switch a.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .view-switch a.active { color: var(--color-accent); }

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 16px;
    overflow-x: auto;
    align-items: start;
}

.kanban-column {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px;
    min-height: 200px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 0 4px;
}

.kanban-column-header h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-column-header .count {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 12px;
    padding: 1px 8px;
    color: var(--color-text-muted);
}

.kanban-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-a_faire   { background: var(--color-text-muted); }
.dot-en_cours  { background: var(--color-info); }
.dot-terminee  { background: var(--color-success); }
.dot-en_retard { background: var(--color-error); }

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 40px;
}

.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    font-size: 13px;
    transition: box-shadow var(--transition);
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card.dragging { opacity: 0.5; }
.kanban-card .kanban-title {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: var(--color-text);
}
.kanban-card .kanban-title:hover { color: var(--color-primary); }
[data-theme="dark"] .kanban-card .kanban-title:hover { color: var(--color-accent); }
.kanban-card .kanban-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: var(--color-text-muted);
    font-size: 12px;
}
.kanban-card .kanban-progress { margin-top: 8px; }

.kanban-placeholder {
    border: 2px dashed var(--color-accent);
    border-radius: var(--radius-sm);
    height: 56px;
    background: var(--color-accent-soft);
}

/* ============================================================
   DÉTAIL DE TÂCHE
   ============================================================ */
.task-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.steps-week {
    margin-bottom: 14px;
}
.steps-week h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}
.step-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 14px;
}
.step-row.done .step-label { text-decoration: line-through; color: var(--color-text-muted); }
.step-row input[type="checkbox"] { width: 18px; height: 18px; }

.comment {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.comment:last-child { border-bottom: none; }
.comment .comment-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}
.comment .comment-meta strong { color: var(--color-text); }

/* ============================================================
   ÉTAT VIDE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h2 { color: var(--color-text); }

/* ---- En-tête de carte convention (dashboard) ---- */
.conv-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}
.conv-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
    .kanban-board { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
    .task-detail-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-md);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.open { display: block; }

    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; align-items: center; }

    /* Espacements resserrés sur petit écran */
    .content { padding: 14px; }
    .topbar { padding: 0 14px; }
    .topbar h1 {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .panel { padding: 16px !important; }

    .kanban-board { grid-template-columns: 1fr; }

    /* Cartes de statistiques : 2 colonnes plutôt que pleine largeur */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    /* Carte convention : titre au-dessus, boutons en grille pleine largeur */
    .conv-card-header { flex-direction: column; align-items: stretch; }
    .conv-card-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        justify-content: stretch;
    }
    .conv-card-actions .btn { text-align: center; padding: 9px 8px; }

    /* En-tête de page (toutes les pages) : titre puis actions, empilés pleine largeur */
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header > div { min-width: 0; }
    /* Groupe d'actions à droite du titre -> rangée qui passe à la ligne */
    .page-header > div:last-child:not(:only-child) {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    .page-header > div:last-child:not(:only-child) .btn { flex: 1 1 auto; }
    .page-header .view-switch { display: flex; flex: 1 1 100%; }
    .page-header .view-switch a { flex: 1 1 auto; text-align: center; }

    /* Barres d'outils / filtres : occupent toute la largeur */
    .table-toolbar { align-items: stretch; }
    .filters { width: 100%; }
    .filters select, .filters input { flex: 1 1 auto; }

    /* Sélecteur d'onglets défilable si trop large */
    .view-switch { max-width: 100%; overflow-x: auto; }

    /* Les tableaux défilent horizontalement dans leur conteneur */
    .table-wrapper { width: 100%; }
    table.data-table { font-size: 13px; }
    table.data-table th, table.data-table td { padding: 10px 12px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-header h2 { font-size: 20px; }
    .btn { padding: 9px 12px; }
    .conv-card-actions { grid-template-columns: repeat(2, 1fr); }
}
