/* =============================================================================
   topbar.css — Esthetique "Prune & Rose poudre", feminine et tres pro.
   Tons plum + rose corail doux + ivoire chaud, typographie systeme.
   Registre cabinet RH / coaching / formation B2B haut de gamme.
   ============================================================================= */

:root {
    --bg-page: #faf6f5;          /* ivoire chaud */
    --bg-card: #ffffff;
    --bg-topbar: #3a1f3d;        /* prune profond */
    --fg-topbar: #faf6f5;
    --fg-muted: #c4a8b8;          /* rose mauve doux pour texte secondaire en topbar */
    --accent: #d97a8a;            /* rose corail doux */
    --accent-hover: #c0586a;      /* rose corail plus profond */
    --accent-soft: #f5e2e6;       /* rose pale pour backgrounds subtils */
    --gold: #c8a878;              /* touche doree pour separateurs / etats */
    --plum-text: #3a1f3d;         /* titres et headings */
    --body-text: #3d2a3a;         /* texte courant, charcoal teinte plum */
    --danger: #c0392b;
    --ok: #5d8a6a;                /* vert sauge plutot que vert vif */
    --border: #ead8d8;            /* bordure douce rose-beige */
    --radius: 6px;
    --shadow-sm: 0 1px 2px rgba(58, 31, 61, 0.06);
    --shadow-md: 0 4px 16px rgba(58, 31, 61, 0.10);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    color: var(--body-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* -----------------------------------------------------------------------------
   Banner impersonation (admin "voit en tant que" un autre user)
   -------------------------------------------------------------------------- */

.impersonation-banner {
    background: linear-gradient(90deg, #f4b01a, #e89a0a);
    color: #2a1530;
    text-align: center;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 2px solid #c08000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.impersonation-banner strong { color: var(--plum-text); }
.impersonation-banner .btn-link {
    background: rgba(58, 31, 61, 0.85);
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
}
.impersonation-banner .btn-link:hover {
    background: var(--plum-text);
    text-decoration: none;
}

/* Quand on est en mode impersonation, on garde une bordure orange subtile sur le viewport */
body.impersonating { box-shadow: inset 0 0 0 3px #f4b01a; }

/* -----------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
    background: var(--bg-topbar);
    color: var(--fg-topbar);
    border-bottom: 1px solid #2a1530;
    box-shadow: var(--shadow-sm);
}

.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 18px;
    height: 56px;
}

.topbar-home {
    color: var(--fg-topbar);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity .15s ease;
}
.topbar-home:hover { opacity: 1; }

.topbar-brand {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0.2px;
    margin-right: 12px;
}
.topbar-brand .brand-main { color: var(--fg-topbar); }
.topbar-brand .brand-accent { color: var(--accent); margin-left: 4px; }

.topbar-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}

.topbar-link {
    color: var(--fg-topbar);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    transition: background .15s ease;
}
.topbar-link:hover, .topbar-link.active {
    background: rgba(255, 255, 255, 0.08);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-client {
    color: var(--fg-muted);
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.topbar-client .topbar-switch {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}
.topbar-client .topbar-switch:hover { color: var(--accent-hover); }

.topbar-user {
    color: var(--fg-muted);
    font-size: 13px;
}

.topbar-logout {
    color: var(--fg-topbar);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.08);
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}
.topbar-logout:hover { background: rgba(255, 255, 255, 0.16); }
.topbar-logout svg { display: block; }

/* -----------------------------------------------------------------------------
   Subnav (sous-bar contextuelle)
   -------------------------------------------------------------------------- */

.subnav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.subnav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 44px;
}

.subnav-link {
    color: var(--body-text);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.subnav-link:hover {
    background: var(--accent-soft);
    color: var(--plum-text);
}
.subnav-link.active {
    background: var(--accent-soft);
    color: var(--plum-text);
    font-weight: 600;
}

/* -----------------------------------------------------------------------------
   Page main
   -------------------------------------------------------------------------- */

.page-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.page-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-sm);
}

.page-h1 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 600;
    color: var(--plum-text);
}

.page-lead {
    margin: 0;
    color: #6b7280;
    font-size: 15px;
}

.page-footer {
    text-align: center;
    color: #9ca3af;
    padding: 20px 0 30px;
    font-size: 12px;
}

/* -----------------------------------------------------------------------------
   Login + choose-client
   -------------------------------------------------------------------------- */

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 36px 32px 30px;
    width: 100%;
    max-width: 420px;
}

.login-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
}
.login-title .brand-main { color: var(--plum-text); }
.login-title .brand-accent { color: var(--accent); margin-left: 6px; }

.login-sub {
    margin: 0 0 24px;
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.login-info {
    background: var(--accent-soft);
    color: var(--plum-text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 0 16px;
}

.login-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 10px 12px;
    font-size: 13px;
    margin: 0 0 16px;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#loginForm input[type=email] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    font-family: inherit;
}
#loginForm input[type=email]:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-color: transparent;
}

#loginForm button {
    background: var(--accent);
    color: white;
    border: 0;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease;
}
#loginForm button:hover { background: var(--accent-hover); }

.login-msg {
    margin: 14px 0 0;
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    color: #6b7280;
}
.login-msg.ok { color: var(--ok); }
.login-msg.error { color: var(--danger); }

.login-foot {
    margin: 18px 0 0;
    text-align: center;
    font-size: 12px;
}
.login-foot a {
    color: #6b7280;
    text-decoration: none;
}
.login-foot a:hover { text-decoration: underline; }

/* Choose-client */

.client-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.client-list form { margin: 0; }

.client-btn {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: inherit;
    transition: border-color .15s ease, background .15s ease;
}
.client-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.client-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--plum-text);
}

.client-role {
    font-size: 12px;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =============================================================================
   Admin pages (clients/, futures pages admin)
   ============================================================================= */

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 20px;
    flex-wrap: wrap;
}

.admin-toolbar .page-h1 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.back-link {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: normal;
}
.back-link:hover { color: var(--accent); }

.toggle-deleted {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--body-text);
    cursor: pointer;
}
.toggle-deleted input { cursor: pointer; }

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin: 0 0 24px;
    box-shadow: var(--shadow-sm);
}

.admin-card h2 {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--plum-text);
}

.admin-card .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 18px;
}
.admin-card .card-head h2 { margin: 0; }

.admin-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;  /* nowrap actif partout -> scroll horizontal si besoin */
}

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

.admin-table thead th {
    background: var(--accent-soft);
    color: var(--plum-text);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table thead th.sortable { cursor: pointer; user-select: none; }
.admin-table thead th.sortable:hover { background: #f0d4d9; }
.admin-table thead th .sort-arrow {
    color: var(--accent);
    font-size: 10px;
    margin-left: 4px;
}

.admin-table thead th.num { text-align: right; }
.admin-table thead th.actions { text-align: right; }

.admin-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3e7e7;
    font-size: 14px;
    vertical-align: middle;
    white-space: nowrap;
}

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

.admin-table tbody tr:hover { background: #fdf8f8; }

.admin-table tbody td.num { text-align: right; }
.admin-table tbody td.actions { text-align: right; white-space: nowrap; }
.admin-table tbody td.empty { text-align: center; color: var(--fg-muted); padding: 30px; font-style: italic; }
.admin-table tbody td.muted { color: var(--fg-muted); }

.admin-table code {
    background: #f5e2e6;
    color: var(--plum-text);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
    font-family: 'Menlo', 'Monaco', monospace;
}

.row-deleted td {
    color: var(--fg-muted);
    background: #faf2f2;
    text-decoration: line-through;
    text-decoration-color: rgba(58, 31, 61, 0.25);
}
.row-deleted td.actions { text-decoration: none; }
.row-deleted strong { color: var(--fg-muted); }

/* Badges */

.badge-ok, .badge-off, .badge-deleted {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-ok    { background: #dff5e3; color: #2d6e3f; }
.badge-off   { background: #f0e6e6; color: #6b5260; }
.badge-deleted { background: #f5d4d4; color: #8a2c2c; margin-left: 8px; text-decoration: none; }
.badge-admin { background: #e9d8ee; color: var(--plum-text); }
.badge-client { background: var(--accent-soft); color: var(--plum-text); }
.badge-internal { background: #efe5d6; color: #7a5400; }

/* Buttons */

.btn-primary {
    background: var(--accent);
    color: white;
    border: 0;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: inherit;
    transition: background .15s ease;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-link {
    background: transparent;
    color: var(--accent);
    border: 0;
    padding: 4px 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-family: inherit;
}
.btn-link:hover { text-decoration: underline; color: var(--accent-hover); }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { color: #8a2c2c; }

/* Boutons icône (actions tableaux : éditer/cloner/supprimer) */
.btn-icon {
    background: transparent;
    border: 0;
    padding: 5px;
    cursor: pointer;
    color: var(--fg-muted);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
    margin: 0 1px;
}
.btn-icon svg { width: 16px; height: 16px; display: block; }
.btn-icon:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn-icon.danger:hover { background: #fbe4e4; color: var(--danger); }
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Forms */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px 18px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--plum-text);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.form-grid label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 500;
    color: var(--body-text);
}

.form-grid input[type=text],
.form-grid input[type=email],
.form-grid select,
.form-grid textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--body-text);
    resize: vertical;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-color: transparent;
}

/* Description tronquée dans la liste (sinon une description longue casse la mise en page) */
.cell-description {
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.inline-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: transparent;
    color: var(--body-text);
}
.inline-input:focus, .inline-input:hover {
    outline: none;
    border-color: var(--border);
    background: var(--bg-card);
}
.inline-input[type=checkbox] { width: auto; }

.muted { color: var(--fg-muted); }
.small { font-size: 12px; }

.hidden { display: none !important; }

/* =============================================================================
   Flatpickr — overrides pour matcher la palette prune/rose
   ============================================================================= */

.flatpickr-calendar {
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(58, 31, 61, 0.15);
    border: 1px solid var(--border);
    font-family: inherit;
}

.flatpickr-months {
    background: var(--accent-soft);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    padding: 6px 0;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month,
.flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: var(--plum-text);
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    color: var(--plum-text);
    fill: var(--plum-text);
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    color: var(--accent-hover);
    fill: var(--accent-hover);
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: inherit; }

.flatpickr-weekdays { background: var(--accent-soft); }
.flatpickr-weekday {
    color: var(--plum-text) !important;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.flatpickr-day {
    color: var(--body-text);
    border-radius: 6px;
    border-color: transparent;
    font-weight: 500;
}
.flatpickr-day:hover, .flatpickr-day:focus,
.flatpickr-day.prevMonthDay:hover, .flatpickr-day.nextMonthDay:hover {
    background: var(--accent-soft);
    border-color: transparent;
    color: var(--plum-text);
}
.flatpickr-day.today {
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
.flatpickr-day.today:hover { background: var(--accent-soft); color: var(--plum-text); }
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected.today {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.flatpickr-day.flatpickr-disabled { color: var(--fg-muted); opacity: 0.4; }
.flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay { color: var(--fg-muted); }

.flatpickr-current-month .numInputWrapper:hover { background: rgba(255, 255, 255, 0.4); }

/* L input "alt" affiche en FR doit avoir le meme look que les autres inputs du form */
.form-grid input.flatpickr-input.form-control,
.form-grid input.flatpickr-alt-input,
input.flatpickr-input.form-control,
input.flatpickr-alt-input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--body-text);
    cursor: pointer;
}
input.flatpickr-alt-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-color: transparent;
}

/* =============================================================================
   Modale (centree, overlay sombre, fermeture click-outside + Escape)
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(58, 31, 61, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(2px);
    animation: fadeIn .12s ease-out;
}

.modal-overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
    background: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(58, 31, 61, 0.25);
    padding: 28px 32px 24px;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    animation: slideUp .15s ease-out;
}

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

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.modal-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--plum-text);
}

.modal-close {
    background: transparent;
    border: 0;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--fg-muted);
    padding: 0 4px;
    transition: color .15s ease;
}
.modal-close:hover { color: var(--accent-hover); }

.modal-hint { margin: 0 0 16px; }

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.modal-card input[readonly] {
    background: #f7eeee;
    color: var(--fg-muted);
    cursor: not-allowed;
}

.modal-card-large { max-width: 720px; }

.form-grid textarea {
    min-height: 80px;
}

/* =============================================================================
   Client switcher dropdown (top bar)
   ============================================================================= */

.topbar-client-wrapper { position: relative; }

.topbar-client.clickable {
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.topbar-client.clickable:hover { background: rgba(255, 255, 255, 0.10); }

button.topbar-client {
    font-family: inherit;
    color: var(--fg-muted);
}

.client-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(58, 31, 61, 0.18);
    padding: 6px;
    z-index: 800;
}

.client-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 0;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: var(--body-text);
}
.client-dropdown-item:hover { background: var(--accent-soft); }
.client-dropdown-item.active { background: var(--accent-soft); font-weight: 600; color: var(--plum-text); }
.client-dropdown-item .cdi-name { flex: 1; }
.client-dropdown-item .cdi-role { font-size: 11px; text-transform: uppercase; color: var(--fg-muted); letter-spacing: 0.4px; }
.client-dropdown-item .cdi-check { color: var(--accent); font-weight: 700; }

/* =============================================================================
   User menu dropdown (avatar initiales + Mon compte + futur)
   ============================================================================= */

.topbar-user-wrapper { position: relative; }

.topbar-user-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--fg-topbar);
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    transition: background .15s ease;
}
.topbar-user-btn:hover { background: rgba(255, 255, 255, 0.10); }

.topbar-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent, #9b6c9e);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.topbar-user-email { color: var(--fg-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-caret { color: var(--fg-muted); font-weight: 600; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(58, 31, 61, 0.18);
    padding: 6px;
    z-index: 800;
}

.user-dropdown-head {
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
    color: var(--body-text);
    font-size: 13px;
    word-break: break-all;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: var(--body-text);
    font-size: 14px;
}
.user-dropdown-item:hover { background: var(--accent-soft); }
.user-dropdown-item .udi-icon { font-size: 16px; width: 20px; text-align: center; }

/* =============================================================================
   Page Mon compte : ajustements
   ============================================================================= */

.notice-banner {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 12px 0;
    font-size: 14px;
}

.email-readonly-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.email-readonly-row input { flex: 1; }
.email-readonly-row input[readonly] {
    background: rgba(0,0,0,0.03);
    color: var(--fg-muted);
    cursor: not-allowed;
}

/* Topbar : logo entreprise (à la place du nom du compte si uploaded) */
.topbar-brand .brand-logo {
    height: 28px;
    max-width: 140px;
    width: auto;
    object-fit: contain;
    margin-left: 8px;
    vertical-align: middle;
}

/* === Section identité juridique : toggle physical / legal === */
.legal-entity-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 18px;
}
.legal-radio {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 14px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    background: var(--bg-card);
    transition: all .15s ease;
    position: relative;
}
.legal-radio:hover { border-color: var(--accent); }
.legal-radio.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.legal-radio input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.legal-radio-icon { font-size: 24px; margin-bottom: 6px; }
.legal-radio-label { font-weight: 600; color: var(--body-text); font-size: 14px; }
.legal-radio-hint { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }

/* === Logo uploader === */
.logo-uploader {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-top: 12px;
}
.logo-preview {
    width: 180px;
    height: 120px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(45deg, #f6f6f6 25%, transparent 25%, transparent 75%, #f6f6f6 75%, #f6f6f6),
                linear-gradient(45deg, #f6f6f6 25%, transparent 25%, transparent 75%, #f6f6f6 75%, #f6f6f6);
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    /* Damier subtil pour visualiser la transparence du logo */
    overflow: hidden;
    flex-shrink: 0;
}
.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}
.logo-actions { flex: 1; }
.logo-actions .btn-primary { margin-bottom: 8px; }

/* =============================================================================
   Themes : picker user/account (cards) + admin editor + live preview
   ============================================================================= */

/* Picker theme dans /account/ : grille de cartes */
.theme-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.theme-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    background: var(--bg-card);
    cursor: pointer;
    transition: all .15s ease;
    text-align: center;
    position: relative;
}
.theme-card:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.theme-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.theme-card input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.theme-card-swatches {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 10px;
    height: 28px;
}
.theme-card-swatch {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.08);
}
.theme-card-name { font-weight: 600; color: var(--body-text); font-size: 13px; }
.theme-card-hint { display: block; margin-top: 2px; }

/* Admin /admin/themes/ : swatches dans la table de liste */
.theme-swatches { display: inline-flex; gap: 3px; }
.theme-swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.08); }

/* Admin editor /admin/themes/edit : layout 2 colonnes (form + preview live) */
.theme-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 1100px) {
    .theme-editor-layout { grid-template-columns: 1fr; }
}
.theme-editor-preview { position: sticky; top: 16px; }

/* Palette grid : 14 color pickers en colonne sur 2 cols */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
@media (max-width: 700px) { .palette-grid { grid-template-columns: 1fr; } }
.palette-row {
    display: grid;
    grid-template-columns: 110px 40px 1fr;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.palette-key { font-family: ui-monospace, monospace; font-size: 12px; color: var(--fg-muted); }
.palette-row input[type=color] { width: 40px; height: 36px; padding: 0; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; background: transparent; }
.palette-hex { font-family: ui-monospace, monospace; font-size: 12px; text-transform: lowercase; }

/* === Mockup live preview : tout est SCOPÉ a .theme-preview pour ne pas
   contaminer le reste de la page admin (qui garde son propre theme actif) === */
.theme-preview {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    color: var(--body-text);
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}
.theme-preview .pv-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-topbar);
    color: var(--fg-topbar);
    padding: 10px 16px;
    font-size: 13px;
}
.theme-preview .pv-brand { font-weight: 700; font-size: 15px; }
.theme-preview .pv-tab { color: var(--fg-muted); cursor: pointer; }
.theme-preview .pv-tab-active { color: var(--fg-topbar); font-weight: 600; border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.theme-preview .pv-spacer { flex: 1; }
.theme-preview .pv-avatar {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 10px;
}
.theme-preview .pv-page { padding: 18px 20px; }
.theme-preview .pv-h1 { color: var(--plum-text); margin: 0 0 6px; font-size: 18px; }
.theme-preview .pv-muted { color: var(--fg-muted); margin: 0 0 14px; font-size: 12px; }
.theme-preview .pv-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}
.theme-preview .pv-card h4 { margin: 0 0 6px; color: var(--plum-text); font-size: 14px; }
.theme-preview .pv-card p { margin: 0 0 10px; color: var(--body-text); font-size: 13px; }
.theme-preview .pv-link { color: var(--accent); text-decoration: underline; }
.theme-preview .pv-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.theme-preview .pv-btn-primary {
    background: var(--accent); color: #fff;
    border: 0; padding: 6px 14px; border-radius: var(--radius);
    font-size: 13px; cursor: pointer; font-family: inherit;
}
.theme-preview .pv-btn-primary:hover { background: var(--accent-hover); }
.theme-preview .pv-btn-link {
    background: transparent; color: var(--accent);
    border: 0; padding: 6px 14px; cursor: pointer; font-family: inherit;
    text-decoration: underline; font-size: 13px;
}
.theme-preview .pv-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.theme-preview .pv-badge {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.theme-preview .pv-badge-ok { background: var(--ok); color: #fff; }
.theme-preview .pv-badge-soft { background: var(--accent-soft); color: var(--plum-text); }
.theme-preview .pv-badge-danger { background: var(--danger); color: #fff; }
.theme-preview .pv-badge-gold { background: var(--gold); color: #fff; }

/* =============================================================================
   Dark mode overrides : ajustements globaux quand body.theme-dark
   (ou .theme-preview.theme-dark dans le mockup admin)
   ============================================================================= */

body.theme-dark, .theme-preview.theme-dark {
    /* Les CSS vars sont déjà inversées par la palette du theme. Ici on ajuste juste
       les ombres pour qu'elles soient visibles sur fond sombre (sinon tout disparait). */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* =============================================================================
   Project Management : tier badges + tier picker + page comparatif niveaux
   ============================================================================= */

/* Badge du tier de complexite (visible dans liste + header projet) */
.pm-tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--body-text);
    margin-left: 4px;
    vertical-align: middle;
}
.pm-tier-simple   { border-color: rgba(16, 185, 129, 0.4); background: rgba(16, 185, 129, 0.08); }
.pm-tier-standard { border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.08); }
.pm-tier-advanced { border-color: rgba(249, 115, 22, 0.5); background: rgba(249, 115, 22, 0.10); }
.pm-tier-pro      { border-color: rgba(239, 68, 68, 0.5);  background: rgba(239, 68, 68, 0.10); }

/* Row stripe : bande verticale gauche colorée selon tier (vue Liste projets).
   Plus compact que le badge texte, immediatement reconnaissable au survol grace
   au title sur le <tr>. */
.admin-table tr.tier-stripe td:first-child {
    border-left: 4px solid transparent;
    padding-left: 12px;
}
.admin-table tr.tier-stripe.tier-simple   td:first-child { border-left-color: #10b981; }
.admin-table tr.tier-stripe.tier-standard td:first-child { border-left-color: #f59e0b; }
.admin-table tr.tier-stripe.tier-advanced td:first-child { border-left-color: #f97316; }
.admin-table tr.tier-stripe.tier-pro      td:first-child { border-left-color: #ef4444; }

/* Priority stripe : meme pattern que tier-stripe mais sur les taches d un projet
   (couleur = priorite : basse=vert / moyenne=ambre / haute=orange / urgente=rouge) */
.admin-table tr.prio-stripe td:first-child {
    border-left: 4px solid transparent;
    padding-left: 12px;
}
.admin-table tr.prio-stripe.prio-basse    td:first-child { border-left-color: #10b981; }
.admin-table tr.prio-stripe.prio-moyenne  td:first-child { border-left-color: #f59e0b; }
.admin-table tr.prio-stripe.prio-haute    td:first-child { border-left-color: #f97316; }
.admin-table tr.prio-stripe.prio-urgente  td:first-child { border-left-color: #ef4444; }

/* Description sous titre — variante full (pas de line-clamp) pour les taches
   ou la lecture exhaustive est attendue. Wrap naturel sur n lignes. */
.row-subtitle-full {
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.4;
    margin-top: 3px;
    white-space: normal;
    word-wrap: break-word;
    max-width: 100%;
}

/* =============================================================================
   Liste des projets v2 : design plus dense + lisible
   ============================================================================= */

/* Hover de ligne pour signaler interactivite */
.projects-list-v2 tbody tr {
    transition: background .12s ease;
}
.projects-list-v2 tbody tr:hover {
    background: var(--accent-soft);
}

/* Title + sous-titre (description) dans la meme cellule */
.projects-list-v2 .row-title {
    line-height: 1.35;
    margin-bottom: 2px;
}
.projects-list-v2 .row-subtitle {
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.35;
    /* Truncation propre sur 2 lignes max — tooltip via title si veut le full */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 480px;
}

/* Cellule "Créé" : date + auteur empilés en compact */
.projects-list-v2 .cell-meta { line-height: 1.3; white-space: nowrap; }
.projects-list-v2 .cell-meta .muted { color: var(--fg-muted); }
.projects-list-v2 .cell-meta div + div { margin-top: 2px; }

/* Actions en icones uniquement */
.projects-list-v2 .actions-icons {
    white-space: nowrap;
    text-align: right;
}
.projects-list-v2 .actions-icons .btn-icon {
    background: transparent;
    border: 0;
    padding: 6px;
    cursor: pointer;
    color: var(--body-text);
    border-radius: 4px;
    transition: background .12s ease, color .12s ease;
    line-height: 0;
    margin-left: 2px;
}
.projects-list-v2 .actions-icons .btn-icon:hover { background: var(--bg-card); color: var(--accent); }
.projects-list-v2 .actions-icons .btn-icon.danger:hover { color: var(--danger); background: rgba(239, 68, 68, 0.08); }
.projects-list-v2 .actions-icons .btn-icon svg { display: block; }

/* Tier picker : fieldset dans la modale creation/edit projet */
fieldset.pm-tier-picker {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 8px 0;
    background: rgba(0,0,0,0.015);
}
fieldset.pm-tier-picker > legend {
    font-weight: 600;
    color: var(--plum-text);
    padding: 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.pm-tier-picker .pm-tier-radio {
    display: grid;
    grid-template-columns: 24px 110px 1fr;
    gap: 8px;
    align-items: center;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
}
.pm-tier-picker .pm-tier-radio:hover { background: var(--accent-soft); }
.pm-tier-picker .pm-tier-radio input[type=radio] { accent-color: var(--accent); }
.pm-tier-picker .pm-tier-radio-label { font-size: 14px; color: var(--body-text); }
.pm-tier-picker .pm-tier-radio-hint { font-size: 12px; line-height: 1.3; }

/* Page /projets/comparer-niveaux/ : grille des 4 cards */
.pm-tiers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.pm-tier-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}
.pm-tier-card-simple   { border-color: rgba(16, 185, 129, 0.4); }
.pm-tier-card-standard { border-color: rgba(245, 158, 11, 0.4); }
.pm-tier-card-advanced { border-color: rgba(249, 115, 22, 0.5); }
.pm-tier-card-pro      { border-color: rgba(239, 68, 68, 0.5); }
.pm-tier-card.coming-soon { opacity: 0.65; }

.pm-tier-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.pm-tier-card-icon { font-size: 22px; }
.pm-tier-card-label { margin: 0; font-size: 18px; color: var(--plum-text); }
.pm-tier-card-tagline { margin: 0 0 8px; font-size: 13px; }
.pm-tier-card-price { margin: 0 0 12px; font-size: 12px; color: var(--accent); font-weight: 600; }
.pm-tier-card-features { list-style: none; padding: 0; margin: 0; flex: 1; }
.pm-tier-card-features li {
    padding: 4px 0;
    font-size: 13px;
    color: var(--body-text);
    border-top: 1px solid var(--border);
}
.pm-tier-card-features li:first-child { border-top: 0; }

/* =============================================================================
   PM Standard tier : chips milestone / critique / slack / deps
   ============================================================================= */

.pm-chip-milestone {
    display: inline-block;
    color: var(--gold);
    font-weight: 700;
    font-size: 14px;
    margin-right: 2px;
    text-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.pm-chip-critical {
    display: inline-block;
    background: var(--danger);
    color: #fff;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 6px;
    letter-spacing: 0.3px;
    vertical-align: middle;
}
.pm-chip-slack {
    display: inline-block;
    background: rgba(16, 185, 129, 0.10);
    color: var(--ok);
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.pm-chip-deps {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
/* Adaptation Kanban : chips plus compactes en pied de carte */
.kanban-card .kc-chip {
    display: inline-block;
    margin-left: 0;
    margin-top: 2px;
    margin-right: 4px;
    font-size: 10px;
    padding: 1px 5px;
}

/* Nudge contextuel pour upgrade tier (projet en mode Simple) */
.pm-tier-nudge {
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin: 12px 0;
    font-size: 13px;
    color: var(--body-text);
}
.pm-tier-nudge a { color: var(--accent); font-weight: 600; }

/* Gantt customs (Frappe Gantt) */
.gantt-critical .bar { fill: var(--danger) !important; }
.gantt-milestone .bar { fill: var(--gold) !important; }
.gantt .bar-label { fill: #fff; }
#ganttContainer .gantt-container { font-family: inherit; background: var(--bg-card); border-radius: var(--radius); }

/* === Code couleur barres selon marge vs deadline ===
   Une barre = la portion PRÉVUE (start → start+duration).
   La couleur indique si on tient l'échéance :
     - .gantt-bar-ok      : marge confortable (>20% de la durée) → VERT
     - .gantt-bar-warning : marge serrée (<20%)                 → ORANGE
     - .gantt-bar-late    : dépasse la deadline                  → ROUGE
     - .gantt-bar-no_deadline : pas d'échéance définie           → gris-bleu neutre
   Note : .gantt-critical et .gantt-milestone gardent leur couleur prioritaire
   (rouge/or) via les règles ci-dessus en !important. */
.gantt-bar-ok .bar          { fill: #16a34a !important; }
.gantt-bar-warning .bar     { fill: #f59e0b !important; }
.gantt-bar-late .bar        { fill: #dc2626 !important; }
.gantt-bar-no_deadline .bar { fill: #64748b !important; }

/* La portion qui dépasse la deadline (overlay rectangulaire hachuré) */
.gantt-overflow {
    pointer-events: none;  /* laisse le clic atteindre la bar dessous */
    opacity: 0.85;
}

/* Marqueur deadline (ligne pointillée verticale rouge) */
.gantt-deadline-marker {
    pointer-events: none;
}

/* Hint inline sous chaque input date/durée dans la modal tâche.
   Apparaît quand 2 des 3 champs sont saisis pour suggérer le 3ème,
   ou pour signaler une incohérence quand les 3 sont saisis. */
.tm-date-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    min-height: 1.2em;
    transition: color 0.15s ease;
}
.tm-date-hint:empty {
    min-height: 0;
}

/* Filtre soft : tâches non-matching restent visibles mais dimmed (preserve contexte CPM) */
#ganttContainer .bar-wrapper.gantt-dimmed,
#ganttContainer .arrow.gantt-dimmed {
    opacity: 0.18;
    filter: grayscale(80%);
    transition: opacity .18s ease, filter .18s ease;
}
#ganttContainer .bar-wrapper:not(.gantt-dimmed),
#ganttContainer .arrow:not(.gantt-dimmed) {
    transition: opacity .18s ease, filter .18s ease;
}

/* Dark mode : inputs natifs ont besoin d ajustements */
body.theme-dark input[type=text],
body.theme-dark input[type=email],
body.theme-dark input[type=tel],
body.theme-dark input[type=date],
body.theme-dark input[type=number],
body.theme-dark input[type=password],
body.theme-dark input[type=search],
body.theme-dark textarea,
body.theme-dark select {
    background: var(--bg-card);
    color: var(--body-text);
    border-color: var(--border);
    color-scheme: dark;  /* native widgets dark */
}
body.theme-dark input[readonly] { background: rgba(255,255,255,0.04); }

/* === Fieldset "Identifiants entreprise" : encadré UNIQUEMENT en mode personne physique
   (pour expliquer que c'est facultatif si pas auto-entrepreneur). En mode personne morale
   (.entity-legal-mode) le bloc est neutralisé visuellement : les champs apparaissent comme
   les autres champs du formulaire, sans border ni légende. === */
.legal-business-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px 16px;
    margin: 6px 0;
    background: rgba(0, 0, 0, 0.015);
}
.legal-business-block > legend {
    font-weight: 600;
    color: var(--plum-text, var(--body-text));
    padding: 0 8px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Mode personne morale : on dé-cadre proprement */
.entity-legal-mode .legal-business-block {
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
}
.entity-legal-mode .legal-business-block > legend { display: none; }
.entity-legal-mode .legal-business-block > .form-grid { display: contents; }
/* display: contents fait remonter les <label> enfants directement dans le grid parent
   pour qu'ils s'alignent comme les autres champs du formulaire (cohérence visuelle). */

/* =============================================================================
   Project view : description, filters, vue toggle
   ============================================================================= */

.project-desc {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 0 0 18px;
    color: var(--body-text);
    line-height: 1.55;
    white-space: pre-wrap;
}

.task-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    flex-wrap: wrap;
}

.filter-input {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--body-text);
}
.filter-input:focus { outline: 2px solid var(--accent); outline-offset: -2px; border-color: transparent; }

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--body-text);
    cursor: pointer;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.view-toggle-btn {
    padding: 7px 14px;
    font-size: 13px;
    color: var(--body-text);
    text-decoration: none;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    transition: background .15s ease;
}
.view-toggle-btn:last-child { border-right: 0; }
.view-toggle-btn:hover { background: var(--accent-soft); }
.view-toggle-btn.active { background: var(--accent); color: white; font-weight: 600; }

.row-title-link {
    color: var(--plum-text);
    text-decoration: none;
}
.row-title-link:hover { color: var(--accent); text-decoration: underline; }

.task-title-link {
    color: var(--plum-text);
    text-decoration: none;
    font-weight: 500;
}
.task-title-link:hover { color: var(--accent); }

/* =============================================================================
   Status badges + priority pills
   ============================================================================= */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.prio {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.prio-basse    { background: #e6f0ea; color: #2d6e3f; }
.prio-moyenne  { background: #fdf3da; color: #7a5400; }
.prio-haute    { background: #fde2d4; color: #a23700; }
.prio-urgente  { background: #f5d4d4; color: #8a2c2c; }

/* =============================================================================
   Avatars (initiales empilees)
   ============================================================================= */

.avatar-stack {
    display: inline-flex;
    align-items: center;
}
.avatar-stack .avatar { margin-left: -6px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid var(--bg-card);
    text-transform: uppercase;
}
.avatar.small { width: 22px; height: 22px; font-size: 10px; border-width: 1px; }
.avatar.avatar-more { background: var(--fg-muted); }

/* Assignee chips : prenoms compactes (remplacent les avatars dans la liste/kanban) */
.cell-assignees { white-space: normal; line-height: 1.6; }

.assignee-chip {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--plum-text);
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin: 1px 3px 1px 0;
    white-space: nowrap;
}

.kc-assignees {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-left: 4px;
}
.kc-assignees .assignee-chip {
    margin: 0;
    font-size: 11px;
    padding: 1px 7px;
}

/* =============================================================================
   Kanban
   ============================================================================= */

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    overflow-x: auto;
}

.kanban-col {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    transition: border-color .15s ease, background .15s ease;
}
.kanban-col.drag-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.kanban-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.kanban-col-count {
    background: var(--accent-soft);
    color: var(--plum-text);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-col-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    cursor: grab;
    box-shadow: var(--shadow-sm);
    position: relative;
    transition: transform .12s ease, box-shadow .12s ease;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.4; }
.kanban-card[draggable=false] { cursor: pointer; }

.kc-prio {
    position: absolute;
    left: 0; top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 2px 2px 0;
}
.kc-prio.prio-basse    { background: #5d8a6a; }
.kc-prio.prio-moyenne  { background: #c8a878; }
.kc-prio.prio-haute    { background: #e08246; }
.kc-prio.prio-urgente  { background: #c0392b; }

.kc-title {
    margin: 0 0 6px 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--plum-text);
    cursor: pointer;
}
.kc-title:hover { color: var(--accent); }

.kc-meta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--fg-muted);
    margin-bottom: 6px;
    margin-left: 4px;
}

.kc-assignees {
    display: flex;
    margin-left: 4px;
}
.kc-assignees .avatar { margin-left: -6px; width: 22px; height: 22px; font-size: 10px; }
.kc-assignees .avatar:first-child { margin-left: 0; }

/* =============================================================================
   Picker compact (search + chips + scroll list) — utilisé pour assignés tâche
   et permissions employés/contacts. Pensé pour scaler à 20-30+ items.
   ============================================================================= */

.picker {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fafafa;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: normal;
    font-size: 13px;
    color: var(--body-text);
}

.picker-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 22px;
}

.picker-empty {
    color: var(--fg-muted);
    font-size: 12px;
    font-style: italic;
    padding: 2px 0;
}

.picker-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent);
    color: white;
    padding: 2px 4px 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.picker-chip button {
    background: rgba(255, 255, 255, 0.2);
    border: 0;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.picker-chip button:hover { background: rgba(255, 255, 255, 0.35); }

.picker-search {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--body-text);
}
.picker-search:focus {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-color: transparent;
}

.picker-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
}

/* Specificite renforcee : .form-grid label applique flex-column + uppercase
   sur tous ses enfants <label>, donc on doit override avec plus de poids. */
.picker .picker-row,
.form-grid .picker .picker-row {
    display: grid !important;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-bottom: 1px solid #f3e7e7;
    cursor: pointer;
    margin: 0;
    /* Reset des heritages du parent .form-grid label */
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: normal !important;
    font-size: 13px !important;
    color: var(--body-text) !important;
    flex-direction: row !important;
    text-align: left !important;
}
.picker .picker-row:last-child { border-bottom: 0; }
.picker .picker-row:hover { background: var(--accent-soft); }
.picker .picker-row input[type=checkbox] { margin: 0; cursor: pointer; }
.picker .picker-row:has(input:checked) { background: var(--accent-soft); }
.picker .picker-row-name {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: left;
    text-transform: none;
    font-size: 13px;
    font-weight: normal;
    color: var(--body-text);
}
.picker .picker-row-name strong { font-weight: 600; color: var(--plum-text); }
.picker .picker-row-email {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 280px;
    text-align: right;
    text-transform: none;
    font-size: 12px;
}

.member-role-select {
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--body-text);
}
.member-role-select:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================================================
   Assignees checkboxes (modale tache) — ANCIEN, garde pour fallback
   ============================================================================= */

.assignees-label { gap: 8px; }

.assignees-checks {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    background: #fafafa;
}

.assignee-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
    color: var(--body-text);
    font-weight: normal;
}
.assignee-check:hover { background: var(--accent-soft); }
.assignee-check input[type=checkbox] { margin: 0; }
.assignee-check .assignee-name { flex: 1; }
.assignee-check .assignee-role {
    font-size: 11px;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* =============================================================================
   Commentaires
   ============================================================================= */

.task-comments-block {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.task-comments-block h4 { margin: 0 0 12px; color: var(--plum-text); font-size: 14px; }

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 280px;
    overflow-y: auto;
    margin-bottom: 14px;
}

.comment {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 13px;
}
.comment-meta {
    font-size: 12px;
    color: var(--fg-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-meta strong { color: var(--plum-text); }
.comment-meta .btn-link { margin-left: auto; padding: 0 4px; font-size: 11px; }
.comment-body { color: var(--body-text); white-space: pre-wrap; word-wrap: break-word; }

.comment-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.comment-form textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

/* =============================================================================
   Status editor (modale paramètres projet)
   ============================================================================= */

.settings-section {
    padding: 18px 0 4px;
    border-bottom: 1px solid var(--border);
}
.settings-section:last-of-type { border-bottom: 0; }
.settings-section h4 { margin: 0 0 6px; color: var(--plum-text); font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.settings-section .muted.small { margin: 0 0 14px; }

.members-editor {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 12px 0 6px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    background: #fafafa;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid transparent;
}
.member-row:hover { border-color: var(--border); }
.member-row input[type=checkbox] { margin: 0; }
.member-row .member-info { flex: 1; font-size: 13px; }
.member-row select {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: inherit;
}
.member-row select:disabled { opacity: 0.4; }

.reminder-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.reminder-input-row input[type=number] {
    width: 80px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    text-align: center;
}

.statuses-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.status-row input[type=text] {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
}
.status-row input[type=color] {
    width: 36px; height: 28px;
    padding: 0; border: 1px solid var(--border); border-radius: 4px;
    cursor: pointer;
}
.status-row .status-move {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 24px; height: 24px;
    cursor: pointer;
    font-size: 11px;
}
.status-row .checkbox {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    color: var(--body-text);
    font-weight: normal;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* =============================================================================
   Responsive (mobile-first overrides : sous 768px on simplifie)
   ============================================================================= */

@media (max-width: 768px) {
    .topbar-inner { padding: 0 12px; gap: 10px; }
    .topbar-brand { font-size: 14px; }
    .topbar-user { display: none; }  /* ou abreviation */
    .topbar-client.clickable { padding: 4px 8px; font-size: 12px; }

    .page-main { padding: 18px 12px 40px; }
    .admin-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .admin-toolbar-actions { justify-content: space-between; }

    /* Tableaux deviennent des cards empilees */
    .admin-table thead { display: none; }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; width: 100%; }
    .admin-table tr {
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: 10px;
        background: var(--bg-card);
        padding: 10px 12px;
    }
    .admin-table td {
        border-bottom: 0 !important;
        padding: 4px 0 !important;
        white-space: normal !important;
    }
    .admin-table td.actions { text-align: left; padding-top: 8px !important; border-top: 1px solid var(--border) !important; }

    /* Kanban : scroll horizontal au lieu de grid */
    .kanban-board {
        display: flex;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 8px;
    }
    .kanban-col { min-width: 260px; flex: 0 0 260px; }

    .modal-card { padding: 22px 18px 18px; }
    .form-grid { grid-template-columns: 1fr; }
}

/* =================== Dashboard projets (sections empilées) =================== */
.dash-filters-bar {
    margin-top: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.dash-filter-count {
    margin-left: auto;
    align-self: center;
}
.dash-project {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 14px;
    overflow: hidden;
    transition: opacity .2s ease;
}
.dash-project.dash-project-empty {
    opacity: 0.35;
}
.dash-project-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px 12px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
    position: relative;
}
.dash-project.folded .dash-project-header {
    border-bottom: 0;
}
.dash-project .tier-stripe {
    width: 5px;
    height: 36px;
    flex: 0 0 5px;
    border-radius: 0;
}
.dash-fold-btn {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    padding: 4px 8px;
    line-height: 1;
}
.dash-fold-btn:hover { color: var(--accent); }
.dash-project-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.dash-project-title a {
    color: var(--plum-text);
    text-decoration: none;
}
.dash-project-title a:hover { color: var(--accent); text-decoration: underline; }
.dash-project-kpis {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.kpi-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--plum-text);
    white-space: nowrap;
}
.kpi-pill.kpi-done    { background: rgba(93, 138, 106, 0.18); color: #3e6e4d; }
.kpi-pill.kpi-overdue { background: rgba(217, 122, 138, 0.20); color: #b1455a; }
.kpi-pill.kpi-due     { background: rgba(200, 168, 120, 0.22); color: #8a6f3a; }
.dash-project-body {
    padding: 6px 0;
}
.dash-project.folded .dash-project-body {
    display: none;
}
.dash-task-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.dash-task {
    border-bottom: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    transition: background .12s ease;
    position: relative;
}
.dash-task:last-child { border-bottom: 0; }
.dash-task:hover { background: var(--accent-soft); }
.dash-task.dash-task-overdue {
    border-left-color: #ef4444;
    border-right-color: #ef4444;
    background: rgba(239, 68, 68, 0.04);
}
.dash-task.dash-task-overdue:hover {
    background: rgba(239, 68, 68, 0.08);
}
.dash-task {
    display: flex;
    align-items: stretch;
}
.dash-task-check {
    margin: 12px 4px 12px 12px;
    flex: 0 0 auto;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    align-self: flex-start;
    margin-top: 14px;
}
.dash-task-link {
    display: grid;
    grid-template-columns: 110px 1fr auto auto auto;
    align-items: start;
    gap: 6px 12px;
    padding: 10px 14px 10px 6px;
    text-decoration: none;
    color: var(--body-text);
    flex: 1;
    min-width: 0;
}
.dash-task-link > .dash-task-status,
.dash-task-link > .dash-task-assignees,
.dash-task-link > .dash-task-due,
.dash-task-link > .dash-task-comments {
    margin-top: 2px;
}
.dash-task-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.dash-task-titlecol {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.dash-task-title {
    font-size: 14px;
    color: var(--plum-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dash-task.dash-task-done .dash-task-title {
    text-decoration: line-through;
    opacity: 0.6;
}
.dash-task-desc {
    font-size: 12px;
    color: var(--fg-muted, var(--muted));
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
}
.dash-task-assignees {
    display: inline-flex;
    gap: 4px;
}
.dash-task-due {
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
}
.dash-task-due.overdue {
    color: var(--danger, #b1455a);
    font-weight: 600;
}
.dash-task-comments {
    font-size: 12px;
    color: var(--muted);
}
.dash-empty {
    padding: 12px 18px;
}

/* Popup détail tâche (dashboard) */
.dash-popup-body {
    padding: 18px 22px 16px;
}
.dash-popup-project {
    margin: 0 0 12px 0;
}
.dash-popup-project a {
    color: var(--accent);
    text-decoration: none;
}
.dash-popup-project a:hover { text-decoration: underline; }
.dash-popup-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: center;
}
.dash-popup-section-h {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin: 14px 0 6px 0;
}
.dash-popup-desc {
    white-space: pre-wrap;
    color: var(--body-text);
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-page);
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.dash-popup-assignees {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.dash-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.prio-pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

/* =================== Bulk action bar (sticky bottom) =================== */
.bulk-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: -100px;
    background: var(--bg-card);
    border-top: 2px solid var(--accent);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 1000;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.10);
    transition: bottom .25s ease;
    flex-wrap: wrap;
}
.bulk-bar.bulk-bar-visible { bottom: 0; }
.bulk-count {
    font-size: 14px;
    color: var(--plum-text);
    margin-right: auto;
}
.bulk-count strong {
    background: var(--accent);
    color: white;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    margin-right: 6px;
}
.bulk-bar .filter-input { min-width: 180px; }
.bulk-bar .btn-link { padding: 7px 12px; }
.bulk-bar .btn-link.bulk-danger { color: #b1455a; }
.bulk-bar .btn-link.bulk-danger:hover { background: rgba(239, 68, 68, 0.1); }
.bulk-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d6e3f;
    color: white;
    padding: 10px 22px;
    border-radius: 8px;
    z-index: 1100;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: bulk-toast-in .25s ease;
}
@keyframes bulk-toast-in {
    from { opacity: 0; transform: translate(-50%, -10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* =================== Topbar : cloche notifications =================== */
.topbar-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--topbar-text, white);
    text-decoration: none;
    padding: 8px;
    border-radius: 50%;
    transition: background .15s ease;
}
.topbar-bell:hover { background: rgba(255, 255, 255, 0.12); }
.topbar-bell-badge {
    position: absolute;
    top: 2px;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--topbar-bg, #3a3338);
}

/* =================== Page notifications =================== */
.notif-list {
    list-style: none;
    margin: 12px 0 0 0;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.notif-item {
    border-bottom: 1px solid var(--border);
    transition: background .12s ease;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--accent-soft); }
.notif-item.notif-unread { background: rgba(93, 138, 106, 0.05); }
.notif-item.notif-unread:hover { background: rgba(93, 138, 106, 0.10); }
.notif-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    text-decoration: none;
    color: var(--body-text);
}
.notif-icon {
    font-size: 22px;
    flex: 0 0 auto;
    line-height: 1.2;
}
.notif-body {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-weight: 600;
    color: var(--plum-text);
    font-size: 14px;
    margin-bottom: 3px;
}
.notif-text {
    font-size: 13px;
    color: var(--body-text);
    line-height: 1.4;
    margin-bottom: 4px;
}
.notif-meta {
    font-size: 11px;
    color: var(--muted);
}
.notif-type-label {
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
    margin-top: 8px;
}

/* =================== Activity feed (panel collapsible /view) =================== */
.activity-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 24px;
    overflow: hidden;
}
.activity-summary {
    cursor: pointer;
    padding: 12px 18px;
    font-weight: 600;
    color: var(--plum-text);
    background: var(--bg-page);
    border-bottom: 0;
    list-style: none;
    user-select: none;
    transition: background .12s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.activity-summary::-webkit-details-marker { display: none; }
.activity-summary::before {
    content: '▶';
    font-size: 10px;
    color: var(--muted);
    transition: transform .15s ease;
    display: inline-block;
}
.activity-panel[open] .activity-summary::before {
    transform: rotate(90deg);
}
.activity-summary:hover { background: var(--accent-soft); }
.activity-panel[open] .activity-summary {
    border-bottom: 1px solid var(--border);
}
.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 480px;
    overflow-y: auto;
}
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: 0; }
.activity-icon {
    font-size: 16px;
    flex: 0 0 auto;
    margin-top: 2px;
}
.activity-body { flex: 1; min-width: 0; }
.activity-line {
    font-size: 13px;
    color: var(--body-text);
    line-height: 1.4;
}
.activity-line strong {
    color: var(--plum-text);
    font-weight: 600;
}
.activity-line em {
    color: var(--accent);
    font-style: normal;
    font-weight: 500;
}
.activity-snippet {
    color: var(--muted);
    font-style: italic;
}
.activity-meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* =================== Page "Mes tâches" =================== */
.mt-bucket {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}
.mt-bucket-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
}
.mt-bucket-icon { font-size: 18px; }
.mt-bucket-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--plum-text);
    flex: 1;
}
.mt-bucket-count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--plum-text);
}
.mt-bucket-overdue .mt-bucket-header { background: rgba(239, 68, 68, 0.06); }
.mt-bucket-overdue .mt-bucket-title  { color: #b1455a; }
.mt-bucket-overdue .mt-bucket-count  { background: rgba(239, 68, 68, 0.15); color: #b1455a; }
.mt-bucket-today .mt-bucket-header   { background: rgba(200, 168, 120, 0.10); }
.mt-bucket-today .mt-bucket-title    { color: #8a6f3a; }

.mt-task-list { list-style: none; margin: 0; padding: 0; }
.mt-task {
    border-bottom: 1px solid var(--border);
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    transition: background .12s ease;
}
.mt-task:last-child { border-bottom: 0; }
.mt-task:hover { background: var(--accent-soft); }
.mt-task.mt-task-overdue {
    border-left-color: #ef4444;
    border-right-color: #ef4444;
    background: rgba(239, 68, 68, 0.04);
}
.mt-task.mt-task-overdue:hover { background: rgba(239, 68, 68, 0.08); }
.mt-task.mt-task-done .mt-task-title {
    text-decoration: line-through;
    opacity: 0.6;
}
.mt-task-link {
    display: grid;
    grid-template-columns: 110px 1fr auto auto;
    align-items: start;
    gap: 6px 12px;
    padding: 10px 14px 10px 18px;
    text-decoration: none;
    color: var(--body-text);
}
.mt-task-link > .mt-task-status,
.mt-task-link > .mt-task-due,
.mt-task-link > .mt-task-comments { margin-top: 2px; }
.mt-task-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mt-task-titlecol {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.mt-task-project {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mt-task-title {
    font-size: 14px;
    color: var(--plum-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mt-task-desc {
    font-size: 12px;
    color: var(--fg-muted, var(--muted));
    line-height: 1.4;
    white-space: normal;
    word-wrap: break-word;
}
.mt-task-due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mt-task-due.overdue { color: #b1455a; font-weight: 600; }
.mt-task-comments { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
    .mt-task-link { grid-template-columns: 80px 1fr; gap: 8px; padding: 10px 12px; }
    .mt-task-link > .mt-task-due,
    .mt-task-link > .mt-task-comments { grid-column: 2; font-size: 11px; }
}

/* =================== Mes tâches : vue Kanban =================== */
.mt-kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 12px;
}
.mt-kcol {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    min-height: 200px;
    overflow: hidden;
}
.mt-kcol-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}
.mt-kcol-icon { font-size: 16px; }
.mt-kcol-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--plum-text);
    flex: 1;
}
.mt-kcol-count {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--plum-text);
}
.mt-kcol-todo .mt-kcol-header     { border-top: 3px solid #94a3b8; }
.mt-kcol-progress .mt-kcol-header { border-top: 3px solid #c8a878; }
.mt-kcol-review .mt-kcol-header   { border-top: 3px solid #e08246; }
.mt-kcol-done .mt-kcol-header     { border-top: 3px solid #5d8a6a; }
.mt-kcol-body {
    padding: 8px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mt-kcol-empty {
    text-align: center;
    padding: 20px 8px;
    margin: 0;
    color: var(--muted);
}
.mt-kcard {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-left-color: transparent;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: box-shadow .12s ease, transform .12s ease;
}
.mt-kcard:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.mt-kcard.prio-basse    { border-left-color: #10b981; }
.mt-kcard.prio-moyenne  { border-left-color: #f59e0b; }
.mt-kcard.prio-haute    { border-left-color: #f97316; }
.mt-kcard.prio-urgente  { border-left-color: #ef4444; }
.mt-kcard.mt-task-overdue {
    border-right: 4px solid #ef4444;
    background: rgba(239, 68, 68, 0.04);
}
.mt-kcard-project {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mt-kcard-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--plum-text);
    line-height: 1.3;
}
.mt-kcard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 11px;
}
.mt-kcard-due {
    color: var(--muted);
    white-space: nowrap;
}
.mt-kcard-due.overdue {
    color: #b1455a;
    font-weight: 600;
}
.mt-kcard-comments {
    color: var(--muted);
}
.mt-kcard-status {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-left: auto;
}

/* Header de groupe dans pickers (utilisé pour labels société vs projet) */
.picker-group-header {
    padding: 8px 10px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    background: var(--bg-page);
    border-top: 1px solid var(--border);
}
.picker-group-header:first-child { border-top: 0; }
.label-scope-icon {
    margin-right: 4px;
    opacity: 0.7;
    font-size: 12px;
}

/* Tree indent dans pickers (déps, ...) */
.picker-tree-arrow {
    color: var(--muted);
    font-weight: 600;
}
.picker-tree-subbadge {
    display: inline-block;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(93, 138, 106, 0.15);
    color: #3e6e4d;
}

/* =================== WBS : tree liste + breadcrumb parent + stats sous-tâches =================== */

/* Bouton toggle ▸/▾ devant les parents */
.row-tree-toggle {
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--accent);
    font-size: 12px;
    padding: 0 6px 0 0;
    margin-right: 2px;
    line-height: 1;
}
.row-tree-toggle:hover { color: var(--plum-text); }
.row-tree-spacer {
    display: inline-block;
    width: 14px;  /* aligne les enfants sans toggle */
}

/* Différenciation visuelle parent vs enfant */
.task-row-parent {
    background: rgba(93, 138, 106, 0.03);
}
.task-row-child td:first-child {
    border-left: 2px solid var(--border);
}

/* Chip "📊 X/Y" sur les rows parents */
.pm-chip-subtasks {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(93, 138, 106, 0.12);
    color: #3e6e4d;
    margin-left: 6px;
}

/* Modale : breadcrumb tâche parente */
.tm-parent-breadcrumb {
    margin: 4px 0 12px;
    font-size: 12px;
    background: var(--accent-soft);
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 3px solid var(--accent);
}
.tm-parent-breadcrumb a {
    color: var(--plum-text);
    text-decoration: none;
}
.tm-parent-breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

/* Modale : bandeau "cette tâche EST un parent" avec progress bar */
.tm-subtask-stats {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    margin: 8px 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.tm-subtask-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--plum-text);
}
#tm_subtask_counter {
    font-size: 13px;
    font-weight: 600;
    color: #3e6e4d;
}
.tm-subtask-bar {
    flex: 1;
    min-width: 120px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.tm-subtask-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #5d8a6a, #7eaa84);
    transition: width .3s ease;
}

/* =================== Étiquettes / labels =================== */
.label-chip-mini {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,0.06);
}
.task-labels {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}
.task-labels .label-chip-mini {
    cursor: default;
}

/* =================== Mentions @user =================== */
.mention-tag {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 500;
}
.mention-popup {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    max-width: 320px;
    z-index: 2000;
    overflow: hidden;
}
.mention-popup-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-bottom: 1px solid var(--border);
}
.mention-popup-item:last-child { border-bottom: 0; }
.mention-popup-item.active,
.mention-popup-item:hover { background: var(--accent-soft); }

/* =================== Récurrence (modale tâche) =================== */
.tm-recurrence-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.tm-rec-days {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
}
.tm-rec-days label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    padding: 2px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
}
.tm-rec-days label input { margin: 0; }

/* =================== Notifications preferences matrix =================== */
.notif-prefs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 13px;
}
.notif-prefs-table th, .notif-prefs-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.notif-prefs-table th.num, .notif-prefs-table td.num {
    text-align: center;
    width: 90px;
    white-space: nowrap;
}
.notif-prefs-table thead th {
    background: var(--bg-page);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
}
.notif-cat-header td {
    background: var(--bg-page);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}
.notif-row:hover { background: var(--accent-soft); }
.notif-row td input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}
.notif-source-user    { color: var(--accent); font-weight: 600; font-size: 11px; }
.notif-source-company { color: #8a6f3a; font-weight: 600; font-size: 11px; }
.notif-source-default { font-weight: 600; font-size: 11px; }

/* =================== Bandeau "Statuts hérités / personnalisés" (settings projet) =================== */
.status-inherit-banner {
    background: var(--accent-soft);
    color: var(--plum-text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.status-inherit-banner.status-inherit-custom {
    background: rgba(200, 168, 120, 0.15);
}
.status-inherit-banner .btn-link {
    margin-left: auto;
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 4px;
}
.status-inherit-banner .btn-link:hover { background: var(--accent); color: white; }

/* =================== Bouton "+ Nouvelle tâche" + picker projet (dashboard) =================== */
.dash-newtask-wrapper {
    position: relative;
    display: inline-block;
}
.dash-newtask-picker {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.dash-newtask-picker-head {
    padding: 10px 14px 6px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--muted);
    font-size: 11px;
}
.dash-newtask-picker .filter-input {
    margin: 0 14px 8px;
}
.dash-newtask-picker-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border);
}
.dash-newtask-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: background .12s ease;
}
.dash-newtask-item:last-child { border-bottom: 0; }
.dash-newtask-item:hover { background: var(--accent-soft); }
.dash-newtask-item-name {
    color: var(--plum-text);
    font-weight: 500;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

/* =================== Pièces jointes (modale tâche) =================== */
.task-attach-block {
    margin: 22px 0 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.task-attach-block h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--plum-text);
}
.attach-list {
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.attach-empty {
    padding: 14px;
    text-align: center;
    background: var(--bg-page);
    border-radius: 6px;
}
.attach-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: background .12s ease;
}
.attach-item:hover { background: var(--accent-soft); }
.attach-thumb {
    flex: 0 0 auto;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border-radius: 5px;
    overflow: hidden;
    text-decoration: none;
}
.attach-thumb-img {
    width: 100%; height: 100%; object-fit: cover;
}
.attach-thumb-icon { font-size: 22px; }
.attach-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
}
.attach-name {
    color: var(--plum-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-name:hover { text-decoration: underline; color: var(--accent); }
.attach-meta { font-size: 11px; }
.attach-del {
    flex: 0 0 auto;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 14px;
    color: var(--muted);
    transition: background .12s ease, color .12s ease;
}
.attach-del:hover { background: rgba(239, 68, 68, 0.1); color: #b1455a; }

.attach-dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 22px 14px;
    text-align: center;
    background: var(--bg-page);
    transition: background .15s ease, border-color .15s ease;
}
.attach-dropzone.attach-dz-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}
.attach-dz-text { margin: 0 0 8px; color: var(--body-text); font-size: 13px; }
.attach-dz-btn {
    display: inline-block;
    padding: 8px 18px;
    background: var(--accent);
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background .12s ease;
}
.attach-dz-btn:hover { background: var(--accent-hover, var(--accent)); filter: brightness(1.05); }
.attach-dz-help { margin: 10px 0 0; font-size: 11px; }
.attach-progress {
    margin-top: 12px;
    background: var(--bg-card);
    border-radius: 4px;
    height: 18px;
    position: relative;
    overflow: hidden;
}
.attach-progress-bar {
    background: var(--accent);
    height: 100%;
    width: 0%;
    transition: width .15s ease;
}
.attach-progress span {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--plum-text);
}

.mt-kcard[draggable="true"] { cursor: grab; }
.mt-kcard[draggable="true"]:active { cursor: grabbing; }
.mt-kcard.mt-kcard-dragging {
    opacity: 0.4;
    transform: scale(0.98);
}
.mt-kcol.mt-kcol-drag-over {
    background: var(--accent-soft);
    outline: 2px dashed var(--accent);
    outline-offset: -4px;
}
.mt-kcol.mt-kcol-drag-over .mt-kcol-body {
    min-height: 80px;
}

@media (max-width: 1100px) {
    .mt-kanban-board { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .mt-kanban-board { grid-template-columns: 1fr; }
}
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

@media (max-width: 720px) {
    .dash-task-link {
        grid-template-columns: 80px 1fr;
        gap: 8px;
        padding: 10px 12px;
    }
    .dash-task-assignees,
    .dash-task-due,
    .dash-task-comments {
        grid-column: 2;
        font-size: 11px;
    }
}

/* =============================================================================
   ============================================================================
   RESPONSIVE COMPREHENSIVE — Phase 2 mobile audit
   Cf. documentation/RESPONSIVE_AUDIT.md
   ============================================================================
   ============================================================================= */

/* ---------------- Burger button (caché sur desktop, visible mobile) ---------------- */
.topbar-burger {
    display: none;
    background: transparent;
    border: 0;
    color: var(--fg-topbar);
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius);
    transition: background .15s ease;
}
.topbar-burger:hover { background: rgba(255, 255, 255, 0.08); }
.topbar-burger svg { display: block; }

/* Drawer mobile (slide-in depuis la gauche) */
.mobile-drawer {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 84%;
    max-width: 320px;
    background: var(--bg-card);
    z-index: 1500;
    transform: translateX(-100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 24px rgba(0,0,0,0.18);
    overflow-y: auto;
    padding-top: env(safe-area-inset-top, 0);
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1499;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}
.mobile-drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.mobile-drawer-head {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.mobile-drawer-head strong { font-size: 16px; color: var(--plum-text); }
.mobile-drawer-close {
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 22px;
    color: var(--muted);
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
}
.mobile-drawer-section {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.mobile-drawer-section:last-child { border-bottom: 0; }
.mobile-drawer-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    padding: 4px 18px;
    font-weight: 700;
}
.mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--body-text);
    text-decoration: none;
    font-size: 15px;
    min-height: 48px;
    border-bottom: 1px solid var(--border);
}
.mobile-drawer-item:last-child { border-bottom: 0; }
.mobile-drawer-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mobile-drawer-item:hover { background: var(--accent-soft); }
.mobile-drawer-item .udi-icon { width: 24px; text-align: center; }
.mobile-drawer-badge {
    margin-left: auto;
    background: #ef4444;
    color: white;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

/* ---------------- Kanban move buttons (visible mobile uniquement) ---------------- */
.kcard-move-buttons {
    display: none;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}
.kcard-move-btn {
    flex: 1;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 4px;
    font-size: 12px;
    cursor: pointer;
    color: var(--body-text);
    min-height: 36px;
}
.kcard-move-btn:hover { background: var(--accent-soft); }
.kcard-move-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* =============================================================================
   Breakpoint principal : ≤ 768px
   ============================================================================= */
@media (max-width: 768px) {

    /* === Topbar / Burger === */
    .topbar-burger { display: inline-flex; align-items: center; justify-content: center; }
    .topbar-nav { display: none; }  /* nav passe dans le drawer */
    .topbar-brand .brand-accent { display: none; }  /* trop chargé */
    .topbar-client-wrapper .topbar-client {
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
    }
    /* Espace dans la topbar : on prio brand + cloche + avatar; on cache logout (drawer) */
    .topbar-logout { display: none; }

    /* === Subnav : scrollable si débordement === */
    .subnav-inner {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .subnav-link {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* === Touch targets >= 44px === */
    .btn-icon, .status-move, .modal-close,
    .topbar-bell, .topbar-user-btn,
    .dash-fold-btn, .attach-del {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* === Modales full-screen === */
    .modal-overlay {
        align-items: stretch;
        padding: 0;
    }
    .modal-card, .modal-card-large {
        max-width: 100vw !important;
        width: 100vw;
        min-height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        padding: 18px 14px 80px 14px;  /* bottom padding pour la sticky bar */
        overflow-y: auto;
    }
    .modal-head {
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 5;
        padding-bottom: 10px;
        border-bottom: 1px solid var(--border);
    }

    /* === Modale tâche : sticky save bar en bas === */
    #taskForm .modal-actions {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--bg-card);
        padding: 10px 14px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
        border-top: 1px solid var(--border);
        z-index: 6;
        display: flex;
        gap: 8px;
        margin: 0;
    }
    #taskForm .modal-actions .btn-primary { flex: 1; min-height: 44px; }
    #taskForm .modal-actions .btn-link { min-height: 44px; padding: 12px 14px; }

    /* === Pickers : rows touch-friendly === */
    .picker-list .picker-row {
        padding: 12px 10px;
        min-height: 44px;
    }
    .picker-list input[type="checkbox"] {
        transform: scale(1.3);
        margin-right: 8px;
    }

    /* === Dashboard : task-link refonte mobile (vertical flex) === */
    .dash-task-link {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 6px;
        padding: 12px 14px 12px 18px;
    }
    .dash-task-link > * {
        grid-column: 1 !important;
    }
    .dash-task-link > .dash-task-status {
        justify-self: start;
        margin-top: 0;
    }
    .dash-task-link > .dash-task-due,
    .dash-task-link > .dash-task-comments,
    .dash-task-link > .dash-task-assignees {
        margin-top: 0;
        font-size: 12px;
    }

    /* === Project section header (dashboard) : empilé === */
    .dash-project-header {
        flex-wrap: wrap;
        padding: 12px 14px 12px 0;
    }
    .dash-project-title {
        flex: 1 1 100%;
        font-size: 15px;
        gap: 6px;
    }
    .dash-project-kpis {
        flex: 1 1 100%;
        margin-left: 0;
        margin-top: 4px;
    }

    /* === Filtres dashboard : empilés === */
    .dash-filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .dash-filters-bar .filter-input,
    .dash-filters-bar .filter-toggle {
        width: 100%;
    }

    /* === Bulk-bar : bottom-sheet vertical mobile === */
    .bulk-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 14px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
    }
    .bulk-bar .bulk-count {
        text-align: center;
        margin-right: 0;
        font-size: 13px;
    }
    .bulk-bar .btn-link, .bulk-bar .filter-input {
        width: 100%;
        text-align: center;
        min-height: 44px;
        font-size: 13px;
    }

    /* === Mes tâches list : task-link === */
    .mt-task-link {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        padding: 12px 14px;
    }
    .mt-task-link > * { grid-column: 1 !important; margin-top: 0; }

    /* === Kanban : drag désactivé sur mobile, move buttons visibles === */
    .mt-kcard, .kanban-card {
        cursor: default !important;
    }
    .mt-kcard[draggable], .kanban-card[draggable] {
        /* HTML5 drag attribute = true mais ne fonctionne pas tactile.
           On garde l'attribut pour desktop hybride (laptop avec écran tactile),
           on neutralise visuellement le grab cursor. */
    }
    .kcard-move-buttons { display: flex; }
    .mt-kcard[draggable="true"] { cursor: default; }

    /* === Notif prefs matrix : cards stackées === */
    .notif-prefs-table thead { display: none; }
    .notif-prefs-table, .notif-prefs-table tbody,
    .notif-prefs-table tr, .notif-prefs-table td {
        display: block;
        width: 100%;
    }
    .notif-prefs-table tr.notif-cat-header td {
        background: var(--bg-page);
        padding: 8px 12px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--accent);
        border-radius: 4px;
        margin-top: 8px;
    }
    .notif-prefs-table tr.notif-row {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 6px;
        padding: 10px 12px;
        margin-bottom: 6px;
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        gap: 4px 10px;
        align-items: center;
    }
    .notif-prefs-table tr.notif-row td {
        padding: 0 !important;
        border: 0 !important;
    }
    .notif-prefs-table tr.notif-row td:nth-child(1) {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .notif-prefs-table tr.notif-row td:nth-child(2),
    .notif-prefs-table tr.notif-row td:nth-child(3) {
        grid-row: 2;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
    }
    .notif-prefs-table tr.notif-row td:nth-child(2)::before { content: "📱"; }
    .notif-prefs-table tr.notif-row td:nth-child(3)::before { content: "📧"; }
    .notif-prefs-table tr.notif-row td:nth-child(4),
    .notif-prefs-table tr.notif-row td:nth-child(5) {
        grid-column: 1 / -1;
        font-size: 11px;
    }

    /* === Status editor / Labels editor (companies/edit + view settings) === */
    .status-editor .status-row {
        flex-wrap: wrap;
        gap: 6px;
    }
    .status-editor .status-row > input[type="text"] {
        flex: 1 1 100%;
        order: -1;
    }
    .status-editor .status-row > .status-move {
        min-width: 44px;
        min-height: 44px;
    }
    .status-editor .status-row > .btn-link.danger {
        margin-left: auto;
        min-width: 44px;
        min-height: 44px;
    }

    /* === Theme picker : grid auto-fill === */
    .theme-picker {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }
    .theme-card { padding: 10px; }

    /* === Comparer niveaux : scroll horizontal au lieu de 4 cols === */
    .pm-tier-compare-grid {
        display: flex !important;
        overflow-x: auto;
        gap: 12px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    .pm-tier-compare-grid > * {
        flex: 0 0 280px;
    }

    /* === View toolbar projet : empilée === */
    .admin-toolbar .view-toggle {
        flex: 1 1 100%;
        order: 1;
    }
    .admin-toolbar .admin-toolbar-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* === Filtres tâches dans view : empilés === */
    .task-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .task-filters .filter-input { width: 100%; }

    /* === Dropdowns (client switcher, user menu, nouvelle tâche picker) === */
    .client-dropdown, .user-dropdown, .dash-newtask-picker {
        position: fixed !important;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        max-height: 70vh;
        border-radius: 12px 12px 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* === Activity feed : compact === */
    .activity-list { max-height: 320px; }

    /* === Attachments dropzone : texte simplifié === */
    .attach-dz-text { font-size: 12px; }
    .attach-dz-help { display: none; }

    /* === Recurrence days : wrap === */
    .tm-rec-days { flex-wrap: wrap; }

    /* === Mention popup : adaptative au-dessus du textarea === */
    .mention-popup {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        max-width: none !important;
        bottom: auto;
        max-height: 30vh;
        overflow-y: auto;
    }

    /* === Gantt : hint mobile === */
    #ganttContainer::before {
        content: "↔ " attr(data-mobile-hint, "Glissez horizontalement pour voir l'ensemble");
        display: block;
        padding: 8px;
        font-size: 11px;
        color: var(--muted);
        text-align: center;
        font-style: italic;
    }

    /* === Settings modal === */
    .settings-section { padding: 12px 0; }
}

/* =============================================================================
   Très petit écran : <= 480px
   ============================================================================= */
@media (max-width: 480px) {
    .topbar-inner { padding: 0 8px; gap: 6px; }
    .topbar-brand { font-size: 13px; }
    .topbar-client-wrapper { display: none; }  /* société va dans drawer */
    .page-main { padding: 12px 8px 80px; }
    .page-h1 { font-size: 20px; }
    .page-h2 { font-size: 17px; }
}


