/* =====================================================================
   FLX-CORP Intranet — feuille de styles
   ===================================================================== */

/* ---------------------------------------------------------------------
   Palette FLX-CORP : noir bleuté profond, halos bleu nuit et violet,
   lavande dégradé du logo comme couleur d'accent.
   --------------------------------------------------------------------- */

:root {
    --bg:            #0a0a12;
    --bg-alt:        #0e0e1a;
    --surface:       #14141f;
    --surface-2:     #1c1c2b;
    --border:        #272738;
    --text:          #e9e6f5;
    --text-muted:    #8e89ab;

    /* Lavande de la marque : clair, donc encre sombre sur les aplats. */
    --accent:        #b9a5f5;
    --accent-2:      #cba7f2;   /* extrémité rosée du dégradé du logo */
    --accent-strong: #8b5cf6;   /* violet saturé, pour les traits et le focus */
    --accent-ink:    #120e1f;   /* texte posé sur un aplat d'accent */
    --accent-soft:   rgba(185, 165, 245, .14);
    --accent-grad:   linear-gradient(120deg, #a98ff2 0%, #c7a6f4 100%);

    --success:       #3ddc84;
    --warning:       #f4b740;
    --danger:        #f4586a;

    --radius:        10px;
    --radius-sm:     6px;
    --shadow:        0 8px 32px rgba(0, 0, 0, .5);
    --sidebar-w:     248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="light"] {
    --bg: #f5f3fb; --bg-alt: #ece8f8; --surface: #ffffff; --surface-2: #f8f6fd;
    --border: #e2ddf2; --text: #1a1630; --text-muted: #6a6488;
    --accent: #7c3aed; --accent-2: #9b5cf0; --accent-strong: #6d28d9;
    --accent-ink: #ffffff;
    --accent-soft: rgba(124, 58, 237, .1);
    --accent-grad: linear-gradient(120deg, #7c3aed 0%, #9b5cf0 100%);
    --shadow: 0 6px 24px rgba(40, 20, 80, .12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    -webkit-font-smoothing: antialiased;

    /* Halos de la DA : bleu nuit en haut à gauche, violet en bas à droite. */
    background-color: var(--bg);
    background-image:
        radial-gradient(1100px 720px at 8% -10%,  rgba(46, 64, 168, .20), transparent 62%),
        radial-gradient(1200px 800px at 102% 108%, rgba(150, 66, 190, .18), transparent 62%);
    background-attachment: fixed;
    background-repeat: no-repeat;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(1100px 720px at 8% -10%,  rgba(124, 58, 237, .07), transparent 62%),
        radial-gradient(1200px 800px at 102% 108%, rgba(190, 100, 220, .07), transparent 62%);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Barres de défilement discrètes, accordées au fond sombre. */
* { scrollbar-width: thin; scrollbar-color: var(--surface-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--surface-2); background-clip: content-box;
    border: 2px solid transparent; border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: var(--border); background-clip: content-box; }
::selection { background: var(--accent-soft); color: var(--text); }

h1 { font-size: 1.5rem; margin: 0 0 .2rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 620; }
h3 { font-size: .9rem; margin: 1.2rem 0 .5rem; font-weight: 600; }
p  { margin: 0 0 .6rem; }

code, pre, .mono { font-family: var(--mono); font-size: .85em; }

.muted      { color: var(--text-muted); }
.small      { font-size: .8rem; }
.center     { text-align: center; }
.right      { text-align: right; }
.nowrap     { white-space: nowrap; }
.grow       { flex: 1; min-width: 0; }
.pad        { padding: 1rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

.clamp-1, .clamp-2 {
    display: -webkit-box; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
}
.clamp-1 { -webkit-line-clamp: 1; line-clamp: 1; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; }

/* Garde-fou : sur une cellule de tableau, `display: -webkit-box` casserait la
   hauteur de la ligne et désalignerait les bordures. On retombe alors sur une
   troncature simple. Dans les vues, préférer <td><span class="clamp-1">…</span></td>. */
td.clamp-1, td.clamp-2, th.clamp-1, th.clamp-2 {
    display: table-cell;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px;
}

.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: .6rem 1rem;
}
.skip-link:focus { left: 0; }

.icon { flex: none; }
.icon--xs { width: 14px; height: 14px; }

/* ------------------------------------------------------------- structure */

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

.sidebar {
    width: var(--sidebar-w); flex: none;
    background: var(--bg-alt);
    border-right: 1px solid var(--border);
    backdrop-filter: blur(14px);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}

.sidebar__brand {
    display: flex; align-items: center; gap: .6rem;
    padding: 1.1rem 1.1rem 1rem;
    border-bottom: 1px solid var(--border);
}

.brand-mark {
    background: var(--accent-grad); color: var(--accent-ink);
    font-weight: 800; font-size: .72rem; letter-spacing: .04em;
    padding: .38rem .45rem; border-radius: var(--radius-sm);
}
.brand-mark--lg { font-size: 1rem; padding: .6rem .7rem; display: inline-block; }

.brand-text { font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.brand-text small { display: block; font-weight: 500; font-size: .68rem; color: var(--text-muted); letter-spacing: .08em; text-transform: uppercase; }

.sidebar__nav { flex: 1; overflow-y: auto; padding: .7rem .6rem; }

.nav-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .7rem; margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-weight: 500;
}
.nav-item:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav-item.is-active {
    background: var(--accent-soft); color: var(--accent);
    box-shadow: inset 2px 0 0 var(--accent);
}
.nav-item--sub { padding-left: 1.1rem; font-size: .86rem; }

.nav-badge {
    margin-left: auto; background: var(--danger); color: #fff;
    font-size: .68rem; font-weight: 700; padding: .05rem .38rem; border-radius: 20px;
}

.nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-muted); padding: 1.1rem .7rem .4rem; font-weight: 600;
}

.sidebar__foot {
    border-top: 1px solid var(--border); padding: .7rem;
    display: flex; align-items: center; gap: .5rem;
}
.user-chip { display: flex; align-items: center; gap: .55rem; flex: 1; min-width: 0; color: var(--text); }
.user-chip:hover { text-decoration: none; }
.user-chip__meta { min-width: 0; line-height: 1.25; }
.user-chip__meta strong { display: block; font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip__meta small { color: var(--text-muted); font-size: .72rem; }
.logout-form { margin: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; gap: 1rem;
    padding: .7rem 1.4rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    position: sticky; top: 0; z-index: 30;
}
.topbar__burger { display: none; }
.topbar__actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

/* Le contenu occupe toute la largeur disponible, quelle que soit la taille de l'écran. */
.content { padding: 1.4rem; width: 100%; }

/* Sur les très grands écrans, on respire un peu plus sur les côtés. */
@media (min-width: 1900px) {
    .content { padding: 1.6rem 2.2rem; }
}

/* ------------------------------------------------------------- recherche */

.search { position: relative; flex: 1; max-width: 460px; display: flex; align-items: center; }
.search .icon { position: absolute; left: .65rem; color: var(--text-muted); }
.search input {
    width: 100%; padding: .5rem .7rem .5rem 2.2rem;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text); font-size: .86rem;
}
.search input:focus { outline: none; border-color: var(--accent); }

.search__results {
    position: absolute; top: calc(100% + .4rem); left: 0; right: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-height: 380px; overflow-y: auto; z-index: 40; padding: .3rem;
}
.search__results a { display: block; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); }
.search__results a:hover, .search__results a.is-active { background: var(--surface-2); text-decoration: none; }
.search__results .type { font-size: .68rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: .05em; }

/* -------------------------------------------------------------- éléments */

.page-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}

.breadcrumb { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--text-muted); margin-bottom: .2rem; }

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1.1rem;
}
.card--danger { border-color: rgba(239, 68, 68, .4); }
.card__head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }

.stack > * { margin-bottom: 1.1rem; }
.stack > *:last-child { margin-bottom: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.grid-2.gap, .grid-3.gap { gap: .8rem; }

.row { display: flex; align-items: center; }
.row.gap { gap: .6rem; }
.row.gap-xs { gap: .4rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.inline { display: inline; }

.sep { border: none; border-top: 1px solid var(--border); margin: 1.1rem 0; }

.empty { color: var(--text-muted); text-align: center; padding: 1.4rem; font-size: .88rem; }

.empty-state {
    text-align: center; padding: 3.5rem 1rem;
    background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty-state h2 { margin-bottom: .4rem; }

/* --------------------------------------------------------------- boutons */

.btn {
    display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
    padding: .5rem .85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text); font-size: .86rem; font-weight: 550;
    cursor: pointer; font-family: inherit; white-space: nowrap;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn--primary {
    background: var(--accent-grad); border-color: transparent; color: var(--accent-ink);
    font-weight: 620;
}
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; }
.btn--danger { background: transparent; border-color: rgba(239, 68, 68, .5); color: var(--danger); }
.btn--danger:hover { background: rgba(239, 68, 68, .12); }
.btn--sm { padding: .32rem .6rem; font-size: .8rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
    color: var(--text-muted); cursor: pointer;
}
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-icon--sm { width: 27px; height: 27px; }
.btn-icon.danger:hover, .btn-icon.danger { color: var(--danger); }

.link-btn {
    background: none; border: none; padding: 0; cursor: pointer;
    color: var(--accent); font-size: .82rem; font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ------------------------------------------------------------ formulaires */

.form { display: block; }
.field { display: block; margin-bottom: .8rem; }
.field__label { display: block; font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }
.field__hint { display: block; font-size: .74rem; color: var(--text-muted); margin-top: .25rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="search"], select, textarea {
    width: 100%; padding: .5rem .65rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: inherit; font-size: .88rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }
select[multiple].multi { min-height: 140px; }

.color-input { width: 56px; height: 34px; padding: 2px; cursor: pointer; }
.color-input--sm { width: 42px; height: 30px; }

.checkbox { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .45rem; cursor: pointer; font-size: .86rem; }
.checkbox input { margin-top: .22rem; flex: none; accent-color: var(--accent); }
.checkbox--inline { margin: 0; }

.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; margin: 0 0 .8rem; }
.fieldset legend { font-size: .76rem; font-weight: 600; color: var(--text-muted); padding: 0 .3rem; }

.inline-form { display: flex; gap: .4rem; align-items: center; margin-top: .5rem; }
.inline-form input[type="text"] { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
    position: relative;
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .25rem .6rem .25rem .55rem; border-radius: 30px;
    border: 1px solid var(--border); background: var(--bg);
    font-size: .8rem; cursor: pointer; user-select: none;
    transition: border-color .12s, background .12s, color .12s;
}
/* Case native masquée mais focalisable au clavier. */
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.chip:hover { border-color: var(--accent); }
.chip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* État sélectionné : classe posée par le JS, et :has() pour un retour immédiat. */
.chip.is-on,
.chip:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}
.chip.is-on::after,
.chip:has(input:checked)::after {
    content: "✓";
    font-size: .78rem; font-weight: 700; line-height: 1;
    margin-left: .1rem;
}
.chip--label { border-left: 3px solid var(--label-color, var(--border)); }
.chip--label.is-on,
.chip--label:has(input:checked) { border-left-color: var(--label-color, var(--accent)); }

/* Bandeau de synchronisation temps réel du kanban. */
.live-hint {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .74rem; color: var(--text-muted);
}
.live-hint__dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--success);
    animation: live-pulse 2.4s ease-in-out infinite;
}
.live-hint.is-stale .live-hint__dot { background: var(--warning); animation: none; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.kcard.is-fresh { animation: card-flash 1.6s ease-out; }
@keyframes card-flash {
    0%   { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
    100% { border-color: var(--border);  box-shadow: none; }
}

/* --------------------------------------------------------------- alertes */

.flashes { margin-bottom: 1rem; display: grid; gap: .5rem; }

.alert {
    display: flex; align-items: flex-start; gap: .6rem; justify-content: space-between;
    padding: .65rem .85rem; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface); font-size: .86rem;
}
.alert--success { border-color: rgba(34, 197, 94, .45);  background: rgba(34, 197, 94, .08); }
.alert--error   { border-color: rgba(239, 68, 68, .45);  background: rgba(239, 68, 68, .08); }
.alert--warning { border-color: rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .08); }
.alert--info    { border-color: rgba(79, 107, 237, .45); background: var(--accent-soft); }
.alert--block { display: flex; margin-bottom: 1.1rem; }
.alert__close { background: none; border: none; color: inherit; font-size: 1.2rem; cursor: pointer; opacity: .6; line-height: 1; }
.alert__close:hover { opacity: 1; }
.alert p { margin: .25rem 0 0; }

.tight-list { margin: .4rem 0 0; padding-left: 1.1rem; }
.tight-list li { margin-bottom: .2rem; }

/* ------------------------------------------------------------- indicateurs */

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.1rem; }
.stat-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-grid--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius); padding: .8rem .95rem;
}
.stat--success { border-left-color: var(--success); }
.stat--danger  { border-left-color: var(--danger); }
.stat__label { display: block; font-size: .74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat__value { display: block; font-size: 1.6rem; font-weight: 650; line-height: 1.25; }
.stat__hint { font-size: .74rem; color: var(--text-muted); }

.progress { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: .4rem 0; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.progress--danger span { background: var(--danger); }

.pill {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .1rem .45rem; border-radius: 20px;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: .72rem; color: var(--text-muted); white-space: nowrap;
}
.pill[style*="--pill-color"] { border-color: var(--pill-color); color: var(--pill-color); }
.pill--accent  { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill--success { border-color: var(--success); color: var(--success); }
.pill--warning { border-color: var(--warning); color: var(--warning); }
.pill--mono { font-family: var(--mono); font-size: .68rem; }

.badge {
    display: inline-block; padding: .08rem .4rem; border-radius: var(--radius-sm);
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
}
.badge--success { background: rgba(34, 197, 94, .18);  color: var(--success); }
.badge--danger  { background: rgba(239, 68, 68, .18);  color: var(--danger); }
.badge--warning { background: rgba(245, 158, 11, .18); color: var(--warning); }
.badge--muted   { background: var(--surface-2); color: var(--text-muted); }

.tag {
    display: inline-flex; align-items: center; gap: .2rem;
    padding: .05rem .35rem; border-radius: 4px;
    background: var(--surface-2); font-size: .7rem; color: var(--text-muted);
}
.tag--low    { color: var(--text-muted); }
.tag--high   { background: rgba(245, 158, 11, .18); color: var(--warning); }
.tag--urgent { background: rgba(239, 68, 68, .18);  color: var(--danger); }
.tag--done   { background: rgba(34, 197, 94, .18);  color: var(--success); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-muted); }
.status-dot--up      { background: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.status-dot--down    { background: var(--danger);  box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }
.status-dot--pending { background: var(--warning); }

.level-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: .45rem; }
.level-dot--info    { background: var(--accent); }
.level-dot--success { background: var(--success); }
.level-dot--warning { background: var(--warning); }
.level-dot--error   { background: var(--danger); }

.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    background: var(--avatar-color, var(--accent)); color: #fff;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
}
.avatar--xs { width: 22px; height: 22px; font-size: .6rem; }
.avatar--lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar--more { background: var(--surface-2); color: var(--text-muted); }
.avatar-stack { display: flex; margin-top: .5rem; }
.avatar-stack .avatar { margin-right: -6px; border: 2px solid var(--surface); }

.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 1px solid var(--border); font-size: .84rem; }
.kv:last-of-type { border-bottom: none; }
.kv span { color: var(--text-muted); }

/* --------------------------------------------------------------- tableaux */

.table-wrap { overflow-x: auto; margin: 0 -.3rem; }
.table-wrap--scroll { max-height: 420px; overflow-y: auto; }

.table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.table th {
    text-align: left; padding: .5rem .55rem; font-size: .72rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface);
}
.table td { padding: .55rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.is-muted { opacity: .55; }
.table--compact td, .table--compact th { padding: .35rem .5rem; }

.pagination { display: flex; gap: .3rem; justify-content: center; margin: 1rem 0; }
.pagination a {
    padding: .3rem .6rem; border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-muted);
}
.pagination a.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- listes */

.task-list, .notif-list, .activity-list, .incident-list, .comments, .checklist {
    list-style: none; margin: 0; padding: 0;
}

.task-list li { border-bottom: 1px solid var(--border); }
.task-list li:last-child { border-bottom: none; }
.task-list a { display: flex; align-items: center; gap: .55rem; padding: .55rem .2rem; color: var(--text); }
.task-list a:hover { text-decoration: none; background: var(--surface-2); }
.task-list__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-list__meta { display: flex; align-items: center; gap: .35rem; flex: none; }

.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: none; }
.notif-list a { display: flex; gap: .55rem; padding: .6rem .2rem; color: var(--text); }
.notif-list a:hover { text-decoration: none; background: var(--surface-2); }
.notif-list strong { display: block; font-size: .87rem; font-weight: 600; }
.notif-list small { display: block; color: var(--text-muted); font-size: .76rem; }
.notif-list li.is-unread { background: var(--accent-soft); }
.notif-list--full li { display: flex; gap: .6rem; padding: .7rem .5rem; align-items: flex-start; }
.notif-body { margin: .25rem 0; font-size: .85rem; color: var(--text-muted); }
.notif-meta { margin-top: .3rem; }

.activity-list li { display: flex; gap: .55rem; padding: .45rem 0; font-size: .83rem; align-items: flex-start; }
.activity-list small { display: block; font-size: .74rem; }
.activity-list--scroll { max-height: 60vh; overflow-y: auto; }

.incident-list li { display: flex; flex-direction: column; gap: .1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.incident-list li:last-child { border-bottom: none; }

/* --------------------------------------------------------------- projets */

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }

.board-card {
    display: flex; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; color: var(--text);
    transition: transform .12s, border-color .12s;
}
.board-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.board-card.is-archived { opacity: .6; }
.board-card__stripe { width: 4px; flex: none; }
.board-card__body { padding: .85rem 1rem; flex: 1; min-width: 0; }
.board-card__body h3 { margin: 0 0 .3rem; font-size: .95rem; }
.board-card__meta { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .76rem; color: var(--text-muted); }

.board-mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.board-mini {
    display: block; padding: .6rem .7rem; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    position: relative; overflow: hidden;
}
.board-mini:hover { text-decoration: none; border-color: var(--accent); }
.board-mini__bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.board-mini strong { display: block; font-size: .85rem; margin-bottom: .1rem; }
.board-mini small { font-size: .74rem; }

.team-grid, .role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.team-card { position: relative; overflow: hidden; }
.team-card__stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.perms { margin: .5rem 0; }

/* ---------------------------------------------------------------- kanban */

.board-head {
    display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    flex-wrap: wrap; padding-left: .8rem; margin-bottom: 1rem;
    border-left: 4px solid var(--board-color, var(--accent));
}
.board-head__meta { margin-top: .4rem; }

.board-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.filters { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.filters input[type="search"] { width: 220px; }

.kanban {
    display: flex; gap: .8rem; align-items: flex-start;
    overflow-x: auto; padding-bottom: 1rem; min-height: 60vh;
}

.kanban-col {
    flex: 0 0 285px; background: var(--bg-alt);
    border: 1px solid var(--border); border-radius: var(--radius);
    display: flex; flex-direction: column; max-height: calc(100vh - 210px);
}
.kanban-col--new { background: transparent; border-style: dashed; padding: .6rem; }
.kanban-col.is-over-limit { border-color: var(--warning); }
.kanban-col.is-drop-target { border-color: var(--accent); background: var(--accent-soft); }

.kanban-col__head {
    display: flex; align-items: center; gap: .4rem;
    padding: .6rem .7rem; border-bottom: 1px solid var(--border);
}
.kanban-col__head h2 { font-size: .85rem; flex: 1; min-width: 0; outline: none; }
.kanban-col__head h2:focus { border-bottom: 1px dashed var(--accent); }
.kanban-col__head .count { font-size: .72rem; color: var(--text-muted); background: var(--surface-2); padding: .05rem .35rem; border-radius: 10px; }

.kanban-col__cards { flex: 1; overflow-y: auto; padding: .5rem; display: flex; flex-direction: column; gap: .45rem; min-height: 40px; }

.kanban-col__add {
    display: flex; align-items: center; gap: .35rem; width: 100%;
    padding: .5rem .7rem; background: none; border: none; border-top: 1px solid var(--border);
    color: var(--text-muted); font-size: .82rem; cursor: pointer; font-family: inherit; text-align: left;
}
.kanban-col__add:hover { color: var(--accent); background: var(--surface); }

.new-list-form { display: flex; flex-direction: column; gap: .4rem; }

.kcard {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .55rem .65rem; cursor: pointer;
    transition: border-color .12s, transform .08s;
}
.kcard:hover { border-color: var(--accent); }
.kcard.is-dragging { opacity: .4; transform: rotate(1.5deg); }
.kcard.is-done .kcard__title { text-decoration: line-through; color: var(--text-muted); }
.kcard.is-hidden { display: none; }
.kcard__labels { display: flex; gap: 3px; margin-bottom: .35rem; }
.label-dot { width: 26px; height: 4px; border-radius: 2px; }
.kcard__title { margin: 0; font-size: .85rem; line-height: 1.4; word-break: break-word; }
.kcard__meta { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .4rem; }
.kcard__avatars { display: flex; justify-content: flex-end; margin-top: .4rem; }
.kcard__avatars .avatar { margin-left: -5px; border: 2px solid var(--surface); }

.menu { position: relative; }
.menu__panel {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); box-shadow: var(--shadow); min-width: 190px; padding: .25rem;
}
.menu__panel button {
    display: block; width: 100%; text-align: left; padding: .4rem .55rem;
    background: none; border: none; color: var(--text); font-size: .82rem;
    cursor: pointer; border-radius: var(--radius-sm); font-family: inherit;
}
.menu__panel button:hover { background: var(--surface-2); }
.menu__panel button.danger { color: var(--danger); }

/* --------------------------------------------------------------- modales */

.modal {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(6, 9, 14, .72);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 3vh 1rem; overflow-y: auto;
}
.modal[hidden] { display: none; }
.modal__panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    width: 100%; max-width: 640px; padding: 1.2rem;
}
.modal__panel--wide { max-width: 940px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.modal__head h2 { font-size: 1.1rem; }

.modal-root { position: fixed; inset: 0; z-index: 70; }
.modal-root[hidden] { display: none; }

.card-modal__head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.card-modal__title { font-size: 1.2rem; margin: .2rem 0 0; outline: none; word-break: break-word; }
.card-modal__title:focus { border-bottom: 1px dashed var(--accent); }
.card-modal__body { display: grid; grid-template-columns: 1fr 250px; gap: 1.4rem; align-items: start; }
.card-modal__main section { margin-bottom: 1.3rem; }
.card-modal__side { border-left: 1px solid var(--border); padding-left: 1.1rem; }

.rich { font-size: .87rem; word-break: break-word; }

.checklist li { display: flex; align-items: flex-start; gap: .4rem; padding: .25rem 0; font-size: .86rem; }
.checklist li.is-done span { text-decoration: line-through; color: var(--text-muted); }
.checklist label { display: flex; gap: .45rem; flex: 1; cursor: pointer; align-items: flex-start; }
.checklist input { margin-top: .25rem; accent-color: var(--accent); }

.comment-form { display: flex; flex-direction: column; gap: .4rem; align-items: flex-end; margin-bottom: .8rem; }
.comment-form textarea { width: 100%; }
.comments li { display: flex; gap: .55rem; padding: .5rem 0; border-top: 1px solid var(--border); align-items: flex-start; }
.comments li > div { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ monitoring */

.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.metric__label { display: block; font-size: .74rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.metric strong { font-size: 1.15rem; }

.sparkbar { display: flex; gap: 2px; align-items: flex-end; height: 20px; }
.sparkbar__tick { width: 4px; height: 100%; border-radius: 1px; background: var(--surface-2); }
.sparkbar__tick--up   { background: var(--success); }
.sparkbar__tick--down { background: var(--danger); }

.chart { display: flex; align-items: flex-end; gap: 2px; height: 150px; padding: .5rem 0; }
.chart__bar { flex: 1; min-width: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.chart__bar--down { background: var(--danger); }
.chart__axis { display: flex; justify-content: space-between; border-top: 1px solid var(--border); padding-top: .25rem; }

/* --------------------------------------------------------- notifications */

.bell { position: relative; }
.bell__badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700;
    padding: 0 .25rem; border-radius: 10px; min-width: 15px; text-align: center;
}
.bell__badge.is-hidden { display: none; }

.dropdown {
    position: absolute; right: 0; top: calc(100% + .5rem); width: 360px; max-width: 92vw;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); z-index: 50; overflow: hidden;
}
.dropdown[hidden] { display: none; }
.dropdown__head { display: flex; justify-content: space-between; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--border); }
.dropdown__body { max-height: 380px; overflow-y: auto; }
.dropdown__foot { display: block; text-align: center; padding: .55rem; border-top: 1px solid var(--border); font-size: .82rem; }
.dropdown__item { display: flex; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--border); color: var(--text); align-items: flex-start; }
.dropdown__item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown__item.is-unread { background: var(--accent-soft); }
.dropdown__item strong { display: block; font-size: .85rem; }
.dropdown__item small { display: block; color: var(--text-muted); font-size: .76rem; }

.toasts { position: fixed; bottom: 1.2rem; right: 1.2rem; z-index: 90; display: flex; flex-direction: column; gap: .5rem; max-width: 360px; }
.toast {
    display: flex; gap: .55rem; align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm); padding: .65rem .8rem; box-shadow: var(--shadow);
    animation: toast-in .22s ease-out;
}
.toast--success { border-left-color: var(--success); }
.toast--warning { border-left-color: var(--warning); }
.toast--error   { border-left-color: var(--danger); }
.toast strong { display: block; font-size: .85rem; }
.toast small { color: var(--text-muted); font-size: .78rem; }
.toast a { color: var(--accent); font-size: .78rem; }

@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ code */

.code {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .7rem .85rem; overflow-x: auto; font-size: .78rem; line-height: 1.55; margin: .5rem 0;
}
.code code { font-family: var(--mono); white-space: pre; }

.copyable { cursor: pointer; border-bottom: 1px dashed var(--text-muted); }
.copyable:hover { color: var(--accent); border-color: var(--accent); }

.key-reveal { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; flex-wrap: wrap; }
.key-reveal code {
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: .4rem .6rem; word-break: break-all; flex: 1; min-width: 220px;
}

.label-manager { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .5rem; }
.label-chip {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .15rem .5rem; border-radius: 20px; font-size: .78rem;
    background: var(--surface-2); border-left: 3px solid var(--label-color, var(--border));
}
.label-chip form { display: inline; }
.label-chip button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0 0 0 .2rem; font-size: .95rem; line-height: 1; }
.label-chip button:hover { color: var(--danger); }

.danger-zone { border: 1px solid rgba(239, 68, 68, .3); border-radius: var(--radius-sm); padding: .8rem; }
.danger-zone h3 { margin-top: 0; color: var(--danger); }

.profile-head { display: flex; gap: .8rem; align-items: center; margin-bottom: 1rem; }

/* --------------------------------------------------- usurpation de compte */

.impersonation-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    height: 40px; padding: 0 1rem;
    background: var(--warning); color: #1b1200;
    font-size: .84rem; font-weight: 600;
}
.impersonation-bar span { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.impersonation-bar form { margin: 0; }
.impersonation-bar .btn {
    background: rgba(0, 0, 0, .82); border-color: rgba(0, 0, 0, .82); color: #fff;
}
.impersonation-bar .btn:hover { background: #000; }

body.has-impersonation .layout   { padding-top: 40px; }
body.has-impersonation .sidebar  { top: 40px; height: calc(100vh - 40px); }
body.has-impersonation .topbar   { top: 40px; }
body.has-impersonation .modal    { padding-top: calc(3vh + 40px); }

/* ------------------------------------------------- accès à un tableau */

.access-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.access-row {
    display: flex; align-items: center; gap: .6rem;
    padding: .4rem .6rem; border-bottom: 1px solid var(--border);
}
.access-row:last-child { border-bottom: none; }
.access-row:hover { background: var(--surface-2); }
.access-row.is-granted { background: var(--accent-soft); }
.access-row__name { flex: 1; min-width: 0; }
.access-row__name strong { display: block; font-size: .85rem; }
.access-row__name small { color: var(--text-muted); font-size: .74rem; }
.access-row select { width: auto; min-width: 170px; font-size: .8rem; padding: .25rem .4rem; }
.access-row .pill { flex: none; }

.access-search { margin-bottom: .5rem; }
.access-summary { font-size: .78rem; color: var(--text-muted); margin: .4rem 0 0; }

/* ---------------------------------------------------------- pages simples */

.body--centered { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-shell { width: 100%; max-width: 400px; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.8rem; }
.auth-card--wide { max-width: 560px; text-align: center; }
.auth-card__brand { text-align: center; margin-bottom: 1.4rem; }
.auth-card__brand h1 {
    margin: .7rem 0 .25rem;
    font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em;
    /* Logotype de la marque : lavande dégradé sur fond sombre. */
    background: var(--accent-grad);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.auth-card__foot { text-align: center; font-size: .78rem; margin-top: 1.2rem; }
.error-code { font-size: 3.4rem; font-weight: 800; color: var(--accent); line-height: 1; }
.trace { text-align: left; font-size: .72rem; background: var(--bg); padding: .7rem; border-radius: var(--radius-sm); overflow-x: auto; max-height: 260px; }
.auth-card--wide .row { justify-content: center; margin-top: 1.2rem; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
    .card-modal__body { grid-template-columns: 1fr; }
    .card-modal__side { border-left: none; border-top: 1px solid var(--border); padding-left: 0; padding-top: 1rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 80;
        transform: translateX(-100%); transition: transform .2s;
    }
    .sidebar.is-open { transform: none; box-shadow: var(--shadow); }
    .topbar__burger { display: inline-flex; }
    .content { padding: 1rem; }
    .hide-sm { display: none; }
}

@media (max-width: 560px) {
    .stat-grid, .stat-grid--3 { grid-template-columns: 1fr 1fr; }
    .page-head { flex-direction: column; align-items: stretch; }
    .kanban-col { flex-basis: 82vw; }
    .search { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
